Class c3dl.Collada
Extends
c3dl.Primitive.
c3dl.Collada represents the model data from a collada file. To
load a collada file into a scene, the file must first be called
with c3dl.addModel('plane.dae'). This makes sure the file
is parsed before it is used. In the main function, you can create
instances of the collada file:
var collada = new c3dl.Collada();
collada.init('plane.dae');
Defined in: collada.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
| Method Attributes | Method Name and Description |
|---|---|
|
Get the angular velocity of the scenegraph's root node.
|
|
|
Get the direction vector of the scenegraph's root node.
|
|
|
getLeft()
Get the left vector of the scenegraph's root node.
|
|
|
Get the linear velocity of the scenegraph's root node.
|
|
|
getPath()
Get the path of collada file loaded.
|
|
|
Can this object be picked when the user clicks on it? In some scripts using
the library, it may not make sense for wall, for example to be picked.
|
|
|
Get the position of the scene graph's root.
|
|
|
Get the scenegraph of the Collada object.
|
|
|
getUp()
Get the up vector of the scenegraph's root node.
|
|
|
init(daepath)
This should be called after the collada object is created.
|
|
|
pitch(angle)
Rotate around the side vector by a hard amount.
|
|
|
roll(angle)
Rotate around the direction vector by a hard amount.
|
|
|
scale(scaleVec)
Scale the the scenegraph's root node.
|
|
|
setAngularVel(vec)
Set the angular velocity of the scenegraph's root node.
|
|
|
setEffect(effect)
Set the way this Collada object should be rendered.
|
|
|
setLinearVel(vec)
Set the linear velocity of the scenegraph's root node.
|
|
|
setMaterial(material)
Sets the material of all the geometry sections (primitive collation elements
or primitiveSets) to this material.
|
|
|
setPickable(isPickable)
Set whether this object should be included in picking tests.
|
|
|
setPosition(pos)
Place the object to a new location relative to the world origin.
|
|
|
setTexture(texturePath)
Set the texture of all the geometry sections (primitive collation elements
or primitiveSets) to this texture.
|
|
|
translate(trans)
Translate the entire Collada object.
|
|
|
yaw(angle)
Rotate around the up vector by a hard amount.
|
- Methods borrowed from class c3dl.Primitive:
- isVisible, setVisible
Method Detail
getAngularVel()
Get the angular velocity of the scenegraph's root node.
- Returns:
{Array}
getDirection()
Get the direction vector of the scenegraph's root node.
- Returns:
- {Array}
{Array}
getLeft()
Get the left vector of the scenegraph's root node.
- Returns:
- {Array}
getLinearVel()
Get the linear velocity of the scenegraph's root node.
- Returns:
getObjectType()
{String}
getPath()
Get the path of collada file loaded. This is set when init()
is called.
- Returns:
- {String}
{bool}
getPickable()
Can this object be picked when the user clicks on it? In some scripts using
the library, it may not make sense for wall, for example to be picked. If the
object cannot be picked, it will not tested against the ray which is generated
then the user clicks the canvas, thus increasing performance.
- Returns:
- {bool} true if the object can be picked, false otherwise.
{Array}
getPosition()
Get the position of the scene graph's root.
- Returns:
- {Array}
{c3dl.SceneNode}
getSceneGraph()
Get the scenegraph of the Collada object.
- Returns:
- {c3dl.SceneNode} Root node of the Collada model's scenegraph.
{Array}
getUp()
Get the up vector of the scenegraph's root node.
- Returns:
- {Array}
init(daepath)
This should be called after the collada object is created. It will be
assigned a structural copy of the collada object which exists in the
ColladaManager. This object will then be able to update the
transformations without changing the object in the manager class. The
nodes are copied, however the arrays of vertices, normals, etc are not.
References exsist within this object which will point to the vertex arrays
in the manager object.
- Parameters:
- {string} daepath
- path of the collada file.
pitch(angle)
Rotate around the side vector by a hard amount.
- Parameters:
- {float} angle
- in radians.
roll(angle)
Rotate around the direction vector by a hard amount.
- Parameters:
- {float} angle
- in radians.
scale(scaleVec)
Scale the the scenegraph's root node.
- Parameters:
- {Array} scaleVec
setAngularVel(vec)
Set the angular velocity of the scenegraph's root node.
- Parameters:
- {Array} vec
setEffect(effect)
Set the way this Collada object should be rendered. The
Effect will be set to all the nodes within the Collada's
scenegraph. This should only be called once the scene has
been initialized since on initialization, the built-in
effects such as c3dl.effects.GOOCH, c3dl.effects.CARTOON, etc.
are created.
- Parameters:
- {c3dl.Effect} effect
setLinearVel(vec)
Set the linear velocity of the scenegraph's root node.
- Parameters:
- {Array} vec
setMaterial(material)
Sets the material of all the geometry sections (primitive collation elements
or primitiveSets) to this material. Thus, the entire Collada object will be
rendered using this material.
- Parameters:
- {c3dl.Material} material
setPickable(isPickable)
Set whether this object should be included in picking tests. By omitting
objects which should not be interacted with, it can increase performance.
- Parameters:
- {bool} isPickable
- true if the object should be included in pikcing tests, false otherwise.
setPosition(pos)
Place the object to a new location relative to the world origin.
- Parameters:
- {Array} pos
setTexture(texturePath)
Set the texture of all the geometry sections (primitive collation elements
or primitiveSets) to this texture.
- Parameters:
- {string} texturePath
- Path of the texture.
translate(trans)
Translate the entire Collada object. This will tell the root of the
Collada scenegraph to translate by 'trans'.
- Parameters:
- {Array} trans
yaw(angle)
Rotate around the up vector by a hard amount.
- Parameters:
- {float} angle
- in radians.