Class JSC3D.Mesh
Mesh
This class implements mesh that is used as an expression of 3D object and the basic primitive for rendering.
A mesh basically consists of a sequence of faces, and optioanlly a material, a texture mapping and other attributes and metadata.
A face consists of 3 or more coplanary vertex that should be descript in counter-clockwise order.
A texture mapping includes a valid texture object with a sequence of texture coordinats specified per vertex.
Defined in: jsc3d.js.
Constructor Attributes | Constructor Name and Description |
---|---|
JSC3D.Mesh(name, visible, material, texture, creaseAngle, isDoubleSided, isEnvironmentCast, coordBuffer, indexBuffer, texCoordBuffer, texCoordIndexBuffer)
|
Method Attributes | Method Name and Description |
---|---|
See if the mesh has valid texture mapping.
|
|
init()
Initialize the mesh.
|
|
See if the mesh is a trivial mesh.
|
|
setMaterial(material)
Set material for the mesh.
|
|
setRenderMode(mode)
Set render mode of the mesh.
|
|
setTexture(texture)
Set texture for the mesh.
|
Class Detail
JSC3D.Mesh(name, visible, material, texture, creaseAngle, isDoubleSided, isEnvironmentCast, coordBuffer, indexBuffer, texCoordBuffer, texCoordIndexBuffer)
- Parameters:
- name
- visible
- material
- texture
- creaseAngle
- isDoubleSided
- isEnvironmentCast
- coordBuffer
- indexBuffer
- texCoordBuffer
- texCoordIndexBuffer
Method Detail
{Boolean}
hasTexture()
See if the mesh has valid texture mapping.
- Returns:
- {Boolean} true if it has valid texture mapping; false if not.
init()
Initialize the mesh.
{Boolean}
isTrivial()
See if the mesh is a trivial mesh. A trivial mesh should be omited in any calculations and rendering.
- Returns:
- {Boolean} true if it is trivial; false if not.
setMaterial(material)
Set material for the mesh.
- Parameters:
- {JSC3D.Material} material
- the material object.
setRenderMode(mode)
Set render mode of the mesh.
Available render modes are:
'point': render meshes as point clouds;
'wireframe': render meshes as wireframe;
'flat': render meshes as solid objects using flat shading;
'smooth': render meshes as solid objects using smooth shading;
'texture': render meshes as solid textured objects, no lighting will be apllied;
'textureflat': render meshes as solid textured objects, lighting will be calculated per face;
'texturesmooth': render meshes as solid textured objects, lighting will be calculated per vertex and interpolated.
Available render modes are:
'point': render meshes as point clouds;
'wireframe': render meshes as wireframe;
'flat': render meshes as solid objects using flat shading;
'smooth': render meshes as solid objects using smooth shading;
'texture': render meshes as solid textured objects, no lighting will be apllied;
'textureflat': render meshes as solid textured objects, lighting will be calculated per face;
'texturesmooth': render meshes as solid textured objects, lighting will be calculated per vertex and interpolated.
- Parameters:
- {String} mode
- new render mode.
setTexture(texture)
Set texture for the mesh.
- Parameters:
- {JSC3D.Texture} texture
- the texture object.