#include <sglViewPlatform.hpp>
Inheritance diagram for sglViewPlatform::
Public Methods | |
sglViewPlatform (sglCamera &camera) | |
virtual | ~sglViewPlatform () |
void | setEnableZUp (bool on) |
bool | getEnableZUp () const |
void | computeViewMatrix (sglMat4f &curr_mat) const |
void | computeViewMatrix (sglMat4d &curr_mat) const |
sglCamera& | getCamera () const |
void | setCamera (sglCamera &camera) |
virtual sglNode* | clone (unsigned int mode) const |
virtual void | printInfo (ostream &ostrm, const char *indent_string) const |
Protected Methods | |
void | computeBound () |
virtual void | cull (sglCull< float > &, unsigned int) const |
virtual void | cull (sglCull< double > &, unsigned int) const |
void | copyTo (sglViewPlatform *dst, unsigned int mode) const |
By default, the view matrix is computed assuming the OpenGL convention that the camera looks down the -Z axis with the +X axis to the right and the +Y axis up. A convenience mode for Performer users (and others?) can be enabled by calling sglViewPlatform::enableZUp(true). This will cause the computeViewMatrix function to return a matrix that has the camera looking down the +Y axis, with +Z up and +X to the right.
The following example attaches the view platform to an sglTransform node which will be used to move the camera around. Also shown in this example is the method for defining the camera projection (view frustum) parameters, associating them with the view platform, and using it in the cull traversal:
Example:
sglCullf trav_state; // used to move the camera sgluSphericalTransformf view_trans = new sgluSphericalTransformf; sglPerspectiveCamera *view_camera = new sglPerspectiveCamera; view_camera->setFOV(M_PI*0.25, (double)win_x/(double)win_y, 1.0, 200.0); sglViewPlatform *view_platform = new sglViewPlatform(*view_camera); view_platform->setEnableZUp(true); view_trans->addChild(view_platform); : root->cull(trav_state, // sglScene::cull(..) ..., *view_platform, ...); (view_platform->getCamera()).applyProjection(); // setup projection matrix trav_state.draw(); // draw the geometry
Definition at line 85 of file sglViewPlatform.hpp.
|
Constructor
|
|
virtual destructor. Will dereference but not delete camera object.
|
|
This function enables the "Performer/PLIB" compatibility mode that assumes the camera looks along the y-axis (x-axis to the right) Otherwise it assumes the default OpenGL mode where the camera looks along the negative z-axis.
Definition at line 102 of file sglViewPlatform.hpp. |
|
Query the current compatibility mode.
Definition at line 107 of file sglViewPlatform.hpp. |
|
Compute a single precision transform to root of tree this node is connected to. Since this node is the first in the progression these functions initialize the matrix.
|
|
Compute a double precision transform to root of tree this node is connected to. Since this node is the first in the progression these functions initialize the matrix.
|
|
Query the current sglCamera.
Definition at line 128 of file sglViewPlatform.hpp. |
|
Switch the camera being used by this node. The old camera object is dereferenced but if the reference count goes to zero it will not be deleted. The reference count of the new camera will be incremented.
|
|
Make a copy of the scenegraph rooted at this node.
Reimplemented from sglNode. |
|
Output the state of this node to the specified ostream.
Reimplemented from sglNode. |
|
The single precision cull traversal function that culls out subgraphs that do not lie in the view frustum (stored in the sglCull parameter). Subclasses must implement this function. The entry point for user-friendly culling is in the sglScene class.
Reimplemented from sglNode. Definition at line 147 of file sglViewPlatform.hpp. |
|
The double precision cull traversal function that culls out subgraphs that do not lie in the view frustum (stored in the sglCull parameter). Subclasses must implement this function. The entry point for user-friendly culling is in the sglScene class.
Reimplemented from sglNode. Definition at line 149 of file sglViewPlatform.hpp. |