Class: Mesh

AL3D.Mesh

new Mesh(p)

Class that represents a Mesh.
Parameters:
Name Type Description
p Object Object that represent a Mesh.
Properties
Name Type Description
vertices Array.<number> An array with the mesh's vertices.
indices Array.<number> An array with the mesh's indices.
normals Array.<number> An array with the mesh's normals.
uv Array.<number> An array with the mesh's uv coordinates.
material AL3D.Material The mesh's material, if not present the material would be BasicMaterial.
Author:
  • Ángel Luis Perales Gómez.
Source:

Extends

Members

orientation

Set the Object3D orientation.
Overrides:
Source:

position

Return the Object3D position.
Overrides:
Source:

rotation

Set the Object3D rotation.
Overrides:
Source:

Methods

(static) createCircle(p) → {AL3D.Mesh}

Create a Circle mesh.
Parameters:
Name Type Description
p Object Object that represent a circle.
Properties
Name Type Description
radius number Circle's radius.
resolution number Circle's height.
material AL3D.Material Circle's material. If material is not defined, the Basic Material will set.
Source:
Returns:
- A circle's mesh.
Type
AL3D.Mesh

(static) createCone(p) → {AL3D.Mesh}

Create a Cone mesh.
Parameters:
Name Type Description
p Object Object that represent a cone.
Properties
Name Type Description
radius number Cone's radius.
height number Cone's height.
material AL3D.Material Cone's material. If material is not defined, the Basic Material will set.
Source:
Returns:
- A cone's mesh.
Type
AL3D.Mesh

(static) createCube(p) → {AL3D.Mesh}

Create a Cube mesh.
Parameters:
Name Type Description
p Object Object that represent a cube.
Properties
Name Type Description
size number Cube's side size.
material AL3D.Material Cube's material. If material is not defined, the Basic Material will set.
Source:
Returns:
- A cube's mesh.
Type
AL3D.Mesh

(static) createCylinder(p) → {AL3D.Mesh}

Create a Cylinder mesh.
Parameters:
Name Type Description
p Object Object that represent a cylinder.
Properties
Name Type Description
radius number Cylinder's radius.
height number Cylinder's height.
material AL3D.Material Cylinder's material. If material is not defined, the Basic Material will set.
Source:
Returns:
- A cylinder's mesh.
Type
AL3D.Mesh

(static) createPlane(p) → {AL3D.Mesh}

Create a Plane mesh.
Parameters:
Name Type Description
p Object Object that represent a plane.
Properties
Name Type Description
size number Plane's side size.
material AL3D.Material Plane's material. If material is not defined, the Basic Material will set.
Source:
Returns:
- A plane's mesh.
Type
AL3D.Mesh

(static) createSphere(p) → {AL3D.Mesh}

Create a Sphere mesh.
Parameters:
Name Type Description
p Object Object that represent a sphere.
Properties
Name Type Description
radius number Sphere's radius.
material Al3D.Material sphere's material. If material is not defined, the Basic Material will set.
Source:
Returns:
- A sphere's mesh.
Type
AL3D.Mesh

addIndex(i)

Add a index.
Parameters:
Name Type Description
i number Index to add.
Source:

addVertex(v)

Add a vertex.
Parameters:
Name Type Description
v Object Vertex to add.
Source:

getIndexes() → {Array.<number>}

Get the mesh's indices.
Source:
Returns:
- The mesh's indices.
Type
Array.<number>

getNormals() → {Array.<number>}

Get the mesh's normals.
Source:
Returns:
- The mesh's normals.
Type
Array.<number>

getVertex() → {Array.<number>}

Get the mesh's vertices.
Source:
Returns:
- The mesh's vertices.
Type
Array.<number>

prepareToRender()

Prepare Object3D to render. This method update the position, orientation and scale
Inherited From:
Source:

setIndexBuffer()

Set the index buffer for the mesh
Source:

setMaterial(material)

Set a material
Parameters:
Name Type Description
material AL3D.Material Material to set, If material is not defined, the Basic Material will set.
Source:

setNormalBuffer()

Set the normal buffer for the mesh
Source:

setNormalMap(urlTexture)

Set a normal map
Parameters:
Name Type Description
urlTexture string Normal map's url to set.
Source:

setShader(vs, fs)

Set a shader for the mesh
Parameters:
Name Type Description
vs string Vertex shader to use.
fs string Fragment shader to use.
Source:

setSpecularMap(urlTexture)

Set a specular map
Parameters:
Name Type Description
urlTexture string Specular map's url to set.
Source:

setTexture(urlTexture, uv)

Set a color map.
Parameters:
Name Type Description
urlTexture string Color map's url to set.
uv Array.<number> Array with the uv coordinates.
Source:

setUVBuffer()

Set the uv buffer for the mesh
Source:

setVertexBuffer()

Set the vertex buffer for the mesh
Source: