Click or drag to resize
AB4D logo

ScreenSpaceLineNode Class

ScreenSpaceLineNode class is an ObjectNode that represent one or more 3D lines. The lines are generated in a geometry shader that reads line positions and generates triangles in such a way that the triangles face the camera and define the lines with specified thickness in screen coordinates. Line thickness, color and other properties are defined by the LineMaterial.
Inheritance Hierarchy
SystemObject
  Ab3d.DirectXDXResourceBase
    Ab3d.DirectXSharedDXResource
      Ab3d.DirectXSharedDXSceneResource
        Ab3d.DirectXSceneNode
          Ab3d.DirectXObjectNode
            Ab3d.DirectXScreenSpaceLineNode

Namespace: Ab3d.DirectX
Assembly: Ab3d.DXEngine (in Ab3d.DXEngine.dll) Version: 7.0.8865.1045
Syntax
C#
public sealed class ScreenSpaceLineNode : ObjectNode, 
	IShadowCastingNode, IMeshNode

The ScreenSpaceLineNode type exposes the following members.

Constructors
Properties
 NameDescription
Public propertyEndLineCap Gets the LineCap that is rendered at the end position of this line. This value can be set from constructor. Default value is Flat which does not render any line cap.
Public propertyIsCastingShadow Gets or sets a Boolean that specifies if this SceneNode is casing shadow. This means that if IsCastingShadow is true, then 3D objects rendered with this SceneNode will create shadow; if false shadow will not be created. This works for VarianceShadowRenderingProvider and PlanarShadowRenderingProvider but not for ScreenSpaceAmbientOcclusionRenderingProvider.
Public propertyIsLineClosed Gets a Boolean that specified if line positions are closed (the last position should be connected to the first position).
Public propertyIsLineStrip Gets a Boolean that specified if positions define connected or disconnected lines: when true if lines are connected to each other (the last position of one line is the first position of the next line). when false if lines are disconnected (each line has two positions that are not shared with other lines).
Public propertyLineMaterial Gets or sets an array of Material that can be set to override the materials defined in the Mesh.
Public propertyMultiPositions Gets a collection of Vector3 array that represent multiple lines. MultiPositions is set in constructor.
Public propertyPositions Gets an array of Vector3 positions that are used to initialize this ScreenSpaceLineNode.
Public propertyStartLineCap Gets the LineCap that is rendered at the start position of this line. This value can be set from constructor. Default value is Flat which does not render any line cap.
Top
Methods
 NameDescription
Public methodCollectRenderableObjects The task of the CollectRenderableObjects method is to create objects derived from RenderablePrimitiveBase and add them to the appropriate RenderingQueue. This method is called at the beginning of RenderScene method call but only when the scene was significantly changed (number of SceneNodes is changed, material is significantly changed, etc.)
(Overrides ObjectNodeCollectRenderableObjects)
Public methodGetDetailsText Returns a string with detailed description of this SceneNode.
(Overrides ObjectNodeGetDetailsText(Boolean, Boolean, Boolean, Boolean, Boolean))
Public methodGetMesh Returns the mesh that is used by this SceneNode.
Public methodStatic memberRemoveDuplicateFollowingPositions RemoveDuplicateFollowingPositions checks an array of Vector3 and returns an array with removed duplicate positions that follow each other. In case there are no duplicates, the same positions instance is returned as it was passed to this method (no new array is created).
Public methodUpdateBounds Updates the bounds of this SceneNode if the dirty flags indicates that the bounds could be changed of if the forceUpdate parameter is set to true
(Overrides SceneNodeUpdateBounds(Boolean))
Public methodUpdatePositions UpdatePositions method needs to be called after the Positions of ScreenSpaceLineMesh are changed. This method updates the RenderableMeshPrimitive that was added to the RenderingQueue. This call also sets MeshVertexBufferDataChanged dirty flag on this SceneNode.
Top
Extension Methods
 NameDescription
Public Extension MethodGetGeometryModel3D Returns a WPF's GeometryModel3D that was used to create the specified sceneNode. If the sceneNode does not define a GeometryModel3D object, then null is returned.
(Defined by Extensions)
Public Extension MethodGetModel3D Returns a WPF's Model3D that was used to create the specified sceneNode. If the sceneNode does not define a Model3D object, then null is returned.
(Defined by Extensions)
Public Extension MethodGetModelVisual3D Returns a WPF's ModelVisual3D that was used to create the specified sceneNode or any parent SceneNode (in case searchParentSceneNodes is true). If a SceneNode that defines a ModelVisual3D is not found, then null is returned.
(Defined by Extensions)
Public Extension MethodGetVisual3D Returns a WPF's Visual3D that was used to create the specified sceneNode or any parent SceneNode (in case searchParentSceneNodes is true). If a SceneNode that defines a Visual3D is not found, then null is returned.
(Defined by Extensions)
Top
Remarks

ScreenSpaceLineNode class is an ObjectNode that represent one or more 3D lines. The lines are generated in a geometry shader that reads line positions and generates triangles in such a way that the triangles face the camera and define the lines with specified thickness in screen coordinates. Line thickness, color and other properties are defined by the LineMaterial.

The positions for the lines are defined in the constructor of the ScreenSpaceLineNode. The positions can be specified as line strip (isLineStrip argument is true). In this case one line position is used an end position for one line and as a start position for the next line. For example, when 3 positions are specified as line strip, then the second positions defined the end of the first line and also the start positions for the second line. When isLineStrip is false, then each line uses two separate positions. This means that the first two positions are used for first line, the third and forth positions is used for second line, and so on. Note that if isLineStrip is set to true, this will not render lines are poly-lines where additional triangles are added to connect two lines segments together. isLineStrip only defines how line positions are defined. It is also possible to define the positions by using ScreenSpaceLineMesh (this is also used behind the scene when the ScreenSpaceLineNode is created from an array of positions).

To render poly-lines where the connections between line segments are smooth, then set IsPolyLine in the LineMaterial to true. Poly-lines can be also created by using the ScreenSpaceLineNode(Vector3, Boolean, Boolean, Boolean, Color4, Single, String) constructor. You can also control how connections are created by setting the MiterLimit property.

To update the positions, first change the positions in the array, then call UpdatePositions method and if the change also changes the bounds (bounding box) also call UpdateBounds(Boolean) method. If the positions were defined by the ScreenSpaceLineMesh, then first call ScreenSpaceLineMesh.RecreateMesh method and then the UpdatePositions and UpdateBounds.

3D lines in Ab3d.DXEngine are rendered by using ThickLineEffect. When this effect is used to render standard 3D objects, then they are rendered as wireframe lines.

See Also