Class Index | File Index

Classes


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.

Class Summary
Constructor Attributes Constructor Name and Description
 
JSC3D.Mesh(name, visible, material, texture, creaseAngle, isDoubleSided, isEnvironmentCast, coordBuffer, indexBuffer, texCoordBuffer, texCoordIndexBuffer)
Field Summary
Field Attributes Field Name and Description
 
The Axis-aligned bounding box of the mesh.
 
An angle to preserve sharp edges in smooth rendering.
 
Number of faces of the mesh.
 
The sequence of vertex indices that describe faces.
 
If set to true, both sides of the faces will be rendered.
 
If set to true, the mesh accepts environment mapping.
 
Name of the mesh.
 
The plain sequence of texture coordinates of the mesh, or null if none.
 
The sequence of tex coord indices.
 
The plain sequence of vertex coordinates of the mesh.
 
Visibility of the mesh.
Method Summary
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.
 
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
Field Detail
aabb
The Axis-aligned bounding box of the mesh. Read only.

creaseAngle
An angle to preserve sharp edges in smooth rendering. If the angle between the normals of two adjacent faces exceeds this value, the edge will be recognized as an sharp edge thus it will not be smoothed.

faceCount
Number of faces of the mesh. Read only.

indexBuffer
The sequence of vertex indices that describe faces. Each face contains at least 3 vertex indices that are ended by a -1. Faces are not limited to triangles.

isDoubleSided
If set to true, both sides of the faces will be rendered.

isEnvironmentCast
If set to true, the mesh accepts environment mapping.

name
Name of the mesh.

texCoordBuffer
The plain sequence of texture coordinates of the mesh, or null if none.

texCoordIndexBuffer
The sequence of tex coord indices. If it is null, the indexBuffer will be used.

vertexBuffer
The plain sequence of vertex coordinates of the mesh.

visible
Visibility of the mesh. If it is set to false, the mesh will be ignored in rendering.
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 calculation or 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.
Parameters:
{String} mode
new render mode.

setTexture(texture)
Set texture for the mesh.
Parameters:
{JSC3D.Texture} texture
the texture object.

Documentation generated by JsDoc Toolkit 2.1.0 on Thu Nov 20 2014 00:20:57 GMT+0800 (CST)