Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

osgUtil::SceneView Class Reference

SceneView is literally a view of a scene, encapsulating the camera, global state, lights and the scene itself. More...

Inheritance diagram for osgUtil::SceneView:

Inheritance graph
[legend]
List of all members.

Public Types

enum  LightingMode { HEADLIGHT, SKY_LIGHT, NO_SCENEVIEW_LIGHT }

Public Methods

 SceneView (osg::DisplaySettings *ds=NULL)
 Construct a default scene view.

void setDefaults ()
 Set scene view to use default global state, light, camera and render visitor.

void setSceneData (osg::Node *node)
 Set the data which to view.

osg::Node * getSceneData ()
 Get the scene data which to view.

const osg::Node * getSceneData () const
 Get the const scene data which to view.

void setViewport (osg::Viewport *viewport)
 Set the viewport of the scene view to use specfied osg::Viewport.

void setViewport (int x, int y, int width, int height)
 Set the viewport of the scene view to specified dimensions.

const osg::Viewport * getViewport () const
 Get the const viewport.

osg::Viewport * getViewport ()
 Get the viewport.

void getViewport (int &x, int &y, int &width, int &height)
 Get the viewport of the scene view.

void setDisplaySettings (osg::DisplaySettings *vs)
 Set the DisplaySettings.

const osg::DisplaySettings * getDisplaySettings () const
 Get the const DisplaySettings.

osg::DisplaySettings * getDisplaySettings ()
 Get the DisplaySettings.

void setBackgroundColor (const osg::Vec4 &color)
 Set the background color used in glClearColor().

const osg::Vec4 & getBackgroundColor () const
 Get the background color.

void setGlobalStateSet (osg::StateSet *state)
osg::StateSet * getGlobalStateSet ()
const osg::StateSet * getGlobalStateSet () const
void setLightingMode (LightingMode mode)
LightingMode getLightingMode () const
void setLight (osg::Light *light)
osg::Light * getLight ()
const osg::Light * getLight () const
void setState (osg::State *state)
osg::State * getState ()
const osg::State * getState () const
void setCamera (osg::Camera *camera)
 set an osg::Camera for the scene view to use for setting projection and modelview matrices internaly.

osg::Camera * getCamera ()
const osg::Camera * getCamera () const
void setProjectionMatrix (osg::Matrix *matrix)
 set a projection matrix.

osg::Matrix * getProjectionMatrix ()
const osg::Matrix * getProjectionMatrix () const
void setModelViewMatrix (osg::Matrix *matrix)
 set a modelview matrix.

osg::Matrix * getModelViewMatrix ()
const osg::Matrix * getModelViewMatrix () const
void setInitVisitor (osg::NodeVisitor *av)
osg::NodeVisitor * getInitVisitor ()
const osg::NodeVisitor * getInitVisitor () const
void setAppVisitor (osg::NodeVisitor *av)
osg::NodeVisitor * getAppVisitor ()
const osg::NodeVisitor * getAppVisitor () const
void setCullVisitor (osgUtil::CullVisitor *cv)
osgUtil::CullVisitor * getCullVisitor ()
const osgUtil::CullVisitor * getCullVisitor () const
void setRenderGraph (osgUtil::RenderGraph *rg)
osgUtil::RenderGraph * getRenderGraph ()
const osgUtil::RenderGraph * getRenderGraph () const
void setRenderStage (osgUtil::RenderStage *rs)
osgUtil::RenderStage * getRenderStage ()
const osgUtil::RenderStage * getRenderStage () const
void setCullMask (const osg::Node::NodeMask nm)
const osg::Node::NodeMask getCullMask () const
void setCullMaskLeft (const osg::Node::NodeMask nm)
const osg::Node::NodeMask getCullMaskLeft () const
void setCullMaskRight (const osg::Node::NodeMask nm)
const osg::Node::NodeMask getCullMaskRight () const
void setLODBias (float bias)
 Set the LOD bias for the CullVisitor to use.

float getLODBias () const
 Get the LOD bias.

