Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

nvui::RenderArea Class Reference

The render area is the place where the actual drawing takes place. More...

#include <RenderArea.h>

Inheritance diagram for nvui::RenderArea:

Inheritance graph
[legend]
Collaboration diagram for nvui::RenderArea:

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual NVSG_API ~RenderArea (void)
 Destructor.
virtual NVSG_API bool init (RenderArea *shareArea=NULL)
 Create the render area.
virtual NVSG_API void destroy (void)
 Destroy the render area.
virtual NVSG_API void keyDown (UINT key, bool keyRepeated=false)
 Handle key down.
virtual NVSG_API void keyUp (UINT key)
 Handle key up.
virtual NVSG_API void resetKeyState (void)
 Reset the current key state.
virtual NVSG_API void mouseButtonDown (UINT btn, int x, int y)
 Handle mouse button down.
virtual NVSG_API void mouseButtonUp (UINT btn, int x, int y)
 Handle mouse button up.
virtual NVSG_API void resetButtonState (void)
 Reset the current button state.
virtual NVSG_API void mouseMotion (int x, int y)
 Handle mouse motion.
virtual NVSG_API void renderScene (void)
 Render the scene.
virtual NVSG_API void setViewportSize (size_t width, size_t height)
 Handle the viewport resizing.
NVSG_API bool pickCameraTargetPoint (int x, int y)
 Pick the cameras' target point.
NVSG_API nvtraverser::RenderTraversergetRenderTraverser (void) const
 Get the current render traverser.
NVSG_API void setRenderTraverser (nvtraverser::RenderTraverser *tr)
 Set the current render traverser.
NVSG_API void setAppTraverser (nvtraverser::AppTraverser *tr)
 Set the current app traverser.
NVSG_API nvtraverser::AppTraversergetAppTraverser () const
 Get the current app traverser.
NVSG_API void pushCullTraverser (nvtraverser::CullTraverser *tr)
 Add a cull traverser to the cull pipeline.
NVSG_API void popCullTraverser ()
 Remove a cull traverser from the cull pipeline.
NVSG_API size_t getNumberOfCullTraverser () const
 Get the number of culling stages in the culling pipeline.
NVSG_API nvtraverser::CullTraversergetCullTraverser (size_t position) const
 Get the specified cull traverser.
NVSG_API const nvsg::ViewStategetViewState (void) const
 Get the current view state.
NVSG_API void setViewState (const nvsg::ViewState *viewState)
 Set the current view state.
NVSG_API float getAspectRatio (void) const
 Get the current aspect ratio of the render area.
NVSG_API bool isStereoAvailable (void)
 Check if stereo is available for the current render area.
NVSG_API void requestFSAA (bool bOn, unsigned int numBuffers)
 Request full-scene antialiasing (FSAA) support.
NVSG_API void requestStereoSupport (bool bStereo)
 Request stereo support.
NVSG_API void setSceneData (nvui::CameraManipulator *pCamManip, const nvsg::Scene *pScene, const nvsg::ViewState *pViewState=NULL)
 Sets the Scene to be rendered together with render-specific view data.
virtual NVSG_API void triggerRedraw (void)

Static Public Member Functions

static NVSG_API size_t createNewRenderAreaID ()
 Trigger a redraw of the scene.

Protected Types

enum  { _UNDEFINED = 0x00000000, _STEREO = 0x00000001, _MULTISAMPLE = 0x00000002 }
 Possible features of the render area. (mainly influencing the pixelformat - OGL). More...

Protected Member Functions

NVSG_API RenderArea (void)
 Default constructor.

Protected Attributes

std::vector< nvtraverser::CullTraverser * > m_cullTraverser
 These traversers cull objects in the tree.
nvtraverser::RenderTraverserm_renderTraverser
 This traverser renders / displays the tree.
nvtraverser::AppTraverserm_appTraverser
 This traversers applie all pending changes to the tree.
