Click or drag to resize
Ab4d.SharpEngine logo

TriangleModelNode Class

A single triangle object in the 3D space.
Inheritance Hierarchy

Namespace: Ab4d.SharpEngine.SceneNodes
Assembly: Ab4d.SharpEngine (in Ab4d.SharpEngine.dll) Version: 4.0.9584+ba1aaa26d4181dd3fa8ed7b6398391d1affa36c8
Syntax
C#
public class TriangleModelNode : ModelNode

The TriangleModelNode type exposes the following members.

Constructors
 NameDescription
Public methodTriangleModelNodeCreate single triangle object in the 3D space.
Public methodTriangleModelNode(String)Create single triangle object in the 3D space.
Public methodTriangleModelNode(Material, String)Create single triangle object in the 3D space.
Public methodTriangleModelNode(Vector3, Vector3, Vector3, String)Create single triangle object in the 3D space.
Public methodTriangleModelNode(Vector3, Vector3, Vector3, Material, String)Create single triangle object in the 3D space.
Public methodTriangleModelNode(Vector3, Vector3, Vector3, Vector2, Vector2, Vector2, Vector3, Material, String)Create single triangle object in the 3D space.
Top
Properties
 NameDescription
Public propertyNormal 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.
Public propertyOffset 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.
Public propertyP1 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.
Public propertyP2 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.
Public propertyP3 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.
Public propertyTextureCoordinate1 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.
Public propertyTextureCoordinate2 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.
Public propertyTextureCoordinate3 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
 NameDescription
Public methodStatic memberCalculateNormal 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.
Public methodStatic memberCreateFromMesh 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.
Public methodUpdateFromMesh 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.
Protected methodUpdateMesh 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