Annwvyn::AnnOgreNoVRRenderer Class Reference

Dummy VR renderer, just render the scene to a window like a non vr game. Doesn't need special hardware or runtime to run. More...

#include <AnnOgreNoVRRenderer.hpp>

Inheritance diagram for Annwvyn::AnnOgreNoVRRenderer:
Collaboration diagram for Annwvyn::AnnOgreNoVRRenderer:

Public Member Functions

 AnnOgreNoVRRenderer (std::string winName="OgreVRNoVRRender")
 Create the no vr renderer. This will not output to a VR system but can be useful for trying stuff anyway. More...
 
 ~AnnOgreNoVRRenderer ()
 Something is buggy here. More...
 
void initVrHmd () override
 Dummy mandatory method : there's no HMD to initialize. More...
 
void initScene () override
 Create the default scene manager. More...
 
void initRttRendering () override
 There's no RenderToTexture to do here, so this attach the mono camera to the window with a viewport. More...
 
void initClientHmdRendering () override
 No client HMD. More...
 
bool shouldQuit () override
 Return true if window is closed. More...
 
bool shouldRecenter () override
 Will allays be false. More...
 
bool isVisibleInHmd () override
 Will allays be true. More...
 
void getTrackingPoseAndVRTiming () override
 This will just apply a simple calculation with the base position and the body orientation + the height (supposed) of an human user standing up. More...
 
void renderAndSubmitFrame () override
 Update the window. More...
 
void recenter () override
 Will do nothing. More...
 
void showDebug (DebugMode mode) override
 Nothing to do, just here to not make this class abstract. More...
 
void updateEyeCameraFrustrum () override
 This just apply the near/far clip distances to the mono camera. More...
 
void handleIPDChange () override
 No stereo 3D so inter-pupilarry distance is useless. More...
 
- Public Member Functions inherited from Annwvyn::AnnOgreVRRenderer
void setShadowFiltering (ShadowFiltering level) const
 Set the shadow filtering level (quality) More...
 
 AnnOgreVRRenderer (const std::string &windowName)
 Construct VR Renderer. More...
 
virtual ~AnnOgreVRRenderer ()
 Destruct VR Renderer. More...
 
Ogre::SceneManager * getSceneManager () const
 Get the scene manager of the virtual world. More...
 
Ogre::Root * getRoot () const
 Get the Ogre::Root object. More...
 
Ogre::RenderWindow * getWindow () const
 Get the RenderWidow that should display a debug render the VR view. More...
 
Ogre::SceneNode * getCameraInformationNode () const
 Get the node that is the player's head anchor point. More...
 
Ogre::Timer * getTimer () const
 Get Ogre's internal timer. More...
 
double getUpdateTime () const
 Get frame update time from the VR renderer. More...
 
void getOgreConfig () const
 Configure the Ogre root engine. Will load all the ogre Plug-ins and components we need. More...
 
void initOgreRoot (const std::string &loggerName)
 
virtual void initPipeline () final
 Init the VR rendering pipeline. More...
 
virtual void initCameras ()
 Create the pair of cameras for the stereo render;. More...
 
virtual void updateTracking () final
 Refresh and update the head tracking. May tell the VR client library to prepare for new frame. More...
 
virtual void cycleDebugHud ()
 (Optional) Cycle through the client debug display if available. More...
 
void setNearClippingDistance (float distance)
 Set the distance from the viewpoint to the near clipping distance plane. More...
 
void setFarClippingDistance (float distance)
 Set the distance from the viewpoint to the far clipping distance plane. More...
 
virtual bool usesCustomAudioDevice ()
 (Optional) return true if audio has to come out from a specific audio device More...
 
virtual std::string getAudioDeviceIdentifierSubString ()
 (Optional) return the sub string to search on the audio device list to get the correct one More...
 
std::array< AnnHandControllerPtr, MAX_CONTROLLER_NUMBERgetHandControllerArray () const
 Get a naked array of hand controllers. More...
 
bool handControllersAvailable () const
 Return true if the hand controllers are available. More...
 
void applyCameraRigPose (AnnPose pose) const
 Apply the position/orientation of the pose object to the camera rig. More...
 
void syncGameplayBody ()
 extract from gameplay-movable information the points used to calculate the world poses More...
 
void calculateTimingFromOgre ()
 
unsigned int createCombinedRenderTexture (unsigned int w, unsigned int h)
 This method create a texture with the wanted Anti Aliasing level. It will set the rttTextureCombined and rttEyesCombined member of this class to the correct value, and return the GLID of the texture. More...
 