void setSmallFeatureCullingPixelSize (float value)
 Set the Small Feature Culling Pixel Size.

float getSmallFeatureCullingPixelSize () const
 Get the Small Feature Culling Pixel Size.

void setCullingMode (osg::CullStack::CullingMode mode)
 Set the culling mode for the CullVisitor to use.

osg::CullStack::CullingMode getCullingMode () const
 Returns the current CullingMode.

void setComputeNearFarMode (CullVisitor::ComputeNearFarMode cnfm)
 Set the ComputeNearFarMode for the CullVisitor to use.

CullVisitor::ComputeNearFarMode getComputeNearFarMode () const
 Get the ComputeNearFarMode.

void setPrioritizeTextures (bool pt)
 set whether the draw method should call renderer->prioritizeTexture.

bool getPrioritizeTextures () const
 get whether the draw method should call renderer->prioritizeTexture.

bool projectWindowIntoObject (const osg::Vec3 &window, osg::Vec3 &object) const
 Calculate, via glUnProject, the object coordinates of a window point.

bool projectWindowXYIntoObject (int x, int y, osg::Vec3 &near_point, osg::Vec3 &far_point) const
 Calculate, via glUnProject, the object coordinates of a window x,y when projected onto the near and far planes.

bool projectObjectIntoWindow (const osg::Vec3 &object, osg::Vec3 &window) const
 Calculate, via glProject, the object coordinates of a window.

void setFrameStamp (osg::FrameStamp *fs)
 Set the frame stamp for the current frame.

const osg::FrameStamp * getFrameStamp () const
 Set the frame stamp for the current frame.

virtual void init ()
 Do init traversal of attached scene graph using Init NodeVisitor.

virtual void app ()
 Do app traversal of attached scene graph using App NodeVisitor.

virtual void cull ()
 Do cull traversal of attached scene graph using Cull NodeVisitor.

virtual void draw ()
 Do draw traversal of draw bins generated by cull traversal.


Protected Methods

virtual ~SceneView ()
virtual void cullStage (osg::Matrix *projection, osg::Matrix *modelview, osgUtil::CullVisitor *cullVisitor, osgUtil::RenderGraph *rendergraph, osgUtil::RenderStage *renderStage)
 Do cull traversal of attached scene graph using Cull NodeVisitor.

virtual void drawStage (osgUtil::RenderStage *renderStage)
const osg::Matrix computeMVPW () const
void clearArea (int x, int y, int width, int height, const osg::Vec4 &color)

Protected Attributes

osg::ref_ptr< osg::Node > _sceneData
osg::ref_ptr< osg::StateSet > _globalState
osg::ref_ptr< osg::Light > _light
osg::ref_ptr< osg::Camera > _camera
osg::ref_ptr< osg::Matrix > _projectionMatrix
osg::ref_ptr< osg::Matrix > _modelviewMatrix
osg::ref_ptr< osg::DisplaySettings > _displaySettings
osg::ref_ptr< osg::State > _state
bool _initCalled
osg::ref_ptr< osg::NodeVisitor > _initVisitor
osg::ref_ptr< osg::NodeVisitor > _appVisitor
osg::Node::NodeMask _cullMask
osg::ref_ptr< osgUtil::CullVisitor > _cullVisitor
osg::ref_ptr< osgUtil::RenderGraph > _rendergraph
osg::ref_ptr< osgUtil::RenderStage > _renderStage
osg::Node::NodeMask _cullMaskLeft
osg::ref_ptr< osgUtil::CullVisitor > _cullVisitorLeft
osg::ref_ptr< osgUtil::RenderGraph > _rendergraphLeft
osg::ref_ptr< osgUtil::RenderStage > _renderStageLeft
osg::Node::NodeMask _cullMaskRight
osg::ref_ptr< osgUtil::CullVisitor > _cullVisitorRight
osg::ref_ptr< osgUtil::RenderGraph > _rendergraphRight
osg::ref_ptr< osgUtil::RenderStage > _renderStageRight
osg::ref_ptr< osg::FrameStamp > _frameStamp
osg::Vec4 _backgroundColor
CullVisitor::ComputeNearFarMode _computeNearFar
osg::CullStack::CullingMode _cullingMode
float _LODBias
float _smallFeatureCullingPixelSize
osg::ref_ptr< osg::Viewport > _viewport
LightingMode _lightingMode
bool _prioritizeTextures

