vtlib library
Public Member Functions | List of all members
vtScene Class Reference

Public Member Functions

void SetRoot (vtGroup *pRoot)
 Set the root node, the top node of the scene graph.
 
void SetGlobalWireframe (bool bWire)
 Set global wireframe, which will force all objects to be drawn wireframe.
 
bool GetGlobalWireframe ()
 Get the global wireframe state.
 
bool Init (int argc, char **argv, bool bStereo=false, int iStereoMode=0)
 Call this method once before calling any other vtlib methods. More...
 
void Shutdown ()
 Call this method after all other vtlib methods, to free memory.
 
float GetFrameRate ()
 Return the instantaneous framerate in frames per seconds estimated.
 
float GetTime ()
 Time in seconds since the scene began.
 
float GetFrameTime ()
 Time in seconds between the start of the previous frame and the current frame.
 
bool CameraRay (const IPoint2 &win, FPoint3 &pos, FPoint3 &dir, vtWindow *pWindow=NULL)
 
void WorldToScreen (const FPoint3 &point, IPoint2 &result)
 
void SetRootEngine (vtEngine *ptr)
 Set the top engine in the Engine graph.
 
vtEngineGetRootEngine ()
 Get the top engine in the Engine graph.
 
void SetPostDrawEngine (vtEngine *ptr)
 Set the top engine in the Engine graph.
 
vtEngineGetPostDrawEngine ()
 Get the top engine in the Engine graph.
 
void AddEngine (vtEngine *ptr)
 Add an Engine to the scene. (for backward compatibility only)
 
void TargetRemoved (osg::Referenced *tar)
 Inform all engines in the scene that a target no longer exists.
 
void SetCamera (vtCamera *cam)
 
vtCameraGetCamera ()
 Get the camera associated with the scene.
 
vtGroupGetRoot ()
 Get the root node, which is the top of the scene graph.
 
void ComputeViewMatrix (FMatrix4 &mat)
 

Detailed Description

A Scene is the all-encompassing container for all 3D objects that are to be managed and drawn by the scene graph / graphics pipeline functionality of vtlib.

A Scene currently encapsulates:

Member Function Documentation

bool vtScene::CameraRay ( const IPoint2 win,
FPoint3 pos,
FPoint3 dir,
vtWindow pWindow = NULL 
)

Convert window coordinates (in pixels) to a ray from the camera in world coordinates. Pixel coordinates are measured from the top left corner of the window: X right, Y down.

void vtScene::ComputeViewMatrix ( FMatrix4 mat)

Compute the full current view transform as a matrix, which includes the projection of the camera and the transform to window coordinates.

This transform is the one used to convert XYZ points in world coodinates into XY window coordinates.

By inverting this matrix, you can "un-project" window coordinates back into the world.

Parameters
matThis matrix will receive the current view transform.
bool vtScene::Init ( int  argc,
char **  argv,
bool  bStereo = false,
int  iStereoMode = 0 
)

Initialize the vtlib library, including the display and scene graph. You should call this function only once, before any other vtlib calls.

Parameters
argc,argvCommand-line arguments.
bStereoTrue for a stereo display output.
iStereoModeCurrently for vtosg, supported values are 0 for Anaglyphic (red-blue) and 1 for Quad-buffer (shutter glasses).
void vtScene::SetCamera ( vtCamera cam)
inline

Set the camera associated with this scene. The scene has a default camera already supplied; you can use GetCamera() to simply use it instead of making your own.

void vtScene::WorldToScreen ( const FPoint3 point,
IPoint2 result 
)

Convert a point in world coordinates to a window pixel coordinate, measured from the top left corner of the window: X right, Y down.