CameraManipulatorm_camManip
 Camera manipulator. Could be NULL!
const nvsg::Scenem_scene
 Pointer to the root node of the scene. m_scene could be NULL !!
const nvsg::ViewStatem_viewState
 Pointer to the view specific controls (camera, animation state,...).
unsigned long m_features
 All requested features for this render area stereo, multisample, ...
UINT m_numMSBuffers
 Number of multi sample buffers.
bool m_raCreated
 Signal the Create() status.
size_t m_raHeight
 Height of the render area.
size_t m_raWidth
 Width of the render area.

Static Protected Attributes

static size_t m_idRenderArea

Detailed Description

The render area is the place where the actual drawing takes place.

This class provides a generic interface to a render target view that is independent of device, hardware, and operating system specifics.

Note:
By default the render area is created with a FrustumCullTraverser for the culling step. You need to set the desired AppTraverser and RenderTraverse.


Member Enumeration Documentation

anonymous enum [protected]
 

Possible features of the render area. (mainly influencing the pixelformat - OGL).

Enumeration values:
_UNDEFINED  No special feature requested.
_STEREO  Stereo requested.
_MULTISAMPLE  Multisample buffer requested.


Constructor & Destructor Documentation

virtual NVSG_API nvui::RenderArea::~RenderArea void   )  [virtual]
 

Destructor.

NVSG_API nvui::RenderArea::RenderArea void   )  [protected]
 

Default constructor.


Member Function Documentation

virtual NVSG_API bool nvui::RenderArea::init RenderArea shareArea = NULL  )  [virtual]
 

Create the render area.

This method creates and initializes the render area.

Returns:
true - everything went fine
Parameters:
shareArea  Pointer to a render area to share display lists, textures, vertex programs, etc. with

Reimplemented in nvui::GLWinRenderArea.

virtual NVSG_API void nvui::RenderArea::destroy void   )  [virtual]
 

Destroy the render area.

This method destroys and cleans up the render area.

Reimplemented in nvui::GLWinRenderArea.

virtual NVSG_API void nvui::RenderArea::keyDown UINT  key,
bool  keyRepeated = false
[virtual]
 

Handle key down.

React on a key down event. (For example, report it to the camera manipulator.)

Parameters:
key  Pressed key.

virtual NVSG_API void nvui::RenderArea::keyUp UINT  key  )  [virtual]
 

Handle key up.

React on a key down event. (For example, report it to the camera manipulator.)

Parameters:
key  Released key.

virtual NVSG_API void nvui::RenderArea::resetKeyState void   )  [virtual]
 

Reset the current key state.

This method also resets the camera manipulator key states.

virtual NVSG_API void nvui::RenderArea::mouseButtonDown UINT  btn,
int  x,
int  y
[virtual]
 

Handle mouse button down.

React on mouse button down events. (For example, report it to the current camera manipulator.)

Parameters:
btn  Pressed button (Windows: MK_LBUTTON, MK_MBUTTON, MK_RBUTTON
x  Current x position of the mouse
y  Current y position of the mouse

Reimplemented in nvui::GLWinRenderArea.

virtual NVSG_API void nvui::RenderArea::mouseButtonUp UINT  btn,
int  x,
int  y
[virtual]
 

Handle mouse button up.

React on mouse button up events. (For example, report it to the current camera manipulator.)

Parameters:
btn  Released buttons (Windows: MK_LBUTTON, MK_MBUTTON, MK_RBUTTON
x  Current x position of the mouse
y  Current y position of the mouse

Reimplemented in nvui::GLWinRenderArea.

virtual NVSG_API void nvui::RenderArea::resetButtonState void   )  [virtual]
 

Reset the current button state.

This method also resets the camera manipulator button states.

virtual NVSG_API void nvui::RenderArea::mouseMotion int  x,
int  y
[virtual]
 

Handle mouse motion.

React on mouse motion events. (For example, report it to the current camera manipulator.)

Parameters:
x  Current x position of the mouse
y  Current y position of the mouse

Reimplemented in nvui::GLWinRenderArea.

virtual NVSG_API void nvui::RenderArea::renderScene void   )  [virtual]
 