Detailed Description

SceneView is literally a view of a scene, encapsulating the camera, global state, lights and the scene itself.

Provides methods for setting up the view and rendering it.


Member Enumeration Documentation

enum osgUtil::SceneView::LightingMode
 

Enumeration values:
HEADLIGHT 
SKY_LIGHT 
NO_SCENEVIEW_LIGHT 


Constructor & Destructor Documentation

osgUtil::SceneView::SceneView (  osg::DisplaySettings *    ds = NULL ) 
 

Construct a default scene view.

virtual osgUtil::SceneView::~SceneView (    )  [protected, virtual]
 


Member Function Documentation

virtual void osgUtil::SceneView::app (    )  [virtual]
 

Do app traversal of attached scene graph using App NodeVisitor.

void osgUtil::SceneView::clearArea (  int    x,
int    y,
int    width,
int    height,
const osg::Vec4 &    color
)  [protected]
 

const osg::Matrix osgUtil::SceneView::computeMVPW (    )  const [protected]
 

virtual void osgUtil::SceneView::cull (    )  [virtual]
 

Do cull traversal of attached scene graph using Cull NodeVisitor.

virtual void osgUtil::SceneView::cullStage (  osg::Matrix *    projection,
osg::Matrix *    modelview,
osgUtil::CullVisitor *    cullVisitor,
osgUtil::RenderGraph *    rendergraph,
osgUtil::RenderStage *    renderStage
)  [protected, virtual]
 

Do cull traversal of attached scene graph using Cull NodeVisitor.

virtual void osgUtil::SceneView::draw (    )  [virtual]
 

Do draw traversal of draw bins generated by cull traversal.

virtual void osgUtil::SceneView::drawStage (  osgUtil::RenderStage *    renderStage )  [protected, virtual]
 

const osg::NodeVisitor* osgUtil::SceneView::getAppVisitor (    )  const [inline]
 

osg::NodeVisitor* osgUtil::SceneView::getAppVisitor (    )  [inline]
 

const osg::Vec4& osgUtil::SceneView::getBackgroundColor (    )  const [inline]
 

Get the background color.

const osg::Camera* osgUtil::SceneView::getCamera (    )  const [inline]
 

osg::Camera* osgUtil::SceneView::getCamera (    )  [inline]
 

CullVisitor::ComputeNearFarMode osgUtil::SceneView::getComputeNearFarMode (    )  const [inline]
 

Get the ComputeNearFarMode.

osg::CullStack::CullingMode osgUtil::SceneView::getCullingMode (    )  const [inline]
 

Returns the current CullingMode.

const osg::Node::NodeMask osgUtil::SceneView::getCullMask (    )  const [inline]
 

const osg::Node::NodeMask osgUtil::SceneView::getCullMaskLeft (    )  const [inline]
 

const osg::Node::NodeMask osgUtil::SceneView::getCullMaskRight (    )  const [inline]
 

const osgUtil::CullVisitor* osgUtil::SceneView::getCullVisitor (    )  const [inline]
 

osgUtil::CullVisitor* osgUtil::SceneView::getCullVisitor (    )  [inline]
 

osg::DisplaySettings* osgUtil::SceneView::getDisplaySettings (    )  [inline]
 

Get the DisplaySettings.

const osg::DisplaySettings* osgUtil::SceneView::getDisplaySettings (    )  const [inline]
 

Get the const DisplaySettings.

const osg::FrameStamp* osgUtil::SceneView::getFrameStamp (    )  const [inline]
 

Set the frame stamp for the current frame.

