GuiTSCtrl

consoledoc.h

Abstract base class for controls that render 3D scenes.

More...

Camera

float

Z rotation angle of camera.

float

The vertical field of view in degrees or zero to use the normal camera FOV.

Rendering

float

The share of the per-frame reflection update work this control's rendering should run.

Indicates how this control should render its contents.

Public Functions

float
calculateViewDistance(float radius)

Given the camera's current FOV, get the distance from the camera's viewpoint at which the given radius will fit in the render area.

Point2F

Get the ratio between world-space units and pixels.

Point3F
project(Point3F worldPosition)

Transform world-space coordinates to screen-space (x, y, depth) coordinates.

void

Sets the current stereo texture to an offscreen canvas.

Point3F
unproject(Point3F screenPosition)

Transform 3D screen-space coordinates (x, y, depth) to world space.

Detailed Description

Abstract base class for controls that render 3D scenes.

GuiTSCtrl is the base class for controls that render 3D camera views in Torque. The class itself does not implement a concrete scene rendering. Use GuiObjectView to display invidiual shapes in the Gui and GameTSCtrl to render full scenes.

Camera

float cameraZRot 

Z rotation angle of camera.

float forceFOV 

The vertical field of view in degrees or zero to use the normal camera FOV.

Rendering

float reflectPriority 

The share of the per-frame reflection update work this control's rendering should run.

The reflect update priorities of all visible GuiTSCtrls are added together and each control is assigned a share of the per-frame reflection update time according to its percentage of the total priority value.

GuiTSRenderStyles renderStyle 

Indicates how this control should render its contents.

Public Functions

calculateViewDistance(float radius)

Given the camera's current FOV, get the distance from the camera's viewpoint at which the given radius will fit in the render area.

Parameters:

radius

Radius in world-space units which should fit in the view.

return:

The distance from the viewpoint at which the given radius would be fully visible.

getWorldToScreenScale()

Get the ratio between world-space units and pixels.

return:

The amount of world-space units covered by the extent of a single pixel.

project(Point3F worldPosition)

Transform world-space coordinates to screen-space (x, y, depth) coordinates.

Parameters:

worldPosition

The world-space position to transform to screen-space.

return:

The

setStereoGui(GuiOffscreenCanvas canvas)

Sets the current stereo texture to an offscreen canvas.

Parameters:

canvas

The desired canvas.

unproject(Point3F screenPosition)

Transform 3D screen-space coordinates (x, y, depth) to world space.

This method can be, for example, used to find the world-space position relating to the current mouse cursor position. Parameters:

screenPosition

The x/y position on the screen plus the depth from the screen-plane outwards.

return:

The world-space position corresponding to the given screen-space coordinates.