MinVR  0.9.0
A multi-platform virtual reality library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
MinVR::AbstractMVREngine Class Referenceabstract

Base class for vr engines. More...

Inheritance diagram for MinVR::AbstractMVREngine:
MinVR::MVREngineGLFW

Public Member Functions

 AbstractMVREngine ()
 
virtual ~AbstractMVREngine ()
 
virtual void init (int argc, char **argv)
 Initialize the engine. More...
 
virtual void init (ConfigMapRef configMap)
 Initialize the engine. More...
 
virtual void runApp (AbstractMVRAppRef app)
 Start the main loop. More...
 
virtual void runOneFrameOfApp (AbstractMVRAppRef app)
 Draws a frame of the graphics. More...
 
virtual void initializeContextSpecificVars (int threadId, WindowRef window)
 Initialize thread specific variables. More...
 
virtual void initializeLogging ()
 Initialize Boost Log v2.0. More...
 

Protected Member Functions

virtual void setupWindowsAndViewports ()
 Creates windows and viewports. More...
 
virtual WindowRef createWindow (WindowSettingsRef settings, std::vector< AbstractCameraRef > cameras)=0
 Creates a window. More...
 
virtual void setupInputDevices ()
 Creates Input Devices. More...
 
virtual void setupRenderThreads ()
 Creates render threads. More...
 
virtual void pollUserInput ()
 Poll the input devices for input. More...
 
virtual void updateProjectionForHeadTracking ()
 Updates head positions. More...
 

Protected Attributes

AbstractMVRAppRef _app
 
ConfigMapRef _configMap
 
std::vector< EventRef_events
 
std::vector< WindowRef_windows
 
std::vector
< AbstractInputDeviceRef
_inputDevices
 
std::vector< RenderThreadRef_renderThreads
 
boost::mutex _threadsInitializedMutex
 
boost::condition_variable _threadsInitializedCond
 
boost::mutex _startRenderingMutex
 
boost::condition_variable _startRenderingCond
 
boost::mutex _renderingCompleteMutex
 
boost::condition_variable _renderingCompleteCond
 
boost::shared_ptr< boost::barrier > _swapBarrier
 
boost::posix_time::ptime _syncTimeStart
 
unsigned long _frameCount
 

Detailed Description

The MVREngine handles creating the windows, threads, devices, and mainloop.

Constructor & Destructor Documentation

MinVR::AbstractMVREngine::AbstractMVREngine ( )
virtual MinVR::AbstractMVREngine::~AbstractMVREngine ( )
virtual

Member Function Documentation

virtual WindowRef MinVR::AbstractMVREngine::createWindow ( WindowSettingsRef  settings,
std::vector< AbstractCameraRef cameras 
)
protectedpure virtual

Called from setupWindowsAndViewports to create a window

Parameters
[in]Windowsettings specifying the dimensions, position, and properties of the window
[in]Arrayof cameras corresponding with viewports for the new window.
See Also
setupWindowsAndViewports

Implemented in MinVR::MVREngineGLFW.

virtual void MinVR::AbstractMVREngine::init ( int  argc,
char **  argv 
)
virtual

Reads config files and parameters based on 'standard' command line arguments then initializes graphics windows etc. based on this info.

virtual void MinVR::AbstractMVREngine::init ( ConfigMapRef  configMap)
virtual

Use this version of init instead and pass it config settings in the configMap argument if you want to handle your own command line arguments

Parameters
[in]Amap of configuration parameters.
[in]Logfile.
virtual void MinVR::AbstractMVREngine::initializeContextSpecificVars ( int  threadId,
WindowRef  window 
)
virtual

Called from each renderthread to initialize needed variables

Parameters
[in]Athread specific id
[in]Windowreference for the calling renderthread.
virtual void MinVR::AbstractMVREngine::initializeLogging ( )
virtual

Sets up the logging file to the console and log file using Boost.Log v2.0

virtual void MinVR::AbstractMVREngine::pollUserInput ( )
protectedvirtual

Iterates through the input devices and windows polling each for input. the input is sorted based on increasing time.

virtual void MinVR::AbstractMVREngine::runApp ( AbstractMVRAppRef  app)
virtual

This version of run takes over the main loop of the program, call it after init when you are ready to start processing user input and rendering graphics

Parameters
[in]AVR application reference.

Reimplemented in MinVR::MVREngineGLFW.

virtual void MinVR::AbstractMVREngine::runOneFrameOfApp ( AbstractMVRAppRef  app)
virtual

Use this version instead and call it repeatedly from your own mainloop if your program design requires you to manage your own mainloop

Parameters
[in]AVR application reference.
virtual void MinVR::AbstractMVREngine::setupInputDevices ( )
protectedvirtual

Called from init to create input devices based on the vrsetup file

See Also
init
virtual void MinVR::AbstractMVREngine::setupRenderThreads ( )
protectedvirtual

Creates a new thread for each window specified in the vrsetup file. The threads are used for multi-threaded rendering.

virtual void MinVR::AbstractMVREngine::setupWindowsAndViewports ( )
protectedvirtual

Called from init to create windows and viewports based on the vrsetup file

See Also
init
virtual void MinVR::AbstractMVREngine::updateProjectionForHeadTracking ( )
protectedvirtual

Updates each camera in every window with the new head location.

Member Data Documentation

AbstractMVRAppRef MinVR::AbstractMVREngine::_app
protected
ConfigMapRef MinVR::AbstractMVREngine::_configMap
protected
std::vector<EventRef> MinVR::AbstractMVREngine::_events
protected
unsigned long MinVR::AbstractMVREngine::_frameCount
protected
std::vector<AbstractInputDeviceRef> MinVR::AbstractMVREngine::_inputDevices
protected
boost::condition_variable MinVR::AbstractMVREngine::_renderingCompleteCond
protected
boost::mutex MinVR::AbstractMVREngine::_renderingCompleteMutex
protected
std::vector<RenderThreadRef> MinVR::AbstractMVREngine::_renderThreads
protected
boost::condition_variable MinVR::AbstractMVREngine::_startRenderingCond
protected
boost::mutex MinVR::AbstractMVREngine::_startRenderingMutex
protected
boost::shared_ptr<boost::barrier> MinVR::AbstractMVREngine::_swapBarrier
protected
boost::posix_time::ptime MinVR::AbstractMVREngine::_syncTimeStart
protected
boost::condition_variable MinVR::AbstractMVREngine::_threadsInitializedCond
protected
boost::mutex MinVR::AbstractMVREngine::_threadsInitializedMutex
protected
std::vector<WindowRef> MinVR::AbstractMVREngine::_windows
protected

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