const osg::StateSet* osgUtil::SceneView::getGlobalStateSet (    )  const [inline]
 

osg::StateSet* osgUtil::SceneView::getGlobalStateSet (    )  [inline]
 

const osg::NodeVisitor* osgUtil::SceneView::getInitVisitor (    )  const [inline]
 

osg::NodeVisitor* osgUtil::SceneView::getInitVisitor (    )  [inline]
 

const osg::Light* osgUtil::SceneView::getLight (    )  const [inline]
 

osg::Light* osgUtil::SceneView::getLight (    )  [inline]
 

LightingMode osgUtil::SceneView::getLightingMode (    )  const [inline]
 

float osgUtil::SceneView::getLODBias (    )  const [inline]
 

Get the LOD bias.

const osg::Matrix* osgUtil::SceneView::getModelViewMatrix (    )  const [inline]
 

osg::Matrix* osgUtil::SceneView::getModelViewMatrix (    )  [inline]
 

bool osgUtil::SceneView::getPrioritizeTextures (    )  const [inline]
 

get whether the draw method should call renderer->prioritizeTexture.

const osg::Matrix* osgUtil::SceneView::getProjectionMatrix (    )  const [inline]
 

osg::Matrix* osgUtil::SceneView::getProjectionMatrix (    )  [inline]
 

const osgUtil::RenderGraph* osgUtil::SceneView::getRenderGraph (    )  const [inline]
 

osgUtil::RenderGraph* osgUtil::SceneView::getRenderGraph (    )  [inline]
 

const osgUtil::RenderStage* osgUtil::SceneView::getRenderStage (    )  const [inline]
 

osgUtil::RenderStage* osgUtil::SceneView::getRenderStage (    )  [inline]
 

const osg::Node* osgUtil::SceneView::getSceneData (    )  const [inline]
 

Get the const scene data which to view.

The data will typically be an osg::Scene but can be any osg::Node type.

osg::Node* osgUtil::SceneView::getSceneData (    )  [inline]
 

Get the scene data which to view.

The data will typically be an osg::Scene but can be any osg::Node type.

float osgUtil::SceneView::getSmallFeatureCullingPixelSize (    )  const [inline]
 

Get the Small Feature Culling Pixel Size.

const osg::State* osgUtil::SceneView::getState (    )  const [inline]
 

osg::State* osgUtil::SceneView::getState (    )  [inline]
 

void osgUtil::SceneView::getViewport (  int &    x,
int &    y,
int &    width,
int &    height
)  [inline]
 

Get the viewport of the scene view.

osg::Viewport* osgUtil::SceneView::getViewport (    )  [inline]
 

Get the viewport.

const osg::Viewport* osgUtil::SceneView::getViewport (    )  const [inline]
 

Get the const viewport.

virtual void osgUtil::SceneView::init (    )  [virtual]
 

Do init traversal of attached scene graph using Init NodeVisitor.

The init traversal is called once for each SceneView, and should be used to compile display list, texture objects intialize data not otherwise intializaed during scene graph loading. Note, is called automatically by app&cull if it hasn't already been called elsewhere. Also init() should only ever be called within a valid graphics context.

bool osgUtil::SceneView::projectObjectIntoWindow (  const osg::Vec3 &    object,
osg::Vec3 &    window
)  const
 

Calculate, via glProject, the object coordinates of a window.

Note, current implementation requires that SceneView::draw() has been previously called for projectWindowIntoObject to produce valid values. Consistent with OpenGL windows coordinates are calculated relative to the bottom left of the window, whereas as window API's normally have the top left as the origin, so you may need to pass in (mouseX,window_height-mouseY,...). Returns true on successful projection.

bool osgUtil::SceneView::projectWindowIntoObject (  const osg::Vec3 &    window,
osg::Vec3 &    object
)  const
 

Calculate, via glUnProject, the object coordinates of a window point.

Note, current implementation requires that SceneView::draw() has been previously called for projectWindowIntoObject to produce valid values. Consistent with OpenGL windows coordinates are calculated relative to the bottom left of the window. Returns true on successful projection.

bool osgUtil::SceneView::projectWindowXYIntoObject (  int    x,
int    y,
osg::Vec3 &    near_point,
osg::Vec3 &    far_point
)  const
 

Calculate, via glUnProject, the object coordinates of a window x,y when projected onto the near and far planes.

Note, current implementation requires that SceneView::draw() has been previously called for projectWindowIntoObject to produce valid values. Consistent with OpenGL windows coordinates are calculated relative to the bottom left of the window. Returns true on successful projection.

void osgUtil::SceneView::setAppVisitor (  osg::NodeVisitor *    av )  [inline]
 

void osgUtil::SceneView::setBackgroundColor (  const osg::Vec4 &    color )  [inline]
 

Set the background color used in glClearColor().

Defaults to an off blue color.

void osgUtil::SceneView::setCamera (  osg::Camera *    camera )  [inline]
 

set an osg::Camera for the scene view to use for setting projection and modelview matrices internaly.

However, the projection matrix from the camera will be overriden by a projection matrix which is set explicitly via setProjectionMatrix(..), see below. Also, the model matrix from the camera will be overriden by a modelview matrix which is set explicitly via setModelViewMatrix(..), see below.

void osgUtil::SceneView::setComputeNearFarMode (  CullVisitor::ComputeNearFarMode    cnfm )  [inline]
 

Set the ComputeNearFarMode for the CullVisitor to use.

void osgUtil::SceneView::setCullingMode (  osg::CullStack::CullingMode    mode )  [inline]
 

Set the culling mode for the CullVisitor to use.

void osgUtil::SceneView::setCullMask (  const osg::Node::NodeMask    nm )  [inline]
 

void osgUtil::SceneView::setCullMaskLeft (  const osg::Node::NodeMask    nm )  [inline]
 

void osgUtil::SceneView::setCullMaskRight (  const osg::Node::NodeMask    nm )  [inline]
 

void osgUtil::SceneView::setCullVisitor (  osgUtil::CullVisitor *    cv )  [inline]
 

void osgUtil::SceneView::setDefaults (    ) 
 

Set scene view to use default global state, light, camera and render visitor.

void osgUtil::SceneView::setDisplaySettings (  osg::DisplaySettings *    vs )  [inline]
 

Set the DisplaySettings.

void osgUtil::SceneView::setFrameStamp (  osg::FrameStamp *    fs )  [inline]
 

Set the frame stamp for the current frame.

void osgUtil::SceneView::setGlobalStateSet (  osg::StateSet *    state )  [inline]
 

void osgUtil::SceneView::setInitVisitor (  osg::NodeVisitor *    av )  [inline]
 

void osgUtil::SceneView::setLight (  osg::Light *    light )  [inline]
 

void osgUtil::SceneView::setLightingMode (  LightingMode    mode )  [inline]
 

void osgUtil::SceneView::setLODBias (  float    bias )  [inline]
 

Set the LOD bias for the CullVisitor to use.

void osgUtil::SceneView::setModelViewMatrix (  osg::Matrix *    matrix )  [inline]
 

set a modelview matrix.

Note, this will override a camera's modelview matrix if it is not NULL.

void osgUtil::SceneView::setPrioritizeTextures (  bool    pt )  [inline]
 

set whether the draw method should call renderer->prioritizeTexture.

void osgUtil::SceneView::setProjectionMatrix (  osg::Matrix *    matrix )  [inline]
 

set a projection matrix.

Note, this will override a camera's projection matrix if it is not NULL.

void osgUtil::SceneView::setRenderGraph (  osgUtil::RenderGraph *    rg )  [inline]
 

void osgUtil::SceneView::setRenderStage (  osgUtil::RenderStage *    rs )  [inline]
 

void osgUtil::SceneView::setSceneData (  osg::Node *    node )  [inline]
 

Set the data which to view.

The data will typically be an osg::Scene but can be any osg::Node type.