GLuintPair createSeparatedRenderTextures (const combinedTextureSizeArray &textureSizes)
 This create a couple of separated render texture. More...
 
std::tuple< Ogre::TexturePtr, unsigned int > createAdditionalRenderBuffer (unsigned int w, unsigned int h, std::string name="") const
 Create a render buffer with not anti aliasing. return a tuple with a TexturePtr and a GLID. use More...
 
void createWindow (unsigned int w=1280, unsigned int h=720, bool vsync=false)
 Create a window. Even if we do VR, the way OGRE is architectured, you need to create a window to initialize the RenderSystem. More...
 
std::string getName () const
 Get the name of this renderer. More...
 
void loadHLMSLibrary (std::string path="./hlms/")
 Load the HLMS library from the file-system. More...
 
void loadCompositor (const std::string &path="./compositor/", const std::string &type="FileSystem")
 Load the compositor resources that are needed to setup the pipeline. More...
 
void setSkyColor (Ogre::ColourValue skyColor, float multiplier, const char *renderingNodeName) const
 Set the color used on the "clear" pass of the compositor node given. More...
 
void setExposure (float exposure, float minAuto, float maxAuto, const char *postProcessMaterial="HDR/DownScale03_SumLumEnd") const
 Set the exposure, need the name of the post process material. More...
 
void setBloomThreshold (float minThreshold, float fullColorThreshold, const char *brightnessPassMaterial="HDR/BrightPass_Start")
 Se the bloom threshold. Need the name of the brightness pass material. More...
 
void createMainSmgr ()
 Create the main scene manager and set some shadow parameters. More...
 
bool shouldPauseFlag () const
 Return true if you should not react to user inputs, according to the rendering runtime... More...
 
bool shouldHideHands () const
 Return true if you need to hide hand models. More...
 
void _resetOgreTimer () const
 Advanced : reset ogre internal timer. More...
 
bool isCompositorLoaded () const
 Return true if the compositor resources are loaded into Ogre. More...
 
bool isHlmsLibLoaded () const
 Return true if the HLMS templates are loaded into Ogre. More...
 

Private Attributes

bool running
 True if running. More...
 

Static Private Attributes

static AnnOgreNoVRRenderernoVRself
 Singleton pointer. More...
 

Additional Inherited Members

- Public Types inherited from Annwvyn::AnnOgreVRRenderer
enum  compositorIndex : size_t { leftEyeCompositor = 0, rightEyeCompositor = 1, monoCompositor = 2, nbCompositor = 3 }
 Indexes of the compositor workspace. More...
 
enum  ShadowFiltering { ShadowFiltering::low, ShadowFiltering::medium, ShadowFiltering::high }
 Liist of the levels of shadow filtering available. More...
 
enum  DebugMode { RAW_BUFFER, HMD_MIRROR, MONOSCOPIC }
 Type of Debug render you can do. More...
 
using combinedTextureSizeArray = std::array< std::array< unsigned int, 2 >, 2 >
 
- Static Public Member Functions inherited from Annwvyn::AnnOgreVRRenderer
static void setAntiAliasingLevel (uint8_t AA)
 
static void detachCameraFromParent (Ogre::Camera *camera)
 Detach camera from their parent node. It seems that Ogre automatically attach new cameras to the root... More...
 
static size_t getHanControllerArraySize ()
 Get the size of the controller array. More...
 
static void makeValidPath (std::string &hlmsFolder)
 Make sure a string will be usable as a path for the hlms library/compositor resource group. More...
 
static void loadOpenGLFunctions ()
 Load "modern" OpenGL functions for the current OpenGL context. More...
 
static void glEasyCopy (GLuint source, GLuint dest, GLuint width, GLuint height)
 Wrap annoying OpenGL call to something humanly acceptable. More...
 
static std::string getAudioDeviceNameFromGUID (GUID guid)
 Return (if found) the name o the audio device you can use in the audio engine from a Windows only "GUID" for a sound card. More...
 
- Public Attributes inherited from Annwvyn::AnnOgreVRRenderer
const size_t numberOfThreads
 number of hardware threads More...
 
AnnPose trackedHeadPose
 The current position of the head center defined by the client library projected in World Space. More...
 
- Static Public Attributes inherited from Annwvyn::AnnOgreVRRenderer
static constexpr const char *const PluginRenderSystemGL3Plus { "./RenderSystem_GL3Plus" }
 Name of the rendersystem plugin to load on Ogre. More...
 
static constexpr const char *const Ogre_glTF_Plugin { "./libOgre_glTF.so" }
 
static constexpr const char *const GLRenderSystem3Plus { "OpenGL 3+ Rendering Subsystem" }
 Name of the rendersystem to initialize. More...
 
static constexpr const char *const RESOURCE_GROUP_COMPOSITOR = "RG_ANN_COMPOSITOR"
 Resource group to load the shaders, material and compositor script for rendering. More...
 
- Protected Member Functions inherited from Annwvyn::AnnOgreVRRenderer
void doStereoRender ()
 
void handleWindowMessages ()
 Handle the window messages and resize event. More...
 
void changedAA () const
 Called if AA level has been updated. More...
 
- Protected Attributes inherited from Annwvyn::AnnOgreVRRenderer
std::array< Ogre::CompositorWorkspace *, nbCompositorcompositorWorkspaces
 Compositor workspaces. 0 = left, 1 = right, 2 = monoscopic, plugged to the render window. More...
 
std::string rendererName
 Name of the renderer object. More...
 
Ogre::SceneManager * smgr
 SceneManager of the VR world. More...
 
std::unique_ptr< Ogre::Root > root
 Ogre root object. More...
 
Ogre::RenderWindow * window
 Render window. VR isn't drawn to this window. A window is mandatory to init the RenderSystem. More...
 
double updateTime
 Update Time. More...
 
double then
 
double now
 
Ogre::Real nearClippingDistance
 Distance between eyeCamera and nearClippingDistance. More...
 
Ogre::Real farClippingDistance
 Distance between eyeCamera and farClippingDistance. More...
 
Ogre::Vector3 feetPosition
 Position of the head. More...
 
Ogre::Quaternion bodyOrientation
 Orientation of the head. More...
 
std::string name
 Name of the window. More...
 
Ogre::SceneNode * gameplayCharacterRoot
 Node that represent the head base. Move this in 3D to move the viewpoint. More...
 
std::array< Ogre::Camera *, 2 > eyeCameras
 Cameras that have to be put where the user's eye is. More...
 
Ogre::Camera * monoCam
 Monoscopic camera. More...
 
Ogre::SceneNode * cameraRig
 Camera rig, node where all the cameras are attached. More...
 
uID frameCounter
 Counter of frames. More...
 
Ogre::RenderTexture * rttEyesCombined
 Render target that serve as intermediate buffer for the eyeCameras. More...
 
std::array< Ogre::RenderTexture *, 2 > rttEyeSeparated
 Couple of render textures separated. More...
 
std::array< AnnHandControllerPtr, MAX_CONTROLLER_NUMBERhandControllers
 Array of hand controller. More...
 
std::array< std::vector< byte >, 2 > currentControllerButtonsPressed
 Buffered button states. More...
 
std::array< std::vector< byte >, 2 > lastControllerButtonsPressed
 
std::vector< uint8_t > pressed
 Dynamically sized containers for pressed/released events. More...
 
std::vector< uint8_t > released
 
bool pauseFlag
 Store if we suggest you to pause reacting to user inputs... More...
 
bool hideHands
 Store if we should hide the hands. More...
 
bool compositorLoaded
 Compositor resources loaded. More...
 
bool hlmsLoaded
 Compositor resources loaded. More...
 
- Static Protected Attributes inherited from Annwvyn::AnnOgreVRRenderer
static AnnOgreVRRendererself { nullptr }
 Singleton pointer. More...
 
static uint8_t AALevel { 4 }
 Level of anti aliasing to use. More...
 
static constexpr const char *const rttTextureName = { "RttTex" }
 Name given to the texture manager for the eyeBuffer. More...
 

Detailed Description

Dummy VR renderer, just render the scene to a window like a non vr game. Doesn't need special hardware or runtime to run.

Definition at line 10 of file AnnOgreNoVRRenderer.hpp.

Constructor & Destructor Documentation

◆ AnnOgreNoVRRenderer()

AnnOgreNoVRRenderer::AnnOgreNoVRRenderer ( std::string  winName = "OgreVRNoVRRender")

Create the no vr renderer. This will not output to a VR system but can be useful for trying stuff anyway.

Definition at line 13 of file AnnOgreNoVRRenderer.cpp.

◆ ~AnnOgreNoVRRenderer()

AnnOgreNoVRRenderer::~AnnOgreNoVRRenderer ( )

Something is buggy here.

Definition at line 97 of file AnnOgreNoVRRenderer.cpp.

