new Face()
Face is a triangle or a quad. If the face is a quad, both triangles composin the quad, shader the same normal - thanks to this flat shaded materials have quads shaded the same way which is nicer than havong each triangle have a slightly different normal.
Currently it supports the following attributes: aPosition, aNormal, aUV and aColor. Should support aTangent and aBinormal soon too.
- Source:
Methods
calculateNormal()
Calculte the normal for this face. Regardless of whether there are 3 or 4 vertices the normal is calculated for the frst 3 of them an applied to the entire face.
- Source:
setColor(a, b, c, dopt)
Set the vertex color for each vertex
WARNING! Colors are not passed to the buffer currently (will be added in the future).
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
a |
SQR.V2 | the first vertex color |
|
b |
SQR.V2 | the second vertex color |
|
c |
SQR.V2 | the thrid vertex color |
|
d |
SQR.V2 |
<optional> |
the optional fourth vertex color |
- Source:
setNormal()
Set the normal shared by all the vertices
- Source:
setPosition(a, b, c, dopt)
Set the vertex positions. For vertices a, b, c, and d is creates a quad as in the example below.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
a |
SQR.V3 | the first vertex position |
|
b |
SQR.V3 | the second vertex position |
|
c |
SQR.V3 | the thrid vertex position |
|
d |
SQR.V3 |
<optional> |
the optional fourth vertex position |
- Source:
Example
//
// a - b
// | / |
// c - d
//
// resulting triangles: `abc, cbd`
//
setUV(a, b, c, dopt)
Set the texture coordinates for each vertex
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
a |
SQR.V2 | the first vertex texture coordinate |
|
b |
SQR.V2 | the second vertex texture coordinate |
|
c |
SQR.V2 | the thrid vertex texture coordinate |
|
d |
SQR.V2 |
<optional> |
the optional fourth vertex texture coordinate |
- Source: