H3D API
2.4.1
|
H3DWindowNode implementet using GLUT. More...
#include <H3D/GLUTWindow.h>
Public Member Functions | |
GLUTWindow (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< SFInt32 > _posX=0, Inst< SFInt32 > _posY=0, Inst< SFBool > _manualCursorControl=0, Inst< SFString > _cursorType=0, Inst< SFString > _gameMode=0) | |
Constructor. | |
~GLUTWindow () | |
Destructor. | |
virtual void | swapBuffers () |
Calls glutSwapBuffers. | |
virtual void | initWindow () |
Creates and initializes a GLUT window/. | |
virtual void | deinitWindow () |
Virtual function to clean up all that was created in initWindow. | |
virtual void | initWindowHandler () |
Initializes GLUT. | |
virtual void | setFullscreen (bool _fullscreen) |
Sets fullscreen mode. | |
virtual void | makeWindowActive () |
Make this the current window. | |
int | getGLUTWindowId () |
Returns the GLUT window id for this window. | |
![]() | |
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< SFInt32 > _posX=0, Inst< SFInt32 > _posY=0, Inst< SFBool > _manualCursorControl=0, Inst< SFString > _cursorType=0, Inst< SFNavigationInfo > _navigationInfo=0, Inst< SFBool > _useFullscreenAntiAliasing=0, Inst< SFVec2f > _clipDistances=0, Inst< SFBool > _singlePassStereo=0, Inst< SFString > _pointingDeviceRefreshMode=0, Inst< SFBool > _resetViewPoint=0, Inst< SFInt32 > _numSamples=0) | |
Constructor. | |
~H3DWindowNode () | |
Destructor. | |
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. More... | |
virtual void | onKeyUp (int key, bool special) |
This function should be called by a window when a key is released. More... | |
virtual void | onMouseButtonAction (int button, int state) |
This function should be called by a window when a mouse button is pressed or released. More... | |
virtual void | onMouseMotionAction (int x, int y) |
This function should be called by a window when a mouse sends a motion event. More... | |
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. | |
virtual void | shareRenderingContext (H3DWindowNode *w) |
This function shares the rendering context between this H3DWindowNode and the one given as an argument. More... | |
operator HWND () | |
Class Conversion Operator For Window Handle (H3DWindowNode Can Be Used As A Window Handle) | |
![]() | |
Node () | |
Constructor. | |
virtual Node * | clone (bool deepCopy=true, DeepCopyMap *deepCopyMap=NULL) |
Returns a new instance of this node type with the same state as this one. More... | |
virtual | ~Node () |
Destructor. | |
X3DPrototypeInstance * | getProtoInstanceParent () |
If this node is the root node in the proto body of a X3DPrototypeInstance then this will return that node. More... | |
void | setProtoInstanceParent (X3DPrototypeInstance *p) |
Set the X3DPrototypeInstance this node is the the root node if applicaple. | |
virtual void | render () |
the render() function is used for the depth-first rendering traversal of the scene-graph. More... | |
virtual void | traverseSG (TraverseInfo &ti) |
traverseSG is called once per scenegraph loop on the scene in order to traverse the scenegraph. More... | |
virtual bool | lineIntersect (const Vec3f &from, const Vec3f &to, LineIntersectResult &result) |
Detect intersection between a line segment and the Node. More... | |
virtual void | closestPoint (const Vec3f &p, NodeIntersectResult &result) |
Find closest point on Node to p. More... | |
virtual bool | movingSphereIntersect (H3DFloat radius, const Vec3f &from, const Vec3f &to, NodeIntersectResult &result) |
Detect collision between a moving sphere and the Node. More... | |
virtual string | defaultXMLContainerField () |
Returns the default xml containerField attribute value. More... | |
virtual Field * | getField (const string &_name) const |
return a pointer to the field specified by name within this instance | |
int | addDestructCallback (void(*func)(Node *, void *), void *args) |
Add a callback function to be run on destruction of node. More... | |
int | removeDestructCallback (void(*func)(Node *, void *), void *args) |
Add a callback function to be run on destruction of node. More... | |
Static Public Member Functions | |
static GLUTWindow * | getGLUTWindow (int glut_id) |
Given the identifier of a GLUT window the GLWindow instance that created that window is returned. | |
static void | glutKeyboardDownCallback (unsigned char key, int x, int y) |
GLUT callback function for glutKeyboardFunc. | |
static void | glutSpecialDownCallback (int key, int x, int y) |
GLUT callback function for glutSpecialFunc. | |
static void | glutKeyboardUpCallback (unsigned char key, int x, int y) |
GLUT callback function for glutKeyboardUpFunc. | |
static void | glutSpecialUpCallback (int key, int x, int y) |
GLUT callback function for glutSpecialUpFunc. | |
static void | glutMouseCallback (int button, int state, int x, int y) |
glut callback function. More... | |
static void | glutMotionCallback (int x, int y) |
glut callback function. Calls onMouseMotionAction | |
static void | glutMouseWheelCallback (int wheel, int direction, int x, int y) |
glut callback function for mouse scroll wheel. More... | |
static void | glutWMCloseCallback () |
GLUT callback function for when window is closed. | |
static void | initGLUT () |
Initialize GLUT. | |
![]() | |
static 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. More... | |
static string | takeScreenShot (const string &url) |
static string | takeScreenshot (const string &url) |
Saves the currently rendered buffer to file. More... | |
![]() | |
static unsigned int | nrNodesAlive () |
Returns the nr of nodes currently alive, i.e. nodes created but not destructed. | |
static int | nrNodesCreated () |
Returns the number of nodes created in total since the start of the program. | |
Public Attributes | |
H3DUniquePtr< SFString > | gameMode |
Support for GLUT GameMode which is basically a string used to optimize the glut window for gaming. More... | |
![]() | |
H3DUniquePtr< SFInt32 > | posX |
The x coordinate in pixels of the window in screen coordinates. More... | |
H3DUniquePtr< SFInt32 > | posY |
The y coordinate in pixels of the window in screen coordinates. More... | |
H3DUniquePtr< SFInt32 > | width |
The width in pixels of the window. More... | |
H3DUniquePtr< SFInt32 > | height |
The height in pixels of the window. More... | |
H3DUniquePtr< SFBool > | fullscreen |
Determines if the window should be in fullscreen or not. More... | |
H3DUniquePtr< SFBool > | mirrored |
Determines if the scene rendered should be mirrored or not. More... | |
H3DUniquePtr< RenderMode > | renderMode |
The mode to render the scene in the window in. More... | |
H3DUniquePtr< SFViewpoint > | viewpoint |
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. More... | |
H3DUniquePtr< SFBool > | manualCursorControl |
If set to true changes of cursor is totally up to the user of the window by changing the cursorType. More... | |
H3DUniquePtr< SFString > | cursorType |
The cursorType field specifies the look of the mouse pointer. More... | |
H3DUniquePtr< SFNavigationInfo > | navigationInfo |
If the navigationInfo field is specified, that NavigationInfo is used for rendering in H3DWindowNode instead of the stack top of the NavigationInfo bindable stack. More... | |
H3DUniquePtr< SFVec2f > | clipDistances |
The distance (in meters) used for the far and near clip plane. More... | |
H3DUniquePtr< SFBool > | useFullscreenAntiAliasing |
If set to true fullscreen anti-aliasing is used for this window. More... | |
H3DUniquePtr< SFInt32 > | viewportWidth |
The width of the viewport being used for this window Access type: outputOnly . | |
H3DUniquePtr< SFInt32 > | projectionWidth |
The width of the projection width, mostly of the time it is the same as the viewport width. More... | |
H3DUniquePtr< SFInt32 > | viewportHeight |
The height of the viewport being used for this window Access type: outputOnly . | |
H3DUniquePtr< SFInt32 > | projectionHeight |
The height of the projection height, mostly of the time it is the same as the viewport height. More... | |
H3DUniquePtr< SFBool > | singlePassStereo |
Flag for whether singlePassStereo is enabled or not. More... | |
H3DUniquePtr< SFString > | pointingDeviceRefreshMode |
Determines how often the X3DPointingDeviceSensorNode's in the scene will be checked for intersection. More... | |
H3DUniquePtr< SFBool > | resetViewPoint |
Reset viewpoint Access type: inputOutput Default value: false . | |
H3DUniquePtr< SFInt32 > | numSamples |
Number of samples used by this window. More... | |
Static Public Attributes | |
static H3DNodeDatabase | database |
The H3DNodeDatabase for this node. | |
![]() | |
static H3DNodeDatabase | database |
The H3DNodeDatabase for this node. | |
Protected Member Functions | |
virtual int | setCursorType (const std::string &cursor_type) |
Set cursor shape according to given cursor mode. | |
virtual string | getCursorForMode (const string &mode) |
Return the cursor type to use for given mode. More... | |
![]() | |
void | initWindowWithContext () |
internal help function to initialize the window and check if success. More... | |
LRESULT | Message (HWND _hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) |
Handles messages. Called by WindowProc. | |
void | renderChild (X3DChildNode *child_to_render, bool render_fbo_only) |
Help function for renderChild. | |
![]() | |
void | cloneFieldValue (Field &_from, Field &_to, bool deepCopy, DeepCopyMap &deepCopyMap) |
A helper function for the clone() method. More... | |
Additional Inherited Members | |
![]() | |
typedef std::map< Node *, Node * > | DeepCopyMap |
A map type used during a deep copy clone() to map from original nodes to cloned nodes. | |
![]() | |
static LRESULT CALLBACK | WindowProc (HWND _hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) |
Whenever a subclass to H3DWindowNode is created this callback is a subclass callback. More... | |
static 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. More... | |
![]() | |
static Node * | getClonedInstance (Node *original, bool deepCopy, DeepCopyMap &deepCopyMap) |
A helper function for nodes that implement clone() More... | |
![]() | |
RenderMode::Mode | last_render_mode |
The render mode used in the last render loop. | |
X3DViewpointNode::EyeMode | eye_mode |
Current eye mode. | |
string | current_cursor |
The cursor currently in use. | |
H3DUniquePtr< WindowSizeChanged > | windowSizeChanged |
Field handles necessary operations needed when window size actually changes. | |
H3DWindowNode implementet using GLUT.
Valid values for the cursorType field are: "RIGHT_ARROW", "LEFT_ARROW", "INFO", "DESTROY", "HELP", "CYCLE", "SPRAYCAN", "WAIT", "TEXT", "CROSSHAIR", "UP_DOWN", "LEFT_RIGHT", "TOP_SIDE", "BOTTOM_SIDE", "LEFT_SIDE", "RIGHT_SIDE", "TOP_LEFT_CORNER", "TOP_RIGHT_CORNER", "BOTTOM_RIGHT_CORNER", "BOTTOM_LEFT_CORNER", "FULL_CROSSHAIR", "NONE", "DEFAULT"
For example usage of this class see the H3DLoad application.
|
protectedvirtual |
Return the cursor type to use for given mode.
This should be implemented for each subclass to choose appropriate cursors.
The standard events are: "DEFAULT" - normal mode ("DEFAULT") "ON_SENSOR_OVER" - when mouse pointer is over a pointing device sensor ("CROSS") "ON_SENSOR_ACTIVE" - when a sensor node is active ("NAVIGATE" ) "ON_NAV_LOOKAT" - when lookat mode is chosen
Reimplemented from H3D::H3DWindowNode.
|
static |
glut callback function.
Calls onMouseButtonAction with the button and state translated to the enumerated values in KeySensor.h
References getGLUTWindow(), and H3D::H3DWindowNode::onMouseButtonAction().
|
static |
glut callback function for mouse scroll wheel.
Calls onMouseWheelAction with direction translated to the values in KeySensor.h
References getGLUTWindow(), and H3D::H3DWindowNode::onMouseWheelAction().
H3DUniquePtr< SFString > H3D::GLUTWindow::gameMode |
Support for GLUT GameMode which is basically a string used to optimize the glut window for gaming.
Some features are disabled for such things. For more information about GLUT GameMode see for example http://freeglut.sourceforge.net/docs/api.php#GameMode
Access type: initializeOnly
Referenced by initWindow(), and setFullscreen().