Render the scene.

Render the entire scene. (app, cull, draw the whole tree) If you want to trigger this method, use triggerRedraw() to force a redraw of the scene.

Reimplemented in nvui::GLWinRenderArea.

virtual NVSG_API void nvui::RenderArea::setViewportSize size_t  width,
size_t  height
[virtual]
 

Handle the viewport resizing.

Resize the viewport. React on parent window size changes. Report it to OpenGL, to the render window, or to the camera manipulator.

Parameters:
width  Width of the viewport
height  Height of the viewport

Reimplemented in nvui::GLWinRenderArea.

NVSG_API bool nvui::RenderArea::pickCameraTargetPoint int  x,
int  y
 

Pick the cameras' target point.

Determine the target point and report it to the current camera. This method takes the mouse coordinates and sends a ray into the scene to calculate the nearest intersection with an object from the scene. It then takes the intersection and reports it to the camera, where the camera can use it as the rotation point, etc.

Returns:
false - no intersection
Parameters:
x  Current x position of the mouse
y  Current x position of the mouse

nvtraverser::RenderTraverser * nvui::RenderArea::getRenderTraverser void   )  const [inline]
 

Get the current render traverser.

Returns:
Current render traverser.
Note:
Render traverser must not live longer than the render area since they are device dependent! (See RenderTraverser)

void nvui::RenderArea::setRenderTraverser nvtraverser::RenderTraverser tr  )  [inline]
 

Set the current render traverser.

The old render traverser will be unreferenced and the new one will be referenced.

Note:
Render traverser must not live longer than the render area since they are device dependent! (See RenderTraverser)
Parameters:
tr  New render traverser.

void nvui::RenderArea::setAppTraverser nvtraverser::AppTraverser tr  )  [inline]
 

Set the current app traverser.

The old app traverser will be unreferenced and the new one will be referenced.

Parameters:
tr  New app traverser.

nvtraverser::AppTraverser * nvui::RenderArea::getAppTraverser  )  const [inline]
 

Get the current app traverser.

Returns:
Current app traverser.

void nvui::RenderArea::pushCullTraverser nvtraverser::CullTraverser tr  )  [inline]
 

Add a cull traverser to the cull pipeline.

This method appends an additional cull traverser to the culling stage of this render area. Every additional culler will be added to the end of the culling pipeline.

Note:
Internally we increment the refcount.

Do not add the same traverser more than once.

Parameters:
tr  New cull traverser.

void nvui::RenderArea::popCullTraverser  )  [inline]
 

Remove a cull traverser from the cull pipeline.

This method removes the last cull traverser from the end of the cull pipeline.

Note:
Internally we decrement the refcount.

size_t nvui::RenderArea::getNumberOfCullTraverser  )  const [inline]
 

Get the number of culling stages in the culling pipeline.

Returns:
Number of active culling stages.

nvtraverser::CullTraverser * nvui::RenderArea::getCullTraverser size_t  position  )  const [inline]
 

Get the specified cull traverser.

Retrieve the cull traverser from the specified position of the culling pipeline.

Note:
Position 0 is the first entry in the culling pipeline.
Returns:
Pointer to the specified cull traverser

const nvsg::ViewState * nvui::RenderArea::getViewState void   )  const [inline]
 

Get the current view state.

Returns:
Current view state.

NVSG_API void nvui::RenderArea::setViewState const nvsg::ViewState viewState  ) 
 

Set the current view state.

This method retrieves the viewstate from the given and copies the data into the local viewstate.

float nvui::RenderArea::getAspectRatio void   )  const [inline]
 

Get the current aspect ratio of the render area.

Returns:
Aspect ratio. (width / height). 0.f if the height and / or width is not valid.

