Projector

From oWiki

Jump to: navigation, search

Contents


Attributes

type

string  ( w )
Sets the type of projector. Possible types are: PT_ORTHOGRAPHIC and PT_PERSPECTIVE.

width

float  ( w )
Sets the orthographic window width, for use with orthographic rendering only.

height

float  ( w )
Sets the orthographic window height, for use with orthographic rendering only.

aspectRatio

float  ( w )
Sets the aspect ratio for the projector viewport.

FOVy

float  ( w )
Sets the Y-dimension Field Of View (FOV) of the projector.

Field Of View (FOV) is the angle made between the projector's position, and the edges of the 'screen' onto which the scene is projected. High values (90+ degrees) result in a wide-angle, fish-eye kind of view, low values (30- degrees) in a stretched, telescopic kind of view. Typical values are between 45 and 60 degrees.
This value represents the VERTICAL field-of-view. The horizontal field of view is calculated from this depending on the dimensions of the viewport (they will only be the same if the viewport is square).

nearClipDistance

float  ( w )
Sets the position of the near clipping plane.

The position of the near clipping plane is the distance from the projector position to the screen on which the world is projected. The near plane distance, combined with the field-of-view and the aspect ratio, determines the size of the viewport through which the world is viewed (in world co-ordinates). Note that this world viewport is different to a screen viewport, which has it's dimensions expressed in pixels. The projector's viewport should have the same aspect ratio as the screen viewport it renders into to avoid distortion.

farClipDistance

float  ( w )
Sets the distance to the far clipping plane.

The view frustum is a pyramid created from the projector position and the edges of the viewport. This method sets the distance for the far end of that pyramid. Different applications need different values: e.g. a flight sim needs a much further far clipping plane than a first-person shooter. An important point here is that the larger the ratio between near and far clipping planes, the lower the accuracy of the Z-buffer used to depth-cue pixels. This is because the Z-range is limited to the size of the Z buffer (16 or 32-bit) and the max values must be spread over the gap between near and far clip planes. As it happens, you can affect the accuracy far more by altering the near distance rather than the far distance, but keep this in mind.


Methods

setPosition( x, y, z )

x: float
y: float
z: float
Return: Vector3

Sets the position of the projector in world coordinate.

lookAt( x, y, z )

x: float
y: float
z: float

Aiming the projector at point (x, y, z) in world coordinate.

attachTo( obj )

obj: molecule

Attach this projector to another object in the same 3D scene.

detachFrom()

obj: molecule (optional)

Detach this projector from its parent object.

Comments

You can use projector object to add projective texture. See TextureUnit::setProjectiveTexturing.
To create a new projector: var proj = new Projector();

Personal tools