Game Development Reference
In-Depth Information
this.pos = vec3.fromValues(0.0, 0.0, 0.0); // Camera eye
position
this.projectionTransform = null;
this.projMatrix;
this.viewMatrix;
this.fieldOfView = 55;
this.nearClippingPlane =0.1;
this.farClippingPlane = 1000.0;
};
In the preceding constructor, we have declared and initialized all the properties that
we need to create the view and projection matrices.
The following code lists all the getters for the up, left, and position vectors. Also, we
have created getters to access the computed projection and view matrix.
Camera.prototype.getLeft =function ()
{
return vec3.clone(this.left);
}
Camera.prototype.getPosition =function ()
{
return vec3.clone(this.pos);
}
Camera.prototype.getProjectionMatrix =function ()
{
return mat4.clone(this.projMatrix);
}
Camera.prototype.getViewMatrix =function ()
{
return mat4.clone(this.viewMatrix);
}
Camera.prototype.getUp =function ()
{
return vec3.clone(this.up);
}
The following code lists the getters for field of view and clipping planes. The field of
view getter returns the value in degrees.
Camera.prototype.getNearClippingPlane =function ()
{
return this.nearClippingPlane;
}
Camera.prototype.getFieldOfView =function ()
{
return this.fieldOfView;
}
 
Search WWH ::




Custom Search