Create a mesh
The WTCGL Rendering context
The parameters for the attribute
Any callbacks to run after render
Any callbacks to run before render
The children of this object
Whether to apply frustum culling to this object
The geometry to render.
The WTCGL rendering context.
The unique ID of the Geometry.
A matrix representing the translation, rotation and scale of this object.
Whether to automatically calculate the object matrix each time updateWorldMatrix is called. Convenient, but potentially costly.
The mode to use to draw this mesh. Can be one of:
The world matrix projected by the camera's view matrix
The model-view normal matrix
Optional
parentThe parent of this object.
Object position
The program that is rendering this object
Object rotation, expressed as a quaternion
Apply a specific render order, overriding calculated z-depth
Object rotation, expressed as a 3D Euler rotation
Object scale
The up unit vector
Whether this objec is visible or not. This will stop the renderer from trying to render this object
The world matrix represents the function of all ancestor matrices and the matrix of this object
A boolean indicating whether the world matrix requires updating.
The z-depth of the object, calculated at render time.
Adds a child object to this and indicates whether to notify the child
The object to add as a child of this one
Whether to set the parent of the indicated child to this
Makes the object look at a particular target, useful for cameras
The point to look at
Look away from, if true
Remove a child from this object.
The child to remove
Whether to notify the child of the removal
Sets the parent of this object and indicates whether to set a child relationship on the parent.
The parent object to use
Whether to set the full parent-child relationsjip
Update the fill world matrix of this object basically used for recursively looping down the hierarchy when a change in the RTS matrix is changed on this.
Optional
force: booleanEven is this is not set to world matrix update, force it. Used when looping down past the first iteration.
UpdateRotation should be called whenever a change to the quaternion variable is made. This will update the rotation in response to the change in the quaternion. For example:
const Box = new Mesh(gl, { geometry: BoxGeo, program });
Box.quaternion = Quat.fromAxisAngle(new Vec3(1,0,0), Math.PI*-.25);
Box.updateQuaternion();
console.log(Box.rotation) // {_x: 0.7853981633974483, _y: 0, _z: 0}
UpdateRotation should be called whenever a change to the rotation variable is made. This will update the quaternion in response to the change in the rotation. For example:
const Box = new Mesh(gl, { geometry: BoxGeo, program });
Box.rotation.x = Math.PI*.25;
Box.updateRotation();
console.log(Box.quaternion) // {_x: 0.3826834323650898, _y: 0, _z: 0, _w: 0.9238795325112867}
Class representing a mesh. A mesh is a binding point between geometry and a program.