Class threedee.Model
The base class for all models.
Defined in: Model.js.
Constructor Attributes | Constructor Name and Description |
---|---|
threedee.Model(vertices, polygons, material)
Constructs a new model with the specified vertices and polygons.
|
Method Attributes | Method Name and Description |
---|---|
Returns the number of polygons used in this model.
|
|
Returns the number of vertices used in this model.
|
|
<static> |
threedee.Model.fromJSON(data)
Creates a new model instance with the data read from the
specified JSON object (with keys 'm' (Global model material), 'v' (Vertices)
and 'p' (Polygons)).
|
Returns the material of the model.
|
|
getPolygon(index)
Returns the polygon with the specified index.
|
|
getVertex(index)
Returns the vertex with the specified index.
|
|
toJSON()
Converts the model into a JSON object with keys 'm', 'v' and 'p'.
|
Class Detail
threedee.Model(vertices, polygons, material)
Constructs a new model with the specified vertices and polygons.
- Parameters:
- {!Array.} vertices
- The model vertices
- {!Array.} polygons
- The model polygons
- {?threedee.Material=} material
- Optional material.
Method Detail
{number}
countPolygons()
Returns the number of polygons used in this model.
- Returns:
- {number} The number of polygons used in this model
{number}
countVertices()
Returns the number of vertices used in this model.
- Returns:
- {number} The number of vertices used in this model
<static>
{!threedee.Model}
threedee.Model.fromJSON(data)
Creates a new model instance with the data read from the
specified JSON object (with keys 'm' (Global model material), 'v' (Vertices)
and 'p' (Polygons)). Returns null if data
was empty.
- Parameters:
- {{m:?Object|v:!Array.|p:!Array.}} data
- The model as JSON object.
- Returns:
- {!threedee.Model} The model object or null if data was empty.
{threedee.Material}
getMaterial()
Returns the material of the model.
- Returns:
- {threedee.Material} The material of the model. Never null.
{!threedee.Polygon}
getPolygon(index)
Returns the polygon with the specified index.
- Parameters:
- {number} index
- The index
- Returns:
- {!threedee.Polygon} The polygon
{!threedee.Vector}
getVertex(index)
Returns the vertex with the specified index.
- Parameters:
- {number} index
- The index
- Returns:
- {!threedee.Vector} The vertex
{Object}
toJSON()
Converts the model into a JSON object with keys 'm', 'v' and 'p'.
- Returns:
- {Object} The model as a JSON object.