Class Index | File Index

Classes


Class threedee.Polygon

A polygon.
Defined in: Polygon.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
threedee.Polygon(vertices, material)
Constructs a new polygon
Method Summary
Method Attributes Method Name and Description
<static>  
threedee.Polygon.count()
Returns and resets the current instance counter.
 
Returns the number of referenced vertices.
<static>  
threedee.Polygon.fromJSON(data)
Creates a new polygon instance with the data read from the specified JSON object (with keys 'v' and 'm').
 
Returns the material.
 
getVertex(index)
Returns the vertex with the specified index.
 
setMaterial(material)
Sets the material.
 
Converts the polygon into a JSON object with keys 'v' (Array with vertex indices) and optionally 'm' (The polygon-specific material).
Class Detail
threedee.Polygon(vertices, material)
Constructs a new polygon
Parameters:
{!Array.} vertices
The referenced vertices.
{?threedee.Material=} material
Optional polygon-specific material. If not set then the polygon uses the material of the model.
Method Detail
<static> {number} threedee.Polygon.count()
Returns and resets the current instance counter.
Returns:
{number} The number of created instances since the last call

{number} countVertices()
Returns the number of referenced vertices.
Returns:
{number} The number of references vertices

<static> {threedee.Polygon} threedee.Polygon.fromJSON(data)
Creates a new polygon instance with the data read from the specified JSON object (with keys 'v' and 'm'). Returns null if data was empty.
Parameters:
{Object} data
The polygon as JSON object
Returns:
{threedee.Polygon} The polygon object or null if data was empty.

{threedee.Material} getMaterial()
Returns the material. Returns null if this polygon is not a polygon-specific material and uses the one of the model instead.
Returns:
{threedee.Material} The material

{number} getVertex(index)
Returns the vertex with the specified index.
Parameters:
{number} index
The index
Returns:
{number} The vertex

setMaterial(material)
Sets the material. Set it to null to remove the polygon-specific material. The model material is used then.
Parameters:
{threedee.Material} material
The material to set

{Object} toJSON()
Converts the polygon into a JSON object with keys 'v' (Array with vertex indices) and optionally 'm' (The polygon-specific material).
Returns:
{Object} The polygon as a JSON object

Documentation generated by JsDoc Toolkit 2.4.0 on Tue Jan 03 2012 16:18:57 GMT+0100 (CET)