Class Index | File Index

Classes


Class Model

Represents a geometric model.
Defined in: benchgl.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Model(options, drawType, useColors, dynamic, colors)
Creates a new Model.
Method Summary
Method Attributes Method Name and Description
 
bindColors(program, update)
Binds the colors of this Model to a shader Program.
 
bindIndices(program, update)
Binds the indices of this Model to a shader Program.
 
bindMaterial(program)
Binds the material properties of this Model to their uniforms variable.
 
bindNormals(program, update)
Binds the normals of this Model to a shader Program.
 
bindTexcoords(program, update)
Binds the texture coordinates of this Model to a shader Program.
 
bindTextures(program, texture)
Binds the textures with this Model to their sampler variable.
 
bindUniforms(program)
Binds the custom properties of this Model to their uniforms variable.
 
bindVertices(program, update)
Binds the vertices of this Model to a shader Program.
<static>  
Model.Circle(options)
Static method to generate a circle Model.
<static>  
Model.Cube(options)
Static method to generate a cube Model.
 
draw()
Draws this Model.
<static>  
Model.factory(type)
Static factory method to generate different kinds of Models.
<static>  
Model.Json(options)
Static method to load a Model from a JSON file.
 
Gets the model matrix associated to this Model.
 
Normalizes the per-vertex color to all vertices in this Model.
<static>  
Model.Pyramid(options)
Static method to generate a pyramid Model.
<static>  
Model.Rectangle(options)
Static method to generate a rectangle Model.
 
Resets the matrix of this Model.
 
rotate(angle, x, y, z)
Rotates this Model through its matrix.
 
rotateXYZ(rx, ry, rz)
Rotates this Model (around the X, Y and Z axis) through its matrix.
 
scale(x, y, z)
Scales this Model through its matrix.
 
Sets the material ambient color of this Model.
 
Sets the material diffuse color of this Model.
 
Sets the material emissive color of this Model.
 
Sets the material shininess of this Model.
 
Sets the material specular color of this Model.
 
setTextures(arguments)
Sets the texture for this Model.
 
setUniform(name, value)
Sets custom property to this Model to bind to a uniform value in a shader program.
<static>  
Model.Sphere(options)
Static method to generate a sphere Model.
 
translate(x, y, z)
Translates this Model through its matrix.
<static>  
Model.Triangle(options)
Static method to generate a triangle Model.
Class Detail
Model(options, drawType, useColors, dynamic, colors)
Creates a new Model.
Parameters:
{Object} options Optional
Parameters to initialize the model.
{Number} drawType Optional
The WebGL primitive type.
{Boolean} useColors Optional
Use color on a per-vertex basis.
{Boolean} dynamic Optional
Avoid caching model's geometry.
{Number[]} colors Optional, Default: [1, 1, 1, 1]
The per-vertex color.
Method Detail
bindColors(program, update)
Binds the colors of this Model to a shader Program.
Parameters:
{Program} program
The program to bind the colors.
{Boolean} update Optional
Avoid using cached colors.

bindIndices(program, update)
Binds the indices of this Model to a shader Program.
Parameters:
{Program} program
The program to bind the indices.
{Boolean} update Optional
Avoid using cached indices.

bindMaterial(program)
Binds the material properties of this Model to their uniforms variable.
Parameters:
{Program} program
The program to bind the properties.

bindNormals(program, update)
Binds the normals of this Model to a shader Program.
Parameters:
{Program} program
The program to bind the normals.
{Boolean} update Optional
Avoid using cached normals.

bindTexcoords(program, update)
Binds the texture coordinates of this Model to a shader Program.
Parameters:
{Program} program
The program to bind the texture coordinates.
{Boolean} update Optional
Avoid using cached texture coordinates.

bindTextures(program, texture)
Binds the textures with this Model to their sampler variable.
Parameters:
{Program} program
The program to bind the properties.
{Texture[]} texture
The previously loaded textures.

bindUniforms(program)
Binds the custom properties of this Model to their uniforms variable.
Parameters:
{Program} program
The program to bind the properties.

bindVertices(program, update)
Binds the vertices of this Model to a shader Program.
Parameters:
{Program} program
The program to bind the vertices.
{Boolean} update Optional
Avoid using cached vertices.

<static> {Model} Model.Circle(options)
Static method to generate a circle Model.
Parameters:
{Object} options Optional
Contains parameters to generate a circle.
{Number[]} options.slices Optional
The circle's approximation slices.
{Number[]} options.radius Optional
The circle's radius.
Returns:
{Model} A new instance of Model.

<static> {Model} Model.Cube(options)
Static method to generate a cube Model.
Parameters:
{Object} options Optional
Contains geometric model data.
{Number[]} options.vertices Optional
Contains geometric vertices data.
{Number[]} options.normals Optional
Contains geometric normals data.
{Number[]} options.texcoords Optional
Contains texture coordinates data.
{Number[]} options.colors Optional
Contains colors data.
{Number[]} options.indices Optional
Contains indices data.
Returns:
{Model} A new instance of Model.