NVSG_API bool nvui::RenderArea::isStereoAvailable void   ) 
 

Check if stereo is available for the current render area.

Note:
The render area must be created and valid.
Returns:
true - stereo is available

NVSG_API void nvui::RenderArea::requestFSAA bool  bOn,
unsigned int  numBuffers
 

Request full-scene antialiasing (FSAA) support.

Note:
Call prior to init()
Parameters:
bOn  true - FSAA on
numBuffers  FSAA level / number of multisample buffers

NVSG_API void nvui::RenderArea::requestStereoSupport bool  bStereo  ) 
 

Request stereo support.

Note:
Call prior to init()
Parameters:
bStereo  true - stereo support required

NVSG_API void nvui::RenderArea::setSceneData nvui::CameraManipulator pCamManip,
const nvsg::Scene pScene,
const nvsg::ViewState pViewState = NULL
 

Sets the Scene to be rendered together with render-specific view data.

The function replaces the RenderArea's current Scene by the Scene passed through pScene. The behavior is undefined if a NULL pointer is passed through pScene!

The CameraManipulator passed through pCamManip replaces the RenderArea's current CameraManipulator. If a NULL pointer is passed through pCamManip, there will be no CameraManipulator attached to the RenderArea after this call!

If a valid CameraManipulator is passed through pCamManip, the RenderArea's internal ViewState will always adopt the camera attached to that manipulator, regardless of whether the ViewState passed through pViewState is valid or not.

If the ViewState passed through pViewState is valid, it will replace the RenderArea's current ViewState. If a NULL pointer is passed through pViewState, the RenderArea's current ViewState remains unchanged.

Parameters:
pCamManip  CameraManipulator to replace the RenderArea's current CameraManipulator.
pScene  Scene to replace the RenderArea's current Scene.
pViewState  ViewState to replace the RenderArea's current ViewState. Will be ignored if a NULL pointer is passed here.

size_t nvui::RenderArea::createNewRenderAreaID  )  [inline, static]
 

Trigger a redraw of the scene.

void nvui::RenderArea::triggerRedraw void   )  [inline, virtual]
 

Note:
Use this method to trigger a redraw instead of calling the drawing method directly!

Reimplemented in nvui::GLWinRenderArea.


Member Data Documentation

std::vector<nvtraverser::CullTraverser *> nvui::RenderArea::m_cullTraverser [protected]
 

These traversers cull objects in the tree.

nvtraverser::RenderTraverser* nvui::RenderArea::m_renderTraverser [protected]
 

This traverser renders / displays the tree.

nvtraverser::AppTraverser* nvui::RenderArea::m_appTraverser [protected]
 

This traversers applie all pending changes to the tree.

CameraManipulator* nvui::RenderArea::m_camManip [protected]
 

Camera manipulator. Could be NULL!

const nvsg::Scene* nvui::RenderArea::m_scene [protected]
 

Pointer to the root node of the scene. m_scene could be NULL !!

const nvsg::ViewState* nvui::RenderArea::m_viewState [protected]
 

Pointer to the view specific controls (camera, animation state,...).

unsigned long nvui::RenderArea::m_features [protected]
 

All requested features for this render area stereo, multisample, ...

UINT nvui::RenderArea::m_numMSBuffers [protected]
 

Number of multi sample buffers.

bool nvui::RenderArea::m_raCreated [protected]
 

Signal the Create() status.

size_t nvui::RenderArea::m_raHeight [protected]
 

Height of the render area.

size_t nvui::RenderArea::m_raWidth [protected]
 

Width of the render area.

size_t nvui::RenderArea::m_idRenderArea [static, protected]
 

The child window ID for the different CWnd derived render area windows. (e.g. GLMFCRAWnd) Use this ID in the create call - see CWnd->Create() - (don't forget to increment the ID before using it).


The documentation for this class was generated from the following file:
Generated on Tue Mar 1 13:21:11 2005 for NVSGSDK by NVIDIA