 |
TriangleModelNode Class |
A single triangle object in the 3D space.
Inheritance Hierarchy Namespace: Ab4d.SharpEngine.SceneNodesAssembly: Ab4d.SharpEngine (in Ab4d.SharpEngine.dll) Version: 4.0.9584+ba1aaa26d4181dd3fa8ed7b6398391d1affa36c8
Syntaxpublic class TriangleModelNode : ModelNode
The TriangleModelNode type exposes the following members.
Constructors| | Name | Description |
|---|
 | TriangleModelNode | Create single triangle object in the 3D space. |
 | TriangleModelNode(String) | Create single triangle object in the 3D space. |
 | TriangleModelNode(Material, String) | Create single triangle object in the 3D space. |
 | TriangleModelNode(Vector3, Vector3, Vector3, String) | Create single triangle object in the 3D space. |
 | TriangleModelNode(Vector3, Vector3, Vector3, Material, String) | Create single triangle object in the 3D space. |
 | TriangleModelNode(Vector3, Vector3, Vector3, Vector2, Vector2, Vector2, Vector3, Material, String) | Create single triangle object in the 3D space. |
Top
Properties| | Name | Description |
|---|
 | Normal |
The normal vector of the triangle. If not set, then it is calculated as a cross product of (P2 - P1) and (P3 - P1).
After the normal vector is set manually, it will not be recalculated automatically.
Property change will re-generate the mesh in the next update phase. To immediately re-generate the mesh, call the Update method.
|
 | Offset |
Offset is used to move the triangle along its normal vector. This can be useful to avoid z-fighting when the triangle is rendered together with other triangles that have the same positions.
Property change will re-generate the mesh in the next update phase. To immediately re-generate the mesh, call the Update method.
Default value is 0.
|
 | P1 |
The first position of the triangle.
Property change will re-generate the mesh in the next update phase. To immediately re-generate the mesh, call the Update method.
|
 | P2 |
The second position of the triangle.
Property change will re-generate the mesh in the next update phase. To immediately re-generate the mesh, call the Update method.
|
 | P3 |
The third position of the triangle.
Property change will re-generate the mesh in the next update phase. To immediately re-generate the mesh, call the Update method.
|
 | TextureCoordinate1 |
The first texture coordinate of the triangle.
Property change will re-generate the mesh in the next update phase. To immediately re-generate the mesh, call the Update method.
|
 | TextureCoordinate2 |
The second texture coordinate of the triangle.
Property change will re-generate the mesh in the next update phase. To immediately re-generate the mesh, call the Update method.
|
 | TextureCoordinate3 |
The third texture coordinate of the triangle.
Property change will re-generate the mesh in the next update phase. To immediately re-generate the mesh, call the Update method.
|
Top
Methods| | Name | Description |
|---|
  | CalculateNormal |
CalculateNormal returns a Vector3 that is a normal vector of the triangle defined by the three points p1, p2 and p3.
The normal vector is calculated as a cross product of (p2 - p1) and (p3 - p1) and then normalized.
|
  | CreateFromMesh |
Creates a TriangleModelNode from a single triangle from the specified mesh.
The triangle is specified by the triangle index (triangleIndex) that is multiplied by 3 to get the vertex indices of the triangle.
The vertex indices are then used to get the positions and texture coordinates of the triangle vertices.
|
 | UpdateFromMesh |
UpdateFromMesh updates the TriangleModelNode from a single triangle from the specified mesh.
The triangle is specified by the triangle index (triangleIndex) that is multiplied by 3 to get the vertex indices of the triangle.
The vertex indices are then used to get the positions and texture coordinates of the triangle vertices.
|
 | UpdateMesh |
UpdateMesh method recreates the mesh based on the current object properties.
The method should be overriden in the derived class that provides its own mesh generation.
(Overrides ModelNodeUpdateMesh) |
Top
See Also