Member Function Documentation

◆ getTrackingPoseAndVRTiming()

void AnnOgreNoVRRenderer::getTrackingPoseAndVRTiming ( )
overridevirtual

This will just apply a simple calculation with the base position and the body orientation + the height (supposed) of an human user standing up.

Implements Annwvyn::AnnOgreVRRenderer.

Definition at line 49 of file AnnOgreNoVRRenderer.cpp.

Here is the call graph for this function:

◆ handleIPDChange()

void AnnOgreNoVRRenderer::handleIPDChange ( )
overridevirtual

No stereo 3D so inter-pupilarry distance is useless.

Implements Annwvyn::AnnOgreVRRenderer.

Definition at line 94 of file AnnOgreNoVRRenderer.cpp.

◆ initClientHmdRendering()

void AnnOgreNoVRRenderer::initClientHmdRendering ( )
overridevirtual

No client HMD.

Implements Annwvyn::AnnOgreVRRenderer.

Definition at line 37 of file AnnOgreNoVRRenderer.cpp.

Here is the call graph for this function:

◆ initRttRendering()

void AnnOgreNoVRRenderer::initRttRendering ( )
overridevirtual

There's no RenderToTexture to do here, so this attach the mono camera to the window with a viewport.

Implements Annwvyn::AnnOgreVRRenderer.

Definition at line 29 of file AnnOgreNoVRRenderer.cpp.

Here is the call graph for this function:

◆ initScene()

void AnnOgreNoVRRenderer::initScene ( )
overridevirtual

Create the default scene manager.

Implements Annwvyn::AnnOgreVRRenderer.

Definition at line 24 of file AnnOgreNoVRRenderer.cpp.

Here is the call graph for this function:

◆ initVrHmd()

void AnnOgreNoVRRenderer::initVrHmd ( )
overridevirtual

Dummy mandatory method : there's no HMD to initialize.

Implements Annwvyn::AnnOgreVRRenderer.

Definition at line 21 of file AnnOgreNoVRRenderer.cpp.

◆ isVisibleInHmd()

bool AnnOgreNoVRRenderer::isVisibleInHmd ( )
overridevirtual

Will allays be true.

Implements Annwvyn::AnnOgreVRRenderer.

Definition at line 89 of file AnnOgreNoVRRenderer.cpp.

◆ recenter()

void AnnOgreNoVRRenderer::recenter ( )
overridevirtual

Will do nothing.

Implements Annwvyn::AnnOgreVRRenderer.

Definition at line 69 of file AnnOgreNoVRRenderer.cpp.

◆ renderAndSubmitFrame()

void AnnOgreNoVRRenderer::renderAndSubmitFrame ( )
overridevirtual

Update the window.

Implements Annwvyn::AnnOgreVRRenderer.

Definition at line 57 of file AnnOgreNoVRRenderer.cpp.

Here is the call graph for this function:

◆ shouldQuit()

bool AnnOgreNoVRRenderer::shouldQuit ( )
overridevirtual

Return true if window is closed.

Implements Annwvyn::AnnOgreVRRenderer.

Definition at line 44 of file AnnOgreNoVRRenderer.cpp.

◆ shouldRecenter()

bool AnnOgreNoVRRenderer::shouldRecenter ( )
overridevirtual

Will allays be false.

Implements Annwvyn::AnnOgreVRRenderer.

Definition at line 84 of file AnnOgreNoVRRenderer.cpp.

◆ showDebug()

void AnnOgreNoVRRenderer::showDebug ( DebugMode  mode)
overridevirtual

Nothing to do, just here to not make this class abstract.

Implements Annwvyn::AnnOgreVRRenderer.

Definition at line 72 of file AnnOgreNoVRRenderer.cpp.

◆ updateEyeCameraFrustrum()

void AnnOgreNoVRRenderer::updateEyeCameraFrustrum ( )
overridevirtual

This just apply the near/far clip distances to the mono camera.

Implements Annwvyn::AnnOgreVRRenderer.

Definition at line 75 of file AnnOgreNoVRRenderer.cpp.

Member Data Documentation

◆ noVRself

AnnOgreNoVRRenderer * AnnOgreNoVRRenderer::noVRself
staticprivate

Singleton pointer.

Definition at line 60 of file AnnOgreNoVRRenderer.hpp.

◆ running

bool Annwvyn::AnnOgreNoVRRenderer::running
private

True if running.

Definition at line 63 of file AnnOgreNoVRRenderer.hpp.


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