H3D::H3DWindowNode Class Reference
[X3D node classes.]

The base class for all window nodes. More...

#include <H3D/H3DWindowNode.h>

Inheritance diagram for H3D::H3DWindowNode:

Inheritance graph

List of all members.

Classes

class  RenderMode
 The mode for rendering specified as a string. More...

Public Member Functions

 H3DWindowNode (Inst< SFInt32 > _width=0, Inst< SFInt32 > _height=0, Inst< SFBool > _fullscreen=0, Inst< SFBool > _mirrored=0, Inst< RenderMode > _renderMode=0, Inst< SFViewpoint > _viewpoint=0, Inst< SFTime > _time=0)
 Constructor.
 ~H3DWindowNode ()
 Destructor.
virtual void swapBuffers ()=0
 Virtual function to swap buffers.
virtual void initWindow ()=0
 Virtual function that should create a new window and set its properties depending on the fields.
virtual void initWindowHandler ()=0
 Virtual function to initialize the window handler if needed.
virtual void setFullscreen (bool fullscreen)=0
 Virtual function to set whether the window should be fullscreen or not.
virtual void makeWindowActive ()=0
 Virtual function to make the current window active, i.e.
virtual void initialize ()
 Initialize the window node.
virtual void render (X3DChildNode *child_to_render)
 This function renders the X3DChildNode given into the window of the H3DWindowNode.
virtual void reshape (int w, int h)
 This function will be called when the window size has changed.
virtual void display ()
 This function is called when the window has to redraw itself.
virtual void onKeyDown (int key, bool special)
 This function should be called by a window when a key is pressed.
virtual void onKeyUp (int key, bool special)
 This function should be called by a window when a key is released.
virtual void onMouseButtonAction (int button, int state)
 This function should be called by a window when a mouse button is pressed or released.
virtual void onMouseMotionAction (int x, int y)
 This function should be called by a window when a mouse sends a motion event.
virtual void onMouseWheelAction (int direction)
 This function should be called by a window when a mouse wheel is scrolled either from or towards the user For values of direction see MouseSensor.h.
bool calculateFarAndNearPlane (H3DFloat &far, H3DFloat &near, X3DChildNode *child, X3DViewpointNode *vp, bool include_stylus)
 Calculate the far and near clipping planes from the bounding box of a X3DChildNode.
void shareRenderingContext (H3DWindowNode *w)
 This function shares the rendering context between this H3DWindowNode and the one given as an argument.

Public Attributes

auto_ptr< SFInt32width
 The width in pixels of the window.
auto_ptr< SFInt32height
 The height in pixels of the window.
auto_ptr< SFBoolfullscreen
 Determines if the window should be in fullscreen or not.
auto_ptr< SFBoolmirrored
 Determines if the scene rendered should be mirrored or not.
auto_ptr< RenderModerenderMode
 The mode to render the scene in the window in.
auto_ptr< SFViewpointviewpoint
 If the viewpoint field is specified, that viewpoint is used by the rendering in H3DWindowNode instead of the stack top of the Viewpoint bindable stack.

Static Public Attributes

static H3DNodeDatabase database
 The H3DNodeDatabase for this node.

Protected Member Functions

void setMultiPassTransparency (bool b)
 If multi pass transparency is set to true the scene will be rendered three times graphically, once for all solid objects, once for the back side of transparent objects and once for the front face of transparent objects.


Detailed Description

The base class for all window nodes.

A H3DWindowNode handles creation of windows and window properties for looking into a Scene. To implement a new window class the following functions has to be specified: swapBuffers(), initWindow(), initWindowHandler(), setFullscreen( bool fullscreen ) makeWindowActive(). For example implementation see GLUTWindow.


Member Function Documentation

bool H3DWindowNode::calculateFarAndNearPlane ( H3DFloat far,
H3DFloat near,
X3DChildNode child,
X3DViewpointNode vp,
bool  include_stylus 
)

Calculate the far and near clipping planes from the bounding box of a X3DChildNode.

The far and near planes will be calculated on contain the node but nothing else. Requires the bounding box type to be BoxBound.

Parameters:
far Return param for the far plane.
near Return param for the near plane.
child The child node we want to be visible.
vp The Viewpoint in the scene.
include_stylus if true the stylus from each HapticsDevice in DeviceInfo will also be included in the calculations of the planes. The bounding box we will use is then the union of the stylus fields and the child parameter.
Returns:
True if successfully calculated and returned parameters. false if the bounding boxes was of another type than BoxBound.

