Class PlaneShape
Represents a geometric plane shape defined by four vertices, suitable for rendering or geometric computations in 3D space.
public class PlaneShape : Shape, IGraphicsResource
- Inheritance
-
PlaneShape
- Implements
- Inherited Members
Remarks
The plane is oriented along the XZ axis at Y = 0, with vertices arranged in a counter-clockwise order. This class provides mesh data such as vertices, normals, tangents, texture coordinates, and indices for use in graphics or physics applications. All mesh data is returned in arrays corresponding to the four corners of the plane.
Methods
GetIndexCount()
Returns the number of indices used by this geometry.
public override int GetIndexCount()
Returns
- int
An integer representing the total number of indices. Always returns 6.
GetIndices()
Returns the array of vertex indices that define the triangles composing the mesh.
public override uint[] GetIndices()
Returns
- uint[]
An array of unsigned integers representing the indices of vertices for each triangle in the mesh. The array contains six elements, corresponding to two triangles.
Remarks
The returned indices are ordered to form two triangles, suitable for rendering a quad as two triangles in graphics APIs. The order of indices determines the winding and orientation of the triangles.
GetNormals()
Returns an array of normal vectors for the surface, with each normal corresponding to a vertex.
public override float[] GetNormals()
Returns
- float[]
An array of four single-precision floating-point values representing the normal vectors for the back-left, back-right, front-right, and front-left vertices. Each normal points upward along the Y-axis.
GetShapeName()
Returns the name of the shape represented by this instance.
public override string GetShapeName()
Returns
- string
A string that contains the name "PlaneShape".
GetTangents()
Returns an array of tangent vectors for the mesh geometry.
public override float[] GetTangents()
Returns
- float[]
An array of four-element floats representing the tangent vectors for each vertex. Each group of four floats corresponds to the tangent vector and handedness for a vertex.
Remarks
The returned array contains tangent data for four vertices, with each tangent represented by four consecutive float values (x, y, z, w). The handedness (w component) is used for normal mapping calculations.
GetUVCoords()
Returns the normalized UV coordinates for the four corners of a quadrilateral surface.
public override float[] GetUVCoords()
Returns
- float[]
An array of four pairs of floating-point values representing the UV coordinates for the back-left, back-right, front-right, and front-left corners, in that order.
Remarks
The returned coordinates are suitable for mapping a texture onto a rectangular surface, with each pair corresponding to a corner in normalized (0.0 to 1.0) UV space.
GetVertices()
Returns the vertex positions for a flat quadrilateral in 3D space.
public override float[] GetVertices()
Returns
- float[]
An array of four 3D vertex positions, each represented by three consecutive float values (X, Y, Z). The vertices are ordered as back-left, back-right, front-right, and front-left.
Remarks
The returned vertices define a quadrilateral lying in the XZ plane at Y = 0, with each corner at a distance of 0.5 units from the origin along the X and Z axes. This method is typically used for rendering or geometry calculations where a flat surface is required.