draw()
Draws this Model.

<static> {Model} Model.factory(type)
Static factory method to generate different kinds of Models.
Parameters:
{Number} type
The type of Model to create.
{Object} options.
Returns:
{Model} A new instance of Model.

<static> {Model} Model.Json(options)
Static method to load a Model from a JSON file.
Parameters:
{Object} options Optional
Options for creating the Model.
{String} options.url Optional
The URL of the JSON file..
{Object} options.model Optional
Contains model options.
Returns:
{Model} A new instance of Model.

{Matrix4} matrix()
Gets the model matrix associated to this Model.
Returns:
{Matrix4} A matrix representing the position of this Model in the scene.

normalizeColors()
Normalizes the per-vertex color to all vertices in this Model.

<static> {Model} Model.Pyramid(options)
Static method to generate a pyramid Model.
Parameters:
{Object} options Optional
Contains geometric model data.
{Number[]} options.vertices Optional
Contains geometric vertices data.
{Number[]} options.normals Optional
Contains geometric normals data.
{Number[]} options.texcoords Optional
Contains texture coordinates data.
{Number[]} options.colors Optional
Contains colors data.
Returns:
{Model} A new instance of Model.

<static> {Model} Model.Rectangle(options)
Static method to generate a rectangle Model.
Parameters:
{Object} options Optional
Contains geometric model data.
{Number[]} options.vertices Optional
Contains geometric vertices data.
{Number[]} options.normals Optional
Contains geometric normals data.
{Number[]} options.texcoords Optional
Contains texture coordinates data.
{Number[]} options.colors Optional
Contains colors data.
{Number[]} options.indices Optional
Contains indices data.
Returns:
{Model} A new instance of Model.

reset()
Resets the matrix of this Model.

rotate(angle, x, y, z)
Rotates this Model through its matrix.
Parameters:
{Number} angle
The rotation angle.
{Number} x
The x component of the rotation axis.
{Number} y
The y component of the rotation axis.
{Number} z
The z component of the rotation axis.

rotateXYZ(rx, ry, rz)
Rotates this Model (around the X, Y and Z axis) through its matrix.
Parameters:
{Number} rx
The rotation angle around X axis.
{Number} ry
The rotation angle around Y axis.
{Number} rz
The rotation angle around Z axis

scale(x, y, z)
Scales this Model through its matrix.
Parameters:
{Number} x
The x-axis scale factor.
{Number} y
The y-axis scale factor.
{Number} z
The z-axis scale factor.

setMaterialAmbient(r, g, b)
Sets the material ambient color of this Model.
Parameters:
{Number} r
The red component of the color.
{Number} g
The red component of the color.
{Number} b
The red component of the color.

setMaterialDiffuse(r, g, b)
Sets the material diffuse color of this Model.
Parameters:
{Number} r
The red component of the color.
{Number} g
The red component of the color.
{Number} b
The red component of the color.

setMaterialEmissive(r, g, b)
Sets the material emissive color of this Model.
Parameters:
{Number} r
The red component of the color.
{Number} g
The red component of the color.
{Number} b
The red component of the color.

setMaterialShininess(r, g, b)
Sets the material shininess of this Model.
Parameters:
{Number} r
The red component of the color.
{Number} g
The red component of the color.
{Number} b
The red component of the color.

setMaterialSpecular(r, g, b)
Sets the material specular color of this Model.
Parameters:
{Number} r
The red component of the color.
{Number} g
The red component of the color.
{Number} b
The red component of the color.

setTextures(arguments)
Sets the texture for this Model.
Parameters:
{String[]} arguments
The textures' names.

setUniform(name, value)
Sets custom property to this Model to bind to a uniform value in a shader program.
Parameters:
{String} name
The name of the uniform variable to bind the property.
{Object} value
The value of the property to set.

<static> {Model} Model.Sphere(options)
Static method to generate a sphere Model.
Parameters:
{Object} options Optional
Contains parameters to generate a sphere.
{Number[]} options.slices Optional
The sphere's approximation slices.
{Number[]} options.slices Optional
The sphere's approximation slices.
{Number[]} options.radius Optional
The sphere's radius.
Returns:
{Model} A new instance of Model.

translate(x, y, z)
Translates this Model through its matrix.
Parameters:
{Number} x
The x-axis translation component.
{Number} y
The y-axis translation component.
{Number} z
The z-axis translation component.

<static> {Model} Model.Triangle(options)
Static method to generate a triangle Model.
Parameters:
{Object} options Optional
Contains geometric model data.
{Number[]} options.vertices Optional
Contains geometric vertices data.
{Number[]} options.normals Optional
Contains geometric normals data.
{Number[]} options.texcoords Optional
Contains texture coordinates data.
{Number[]} options.colors Optional
Contains colors data.
Returns:
{Model} A new instance of Model.

Documentation generated by JsDoc Toolkit 2.4.0 on Thu May 19 2011 00:47:49 GMT+0200 (CEST)