Polycode::Polygon Class Reference

A polygon structure. More...

List of all members.

Public Member Functions

 Polygon ()
 Default constructor.
unsigned int getVertexCount ()
 Returns the number of vertices in the polygon.
VertexgetVertex (unsigned int index)
 Returns the vertex at specified index.
VertexaddVertex (Number x, Number y, Number z)
 Adds a new vertex with the specified position coordinates.
VertexaddVertex (Number x, Number y, Number z, Number u, Number v)
 Adds a new vertex with the specified position coordinates and texture coordinates.
void addVertex (Vertex *vertex)
 Adds a new vertex.
void removeVertex (int index)
 Removes and deletes the vertex at specified index.
void calculateNormal ()
 Calculates the average normal for the vertices.
void calculateTangent ()
 Calculates the tangent space vector for the vertices.
Vector3 getFaceNormal ()
 Returns the face normal.
Vector3 getFaceTangent ()
 Returns the face tangent vector.
void setNormal (Vector3 normal)
 Sets the polygon normal.
void flipUVY ()
 Flips the texture coordinate vertically.

Public Attributes

bool useVertexNormals
 If true, will use vertex normals, if false will use the polygon normal.

Detailed Description

A polygon structure.


Member Function Documentation

void Polycode::Polygon::addVertex ( Vertex vertex  ) 

Adds a new vertex.

Parameters:
vertex New vertex.
Vertex * Polycode::Polygon::addVertex ( Number  x,
Number  y,
Number  z,
Number  u,
Number  v 
)

Adds a new vertex with the specified position coordinates and texture coordinates.

Parameters:
x X coordinate of new vertex.
y Y coordinate of new vertex.
z Z coordinate of new vertex.
u Horizontal texture coordinate.
v Vertical texture coordinate.
Returns:
Newly added vertex.
Vertex * Polycode::Polygon::addVertex ( Number  x,
Number  y,
Number  z 
)

Adds a new vertex with the specified position coordinates.

Parameters:
x X coordinate of new vertex.
y Y coordinate of new vertex.
z Z coordinate of new vertex.
Returns:
Newly added vertex.
Vector3 Polycode::Polygon::getFaceNormal (  ) 

Returns the face normal.

Returns:
Face normal.
Vector3 Polycode::Polygon::getFaceTangent (  ) 

Returns the face tangent vector.

Returns:
Face tangent vector.
Vertex * Polycode::Polygon::getVertex ( unsigned int  index  ) 

Returns the vertex at specified index.

Returns:
Vertex at specified index.
unsigned int Polycode::Polygon::getVertexCount (  ) 

Returns the number of vertices in the polygon.

Returns:
Number of vertices in the polygon.
void Polycode::Polygon::removeVertex ( int  index  ) 

Removes and deletes the vertex at specified index.

Parameters:
index to remove vertex at.
void Polycode::Polygon::setNormal ( Vector3  normal  ) 

Sets the polygon normal.

Parameters:
normal The new normal.
Generated on Sat Aug 11 18:04:11 2012 for Polycode by  doxygen 1.6.3