References H3D::X3DViewpointNode::accForwardMatrix, H3D::H3DBoundedObject::bound, H3D::Bound::boundUnion(), H3D::TransformedBoxBound::boxBound, H3D::BoxBound::center, H3D::DeviceInfo::device, H3D::DeviceInfo::getActive(), H3D::TransformedBoxBound::matrix, H3D::BoxBound::size, H3D::H3DHapticsDevice::stylus, H3D::X3DViewpointNode::totalOrientation, H3D::X3DViewpointNode::totalPosition, H3D::H3DHapticsDevice::trackerOrientation, H3D::MatrixTransform::transformedBound, and H3D::H3DHapticsDevice::weightedProxyPosition.

Referenced by render().

virtual void H3D::H3DWindowNode::initWindow (  )  [pure virtual]

Virtual function that should create a new window and set its properties depending on the fields.

Implemented in H3D::GLUTWindow.

Referenced by initialize().

virtual void H3D::H3DWindowNode::initWindowHandler (  )  [pure virtual]

Virtual function to initialize the window handler if needed.

E.g. glutInit().

Implemented in H3D::GLUTWindow.

Referenced by initialize().

virtual void H3D::H3DWindowNode::makeWindowActive (  )  [pure virtual]

Virtual function to make the current window active, i.e.

make subsequent OpenGL calls draw in the context of this window.

Implemented in H3D::GLUTWindow.

Referenced by render().

void H3DWindowNode::onKeyDown ( int  key,
bool  special 
) [virtual]

This function should be called by a window when a key is pressed.

When special is true the key is a special key enumerated in X3DKeyDeviceSensorNode.h The window handles the translation from its internal behaviour to ASCII and the special numbers.

Parameters:
key Specifies the key that is pressed.
special True when the key is a special key, and false when it is not.

References H3D::X3DKeyDeviceSensorNode::keyboardDownCallback(), and H3D::X3DKeyDeviceSensorNode::keyboardSpecialDownCallback().

Referenced by H3D::GLUTWindow::glutKeyboardDownCallback(), and H3D::GLUTWindow::glutSpecialDownCallback().

void H3DWindowNode::onKeyUp ( int  key,
bool  special 
) [virtual]

This function should be called by a window when a key is released.

When special is true the key is a special key enumerated in X3DKeyDeviceSensorNode.h The window handles the translation from its internal behaviour to ASCII and the special numbers.

Parameters:
key Specifies the key that is released
special True when the key is a special key, and false when it is not.

References H3D::X3DKeyDeviceSensorNode::keyboardSpecialUpCallback(), and H3D::X3DKeyDeviceSensorNode::keyboardUpCallback().

Referenced by H3D::GLUTWindow::glutKeyboardUpCallback(), and H3D::GLUTWindow::glutSpecialUpCallback().

void H3DWindowNode::onMouseButtonAction ( int  button,
int  state 
) [virtual]

This function should be called by a window when a mouse button is pressed or released.

For values of button and state see MouseSensor.h

Parameters:
button specifies the mouse button pressed or released
state shows that the button is pressed or released

References H3D::MouseSensor::buttonCallback().

Referenced by H3D::GLUTWindow::glutMouseCallback().

void H3DWindowNode::onMouseMotionAction ( int  x,
int  y 
) [virtual]

This function should be called by a window when a mouse sends a motion event.

x, y are window relative coordinates

References H3D::MouseSensor::motionCallback().

Referenced by H3D::GLUTWindow::glutMotionCallback().

void H3DWindowNode::render ( X3DChildNode child_to_render  )  [virtual]

This function renders the X3DChildNode given into the window of the H3DWindowNode.

