Skip to content

Instantly share code, notes, and snippets.

@jerstlouis
Last active February 7, 2018 08:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jerstlouis/fbae239341c5346c992f80744615f270 to your computer and use it in GitHub Desktop.
Save jerstlouis/fbae239341c5346c992f80744615f270 to your computer and use it in GitHub Desktop.
/****************************************************************************
A Virtual Reality sample using OpenVR, the Ecere SDK and the eC language
- adapted from OpenVR samples/hellovr_opengl_main.cpp
(Copyright Valve Corporation)
****************************************************************************/
import "ecere"
#define bool VRbool
#include <openvr_capi.h>
#undef bool
#define MessageBox _MessageBox
#include "gl123es.h" //<GL/gl.h>
#undef MessageBox
// ---- OpenVR Utility Stuff not in openvr_capi.h ----
typedef struct VR_IVRSystem_FnTable IVRSystem;
typedef struct VR_IVRRenderModels_FnTable IVRRenderModels;
typedef struct VR_IVRCompositor_FnTable IVRCompositor;
void * VR_GetFnTable(const String ifaceVersion, EVRInitError *error)
{
char fnTableName[128];
sprintf(fnTableName, "FnTable:%s", ifaceVersion);
return (void *)VR_GetGenericInterface(fnTableName, error);
}
IVRSystem * VR_Init(EVRInitError *error, EVRApplicationType eType)
{
struct VR_IVRSystem_FnTable * systemFunctions = null;
uint64 vrToken;
if(error) *error = EVRInitError_VRInitError_Init_HmdNotFound;
if(error && VR_IsHmdPresent() && VR_IsRuntimeInstalled() && (vrToken = VR_InitInternal(error, eType)) &&
*error == EVRInitError_VRInitError_None)
{
systemFunctions = VR_GetFnTable(IVRSystem_Version, error);
if(*error != EVRInitError_VRInitError_None)
systemFunctions = null;
/*
else if(systemFunctions->IsDisplayOnDesktop())
printf("Display is on desktop\n");
else
printf("Display is NOT on desktop\n");
*/
}
return systemFunctions;
}
void VR_Shutdown()
{
VR_ShutdownInternal();
}
// ---------------------------------------------------
define maxTrackedDeviceCount = 64;
#define COUNTOF(x) (sizeof(x)/sizeof((x)[0]))
#define OFFSETOF(t, x) (&((t *)0)->x)
static String getTrackedDeviceString( IVRSystem *pHmd, TrackedDeviceIndex_t unDevice, TrackedDeviceProperty prop, TrackedPropertyError *error )
{
String s = null;
uint32 requiredBufferLen = pHmd ? pHmd->GetStringTrackedDeviceProperty( unDevice, prop, null, 0, error ) : 0;
if(requiredBufferLen)
{
s = new char[requiredBufferLen];
requiredBufferLen = pHmd->GetStringTrackedDeviceProperty(unDevice, prop, s, requiredBufferLen, error);
}
return s;
}
class GLRenderModel
{
public:
String modelName;
private:
uint vboVertices;
uint iboIndices;
uint vaoVertices;
uint texTexture;
GLsizei vertexCount;
~GLRenderModel()
{
if(iboIndices) glDeleteBuffers(1, &iboIndices);
if(vaoVertices) glDeleteVertexArrays( 1, &vaoVertices );
if(vboVertices) glDeleteBuffers(1, &vboVertices);
delete modelName;
}
bool init(const RenderModel_t * vrModel, const RenderModel_TextureMap_t * vrDiffuseTexture)
{
float anisotropy;
// create and bind a VAO to hold state for this model
glGenVertexArrays( 1, &vaoVertices );
glBindVertexArray( vaoVertices );
// Populate a vertex buffer
glGenBuffers( 1, &vboVertices );
glBindBuffer( GL_ARRAY_BUFFER, vboVertices );
glBufferData( GL_ARRAY_BUFFER, sizeof( RenderModel_Vertex_t ) * vrModel->unVertexCount, vrModel->rVertexData, GL_STATIC_DRAW );
// Identify the components in the vertex buffer
glEnableVertexAttribArray( 0 );
glVertexAttribPointer( 0, 3, GL_FLOAT, GL_FALSE, sizeof( RenderModel_Vertex_t ), (void *)OFFSETOF( RenderModel_Vertex_t, vPosition ) );
glEnableVertexAttribArray( 1 );
glVertexAttribPointer( 1, 3, GL_FLOAT, GL_FALSE, sizeof( RenderModel_Vertex_t ), (void *)OFFSETOF( RenderModel_Vertex_t, vNormal ) );
glEnableVertexAttribArray( 2 );
glVertexAttribPointer( 2, 2, GL_FLOAT, GL_FALSE, sizeof( RenderModel_Vertex_t ), (void *)OFFSETOF( RenderModel_Vertex_t, rfTextureCoord ) );
// Create and populate the index buffer
glGenBuffers( 1, &iboIndices );
glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, iboIndices );
glBufferData( GL_ELEMENT_ARRAY_BUFFER, sizeof( uint16_t ) * vrModel->unTriangleCount * 3, vrModel->rIndexData, GL_STATIC_DRAW );
glBindVertexArray( 0 );
// create and populate the texture
glGenTextures(1, &texTexture );
glBindTexture( GL_TEXTURE_2D, texTexture );
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, vrDiffuseTexture->unWidth, vrDiffuseTexture->unHeight,
0, GL_RGBA, GL_UNSIGNED_BYTE, vrDiffuseTexture->rubTextureMapData );
// If this renders black ask McJohn what's wrong.
glGenerateMipmap(GL_TEXTURE_2D);
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR );
glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &anisotropy);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, anisotropy);
glBindTexture( GL_TEXTURE_2D, 0 );
vertexCount = vrModel->unTriangleCount * 3;
return true;
}
void draw()
{
glBindVertexArray(vaoVertices);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, texTexture);
glDrawElements(GL_TRIANGLES, vertexCount, GL_UNSIGNED_SHORT, 0);
glBindVertexArray(0);
}
};
struct VertexDataScene
{
Vector3Df position;
Pointf texCoord;
};
struct VertexDataWindow
{
Pointf position;
Pointf texCoord;
};
struct GLFramebuffer
{
int width, height;
uint rboDepthBuffer;
uint texRenderTexture;
uint fboFrameBuffer;
uint texResolve;
uint fboResolve;
bool create(int width, int height)
{
GLenum status;
this.width = width;
this.height = height;
glGenFramebuffers(1, &fboFrameBuffer );
glBindFramebuffer(GL_FRAMEBUFFER, fboFrameBuffer);
glGenRenderbuffers(1, &rboDepthBuffer);
glBindRenderbuffer(GL_RENDERBUFFER, rboDepthBuffer);
glRenderbufferStorageMultisample(GL_RENDERBUFFER, 4, GL_DEPTH_COMPONENT, width, height);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rboDepthBuffer );
glGenTextures(1, &texRenderTexture);
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, texRenderTexture);
glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, 4, GL_RGBA8, width, height, GL_TRUE);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D_MULTISAMPLE, texRenderTexture, 0);
glGenFramebuffers(1, &fboResolve );
glBindFramebuffer(GL_FRAMEBUFFER, fboResolve);
glGenTextures(1, &texResolve );
glBindTexture(GL_TEXTURE_2D, texResolve);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, null);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texResolve, 0);
status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
glBindFramebuffer( GL_FRAMEBUFFER, 0 );
return status == GL_FRAMEBUFFER_COMPLETE;
}
void free()
{
glDeleteRenderbuffers(1, &rboDepthBuffer);
glDeleteTextures(1, &texRenderTexture);
glDeleteFramebuffers(1, &fboFrameBuffer);
glDeleteTextures(1, &texResolve);
glDeleteFramebuffers(1, &fboResolve);
}
void preRender()
{
glEnable(GL_MULTISAMPLE);
glBindFramebuffer(GL_FRAMEBUFFER, fboFrameBuffer);
glViewport(0, 0, width, height);
}
void postRender()
{
glBindFramebuffer( GL_FRAMEBUFFER, 0 );
glDisable( GL_MULTISAMPLE );
glBindFramebuffer(GL_READ_FRAMEBUFFER, fboFrameBuffer);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fboResolve );
glBlitFramebuffer( 0, 0, width, height, 0, 0, width, height, GL_COLOR_BUFFER_BIT, GL_LINEAR );
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0 );
}
};
static inline void mat2float(const Matrix matrix, float * f)
{
int i;
for(i = 0; i < 16; i++)
f[i] = (float)matrix.array[i];
}
class CompiledShaderMatrix : CompiledShader
{
int uScene;
void registerUniforms(int program, uint64 state)
{
uScene = glGetUniformLocation( program, "matrix" );
}
}
// This shader is used to render the cubes
class SceneShader : Shader
{
float local[16], scene[16];
property Matrix scene { set { mat2float(value, scene); uniformsModified = true; } }
property Matrix local { set { mat2float(value, local); uniformsModified = true; } }
vertexShader =
"#version 410\n"
"uniform mat4 matrix;\n"
"uniform mat4 localTransform;\n"
"layout(location = 0) in vec4 position;\n"
"layout(location = 1) in vec2 v2UVcoordsIn;\n"
"layout(location = 2) in vec3 v3NormalIn;\n"
"out vec2 v2UVcoords;\n"
"void main()\n"
"{\n"
" v2UVcoords = v2UVcoordsIn;\n"
" int x = gl_InstanceID / 400;\n"
" int y = (gl_InstanceID-x*400) / 20;\n"
" int z = gl_InstanceID-x*400-y*20;\n"
" vec4 p = localTransform * position;\n"
" vec4 pos = vec4((x - 10) * 4.0 + p.x, (y - 10) * 4.0 + p.y + 2, (z - 10.0) * 4.0 + p.z + 2, 1);\n"
" gl_Position = matrix * pos;\n"
"}\n";
fragmentShader =
"#version 410 core\n"
"uniform sampler2D mytexture;\n"
"in vec2 v2UVcoords;\n"
"out vec4 outputColor;\n"
"void main()\n"
"{\n"
" outputColor = texture(mytexture, v2UVcoords);\n"
"}\n";
void uploadUniforms(CompiledSceneShader shader)
{
glUniformMatrix4fv(shader.uScene, 1, GL_FALSE, scene);
glUniformMatrix4fv(shader.uLocal, 1, GL_FALSE, local);
}
CompiledShader registerShader(int program, uint64 state)
{
CompiledSceneShader shader { };
shader.registerUniforms(program, state);
return shader;
}
};
class CompiledSceneShader : CompiledShaderMatrix
{
int uLocal;
void registerUniforms(int program, uint64 state)
{
CompiledShaderMatrix::registerUniforms(program, state);
uLocal = glGetUniformLocation( program, "localTransform" );
}
}
// This shader is used to render the cubes
class ControllerAxesShader : Shader
{
float scene[16];
property Matrix scene { set { mat2float(value, scene); uniformsModified = true; } }
vertexShader =
"#version 410\n"
"uniform mat4 matrix;\n"
"layout(location = 0) in vec4 position;\n"
"layout(location = 1) in vec3 v3ColorIn;\n"
"out vec4 v4Color;\n"
"void main()\n"
"{\n"
" v4Color.xyz = v3ColorIn; v4Color.a = 1.0;\n"
" gl_Position = matrix * position;\n"
"}\n";
fragmentShader =
"#version 410\n"
"in vec4 v4Color;\n"
"out vec4 outputColor;\n"
"void main()\n"
"{\n"
" outputColor = v4Color;\n"
"}\n";
void uploadUniforms(CompiledSceneShader shader)
{
glUniformMatrix4fv(shader.uScene, 1, GL_FALSE, scene);
}
CompiledShader registerShader(int program, uint64 state)
{
CompiledShaderMatrix shader { };
shader.registerUniforms(program, state);
return shader;
}
};
// This shader is used to render the controller models
class RenderModelShader : Shader
{
float scene[16];
property Matrix scene { set { mat2float(value, scene); uniformsModified = true; } }
vertexShader =
"#version 410\n"
"uniform mat4 matrix;\n"
"layout(location = 0) in vec4 position;\n"
"layout(location = 1) in vec3 v3NormalIn;\n"
"layout(location = 2) in vec2 v2TexCoordsIn;\n"
"out vec2 v2TexCoord;\n"
"void main()\n"
"{\n"
" v2TexCoord = v2TexCoordsIn;\n"
" gl_Position = matrix * vec4(position.xyz, 1);\n"
"}\n";
fragmentShader =
"#version 410 core\n"
"uniform sampler2D diffuse;\n"
"in vec2 v2TexCoord;\n"
"out vec4 outputColor;\n"
"void main()\n"
"{\n"
" outputColor = texture( diffuse, v2TexCoord);\n"
"}\n";
void uploadUniforms(CompiledSceneShader shader)
{
glUniformMatrix4fv(shader.uScene, 1, GL_FALSE, scene);
}
CompiledShader registerShader(int program, uint64 state)
{
CompiledShaderMatrix shader { };
shader.registerUniforms(program, state);
return shader;
}
};
// This shader is used to copy the eye textures to the companion window
class CompanionWindowShader : Shader
{
vertexShader =
"#version 410 core\n"
"layout(location = 0) in vec4 position;\n"
"layout(location = 1) in vec2 v2UVIn;\n"
"noperspective out vec2 v2UV;\n"
"void main()\n"
"{\n"
" v2UV = v2UVIn;\n"
" gl_Position = position;\n"
"}\n";
fragmentShader =
"#version 410 core\n"
"uniform sampler2D mytexture;\n"
"noperspective in vec2 v2UV;\n"
"out vec4 outputColor;\n"
"void main()\n"
"{\n"
" outputColor = texture(mytexture, v2UV);\n"
"}\n";
}
class VRCompanionWindow : Window
{
displayDriver = "OpenGL";
clientSize = { 640, 320 };
caption = "Hello, VR!";
hasClose = true;
glCapabilities.compatible = false; // Use a core proile
// App configuration
bool vBlank; vBlank = true;
bool glFinishHack; glFinishHack = true;
bool showCubes; showCubes = true;
// OpenVR Interfaces
IVRSystem * ivrHMD;
IVRRenderModels * ivrRenderModels;
IVRCompositor * ivrCompositor;
// OpenGL shaders
SceneShader sceneShader { };
RenderModelShader renderModelShader { };
ControllerAxesShader controllerAxesShader { };
CompanionWindowShader companionWindowShader { };
// Scene (cubes) rendering
uint vboCubeVertices, vaoScene;
Degrees yaw, pitch;
BitmapResource cubeTexture { ":knot.png", mipMaps = true, window = this };
float nearClip; nearClip = 0.1f;
float farClip; farClip = 100.0f;
// Companion window rendering
uint vaoCompanionWindow, vboCompanionWindow, iboCompanionWindow, companionWindowIndexCount;
// Controller axes & projected laser
uint vboController, vaoController, controllerVertCount;
// HMD Matrices returned by OpenVR
Matrix matHMDPose;
Matrix matEyePosLeft, matEyePosRight;
Matrix matProjectionLeft, matProjectionRight;
// Framebuffers set up to render each eye
GLFramebuffer leftEyeFB, rightEyeFB;
// Tracked devices information
TrackedDevicePose_t trackedDevicePose[maxTrackedDeviceCount];
Matrix matDevicePose[maxTrackedDeviceCount];
bool showTrackedDevices[maxTrackedDeviceCount];
char devClassChar[maxTrackedDeviceCount]; // for each device, a character representing its class
String poseClasses; // what classes we saw poses for this frame
int trackedControllerCount, lastTrackedControllerCount; lastTrackedControllerCount = -1;
int validPoseCount, lastValidPoseCount; lastValidPoseCount = -1;
// Models to use for controllers themselves
Array<GLRenderModel> renderModels { };
GLRenderModel trackedDeviceModels[maxTrackedDeviceCount];
void setupCube(float * vertData)
{
Vector3Df verts[8] =
{
{ -0.5f, -0.5f, -0.5f },
{ 0.5f, -0.5f, -0.5f },
{ 0.5f, 0.5f, -0.5f },
{ -0.5f, 0.5f, -0.5f },
{ -0.5f, -0.5f, 0.5f },
{ 0.5f, -0.5f, 0.5f },
{ 0.5f, 0.5f, 0.5f },
{ -0.5f, 0.5f, 0.5f }
};
Pointf texCoords[6] = { { 0, 1 }, { 1, 1 }, { 1, 0 }, { 1, 0 }, { 0, 0 }, { 0, 1 } };
uint indices[36] =
{
4, 5, 6, 6, 7, 4, // Front
1, 0, 3, 3, 2, 1, // Back
7, 6, 2, 2, 3, 7, // Top
0, 1, 5, 5, 4, 0, // Bottom
0, 4, 7, 7, 3, 0, // Left
5, 1, 2, 2, 6, 5 // Right
};
uint i, v = 0;
for(i = 0; i < 36; i++)
{
Vector3Df p = verts[indices[i]];
Pointf tc = texCoords[i % 6];
vertData[v++] = p.x;
vertData[v++] = p.y;
vertData[v++] = p.z;
vertData[v++] = tc.x;
vertData[v++] = tc.y;
}
}
void setupScene()
{
float vertData[5*6*6]; // (vertices + texCoords) * 6 vertices * 6 faces
GLsizei stride = sizeof(VertexDataScene);
uintptr offset = 0;
setupCube(vertData);
glGenVertexArrays(1, &vaoScene);
glBindVertexArray(vaoScene);
glGenBuffers(1, &vboCubeVertices);
glBindBuffer(GL_ARRAY_BUFFER, vboCubeVertices);
glBufferData(GL_ARRAY_BUFFER, sizeof(vertData), vertData, GL_STATIC_DRAW);
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, stride, (const void *)offset);
offset += sizeof(Vector3Df);
glEnableVertexAttribArray(1);
glVertexAttribPointer( 1, 2, GL_FLOAT, GL_FALSE, stride, (const void *)offset);
glBindVertexArray(0);
glDisableVertexAttribArray(0);
glDisableVertexAttribArray(1);
}
void updateControllerAxes()
{
// Don't attempt to update controllers if input is not available
if(ivrHMD && ivrHMD->IsInputAvailable() )
{
Array<float> vertDataArray { };
TrackedDeviceIndex_t td;
controllerVertCount = 0;
trackedControllerCount = 0;
for(td = k_unTrackedDeviceIndex_Hmd + 1; td < maxTrackedDeviceCount; td++)
{
if(ivrHMD->IsTrackedDeviceConnected( td ) && ivrHMD->GetTrackedDeviceClass( td ) == ETrackedDeviceClass_TrackedDeviceClass_Controller &&
trackedDevicePose[ td ].bPoseIsValid)
{
const Matrix * mat = &matDevicePose[td];
Vector3Df center, start, end;
ColorRGB color { .92f, .92f, .71f };
int i;
// Controller Axes
center.MultMatrix({ 0, 0, 0 }, mat);
for ( i = 0; i < 3; i++ )
{
Vector3Df point;
ColorRGB color { (float)(i == 0), (float)(i == 1), (float)(i == 2) };
point.MultMatrix({ (float)(i == 0) * 0.05f, (float)(i == 1) * 0.05f, (float)(i == 2) * 0.05f }, mat); // offset in X, Y, Z
vertDataArray.Add( center.x ); vertDataArray.Add( center.y ); vertDataArray.Add( center.z );
vertDataArray.Add( color.r ); vertDataArray.Add( color.g ); vertDataArray.Add( color.b );
vertDataArray.Add( point.x ); vertDataArray.Add( point.y ); vertDataArray.Add( point.z );
vertDataArray.Add( color.r ); vertDataArray.Add( color.g ); vertDataArray.Add( color.b );
controllerVertCount += 2;
}
// Projected laser light
start.MultMatrix({ 0, 0, -0.02f }, mat);
end.MultMatrix({ 0, 0, -39.f }, mat);
vertDataArray.Add( start.x );vertDataArray.Add( start.y );vertDataArray.Add( start.z );
vertDataArray.Add( color.r );vertDataArray.Add( color.g );vertDataArray.Add( color.b );
vertDataArray.Add( end.x );vertDataArray.Add( end.y );vertDataArray.Add( end.z );
vertDataArray.Add( color.r );vertDataArray.Add( color.g );vertDataArray.Add( color.b );
controllerVertCount += 2;
trackedControllerCount++;
}
}
// Setup the VAO the first time through.
if(!vaoController)
{
uint stride = 2 * 3 * sizeof(float);
uintptr offset = 0;
glGenVertexArrays(1, &vaoController);
glBindVertexArray(vaoController);
glGenBuffers( 1, &vboController );
glBindBuffer( GL_ARRAY_BUFFER, vboController );
glEnableVertexAttribArray( 0 );
glVertexAttribPointer( 0, 3, GL_FLOAT, GL_FALSE, stride, (const void *)offset);
offset += sizeof( Vector3Df );
glEnableVertexAttribArray( 1 );
glVertexAttribPointer( 1, 3, GL_FLOAT, GL_FALSE, stride, (const void *)offset);
glBindVertexArray(0);
}
glBindBuffer( GL_ARRAY_BUFFER, vboController );
// set vertex data if we have some
if(vertDataArray.count)
//$ TODO: Use glBufferSubData for this...
glBufferData( GL_ARRAY_BUFFER, sizeof(float) * vertDataArray.count, &vertDataArray[0], GL_STREAM_DRAW );
delete vertDataArray;
}
}
void setupCameras()
{
getHMDMatrixProjectionEye(EVREye_Eye_Left, matProjectionLeft);
getHMDMatrixProjectionEye(EVREye_Eye_Right, matProjectionRight);
getHMDMatrixPoseEye(EVREye_Eye_Left, matEyePosLeft);
getHMDMatrixPoseEye(EVREye_Eye_Right, matEyePosRight);
}
bool setupStereoRenderTargets()
{
uint32 renderWidth = 1080, renderHeight = 1200;
if(ivrHMD)
ivrHMD->GetRecommendedRenderTargetSize(&renderWidth, &renderHeight);
leftEyeFB.create(renderWidth, renderHeight);
rightEyeFB.create(renderWidth, renderHeight);
return true;
}
void setupCompanionWindow()
{
Array<VertexDataWindow> vVerts { };
GLushort vIndices[] = { 0, 1, 3, 0, 3, 2, 4, 5, 7, 4, 7, 6 };
// left eye verts
vVerts.Add({ {-1, -1 }, { 0, 1 } });
vVerts.Add({ { 0, -1 }, { 1, 1 } });
vVerts.Add({ {-1, 1 }, { 0, 0 } });
vVerts.Add({ { 0, 1 }, { 1, 0 } });
// right eye verts
vVerts.Add({ { 0, -1 }, { 0, 1 } });
vVerts.Add({ { 1, -1 }, { 1, 1 } });
vVerts.Add({ { 0, 1 }, { 0, 0 } });
vVerts.Add({ { 1, 1 }, { 1, 0 } });
companionWindowIndexCount = COUNTOF(vIndices);
glGenVertexArrays(1, &vaoCompanionWindow);
glBindVertexArray(vaoCompanionWindow);
glGenBuffers(1, &vboCompanionWindow);
glBindBuffer(GL_ARRAY_BUFFER, vboCompanionWindow);
glBufferData(GL_ARRAY_BUFFER, vVerts.count*sizeof(VertexDataWindow), &vVerts[0], GL_STATIC_DRAW);
glGenBuffers(1, &iboCompanionWindow );
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, iboCompanionWindow );
glBufferData(GL_ELEMENT_ARRAY_BUFFER, companionWindowIndexCount*sizeof(GLushort), &vIndices[0], GL_STATIC_DRAW);
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, sizeof(VertexDataWindow), (void *)OFFSETOF(VertexDataWindow, position));
glEnableVertexAttribArray(1);
glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, sizeof(VertexDataWindow), (void *)OFFSETOF(VertexDataWindow, texCoord));
glBindVertexArray(0);
glDisableVertexAttribArray(0);
glDisableVertexAttribArray(1);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
delete vVerts;
}
void renderCompanionWindow()
{
Size s = clientSize;
glDisable(GL_DEPTH_TEST);
glViewport(0, 0, s.w, s.h);
glBindVertexArray(vaoCompanionWindow);
companionWindowShader.activate();
// render left eye (first half of index array )
glBindTexture(GL_TEXTURE_2D, leftEyeFB.texResolve );
glDrawElements(GL_TRIANGLES, companionWindowIndexCount/2, GL_UNSIGNED_SHORT, 0);
// render right eye (second half of index array )
glBindTexture(GL_TEXTURE_2D, rightEyeFB.texResolve );
glDrawElements(GL_TRIANGLES, companionWindowIndexCount/2, GL_UNSIGNED_SHORT, (const void *)(uintptr)(companionWindowIndexCount));
glBindVertexArray(1);
}
void renderScene(Hmd_Eye eye)
{
uint32 td;
bool inputAvailable = ivrHMD && ivrHMD->IsInputAvailable();
Matrix eyeMat, tmp;
getCurrentViewProjectionMatrix(eye, eyeMat);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_DEPTH_TEST);
// draw the scene (cubes)
if(showCubes)
{
Quaternion quat = Euler { yaw, pitch };
tmp.RotationQuaternion(quat);
sceneShader.local = tmp;
sceneShader.scene = eyeMat;
sceneShader.activate();
glBindVertexArray(vaoScene);
glBindTexture(GL_TEXTURE_2D, (uint)(uintptr)cubeTexture.bitmap.driverData);
glDrawArraysInstanced(GL_TRIANGLES, 0, 6*6, 20*20*20);
glBindVertexArray(0);
}
// draw the controller axis lines
if(inputAvailable)
{
controllerAxesShader.scene = eyeMat;
controllerAxesShader.activate();
glBindVertexArray(vaoController);
glDrawArrays(GL_LINES, 0, controllerVertCount);
glBindVertexArray(0);
}
// draw the controller models
for(td = 0; td < maxTrackedDeviceCount; td++)
{
if(trackedDeviceModels[td] && showTrackedDevices[td])
{
const TrackedDevicePose_t * pose = &trackedDevicePose[td];
if(pose->bPoseIsValid && (!inputAvailable || ivrHMD->GetTrackedDeviceClass(td) == ETrackedDeviceClass_TrackedDeviceClass_Controller))
{
tmp.Multiply(matDevicePose[td], eyeMat);
renderModelShader.scene = tmp;
renderModelShader.activate();
trackedDeviceModels[td].draw();
}
}
}
}
void getHMDMatrixProjectionEye(Hmd_Eye eye, Matrix matrix)
{
if(ivrHMD)
{
HmdMatrix44_t mat = ivrHMD->GetProjectionMatrix( eye, nearClip, farClip );
Matrix m
{ {
mat.m[0][0], mat.m[1][0], mat.m[2][0], mat.m[3][0],
mat.m[0][1], mat.m[1][1], mat.m[2][1], mat.m[3][1],
mat.m[0][2], mat.m[1][2], mat.m[2][2], mat.m[3][2],
mat.m[0][3], mat.m[1][3], mat.m[2][3], mat.m[3][3]
} };
matrix = m; // TODO: fix matrix = not doing same as instantiation for union...
}
else
matrix.Identity();
}
static inline void ::convertSteamVRMatrixToMatrix(const HmdMatrix34_t * matPose, Matrix matrix)
{
Matrix m
{ {
matPose->m[0][0], matPose->m[1][0], matPose->m[2][0], 0.0,
matPose->m[0][1], matPose->m[1][1], matPose->m[2][1], 0.0,
matPose->m[0][2], matPose->m[1][2], matPose->m[2][2], 0.0,
matPose->m[0][3], matPose->m[1][3], matPose->m[2][3], 1.0f
} };
matrix = m; // FIXME:
}
void getHMDMatrixPoseEye(Hmd_Eye eye, Matrix matrix)
{
if(ivrHMD)
{
HmdMatrix34_t matEyeRight = ivrHMD->GetEyeToHeadTransform( eye );
Matrix matrixObj;
convertSteamVRMatrixToMatrix(&matEyeRight, matrixObj);
matrix.Inverse(matrixObj);
}
else
matrix.Identity();
}
void getCurrentViewProjectionMatrix(Hmd_Eye eye, Matrix output)
{
Matrix tmp;
if(eye == EVREye_Eye_Left)
tmp.Multiply(matEyePosLeft, matProjectionLeft);
else if( eye == EVREye_Eye_Right )
tmp.Multiply(matEyePosRight, matProjectionRight);
output.Multiply(matHMDPose, tmp);
}
void updateHMDMatrixPose()
{
if(ivrHMD)
{
char strPoseClass[65];
int nDevice;
strPoseClass[0] = 0;
ivrCompositor->WaitGetPoses(trackedDevicePose, maxTrackedDeviceCount, null, 0 );
validPoseCount = 0;
poseClasses = null;
for(nDevice = 0; nDevice < maxTrackedDeviceCount; nDevice++)
{
if(trackedDevicePose[nDevice].bPoseIsValid)
{
convertSteamVRMatrixToMatrix(&trackedDevicePose[nDevice].mDeviceToAbsoluteTracking, matDevicePose[nDevice]);
if(!devClassChar[nDevice])
{
switch(ivrHMD->GetTrackedDeviceClass(nDevice))
{
case ETrackedDeviceClass_TrackedDeviceClass_Controller: devClassChar[nDevice] = 'C'; break;
case ETrackedDeviceClass_TrackedDeviceClass_HMD: devClassChar[nDevice] = 'H'; break;
case ETrackedDeviceClass_TrackedDeviceClass_Invalid: devClassChar[nDevice] = 'I'; break;
case ETrackedDeviceClass_TrackedDeviceClass_GenericTracker: devClassChar[nDevice] = 'G'; break;
case ETrackedDeviceClass_TrackedDeviceClass_TrackingReference: devClassChar[nDevice] = 'T'; break;
default: devClassChar[nDevice] = '?'; break;
}
}
strPoseClass[validPoseCount++] = devClassChar[nDevice];
}
}
strPoseClass[validPoseCount] = 0;
if(trackedDevicePose[k_unTrackedDeviceIndex_Hmd].bPoseIsValid)
matHMDPose.Inverse(matDevicePose[k_unTrackedDeviceIndex_Hmd]);
delete poseClasses;
poseClasses = CopyString(strPoseClass);
}
}
GLRenderModel findOrLoadRenderModel(const String renderModelName)
{
GLRenderModel result = null;
for(i : renderModels; !stricmp(i.modelName, renderModelName))
{
result = i;
break;
}
if(!result)
{
GLRenderModel renderModel = null;
EVRRenderModelError error;
RenderModel_t *model = null;
RenderModel_TextureMap_t *texture = null;
while(true)
{
if((error = ivrRenderModels->LoadRenderModel_Async(renderModelName, &model)) != EVRRenderModelError_VRRenderModelError_Loading)
break;
ecere::sys::Sleep( 0.001 );
}
if(error == EVRRenderModelError_VRRenderModelError_None)
{
while(true)
{
if((error = ivrRenderModels->LoadTexture_Async(model->diffuseTextureId, &texture)) != EVRRenderModelError_VRRenderModelError_Loading)
break;
ecere::sys::Sleep( 0.001 );
}
if(error == EVRRenderModelError_VRRenderModelError_None)
{
renderModel = GLRenderModel { CopyString(renderModelName) };
if(renderModel.init(model, texture))
{
renderModels.Add(renderModel);
result = renderModel;
}
else
{
Logf( "Unable to create GL model from render model %s\n", renderModelName );
delete renderModel;
}
}
else
Logf( "Unable to load render texture id:%d for render model %s\n", model->diffuseTextureId, renderModelName );
}
else
Logf( "Unable to load render model %s - %s\n", renderModelName, ivrRenderModels->GetRenderModelErrorNameFromEnum(error));
if(model) ivrRenderModels->FreeRenderModel(model);
if(texture) ivrRenderModels->FreeTexture(texture);
}
return result;
}
void setupRenderModelForTrackedDevice( TrackedDeviceIndex_t unTrackedDeviceIndex )
{
if( unTrackedDeviceIndex < maxTrackedDeviceCount )
{
// try to find a model we've already set up
String sRenderModelName = getTrackedDeviceString( ivrHMD, unTrackedDeviceIndex, ETrackedDeviceProperty_Prop_RenderModelName_String, null );
GLRenderModel renderModel = findOrLoadRenderModel( sRenderModelName );
if(!renderModel)
{
String sTrackingSystemName = getTrackedDeviceString( ivrHMD, unTrackedDeviceIndex, ETrackedDeviceProperty_Prop_TrackingSystemName_String, null );
Logf( "Unable to load render model for tracked device %d (%s.%s)", unTrackedDeviceIndex, sTrackingSystemName, sRenderModelName );
}
else
{
trackedDeviceModels[ unTrackedDeviceIndex ] = renderModel;
showTrackedDevices[ unTrackedDeviceIndex ] = true;
}
}
}
void setupRenderModels()
{
if(ivrHMD)
{
uint32 i;
for(i = k_unTrackedDeviceIndex_Hmd + 1; i < maxTrackedDeviceCount; i++)
if(ivrHMD->IsTrackedDeviceConnected(i))
setupRenderModelForTrackedDevice(i);
}
}
void processVREvent(const struct VREvent_t * event)
{
switch(event->eventType)
{
case EVREventType_VREvent_TrackedDeviceActivated:
setupRenderModelForTrackedDevice(event->trackedDeviceIndex);
Logf("Device %u attached. Setting up render model.\n", event->trackedDeviceIndex);
break;
case EVREventType_VREvent_TrackedDeviceDeactivated:
Logf("Device %u detached.\n", event->trackedDeviceIndex);
break;
case EVREventType_VREvent_TrackedDeviceUpdated:
Logf("Device %u updated.\n", event->trackedDeviceIndex);
break;
}
}
bool OnKeyHit(Key key, unichar ch)
{
switch(key)
{
case escape: case q: Destroy(0); break;
case c: showCubes ^= true; break;
}
return true;
}
bool OnLoadGraphics()
{
ogl_LoadFunctions(); // Initialize our local copy of glLoadGen
matHMDPose.Identity();
setupScene();
setupCameras();
setupStereoRenderTargets();
setupCompanionWindow();
setupRenderModels();
return true;
}
void OnUnloadGraphics()
{
renderModels.Free();
glDeleteBuffers(1, &vboCubeVertices);
sceneShader.free();
controllerAxesShader.free();
renderModelShader.free();
companionWindowShader.free();
leftEyeFB.free();
rightEyeFB.free();
if(vaoCompanionWindow) glDeleteVertexArrays(1, &vaoCompanionWindow);
if(vaoScene) glDeleteVertexArrays(1, &vaoScene);
if(vaoController) glDeleteVertexArrays(1, &vaoController);
}
void OnRedraw(Surface surface)
{
Texture_t leftEyeTexture = { (void*)(uintptr)leftEyeFB.texResolve, ETextureType_TextureType_OpenGL, EColorSpace_ColorSpace_Gamma };
Texture_t rightEyeTexture = { (void*)(uintptr)rightEyeFB.texResolve, ETextureType_TextureType_OpenGL, EColorSpace_ColorSpace_Gamma };
yaw += 0.02, pitch += 0.01; // Spin the cube
glDisable(GL_SCISSOR_TEST);
glClearColor(0, 0, 0, 1);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
updateControllerAxes();
// Render stereo targets
leftEyeFB. preRender(); renderScene(EVREye_Eye_Left); leftEyeFB.postRender();
rightEyeFB.preRender(); renderScene(EVREye_Eye_Right); rightEyeFB.postRender();
renderCompanionWindow();
if(ivrHMD)
{
ivrCompositor->Submit(EVREye_Eye_Left, &leftEyeTexture, null, 0);
ivrCompositor->Submit(EVREye_Eye_Right, &rightEyeTexture, null, 0);
}
if(vBlank && glFinishHack)
{
//$ HACKHACK. From gpuview profiling, it looks like there is a bug where two renders and a present
// happen right before and after the vsync causing all kinds of jittering issues. This glFinish()
// appears to clear that up. Temporary fix while I try to get nvidia to investigate this problem.
// 1/29/2014 mikesart
glFinish();
}
// Flush and wait for swap.
if(vBlank)
{
glFlush();
glFinish();
}
// Spew out the controller and pose count whenever they change.
if(trackedControllerCount != lastTrackedControllerCount || validPoseCount != lastValidPoseCount)
{
lastValidPoseCount = validPoseCount;
lastTrackedControllerCount = trackedControllerCount;
Logf( "PoseCount:%d(%s) Controllers:%d\n", validPoseCount, poseClasses, trackedControllerCount );
}
updateHMDMatrixPose();
}
}
class VRApplication : GuiApplication
{
IVRSystem *ivrHMD;
VRCompanionWindow companionWindow { };
timerResolution = 120;
bool Init()
{
bool result = false;
EVRInitError eError = EVRInitError_VRInitError_None;
const String errorCtx = "Unable to init VR runtime: %s";
int i;
UseSingleGLContext(true);
SetLoggingMode(debug, null);
for(i = 1; i < argc; i++)
{
if( !stricmp( argv[i], "-gldebug" ) ) companionWindow.glCapabilities.debug = true;
else if( !stricmp( argv[i], "-novblank" ) ) companionWindow.vBlank = false;
else if( !stricmp( argv[i], "-noglfinishhack" ) ) companionWindow.glFinishHack = false;
else if( !stricmp( argv[i], "-noprintf" ) ) SetLoggingMode(stdOut, null);
}
// Loading the SteamVR Runtime
companionWindow.ivrHMD = ivrHMD = VR_Init(&eError, EVRApplicationType_VRApplication_Scene);
if(ivrHMD)
{
errorCtx = "Unable to get render model interface: %s";
if((companionWindow.ivrRenderModels = VR_GetFnTable(IVRRenderModels_Version, &eError)))
{
errorCtx = "Unable to get compositor interface: %s";
if((companionWindow.ivrCompositor = VR_GetFnTable(IVRCompositor_Version, &eError)))
{
String strDriver = getTrackedDeviceString( ivrHMD, k_unTrackedDeviceIndex_Hmd, ETrackedDeviceProperty_Prop_TrackingSystemName_String, null );
String strDisplay = getTrackedDeviceString( ivrHMD, k_unTrackedDeviceIndex_Hmd, ETrackedDeviceProperty_Prop_SerialNumber_String, null );
String strWindowTitle = PrintString("Hello, VR! - ", strDriver, " (", strDisplay, ")");
companionWindow.caption = strWindowTitle;
delete strWindowTitle;
delete strDriver;
delete strDisplay;
result = true;
}
}
}
if(eError != EVRInitError_VRInitError_None )
{
char buf[1024];
ivrHMD = null;
VR_Shutdown();
sprintf( buf, errorCtx, VR_GetVRInitErrorAsEnglishDescription( eError ) );
MessageBox { caption = "VR_Init Failed", contents = buf }.Modal();
}
return result;
}
bool Cycle(bool idle)
{
if(ivrHMD)
{
// Handle HMD & Controllers Input
struct VREvent_t event;
TrackedDeviceIndex_t d;
// Process SteamVR events
while(ivrHMD->PollNextEvent(&event, sizeof(event)))
companionWindow.processVREvent(&event);
// Process SteamVR controller state
for( d = 0; d < maxTrackedDeviceCount; d++)
{
VRControllerState_t state;
if(ivrHMD->GetControllerState(d, &state, sizeof(state)))
companionWindow.showTrackedDevices[d] = state.ulButtonPressed == 0;
}
}
companionWindow.Update(null);
return true;
}
void Terminate()
{
if(ivrHMD)
{
VR_Shutdown();
ivrHMD = null;
}
}
}
{
"Version" : 0.2,
"ModuleName" : "helloVR",
"Options" : {
"Warnings" : "All",
"IncludeDirs" : [
"$(ECERE_SDK_SRC)/ecere/src/gfx/drivers/gl3"
],
"TargetType" : "Executable",
"TargetFileName" : "helloVR",
"Libraries" : [
"ecere",
"openvr_api"
]
},
"Platforms" : [
{
"Name" : "win32",
"Options" : {
"Libraries" : [
"opengl32"
]
}
}
],
"Configurations" : [
{
"Name" : "Debug",
"Options" : {
"Debug" : true,
"Optimization" : "None",
"PreprocessorDefinitions" : [
"_DEBUG"
],
"Console" : true,
"FastMath" : false
}
},
{
"Name" : "Release",
"Options" : {
"Debug" : false,
"Optimization" : "Speed",
"FastMath" : true
}
}
],
"Files" : [
{
"Folder" : "deps",
"Files" : [
"$(ECERE_SDK_SRC)/ecere/src/gfx/drivers/gl3/gl_compat_4_4.c"
]
},
"helloVR.ec",
"$(OPENVR_SDK)/headers/openvr_capi.h"
],
"ResourcesPath" : "",
"Resources" : [
"$(ECERE_SDK_SRC)/samples/3D/cube2/knot.png"
]
}
diff --git a/headers/openvr_capi.h b/headers/openvr_capi.h
index e32fb64..8bce4c8 100644
--- a/headers/openvr_capi.h
+++ b/headers/openvr_capi.h
@@ -30,7 +30,7 @@
#elif defined( OPENVR_API_NODLL )
#define S_API EXTERN_C
#else
- #define S_API extern "C" __declspec( dllimport )
+ #define S_API EXTERN_C __declspec( dllimport )
#endif // OPENVR_API_EXPORTS
#elif defined( __GNUC__ )
#if defined( OPENVR_API_EXPORTS )
@@ -93,161 +93,161 @@ static const unsigned int k_unControllerStateAxisCount = 5;
static const unsigned long k_ulOverlayHandleInvalid = 0;
static const unsigned int k_unScreenshotHandleInvalid = 0;
static const char * IVRSystem_Version = "IVRSystem_019";
-static const char * IVRExtendedDisplay_Version = "IVRExtendedDisplay_001";
-static const char * IVRTrackedCamera_Version = "IVRTrackedCamera_003";
+__attribute__((unused)) static const char * IVRExtendedDisplay_Version = "IVRExtendedDisplay_001";
+__attribute__((unused)) static const char * IVRTrackedCamera_Version = "IVRTrackedCamera_003";
static const unsigned int k_unMaxApplicationKeyLength = 128;
-static const char * k_pch_MimeType_HomeApp = "vr/home";
-static const char * k_pch_MimeType_GameTheater = "vr/game_theater";
-static const char * IVRApplications_Version = "IVRApplications_006";
-static const char * IVRChaperone_Version = "IVRChaperone_003";
-static const char * IVRChaperoneSetup_Version = "IVRChaperoneSetup_005";
-static const char * IVRCompositor_Version = "IVRCompositor_022";
+__attribute__((unused)) static const char * k_pch_MimeType_HomeApp = "vr/home";
+__attribute__((unused)) static const char * k_pch_MimeType_GameTheater = "vr/game_theater";
+__attribute__((unused)) static const char * IVRApplications_Version = "IVRApplications_006";
+__attribute__((unused)) static const char * IVRChaperone_Version = "IVRChaperone_003";
+__attribute__((unused)) static const char * IVRChaperoneSetup_Version = "IVRChaperoneSetup_005";
+__attribute__((unused)) static const char * IVRCompositor_Version = "IVRCompositor_022";
static const unsigned int k_unVROverlayMaxKeyLength = 128;
static const unsigned int k_unVROverlayMaxNameLength = 128;
static const unsigned int k_unMaxOverlayCount = 64;
static const unsigned int k_unMaxOverlayIntersectionMaskPrimitivesCount = 32;
-static const char * IVROverlay_Version = "IVROverlay_018";
-static const char * k_pch_Controller_Component_GDC2015 = "gdc2015";
-static const char * k_pch_Controller_Component_Base = "base";
-static const char * k_pch_Controller_Component_Tip = "tip";
-static const char * k_pch_Controller_Component_HandGrip = "handgrip";
-static const char * k_pch_Controller_Component_Status = "status";
-static const char * IVRRenderModels_Version = "IVRRenderModels_005";
+__attribute__((unused)) static const char * IVROverlay_Version = "IVROverlay_018";
+__attribute__((unused)) static const char * k_pch_Controller_Component_GDC2015 = "gdc2015";
+__attribute__((unused)) static const char * k_pch_Controller_Component_Base = "base";
+__attribute__((unused)) static const char * k_pch_Controller_Component_Tip = "tip";
+__attribute__((unused)) static const char * k_pch_Controller_Component_HandGrip = "handgrip";
+__attribute__((unused)) static const char * k_pch_Controller_Component_Status = "status";
+__attribute__((unused)) static const char * IVRRenderModels_Version = "IVRRenderModels_005";
static const unsigned int k_unNotificationTextMaxSize = 256;
-static const char * IVRNotifications_Version = "IVRNotifications_002";
+__attribute__((unused)) static const char * IVRNotifications_Version = "IVRNotifications_002";
static const unsigned int k_unMaxSettingsKeyLength = 128;
-static const char * IVRSettings_Version = "IVRSettings_002";
-static const char * k_pch_SteamVR_Section = "steamvr";
-static const char * k_pch_SteamVR_RequireHmd_String = "requireHmd";
-static const char * k_pch_SteamVR_ForcedDriverKey_String = "forcedDriver";
-static const char * k_pch_SteamVR_ForcedHmdKey_String = "forcedHmd";
-static const char * k_pch_SteamVR_DisplayDebug_Bool = "displayDebug";
-static const char * k_pch_SteamVR_DebugProcessPipe_String = "debugProcessPipe";
-static const char * k_pch_SteamVR_DisplayDebugX_Int32 = "displayDebugX";
-static const char * k_pch_SteamVR_DisplayDebugY_Int32 = "displayDebugY";
-static const char * k_pch_SteamVR_SendSystemButtonToAllApps_Bool = "sendSystemButtonToAllApps";
-static const char * k_pch_SteamVR_LogLevel_Int32 = "loglevel";
-static const char * k_pch_SteamVR_IPD_Float = "ipd";
-static const char * k_pch_SteamVR_Background_String = "background";
-static const char * k_pch_SteamVR_BackgroundUseDomeProjection_Bool = "backgroundUseDomeProjection";
-static const char * k_pch_SteamVR_BackgroundCameraHeight_Float = "backgroundCameraHeight";
-static const char * k_pch_SteamVR_BackgroundDomeRadius_Float = "backgroundDomeRadius";
-static const char * k_pch_SteamVR_GridColor_String = "gridColor";
-static const char * k_pch_SteamVR_PlayAreaColor_String = "playAreaColor";
-static const char * k_pch_SteamVR_ShowStage_Bool = "showStage";
-static const char * k_pch_SteamVR_ActivateMultipleDrivers_Bool = "activateMultipleDrivers";
-static const char * k_pch_SteamVR_DirectMode_Bool = "directMode";
-static const char * k_pch_SteamVR_DirectModeEdidVid_Int32 = "directModeEdidVid";
-static const char * k_pch_SteamVR_DirectModeEdidPid_Int32 = "directModeEdidPid";
-static const char * k_pch_SteamVR_UsingSpeakers_Bool = "usingSpeakers";
-static const char * k_pch_SteamVR_SpeakersForwardYawOffsetDegrees_Float = "speakersForwardYawOffsetDegrees";
-static const char * k_pch_SteamVR_BaseStationPowerManagement_Bool = "basestationPowerManagement";
-static const char * k_pch_SteamVR_NeverKillProcesses_Bool = "neverKillProcesses";
-static const char * k_pch_SteamVR_SupersampleScale_Float = "supersampleScale";
-static const char * k_pch_SteamVR_AllowAsyncReprojection_Bool = "allowAsyncReprojection";
-static const char * k_pch_SteamVR_AllowReprojection_Bool = "allowInterleavedReprojection";
-static const char * k_pch_SteamVR_ForceReprojection_Bool = "forceReprojection";
-static const char * k_pch_SteamVR_ForceFadeOnBadTracking_Bool = "forceFadeOnBadTracking";
-static const char * k_pch_SteamVR_DefaultMirrorView_Int32 = "defaultMirrorView";
-static const char * k_pch_SteamVR_ShowMirrorView_Bool = "showMirrorView";
-static const char * k_pch_SteamVR_MirrorViewGeometry_String = "mirrorViewGeometry";
-static const char * k_pch_SteamVR_StartMonitorFromAppLaunch = "startMonitorFromAppLaunch";
-static const char * k_pch_SteamVR_StartCompositorFromAppLaunch_Bool = "startCompositorFromAppLaunch";
-static const char * k_pch_SteamVR_StartDashboardFromAppLaunch_Bool = "startDashboardFromAppLaunch";
-static const char * k_pch_SteamVR_StartOverlayAppsFromDashboard_Bool = "startOverlayAppsFromDashboard";
-static const char * k_pch_SteamVR_EnableHomeApp = "enableHomeApp";
-static const char * k_pch_SteamVR_CycleBackgroundImageTimeSec_Int32 = "CycleBackgroundImageTimeSec";
-static const char * k_pch_SteamVR_RetailDemo_Bool = "retailDemo";
-static const char * k_pch_SteamVR_IpdOffset_Float = "ipdOffset";
-static const char * k_pch_SteamVR_AllowSupersampleFiltering_Bool = "allowSupersampleFiltering";
-static const char * k_pch_SteamVR_EnableLinuxVulkanAsync_Bool = "enableLinuxVulkanAsync";
-static const char * k_pch_SteamVR_AllowDisplayLockedMode_Bool = "allowDisplayLockedMode";
-static const char * k_pch_SteamVR_HaveStartedTutorialForNativeChaperoneDriver_Bool = "haveStartedTutorialForNativeChaperoneDriver";
-static const char * k_pch_SteamVR_ForceWindows32bitVRMonitor = "forceWindows32BitVRMonitor";
-static const char * k_pch_Lighthouse_Section = "driver_lighthouse";
-static const char * k_pch_Lighthouse_DisableIMU_Bool = "disableimu";
-static const char * k_pch_Lighthouse_DisableIMUExceptHMD_Bool = "disableimuexcepthmd";
-static const char * k_pch_Lighthouse_UseDisambiguation_String = "usedisambiguation";
-static const char * k_pch_Lighthouse_DisambiguationDebug_Int32 = "disambiguationdebug";
-static const char * k_pch_Lighthouse_PrimaryBasestation_Int32 = "primarybasestation";
-static const char * k_pch_Lighthouse_DBHistory_Bool = "dbhistory";
-static const char * k_pch_Lighthouse_EnableBluetooth_Bool = "enableBluetooth";
-static const char * k_pch_Null_Section = "driver_null";
-static const char * k_pch_Null_SerialNumber_String = "serialNumber";
-static const char * k_pch_Null_ModelNumber_String = "modelNumber";
-static const char * k_pch_Null_WindowX_Int32 = "windowX";
-static const char * k_pch_Null_WindowY_Int32 = "windowY";
-static const char * k_pch_Null_WindowWidth_Int32 = "windowWidth";
-static const char * k_pch_Null_WindowHeight_Int32 = "windowHeight";
-static const char * k_pch_Null_RenderWidth_Int32 = "renderWidth";
-static const char * k_pch_Null_RenderHeight_Int32 = "renderHeight";
-static const char * k_pch_Null_SecondsFromVsyncToPhotons_Float = "secondsFromVsyncToPhotons";
-static const char * k_pch_Null_DisplayFrequency_Float = "displayFrequency";
-static const char * k_pch_UserInterface_Section = "userinterface";
-static const char * k_pch_UserInterface_StatusAlwaysOnTop_Bool = "StatusAlwaysOnTop";
-static const char * k_pch_UserInterface_MinimizeToTray_Bool = "MinimizeToTray";
-static const char * k_pch_UserInterface_Screenshots_Bool = "screenshots";
-static const char * k_pch_UserInterface_ScreenshotType_Int = "screenshotType";
-static const char * k_pch_Notifications_Section = "notifications";
-static const char * k_pch_Notifications_DoNotDisturb_Bool = "DoNotDisturb";
-static const char * k_pch_Keyboard_Section = "keyboard";
-static const char * k_pch_Keyboard_TutorialCompletions = "TutorialCompletions";
-static const char * k_pch_Keyboard_ScaleX = "ScaleX";
-static const char * k_pch_Keyboard_ScaleY = "ScaleY";
-static const char * k_pch_Keyboard_OffsetLeftX = "OffsetLeftX";
-static const char * k_pch_Keyboard_OffsetRightX = "OffsetRightX";
-static const char * k_pch_Keyboard_OffsetY = "OffsetY";
-static const char * k_pch_Keyboard_Smoothing = "Smoothing";
-static const char * k_pch_Perf_Section = "perfcheck";
-static const char * k_pch_Perf_HeuristicActive_Bool = "heuristicActive";
-static const char * k_pch_Perf_NotifyInHMD_Bool = "warnInHMD";
-static const char * k_pch_Perf_NotifyOnlyOnce_Bool = "warnOnlyOnce";
-static const char * k_pch_Perf_AllowTimingStore_Bool = "allowTimingStore";
-static const char * k_pch_Perf_SaveTimingsOnExit_Bool = "saveTimingsOnExit";
-static const char * k_pch_Perf_TestData_Float = "perfTestData";
-static const char * k_pch_Perf_LinuxGPUProfiling_Bool = "linuxGPUProfiling";
-static const char * k_pch_CollisionBounds_Section = "collisionBounds";
-static const char * k_pch_CollisionBounds_Style_Int32 = "CollisionBoundsStyle";
-static const char * k_pch_CollisionBounds_GroundPerimeterOn_Bool = "CollisionBoundsGroundPerimeterOn";
-static const char * k_pch_CollisionBounds_CenterMarkerOn_Bool = "CollisionBoundsCenterMarkerOn";
-static const char * k_pch_CollisionBounds_PlaySpaceOn_Bool = "CollisionBoundsPlaySpaceOn";
-static const char * k_pch_CollisionBounds_FadeDistance_Float = "CollisionBoundsFadeDistance";
-static const char * k_pch_CollisionBounds_ColorGammaR_Int32 = "CollisionBoundsColorGammaR";
-static const char * k_pch_CollisionBounds_ColorGammaG_Int32 = "CollisionBoundsColorGammaG";
-static const char * k_pch_CollisionBounds_ColorGammaB_Int32 = "CollisionBoundsColorGammaB";
-static const char * k_pch_CollisionBounds_ColorGammaA_Int32 = "CollisionBoundsColorGammaA";
-static const char * k_pch_Camera_Section = "camera";
-static const char * k_pch_Camera_EnableCamera_Bool = "enableCamera";
-static const char * k_pch_Camera_EnableCameraInDashboard_Bool = "enableCameraInDashboard";
-static const char * k_pch_Camera_EnableCameraForCollisionBounds_Bool = "enableCameraForCollisionBounds";
-static const char * k_pch_Camera_EnableCameraForRoomView_Bool = "enableCameraForRoomView";
-static const char * k_pch_Camera_BoundsColorGammaR_Int32 = "cameraBoundsColorGammaR";
-static const char * k_pch_Camera_BoundsColorGammaG_Int32 = "cameraBoundsColorGammaG";
-static const char * k_pch_Camera_BoundsColorGammaB_Int32 = "cameraBoundsColorGammaB";
-static const char * k_pch_Camera_BoundsColorGammaA_Int32 = "cameraBoundsColorGammaA";
-static const char * k_pch_Camera_BoundsStrength_Int32 = "cameraBoundsStrength";
-static const char * k_pch_audio_Section = "audio";
-static const char * k_pch_audio_OnPlaybackDevice_String = "onPlaybackDevice";
-static const char * k_pch_audio_OnRecordDevice_String = "onRecordDevice";
-static const char * k_pch_audio_OnPlaybackMirrorDevice_String = "onPlaybackMirrorDevice";
-static const char * k_pch_audio_OffPlaybackDevice_String = "offPlaybackDevice";
-static const char * k_pch_audio_OffRecordDevice_String = "offRecordDevice";
-static const char * k_pch_audio_VIVEHDMIGain = "viveHDMIGain";
-static const char * k_pch_Power_Section = "power";
-static const char * k_pch_Power_PowerOffOnExit_Bool = "powerOffOnExit";
-static const char * k_pch_Power_TurnOffScreensTimeout_Float = "turnOffScreensTimeout";
-static const char * k_pch_Power_TurnOffControllersTimeout_Float = "turnOffControllersTimeout";
-static const char * k_pch_Power_ReturnToWatchdogTimeout_Float = "returnToWatchdogTimeout";
-static const char * k_pch_Power_AutoLaunchSteamVROnButtonPress = "autoLaunchSteamVROnButtonPress";
-static const char * k_pch_Power_PauseCompositorOnStandby_Bool = "pauseCompositorOnStandby";
-static const char * k_pch_Dashboard_Section = "dashboard";
-static const char * k_pch_Dashboard_EnableDashboard_Bool = "enableDashboard";
-static const char * k_pch_Dashboard_ArcadeMode_Bool = "arcadeMode";
-static const char * k_pch_modelskin_Section = "modelskins";
-static const char * k_pch_Driver_Enable_Bool = "enable";
-static const char * IVRScreenshots_Version = "IVRScreenshots_001";
-static const char * IVRResources_Version = "IVRResources_001";
-static const char * IVRDriverManager_Version = "IVRDriverManager_001";
+__attribute__((unused)) static const char * IVRSettings_Version = "IVRSettings_002";
+__attribute__((unused)) static const char * k_pch_SteamVR_Section = "steamvr";
+__attribute__((unused)) static const char * k_pch_SteamVR_RequireHmd_String = "requireHmd";
+__attribute__((unused)) static const char * k_pch_SteamVR_ForcedDriverKey_String = "forcedDriver";
+__attribute__((unused)) static const char * k_pch_SteamVR_ForcedHmdKey_String = "forcedHmd";
+__attribute__((unused)) static const char * k_pch_SteamVR_DisplayDebug_Bool = "displayDebug";
+__attribute__((unused)) static const char * k_pch_SteamVR_DebugProcessPipe_String = "debugProcessPipe";
+__attribute__((unused)) static const char * k_pch_SteamVR_DisplayDebugX_Int32 = "displayDebugX";
+__attribute__((unused)) static const char * k_pch_SteamVR_DisplayDebugY_Int32 = "displayDebugY";
+__attribute__((unused)) static const char * k_pch_SteamVR_SendSystemButtonToAllApps_Bool = "sendSystemButtonToAllApps";
+__attribute__((unused)) static const char * k_pch_SteamVR_LogLevel_Int32 = "loglevel";
+__attribute__((unused)) static const char * k_pch_SteamVR_IPD_Float = "ipd";
+__attribute__((unused)) static const char * k_pch_SteamVR_Background_String = "background";
+__attribute__((unused)) static const char * k_pch_SteamVR_BackgroundUseDomeProjection_Bool = "backgroundUseDomeProjection";
+__attribute__((unused)) static const char * k_pch_SteamVR_BackgroundCameraHeight_Float = "backgroundCameraHeight";
+__attribute__((unused)) static const char * k_pch_SteamVR_BackgroundDomeRadius_Float = "backgroundDomeRadius";
+__attribute__((unused)) static const char * k_pch_SteamVR_GridColor_String = "gridColor";
+__attribute__((unused)) static const char * k_pch_SteamVR_PlayAreaColor_String = "playAreaColor";
+__attribute__((unused)) static const char * k_pch_SteamVR_ShowStage_Bool = "showStage";
+__attribute__((unused)) static const char * k_pch_SteamVR_ActivateMultipleDrivers_Bool = "activateMultipleDrivers";
+__attribute__((unused)) static const char * k_pch_SteamVR_DirectMode_Bool = "directMode";
+__attribute__((unused)) static const char * k_pch_SteamVR_DirectModeEdidVid_Int32 = "directModeEdidVid";
+__attribute__((unused)) static const char * k_pch_SteamVR_DirectModeEdidPid_Int32 = "directModeEdidPid";
+__attribute__((unused)) static const char * k_pch_SteamVR_UsingSpeakers_Bool = "usingSpeakers";
+__attribute__((unused)) static const char * k_pch_SteamVR_SpeakersForwardYawOffsetDegrees_Float = "speakersForwardYawOffsetDegrees";
+__attribute__((unused)) static const char * k_pch_SteamVR_BaseStationPowerManagement_Bool = "basestationPowerManagement";
+__attribute__((unused)) static const char * k_pch_SteamVR_NeverKillProcesses_Bool = "neverKillProcesses";
+__attribute__((unused)) static const char * k_pch_SteamVR_SupersampleScale_Float = "supersampleScale";
+__attribute__((unused)) static const char * k_pch_SteamVR_AllowAsyncReprojection_Bool = "allowAsyncReprojection";
+__attribute__((unused)) static const char * k_pch_SteamVR_AllowReprojection_Bool = "allowInterleavedReprojection";
+__attribute__((unused)) static const char * k_pch_SteamVR_ForceReprojection_Bool = "forceReprojection";
+__attribute__((unused)) static const char * k_pch_SteamVR_ForceFadeOnBadTracking_Bool = "forceFadeOnBadTracking";
+__attribute__((unused)) static const char * k_pch_SteamVR_DefaultMirrorView_Int32 = "defaultMirrorView";
+__attribute__((unused)) static const char * k_pch_SteamVR_ShowMirrorView_Bool = "showMirrorView";
+__attribute__((unused)) static const char * k_pch_SteamVR_MirrorViewGeometry_String = "mirrorViewGeometry";
+__attribute__((unused)) static const char * k_pch_SteamVR_StartMonitorFromAppLaunch = "startMonitorFromAppLaunch";
+__attribute__((unused)) static const char * k_pch_SteamVR_StartCompositorFromAppLaunch_Bool = "startCompositorFromAppLaunch";
+__attribute__((unused)) static const char * k_pch_SteamVR_StartDashboardFromAppLaunch_Bool = "startDashboardFromAppLaunch";
+__attribute__((unused)) static const char * k_pch_SteamVR_StartOverlayAppsFromDashboard_Bool = "startOverlayAppsFromDashboard";
+__attribute__((unused)) static const char * k_pch_SteamVR_EnableHomeApp = "enableHomeApp";
+__attribute__((unused)) static const char * k_pch_SteamVR_CycleBackgroundImageTimeSec_Int32 = "CycleBackgroundImageTimeSec";
+__attribute__((unused)) static const char * k_pch_SteamVR_RetailDemo_Bool = "retailDemo";
+__attribute__((unused)) static const char * k_pch_SteamVR_IpdOffset_Float = "ipdOffset";
+__attribute__((unused)) static const char * k_pch_SteamVR_AllowSupersampleFiltering_Bool = "allowSupersampleFiltering";
+__attribute__((unused)) static const char * k_pch_SteamVR_EnableLinuxVulkanAsync_Bool = "enableLinuxVulkanAsync";
+__attribute__((unused)) static const char * k_pch_SteamVR_AllowDisplayLockedMode_Bool = "allowDisplayLockedMode";
+__attribute__((unused)) static const char * k_pch_SteamVR_HaveStartedTutorialForNativeChaperoneDriver_Bool = "haveStartedTutorialForNativeChaperoneDriver";
+__attribute__((unused)) static const char * k_pch_SteamVR_ForceWindows32bitVRMonitor = "forceWindows32BitVRMonitor";
+__attribute__((unused)) static const char * k_pch_Lighthouse_Section = "driver_lighthouse";
+__attribute__((unused)) static const char * k_pch_Lighthouse_DisableIMU_Bool = "disableimu";
+__attribute__((unused)) static const char * k_pch_Lighthouse_DisableIMUExceptHMD_Bool = "disableimuexcepthmd";
+__attribute__((unused)) static const char * k_pch_Lighthouse_UseDisambiguation_String = "usedisambiguation";
+__attribute__((unused)) static const char * k_pch_Lighthouse_DisambiguationDebug_Int32 = "disambiguationdebug";
+__attribute__((unused)) static const char * k_pch_Lighthouse_PrimaryBasestation_Int32 = "primarybasestation";
+__attribute__((unused)) static const char * k_pch_Lighthouse_DBHistory_Bool = "dbhistory";
+__attribute__((unused)) static const char * k_pch_Lighthouse_EnableBluetooth_Bool = "enableBluetooth";
+__attribute__((unused)) static const char * k_pch_Null_Section = "driver_null";
+__attribute__((unused)) static const char * k_pch_Null_SerialNumber_String = "serialNumber";
+__attribute__((unused)) static const char * k_pch_Null_ModelNumber_String = "modelNumber";
+__attribute__((unused)) static const char * k_pch_Null_WindowX_Int32 = "windowX";
+__attribute__((unused)) static const char * k_pch_Null_WindowY_Int32 = "windowY";
+__attribute__((unused)) static const char * k_pch_Null_WindowWidth_Int32 = "windowWidth";
+__attribute__((unused)) static const char * k_pch_Null_WindowHeight_Int32 = "windowHeight";
+__attribute__((unused)) static const char * k_pch_Null_RenderWidth_Int32 = "renderWidth";
+__attribute__((unused)) static const char * k_pch_Null_RenderHeight_Int32 = "renderHeight";
+__attribute__((unused)) static const char * k_pch_Null_SecondsFromVsyncToPhotons_Float = "secondsFromVsyncToPhotons";
+__attribute__((unused)) static const char * k_pch_Null_DisplayFrequency_Float = "displayFrequency";
+__attribute__((unused)) static const char * k_pch_UserInterface_Section = "userinterface";
+__attribute__((unused)) static const char * k_pch_UserInterface_StatusAlwaysOnTop_Bool = "StatusAlwaysOnTop";
+__attribute__((unused)) static const char * k_pch_UserInterface_MinimizeToTray_Bool = "MinimizeToTray";
+__attribute__((unused)) static const char * k_pch_UserInterface_Screenshots_Bool = "screenshots";
+__attribute__((unused)) static const char * k_pch_UserInterface_ScreenshotType_Int = "screenshotType";
+__attribute__((unused)) static const char * k_pch_Notifications_Section = "notifications";
+__attribute__((unused)) static const char * k_pch_Notifications_DoNotDisturb_Bool = "DoNotDisturb";
+__attribute__((unused)) static const char * k_pch_Keyboard_Section = "keyboard";
+__attribute__((unused)) static const char * k_pch_Keyboard_TutorialCompletions = "TutorialCompletions";
+__attribute__((unused)) static const char * k_pch_Keyboard_ScaleX = "ScaleX";
+__attribute__((unused)) static const char * k_pch_Keyboard_ScaleY = "ScaleY";
+__attribute__((unused)) static const char * k_pch_Keyboard_OffsetLeftX = "OffsetLeftX";
+__attribute__((unused)) static const char * k_pch_Keyboard_OffsetRightX = "OffsetRightX";
+__attribute__((unused)) static const char * k_pch_Keyboard_OffsetY = "OffsetY";
+__attribute__((unused)) static const char * k_pch_Keyboard_Smoothing = "Smoothing";
+__attribute__((unused)) static const char * k_pch_Perf_Section = "perfcheck";
+__attribute__((unused)) static const char * k_pch_Perf_HeuristicActive_Bool = "heuristicActive";
+__attribute__((unused)) static const char * k_pch_Perf_NotifyInHMD_Bool = "warnInHMD";
+__attribute__((unused)) static const char * k_pch_Perf_NotifyOnlyOnce_Bool = "warnOnlyOnce";
+__attribute__((unused)) static const char * k_pch_Perf_AllowTimingStore_Bool = "allowTimingStore";
+__attribute__((unused)) static const char * k_pch_Perf_SaveTimingsOnExit_Bool = "saveTimingsOnExit";
+__attribute__((unused)) static const char * k_pch_Perf_TestData_Float = "perfTestData";
+__attribute__((unused)) static const char * k_pch_Perf_LinuxGPUProfiling_Bool = "linuxGPUProfiling";
+__attribute__((unused)) static const char * k_pch_CollisionBounds_Section = "collisionBounds";
+__attribute__((unused)) static const char * k_pch_CollisionBounds_Style_Int32 = "CollisionBoundsStyle";
+__attribute__((unused)) static const char * k_pch_CollisionBounds_GroundPerimeterOn_Bool = "CollisionBoundsGroundPerimeterOn";
+__attribute__((unused)) static const char * k_pch_CollisionBounds_CenterMarkerOn_Bool = "CollisionBoundsCenterMarkerOn";
+__attribute__((unused)) static const char * k_pch_CollisionBounds_PlaySpaceOn_Bool = "CollisionBoundsPlaySpaceOn";
+__attribute__((unused)) static const char * k_pch_CollisionBounds_FadeDistance_Float = "CollisionBoundsFadeDistance";
+__attribute__((unused)) static const char * k_pch_CollisionBounds_ColorGammaR_Int32 = "CollisionBoundsColorGammaR";
+__attribute__((unused)) static const char * k_pch_CollisionBounds_ColorGammaG_Int32 = "CollisionBoundsColorGammaG";
+__attribute__((unused)) static const char * k_pch_CollisionBounds_ColorGammaB_Int32 = "CollisionBoundsColorGammaB";
+__attribute__((unused)) static const char * k_pch_CollisionBounds_ColorGammaA_Int32 = "CollisionBoundsColorGammaA";
+__attribute__((unused)) static const char * k_pch_Camera_Section = "camera";
+__attribute__((unused)) static const char * k_pch_Camera_EnableCamera_Bool = "enableCamera";
+__attribute__((unused)) static const char * k_pch_Camera_EnableCameraInDashboard_Bool = "enableCameraInDashboard";
+__attribute__((unused)) static const char * k_pch_Camera_EnableCameraForCollisionBounds_Bool = "enableCameraForCollisionBounds";
+__attribute__((unused)) static const char * k_pch_Camera_EnableCameraForRoomView_Bool = "enableCameraForRoomView";
+__attribute__((unused)) static const char * k_pch_Camera_BoundsColorGammaR_Int32 = "cameraBoundsColorGammaR";
+__attribute__((unused)) static const char * k_pch_Camera_BoundsColorGammaG_Int32 = "cameraBoundsColorGammaG";
+__attribute__((unused)) static const char * k_pch_Camera_BoundsColorGammaB_Int32 = "cameraBoundsColorGammaB";
+__attribute__((unused)) static const char * k_pch_Camera_BoundsColorGammaA_Int32 = "cameraBoundsColorGammaA";
+__attribute__((unused)) static const char * k_pch_Camera_BoundsStrength_Int32 = "cameraBoundsStrength";
+__attribute__((unused)) static const char * k_pch_audio_Section = "audio";
+__attribute__((unused)) static const char * k_pch_audio_OnPlaybackDevice_String = "onPlaybackDevice";
+__attribute__((unused)) static const char * k_pch_audio_OnRecordDevice_String = "onRecordDevice";
+__attribute__((unused)) static const char * k_pch_audio_OnPlaybackMirrorDevice_String = "onPlaybackMirrorDevice";
+__attribute__((unused)) static const char * k_pch_audio_OffPlaybackDevice_String = "offPlaybackDevice";
+__attribute__((unused)) static const char * k_pch_audio_OffRecordDevice_String = "offRecordDevice";
+__attribute__((unused)) static const char * k_pch_audio_VIVEHDMIGain = "viveHDMIGain";
+__attribute__((unused)) static const char * k_pch_Power_Section = "power";
+__attribute__((unused)) static const char * k_pch_Power_PowerOffOnExit_Bool = "powerOffOnExit";
+__attribute__((unused)) static const char * k_pch_Power_TurnOffScreensTimeout_Float = "turnOffScreensTimeout";
+__attribute__((unused)) static const char * k_pch_Power_TurnOffControllersTimeout_Float = "turnOffControllersTimeout";
+__attribute__((unused)) static const char * k_pch_Power_ReturnToWatchdogTimeout_Float = "returnToWatchdogTimeout";
+__attribute__((unused)) static const char * k_pch_Power_AutoLaunchSteamVROnButtonPress = "autoLaunchSteamVROnButtonPress";
+__attribute__((unused)) static const char * k_pch_Power_PauseCompositorOnStandby_Bool = "pauseCompositorOnStandby";
+__attribute__((unused)) static const char * k_pch_Dashboard_Section = "dashboard";
+__attribute__((unused)) static const char * k_pch_Dashboard_EnableDashboard_Bool = "enableDashboard";
+__attribute__((unused)) static const char * k_pch_Dashboard_ArcadeMode_Bool = "arcadeMode";
+__attribute__((unused)) static const char * k_pch_modelskin_Section = "modelskins";
+__attribute__((unused)) static const char * k_pch_Driver_Enable_Bool = "enable";
+__attribute__((unused)) static const char * IVRScreenshots_Version = "IVRScreenshots_001";
+__attribute__((unused)) static const char * IVRResources_Version = "IVRResources_001";
+__attribute__((unused)) static const char * IVRDriverManager_Version = "IVRDriverManager_001";
// OpenVR Enums
@@ -1370,7 +1370,7 @@ typedef struct VREvent_Status_t
typedef struct VREvent_Keyboard_t
{
- char * cNewInput[8]; //char[8]
+ char cNewInput[8]; //char[8]
uint64_t uUserValue;
} VREvent_Keyboard_t;
@@ -1990,7 +1990,7 @@ struct VR_IVROverlay_FnTable
struct VR_IVRRenderModels_FnTable
{
- EVRRenderModelError (OPENVR_FNTABLE_CALLTYPE *LoadRenderModel_Async)(char * pchRenderModelName, struct RenderModel_t ** ppRenderModel);
+ EVRRenderModelError (OPENVR_FNTABLE_CALLTYPE *LoadRenderModel_Async)(const char * pchRenderModelName, struct RenderModel_t ** ppRenderModel);
void (OPENVR_FNTABLE_CALLTYPE *FreeRenderModel)(struct RenderModel_t * pRenderModel);
EVRRenderModelError (OPENVR_FNTABLE_CALLTYPE *LoadTexture_Async)(TextureID_t textureId, struct RenderModel_TextureMap_t ** ppTexture);
void (OPENVR_FNTABLE_CALLTYPE *FreeTexture)(struct RenderModel_TextureMap_t * pTexture);
@@ -2056,7 +2056,7 @@ struct VR_IVRDriverManager_FnTable
};
-#if 0
+#if 1
// Global entry points
S_API intptr_t VR_InitInternal( EVRInitError *peError, EVRApplicationType eType );
S_API void VR_ShutdownInternal();
@@ -2068,5 +2068,3 @@ S_API const char * VR_GetVRInitErrorAsEnglishDescription( EVRInitError error );
#endif
#endif // __OPENVR_API_FLAT_H__
-
-
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment