Documentation generator: JsDoc Toolkit 2.4.0
Template: Codeview 1.2
Generated on: 2012-11-19 0:05

Class SpiderGL.Space.MatrixStack

The SpiderGL.Space.MatrixStack is a stack for 4x4 matrices.

Class Summary
Constructor Attributes Constructor Name and Description
 
Creates a SpiderGL.Space.MatrixStack.
Field Summary
Field Attributes Field Name and Description
<readonly>  
Gets a copy of the inverse of the matrix at the top of the stack.
<readonly>  
Gets a reference to the inverse of the matrix at the top of the stack.
<readonly>  
Gets a copy of the transpose of the inverse of the matrix at the top of the stack.
<readonly>  
Gets a reference to the transpose of the inverse of the matrix at the top of the stack.
<readonly>  
Gets a copy of the matrix at the top of the stack.
<readonly>  
Gets a reference to the matrix at the top of the stack.
<readonly>  
Gets the stack depth.
<readonly>  
top
Alias for #matrix.
<readonly>  
Alias for #matrix$.
<readonly>  
Gets a copy of the transpose of the matrix at the top of the stack.
<readonly>  
Gets a reference to the transpose of the matrix at the top of the stack.
Fields borrowed from class SpiderGL.Core.ObjectBase:
uid

Method Summary

Method Attributes Method Name and Description
 
frustum(min, max)
Post-multiplies the matrix at the top with a frustum matrix.
 
load(m)
Replaces the matrix at the top with a clone of the passed matrix.
 
Replaces the matrix at the top with an identity matrix.
 
lookAt(position, target, position)
Post-multiplies the matrix at the top with a look-at matrix.
 
Post-multiplies the matrix at the top with the passed matrix The matrix a at the top will be replaced by a * m.
 
ortho(min, max)
Post-multiplies the matrix at the top with an ortographic projection matrix.
 
perspective(fovY, aspectRatio, zNear, zFar)
Post-multiplies the matrix at the top with a perspective projection matrix.
 
pop()
Pops the stack.
 
push()
Pushes into the stack the matrix at its top.
 
Resets the stack.
 
rotate(angle, axis)
Post-multiplies the matrix at the top with a rotation matrix.
 
scale(v)
Post-multiplies the matrix at the top with a scaling matrix.
 
Post-multiplies the matrix at the top with a translation matrix.
Event Summary
Event Attributes Event Name and Description
 
Gets/Sets the callback invoked whenever the top matrix changes.

Class Detail