References H3D::X3DViewpointNode::accInverseMatrix, H3DUtil::ArithmeticTypes::Rotationd::angle, H3D::CollisionOptions::avatarCollision, H3DUtil::ArithmeticTypes::Rotationd::axis, calculateFarAndNearPlane(), H3D::X3DLightNode::decreaseLightIndex(), H3D::DefaultAppearance::defaultAppearance, H3D::X3DShapeNode::disable_lighting_if_no_app, H3D::H3DDisplayListObject::displayList, H3D::H3DNavigation::doNavigation(), H3D::NavigationInfo::doNavigation(), H3D::StereoInfo::focalDistance, fullscreen, H3D::StereoInfo::getActive(), H3D::X3DViewpointNode::getActive(), H3D::NavigationInfo::getActive(), H3D::GlobalSettings::getActive(), H3D::Fog::getActive(), H3D::X3DBackgroundNode::getActive(), H3D::Scene::getLastTraverseInfo(), H3D::X3DLightNode::getLightIndex(), H3D::GlobalSettings::getOptionNode(), H3D::X3DBackgroundNode::glClearColor(), H3D::NavigationInfo::headlight, height, H3D::H3DWindowNode::RenderMode::HORIZONTAL_INTERLACED, H3D::H3DWindowNode::RenderMode::HORIZONTAL_SPLIT, initialize(), H3D::StereoInfo::interocularDistance, H3DUtil::RefCountedClass::isInitialized(), makeWindowActive(), H3D::Appearance::material, mirrored, H3D::RenderProperties::multiPassTransparency, H3D::H3DWindowNode::RenderMode::QUAD_BUFFERED_STEREO, H3D::H3DDisplayListObject::DisplayList::rebuildAllDisplayLists(), H3D::H3DWindowNode::RenderMode::RED_BLUE_STEREO, H3D::H3DWindowNode::RenderMode::RED_CYAN_STEREO, H3D::H3DWindowNode::RenderMode::RED_GREEN_STEREO, H3D::X3DBackgroundNode::renderBackground(), H3D::Fog::renderFog(), renderMode, H3D::H3DMultiPassRenderObject::renderPostSceneAll(), H3D::H3DMultiPassRenderObject::renderPostViewpointAll(), H3D::H3DMultiPassRenderObject::renderPreViewpointAll(), H3D::Appearance::renderProperties, H3D::Scene::scenes, H3D::X3DAppearanceNode::setDefaultUsingMultiPassTransparency(), setFullscreen(), swapBuffers(), H3D::X3DViewpointNode::totalOrientation, H3D::X3DViewpointNode::totalPosition, H3D::X3DPointingDeviceSensorNode::updateX3DPointingDeviceSensors(), H3D::H3DWindowNode::RenderMode::VERTICAL_INTERLACED, H3D::H3DWindowNode::RenderMode::VERTICAL_INTERLACED_GREEN_SHIFT, H3D::H3DWindowNode::RenderMode::VERTICAL_SPLIT, H3D::H3DWindowNode::RenderMode::VERTICAL_SPLIT_KEEP_RATIO, viewpoint, H3D::NavigationInfo::viewpointToUse(), H3D::NavigationInfo::visibilityLimit, width, H3D::X3DViewpointNode::windowFromfieldOfView(), and H3D::TraverseInfo::x3dlightnode_vector.

Referenced by H3D::Scene::idle().

void H3D::H3DWindowNode::setMultiPassTransparency ( bool  b  )  [inline, protected]

If multi pass transparency is set to true the scene will be rendered three times graphically, once for all solid objects, once for the back side of transparent objects and once for the front face of transparent objects.

This is in order to avoid artifacts for transparent objects when rendered in the wrong order.

Referenced by H3D::Scene::idle().

void H3DWindowNode::shareRenderingContext ( H3DWindowNode w  ) 

This function shares the rendering context between this H3DWindowNode and the one given as an argument.

This means that the two windows after the call can share display lists and textures. When several H3DWindowNode instances are created this function will always be called to share the rendering context between them, i.e. all H3DWindowNode instances share rendering context by default.

References H3D_FULL_LOCATION.

Referenced by initialize().


Member Data Documentation

Determines if the window should be in fullscreen or not.

Access type: inputOutput
Default value: FALSE

Referenced by H3DWindowNode(), and render().

The height in pixels of the window.

Access type: inputOutput
Default value: 600

Referenced by H3DWindowNode(), H3D::GLUTWindow::initWindow(), render(), and reshape().

Determines if the scene rendered should be mirrored or not.

Access type: inputOutput
Default value: FALSE

Referenced by H3DWindowNode(), and render().

The mode to render the scene in the window in.

See RenderMode::Mode for valid values. Values are specified as a string with the same name as the enum value of the mode you want.

Access type: inputOutput
Default value: "MONO"

Referenced by H3DWindowNode(), initialize(), H3D::GLUTWindow::initWindow(), render(), and reshape().

If the viewpoint field is specified, that viewpoint is used by the rendering in H3DWindowNode instead of the stack top of the Viewpoint bindable stack.

This is so that multiple windows with different viewpoints can be specified.

Access type: inputOutput
Default value: NULL

Referenced by render().

The width in pixels of the window.

Access type: inputOutput
Default value: 800

Referenced by H3DWindowNode(), H3D::GLUTWindow::initWindow(), render(), and reshape().


The documentation for this class was generated from the following files:

Generated on Fri Nov 7 10:30:18 2008 for H3D API by  doxygen 1.5.7