Skip to content
cjcliffe edited this page Oct 15, 2011 · 3 revisions

CubicVR.Face

The Face class is used to represent a triangle or quad as part of a Mesh. It can be used for higher level polygons but they are not currently supported for compiling and rendering.

Constructor:

Face()

Structure:

  • Face
    • points[] : Array of point indices from the related Mesh
    • point_normals[] : Array of normals for each point [X,Y,Z]
    • uvs[] : Array of [U,V] pairs for each point
    • normal : Normal for this face [X,Y,Z]
    • material : Material ID (Material.mat_id reference) for this face
    • segment : Mesh segment this face belongs to

Methods:

setUV( uvs, point_num )

Set the UV coordinates for this face.

Parameters:

  • uvs : A single pair or array of U,V coordinates. If single pair [0,0]provided without point_num it will be appended to Face.uvs[], otherwise it will be applied to the specified point_num. If multiple U,V pairs are supplied [ [0,1], [0,0], [1,0] ] they will replace the face's Face.uvs[] array directly.

  • point_num : The point index for the supplied U,V pair.

Returns:

none

flip()

Flip the face point winding so that the normal is facing in the opposite direction when calculated.

Returns:

none

Clone this wiki locally