Cavelib manual
The main function in the CaveHelloCone example. A headlight is a directional light that always points in the direction you are looking. This is convenient for simple scenes. Here we simply add some transforms to the Inventor scene graph.
The source code for the InventorReadFile function is the same as the Mentor example. NET in the scene for illumination. The InventorFrameUpdate function will be called exactly once by each render thread, before rendering each frame. This function will return TRUE in exactly one of the render threads. This allows time-based sensors and engines in the Open Inventor scene graph to function properly.
Next the master thread updates the headlight direction with the current view direction. Finally the master thread enters the display barrier, releasing all the render threads to begin rendering the frame. The InventorDraw function has been updated for this example. CAVELib computes the necessary viewing and projection matrices, based on head tracking if enabled, and passes those matrices to OpenGL before the draw function is called.
NET to the scene graph, as in the previous example. However some very useful Open Inventor nodes depend on knowing the position and direction of the virtual camera or viewer. To allow these nodes to work correctly, we query the view information and matrices from CAVELib and assign values to the corresponding elements in the Open Inventor traversal state.
This tells Open Inventor that the information has already been sent to OpenGL and should not be sent again. Most of the code is the same as the previous example. The InventorAddWand and InventorUpdateWand functions show one way to implement a simple virtual pointer geometry for the wand or other tracked input device. The code is straightforward and is not reproduced here.
The InventorFrameUpdate function has several important modifications in this example. This can be important for synchronizing multiple render processes in a cluster, network, or collaboration environment.
The second modification is a call to the new function InventorHandleEvents , which will create Open Inventor event objects based on the wand position, orientation, and controller buttons. Finally we check if any sensors have been added to the Open Inventor timer queue or delay queue and need to be processed. This is work that is normally done by the Open Inventor viewer class in a desktop application. Processing these queues is important for correct operation of some Open Inventor applications.
NET , stores the necessary information and passes that event to the scene graph. Various nodes in the scene graph may respond to these events. NET node will respond to press and release of controller button 1 in the same way it responds to press and release of mouse button 1 in a desktop application.
Draggers will respond to both button events and motion events. Note that tracked input devices are typically polled continuously for their current value, while Open Inventor expects discrete events indicating a significant change in value. Therefore we use a tolerance value when comparing the wand position and orientation because we do not want to process events when nothing is really happening.
Reset the state tracker. See new function: InventorAddHeadlight. Scale and translate a scene to fit inside the CAVE. See new function: InventorFitScene. Some of the items that CAVELib abstracts for a developer are window and viewport creation, viewer-centered perspective calculations, displaying to multiple graphics channels, multi-processing and multi-threading, cluster synchronization and data sharing, and stereoscopic viewing.
CAVELib-based applications are externally configurable at run time, making the application executable independent of the display system. So, without recompilation, the application can be run on a wide variety of display systems. Most Open Inventor programming experience, for example creating and modifying the scene graph, is equally applicable to desktop and immersive environments. This example is conceptually similar to Example 1 in Chapter 2 of the Inventor Mentor.
It shows how to:. Create a simple Open Inventor scene graph. See function main. Do Open Inventor global one time initialization. See function InventorInit. Do Open Inventor per-thread initialization.
See function InventorThreadInit. Render the Open Inventor scene graph. See function InventorDraw. CAVELib will create and begin execution of a render thread for each graphics pipe. We initialize Open Inventor and any extensions that are used by the application. Because we are using multi-threaded rendering, it is important to use the multi-thread initialization methods, for example SoDB::threadInit.
We create a simple data structure to keep some information that is specific to each graphics pipe. Finally we specify the number of Open Inventor render caches so that each graphics pipe will have its own display lists and texture objects.
The Open Inventor thread initialization function InventorThreadInit will be called exactly once from each render thread. We create the Open Inventor render action for the current thread and store its address in the data structure we created in the global initialization function. We set the pipe number as the cacheContext id for each render action to ensure that separate display lists and texture objects are created for each pipe. The Open Inventor render function InventorDraw will be called one or more times from each render thread for each frame.
The main goal is to transfer information from the CAVELib state into the Open Inventor traversal state, then apply the appropriate render action to the scene graph. This traversal state setup would typically be handled by a viewer class in a desktop Open Inventor application. This allows us to optimize by avoiding unnecessary state setting. Example The main function in the CaveHelloCone example.
A headlight is a directional light that always points in the direction you are looking. This is convenient for simple scenes. Here we simply add some transforms to the Inventor scene graph. The source code for the InventorReadFile function is the same as the Mentor example. NET in the scene for illumination. The InventorFrameUpdate function will be called exactly once by each render thread, before rendering each frame.
This function will return TRUE in exactly one of the render threads. This allows time-based sensors and engines in the Open Inventor scene graph to function properly. Next the master thread updates the headlight direction with the current view direction. Finally the master thread enters the display barrier, releasing all the render threads to begin rendering the frame. The InventorDraw function has been updated for this example.
0コメント