void osgUtil::SceneView::setSmallFeatureCullingPixelSize (  float    value )  [inline]
 

Set the Small Feature Culling Pixel Size.

void osgUtil::SceneView::setState (  osg::State *    state )  [inline]
 

void osgUtil::SceneView::setViewport (  int    x,
int    y,
int    width,
int    height
)  [inline]
 

Set the viewport of the scene view to specified dimensions.

void osgUtil::SceneView::setViewport (  osg::Viewport *    viewport )  [inline]
 

Set the viewport of the scene view to use specfied osg::Viewport.


Member Data Documentation

osg::ref_ptr<osg::NodeVisitor> osgUtil::SceneView::_appVisitor [protected]
 

osg::Vec4 osgUtil::SceneView::_backgroundColor [protected]
 

osg::ref_ptr<osg::Camera> osgUtil::SceneView::_camera [protected]
 

CullVisitor::ComputeNearFarMode osgUtil::SceneView::_computeNearFar [protected]
 

osg::CullStack::CullingMode osgUtil::SceneView::_cullingMode [protected]
 

osg::Node::NodeMask osgUtil::SceneView::_cullMask [protected]
 

osg::Node::NodeMask osgUtil::SceneView::_cullMaskLeft [protected]
 

osg::Node::NodeMask osgUtil::SceneView::_cullMaskRight [protected]
 

osg::ref_ptr<osgUtil::CullVisitor> osgUtil::SceneView::_cullVisitor [protected]
 

osg::ref_ptr<osgUtil::CullVisitor> osgUtil::SceneView::_cullVisitorLeft [protected]
 

osg::ref_ptr<osgUtil::CullVisitor> osgUtil::SceneView::_cullVisitorRight [protected]
 

osg::ref_ptr<osg::DisplaySettings> osgUtil::SceneView::_displaySettings [protected]
 

osg::ref_ptr<osg::FrameStamp> osgUtil::SceneView::_frameStamp [protected]
 

osg::ref_ptr<osg::StateSet> osgUtil::SceneView::_globalState [protected]
 

bool osgUtil::SceneView::_initCalled [protected]
 

osg::ref_ptr<osg::NodeVisitor> osgUtil::SceneView::_initVisitor [protected]
 

osg::ref_ptr<osg::Light> osgUtil::SceneView::_light [protected]
 

LightingMode osgUtil::SceneView::_lightingMode [protected]
 

float osgUtil::SceneView::_LODBias [protected]
 

osg::ref_ptr<osg::Matrix> osgUtil::SceneView::_modelviewMatrix [protected]
 

bool osgUtil::SceneView::_prioritizeTextures [protected]
 

osg::ref_ptr<osg::Matrix> osgUtil::SceneView::_projectionMatrix [protected]
 

osg::ref_ptr<osgUtil::RenderGraph> osgUtil::SceneView::_rendergraph [protected]
 

osg::ref_ptr<osgUtil::RenderGraph> osgUtil::SceneView::_rendergraphLeft [protected]
 

osg::ref_ptr<osgUtil::RenderGraph> osgUtil::SceneView::_rendergraphRight [protected]
 

osg::ref_ptr<osgUtil::RenderStage> osgUtil::SceneView::_renderStage [protected]
 

osg::ref_ptr<osgUtil::RenderStage> osgUtil::SceneView::_renderStageLeft [protected]
 

osg::ref_ptr<osgUtil::RenderStage> osgUtil::SceneView::_renderStageRight [protected]
 

osg::ref_ptr<osg::Node> osgUtil::SceneView::_sceneData [protected]
 

float osgUtil::SceneView::_smallFeatureCullingPixelSize [protected]
 

osg::ref_ptr<osg::State> osgUtil::SceneView::_state [protected]
 

osg::ref_ptr<osg::Viewport> osgUtil::SceneView::_viewport [protected]
 


The documentation for this class was generated from the following file:
Generated at Wed Sep 18 13:56:02 2002 for the Open Scene Graph by doxygen 1.2.16.