SpiderGL.Space.MatrixStack(onChange)
Creates a SpiderGL.Space.MatrixStack. SpiderGL.Space.MatrixStack is a stack for 4x4 matrices. Initially, the stack depth is one and contains an identity matrix. Every method or getter to access the top matrix (or a derivation like inverse or transpose) returns a copy of the internal matrix. For performance reasons, variants of the above accessors (having the same identifier with the postfix "$" appended) that return a reference to the internal matrix are also present. The transpose, inverse, and inverse-transpose of the top matrix are calculated and cached when they are accessed.
var s = new SpiderGL.Space.MatrixStack();
s.loadIdentity();
s.scale([2, 0.5, 2]);
for (var i=0; i
						
					
				
					
						
Parameters:
{function(this)} onChange Optional
A callback function called whenever the stack is modified.
See:
reset
SpiderGL.Space.TransformationStack

Field Detail

<readonly> {array} inverse
Gets a copy of the inverse of the matrix at the top of the stack.
See:
#inverse$
<readonly> {array} inverse$
Gets a reference to the inverse of the matrix at the top of the stack. The returned array MUST NOT be changed.
See:
#inverse
<readonly> {array} inverseTranspose
Gets a copy of the transpose of the inverse of the matrix at the top of the stack.
See:
#inverseTranspose$
<readonly> {array} inverseTranspose$
Gets a reference to the transpose of the inverse of the matrix at the top of the stack. The returned array MUST NOT be changed.
See:
#inverseTranspose
<readonly> {array} matrix
Gets a copy of the matrix at the top of the stack. Initially, the stack has depth one and contains an identity matrix.
See:
#matrix$
<readonly> {array} matrix$
Gets a reference to the matrix at the top of the stack. The returned array MUST NOT be changed. Initially, the stack has depth one and contains an identity matrix.
See:
#matrix
<readonly> {number} size
Gets the stack depth. Initially, the stack contains an identity matrix, so its depth is one.
<readonly> {array} top
Alias for #matrix.
See:
#top$
#matrix
<readonly> {array} top$
Alias for #matrix$.
See:
#top
#matrix$
<readonly> {array} transpose
Gets a copy of the transpose of the matrix at the top of the stack.
See:
#transpose$
<readonly> {array} transpose$
Gets a reference to the transpose of the matrix at the top of the stack. The returned array MUST NOT be changed.
See:
#transpose

Method Detail

  • frustum(min, max)
    Post-multiplies the matrix at the top with a frustum matrix.
    Parameters:
    {array} min
    A 3-component array with the minimum coordinates of the frustum volume.
    {array} max
    A 3-component array with the maximum coordinates of the frustum volume.
    See:
    #perspective
    #ortho
    SpiderGL.Math.Mat4.frustum
    SpiderGL.Math.Mat4.mul$
  • load(m)
    Replaces the matrix at the top with a clone of the passed matrix.
    Parameters:
    {array} m
    The matrix whose clone will be set as the top of the stack.
    See:
    #loadIdentity
    #multiply
    SpiderGL.Math.Mat4.dup
  • loadIdentity()
    Replaces the matrix at the top with an identity matrix.
    See:
    #load
    #multiply
    SpiderGL.Math.Mat4.identity
    SpiderGL.Math.Mat4.identity$
  • lookAt(position, target, position)
    Post-multiplies the matrix at the top with a look-at matrix.
    Parameters:
    {array} position
    The viewer's position as a 3-dimensional vector.
    {array} target
    The viewer's look-at point as a 3-dimensional vector.
    {array} position
    The viewer's up vector as a 3-dimensional vector.
    See:
    SpiderGL.Math.Mat4.lookAt
    SpiderGL.Math.Mat4.mul$
  • multiply(m)
    Post-multiplies the matrix at the top with the passed matrix The matrix a at the top will be replaced by a * m.
    Parameters:
    {array} m
    The matrix to post-multiply.
    See:
    #load
    SpiderGL.Math.Mat4.mul
    SpiderGL.Math.Mat4.mul$
  • ortho(min, max)
    Post-multiplies the matrix at the top with an ortographic projection matrix.
    Parameters:
    {array} min
    The minimum coordinates of the parallel viewing volume.
    {array} max
    The maximum coordinates of the parallel viewing volume.
    See:
    #frustum
    #perspective
    SpiderGL.Math.Mat4.ortho
    SpiderGL.Math.Mat4.mul$
  • perspective(fovY, aspectRatio, zNear, zFar)
    Post-multiplies the matrix at the top with a perspective projection matrix.
    Parameters:
    {number} fovY
    The vertical field-of-view angle, in radians.
    {number} aspectRatio
    The projection plane aspect ratio.
    {number} zNear
    The distance of the near clipping plane.
    {number} zFar
    The distance of the far clipping plane.
    See:
    #frustum
    #ortho
    SpiderGL.Math.Mat4.perspective
    SpiderGL.Math.Mat4.mul$
  • pop()
    Pops the stack. After a pop operation, the stack depth is decremented by one. Nothing is done if the stack has only one element.
    See:
    #push
  • push()
    Pushes into the stack the matrix at its top. After a push operation, the stack depth is incremented by one and the two matrices at its top are identical. There is no limit on the depth the stack can reach.
    See:
    #pop
  • reset()
    Resets the stack. The stack is reset to its initial state, that is, a stack with depth one containing the identity matrix.
    See:
    SpiderGL.Math.Mat4.identity
  • rotate(angle, axis)
    Post-multiplies the matrix at the top with a rotation matrix.
    Parameters:
    {number} angle
    The counter-clockwise rotation angle, in radians.
    {array} axis
    A 3-dimensional vector representing the rotation axis.
    See:
    #translate
    #scale
    SpiderGL.Math.Mat4.rotationAngleAxis
    SpiderGL.Math.Mat4.rotateAngleAxis$
  • scale(v)
    Post-multiplies the matrix at the top with a scaling matrix.
    Parameters:
    {array} v
    The scaling amount as a 3-dimensional array.
    See:
    #translate
    #rotate
    SpiderGL.Math.Mat4.scaling
    SpiderGL.Math.Mat4.scale$
  • translate(v)
    Post-multiplies the matrix at the top with a translation matrix.
    Parameters:
    {array} v
    A 3-dimensional vector with translation offsets.
    See:
    #rotate
    #scale
    SpiderGL.Math.Mat4.translation
    SpiderGL.Math.Mat4.translate$

Event Detail

onChange()
Gets/Sets the callback invoked whenever the top matrix changes. Initially, no callback is defined.