vtlib library
|
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. | |
vtEngine * | GetRootEngine () |
Get the top engine in the Engine graph. | |
void | SetPostDrawEngine (vtEngine *ptr) |
Set the top engine in the Engine graph. | |
vtEngine * | GetPostDrawEngine () |
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) |
vtCamera * | GetCamera () |
Get the camera associated with the scene. | |
vtGroup * | GetRoot () |
Get the root node, which is the top of the scene graph. | |
void | ComputeViewMatrix (FMatrix4 &mat) |
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:
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.
mat | This 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.
argc,argv | Command-line arguments. |
bStereo | True for a stereo display output. |
iStereoMode | Currently for vtosg, supported values are 0 for Anaglyphic (red-blue) and 1 for Quad-buffer (shutter glasses). |
|
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.