Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Atte Sillanpaeae
VR-demos
Commits
419fea85
Commit
419fea85
authored
Apr 27, 2018
by
Ruben Jesus Garcia Hernandez
Browse files
NOMADVR for HTC Vive:
Allow multiple config files Selection of atoms Indication of atom # and atom-controller distance
parent
b7f69000
Changes
10
Hide whitespace changes
Inline
Side-by-side
NOMADVRLib/ConfigFile.cpp
View file @
419fea85
...
...
@@ -25,10 +25,9 @@
#include "eprintf.h"
#include "polyhedron.h"
const
char
*
PATH
;
const
char
*
SCREENSHOT
;
char
*
PATH
;
char
*
SCREENSHOT
;
int
ISOS
;
int
TIMESTEPS
;
float
**
isocolours
;
// [ISOS][4];
const
char
**
plyfiles
;
float
**
translations
;
...
...
@@ -113,7 +112,7 @@ const char * loadConfigFileErrors[] =
};
void
updateTIMESTEPS
(
int
timesteps
)
{
{
if
(
TIMESTEPS
==
0
)
TIMESTEPS
=
timesteps
;
else
...
...
@@ -164,16 +163,64 @@ while (*file!='\0') {
}
}
void
cleanConfig
()
{
for
(
int
i
=
0
;
i
<
ISOS
;
i
++
)
{
delete
[]
isocolours
[
i
];
delete
[]
translations
[
i
];
}
delete
[]
isocolours
;
isocolours
=
nullptr
;
delete
[]
translations
;
translations
=
nullptr
;
if
(
plyfiles
)
{
for
(
int
i
=
0
;
i
<
ISOS
;
i
++
)
free
((
void
*
)(
plyfiles
[
i
]));
//strdup
delete
[]
plyfiles
;
}
plyfiles
=
nullptr
;
free
(
PATH
);
PATH
=
nullptr
;
atomtrajectoryrestarts
.
clear
();
free
(
SCREENSHOT
);
SCREENSHOT
=
nullptr
;
if
(
markers
)
{
for
(
int
i
=
0
;
i
<
TIMESTEPS
;
i
++
)
{
delete
[]
markers
[
i
];
delete
[]
markercolours
[
i
];
}
delete
[]
markers
;
delete
[]
markercolours
;
markers
=
nullptr
;
markercolours
=
nullptr
;
}
for
(
int
i
=
0
;
i
<
info
.
size
();
i
++
)
{
free
(
info
[
i
].
filename
);
}
info
.
clear
();
if
(
numAtoms
)
{
for
(
int
i
=
0
;
i
<
getAtomTimesteps
();
i
++
)
{
delete
[]
atoms
[
i
];
}
delete
[]
atoms
;
delete
[]
numAtoms
;
numAtoms
=
nullptr
;
atoms
=
nullptr
;
}
}
void
initState
()
{
BACKGROUND
[
0
]
=
0.95
f
;
BACKGROUND
[
1
]
=
0.95
f
;
BACKGROUND
[
2
]
=
0.95
f
;
SCREENSHOT
=
"C:
\\
temp
\\
frame"
;
SCREENSHOT
=
strdup
(
"C:
\\
temp
\\
frame"
)
;
ISOS
=
0
;
TIMESTEPS
=
0
;
PATH
=
strdup
(
""
);
numAtoms
=
0
;
numAtoms
=
nullptr
;
atomScaling
=
1
;
clonedAtoms
=
0
;
fixedAtoms
=
false
;
...
...
@@ -357,6 +404,7 @@ int loadConfigFile(const char * f)
r
=
readString
(
F
,
s
);
if
(
r
!=
0
)
return
-
14
;
free
(
SCREENSHOT
);
SCREENSHOT
=
strdup
(
s
);
}
else
if
(
!
strcmp
(
s
,
"xyzfile"
)
||!
strcmp
(
s
,
"atomfile"
))
{
...
...
NOMADVRLib/ConfigFile.h
View file @
419fea85
...
...
@@ -21,10 +21,9 @@
#include "polyhedron.h"
#include "ConfigFileAtoms.h"
extern
const
char
*
PATH
;
extern
const
char
*
SCREENSHOT
;
extern
char
*
PATH
;
extern
char
*
SCREENSHOT
;
extern
int
ISOS
;
extern
int
TIMESTEPS
;
extern
float
**
isocolours
;
// [ISOS][4];
extern
const
char
**
plyfiles
;
extern
float
**
translations
;
...
...
@@ -81,13 +80,14 @@ extern float ** markercolours;
extern
const
char
*
loadConfigFileErrors
[];
void
cleanConfig
();
int
loadConfigFile
(
const
char
*
f
);
struct
information
{
float
pos
[
3
];
float
size
;
int
atom
;
//-1=do not draw line
const
char
*
filename
;
char
*
filename
;
GLuint
tex
;
};
...
...
NOMADVRLib/atoms.cpp
View file @
419fea85
...
...
@@ -44,10 +44,19 @@ const char * TMPDIR;//filled by main
bool
inv_abc_init
=
false
;
float
inv_abc
[
3
][
3
];
int
TIMESTEPS
;
std
::
vector
<
const
char
*>
extraAtomNames
;
std
::
vector
<
float
*>
extraAtomData
;
int
getAtomTimesteps
()
{
if
(
fixedAtoms
)
return
1
;
else
return
TIMESTEPS
;
}
const
char
*
const
atomNames
[]
=
{
...
...
@@ -208,6 +217,8 @@ do {
}
while
(
c
!=
EOF
&&
c
!=
'\n'
);
}
int
findAtom
(
const
char
*
const
s
)
{
//discard number at end
...
...
@@ -252,6 +263,17 @@ const char * readAtomsXYZErrors[] = {
"Corrupt xyz file"
//-4
};
void
cleanAtoms
(
int
**
numatoms
,
int
timesteps
,
float
***
pos
)
{
for
(
int
i
=
0
;
i
<
timesteps
;
i
++
)
{
delete
[]
((
*
pos
)[
i
]);
}
delete
[]
(
*
numatoms
);
*
numatoms
=
nullptr
;
delete
[]
(
*
pos
);
*
pos
=
nullptr
;
}
int
readAtomsXYZ
(
const
char
*
const
file
,
int
**
numatoms
,
int
*
timesteps
,
float
***
pos
)
{
int
mynumatoms
;
...
...
NOMADVRLib/atoms.hpp
View file @
419fea85
...
...
@@ -31,6 +31,8 @@ const int atomsInPeriodicTable=118;
extern
const
char
*
TMPDIR
;
int
getAtomTimesteps
();
void
cleanAtoms
(
int
**
numatoms
,
int
timesteps
,
float
***
pos
);
int
readAtomsXYZ
(
const
char
*
const
file
,
int
**
numatoms
,
int
*
timesteps
,
float
***
pos
);
int
readAtomsCube
(
const
char
*
const
file
,
int
**
numatoms
,
int
*
timesteps
,
float
***
pos
);
int
readAtomsJson
(
const
char
*
const
file
,
int
**
numatoms
,
int
*
timesteps
,
float
***
pos
,
float
abc
[
3
][
3
],
std
::
vector
<
float
>**
clonedAtoms
,
const
char
*
const
token
=
0
);
...
...
@@ -66,4 +68,6 @@ extern const char * const atomNames[];
extern
std
::
vector
<
const
char
*>
extraAtomNames
;
extern
std
::
vector
<
float
*>
extraAtomData
;
extern
int
TIMESTEPS
;
#endif //__ATOMS_H
NOMADVRLib/atomsGL.cpp
View file @
419fea85
...
...
@@ -28,14 +28,6 @@
#include "polyhedron.h"
#include "Grid.h"
int
getAtomTimesteps
()
{
if
(
fixedAtoms
)
return
1
;
else
return
TIMESTEPS
;
}
GLenum
atomTexture
(
GLuint
t
)
{
GLenum
e
;
...
...
@@ -230,6 +222,26 @@ if (!solid) {
return
e
;
}
//SetupAtomsNoTess
void
CleanAtoms
(
GLuint
**
AtomVAO
/*[4]*/
,
GLuint
**
AtomVertBuffer
/*[3]*/
,
GLuint
*
BondIndices
)
{
if
(
!
numAtoms
)
return
;
glDeleteVertexArrays
(
4
,
*
AtomVAO
);
glDeleteBuffers
(
3
,
*
AtomVertBuffer
);
glDeleteBuffers
(
1
,
BondIndices
);
delete
[]
(
*
AtomVAO
);
delete
[]
(
*
AtomVertBuffer
);
*
AtomVAO
=
nullptr
;
*
AtomVertBuffer
=
nullptr
;
if
(
numBonds
)
delete
[]
numBonds
;
numBonds
=
nullptr
;
bonds
.
clear
();
}
GLenum
SetupAtoms
(
GLuint
**
AtomVAO
/*[4]*/
,
GLuint
**
AtomVertBuffer
/*[3]*/
,
GLuint
*
BondIndices
)
{
...
...
@@ -245,7 +257,7 @@ GLenum SetupAtoms(GLuint **AtomVAO /*[4]*/, GLuint **AtomVertBuffer /*[3]*/, GLu
for
(
int
i
=
0
;
i
<
getAtomTimesteps
()
;
i
++
)
{
totalatoms
+=
numAtoms
[
i
];
}
eprintf
(
"SetupAtoms: totalatoms=%d"
,
totalatoms
);
//
eprintf("SetupAtoms: totalatoms=%d", totalatoms);
*
AtomVAO
=
new
GLuint
[
4
];
//atoms, cloned atoms, bonds, trajectories
*
AtomVertBuffer
=
new
GLuint
[
3
];
//atoms, cloned atoms, trajectories
...
...
@@ -437,6 +449,13 @@ GLenum SetupAtoms(GLuint **AtomVAO /*[4]*/, GLuint **AtomVertBuffer /*[3]*/, GLu
return
e
;
}
void
CleanInfoCube
(
GLuint
*
VAO
,
GLuint
*
VertBuffer
,
GLuint
*
IndexBuffer
)
{
glDeleteVertexArrays
(
1
,
VAO
);
glDeleteBuffers
(
1
,
VertBuffer
);
glDeleteBuffers
(
1
,
IndexBuffer
);
}
GLenum
SetupInfoCube
(
GLuint
*
VAO
,
GLuint
*
VertBuffer
,
GLuint
*
IndexBuffer
)
{
glGenVertexArrays
(
1
,
VAO
);
...
...
@@ -606,6 +625,12 @@ GLenum SetupMarkerNoTess(GLuint *MarkerVAO, GLuint *MarkerVertBuffer, GLuint *Ma
return
e
;
}
void
CleanMarker
(
GLuint
*
MarkerVAO
,
GLuint
*
MarkerVertBuffer
)
{
glDeleteVertexArrays
(
1
,
MarkerVAO
);
glDeleteBuffers
(
1
,
MarkerVertBuffer
);
}
GLenum
SetupMarker
(
GLuint
*
MarkerVAO
,
GLuint
*
MarkerVertBuffer
)
{
//requires tesselation
if
(
!
markers
)
...
...
@@ -647,6 +672,13 @@ GLenum SetupMarker(GLuint *MarkerVAO, GLuint *MarkerVertBuffer)
return
glGetError
();
}
void
CleanUnitCell
(
GLuint
*
UnitCellVAO
,
GLuint
*
UnitCellVertBuffer
,
GLuint
*
UnitCellIndexBuffer
)
{
glDeleteVertexArrays
(
1
,
UnitCellVAO
);
glDeleteBuffers
(
1
,
UnitCellVertBuffer
);
glDeleteBuffers
(
1
,
UnitCellIndexBuffer
);
}
GLenum
SetupUnitCell
(
GLuint
*
UnitCellVAO
,
GLuint
*
UnitCellVertBuffer
,
GLuint
*
UnitCellIndexBuffer
)
{
//add here both unit cell and supercell
...
...
NOMADVRLib/atomsGL.h
View file @
419fea85
...
...
@@ -28,10 +28,14 @@
GLenum
atomTexture
(
GLuint
t
);
GLenum
SetupAtoms
(
GLuint
**
AtomVAO
,
GLuint
**
AtomVertBuffer
,
GLuint
*
BondIndices
);
void
CleanAtoms
(
GLuint
**
AtomVAO
/*[4]*/
,
GLuint
**
AtomVertBuffer
/*[3]*/
,
GLuint
*
BondIndices
);
GLenum
SetupAtomsNoTess
(
GLuint
**
AtomVAO
,
GLuint
**
AtomVertBuffer
,
GLuint
**
AtomIndexBuffer
);
void
CleanUnitCell
(
GLuint
*
UnitCellVAO
,
GLuint
*
UnitCellVertBuffer
,
GLuint
*
UnitCellIndexBuffer
);
GLenum
SetupUnitCell
(
GLuint
*
UnitCellVAO
,
GLuint
*
UnitCellVertBuffer
,
GLuint
*
UnitCellIndexBuffer
);
void
CleanMarker
(
GLuint
*
MarkerVAO
,
GLuint
*
MarkerVertBuffer
);
GLenum
SetupMarker
(
GLuint
*
MarkerVAO
,
GLuint
*
MarkerVertBuffer
);
GLenum
SetupMarkerNoTess
(
GLuint
*
MarkerVAO
,
GLuint
*
MarkerVertBuffer
,
GLuint
*
MarkerIndexBuffer
);
void
CleanInfoCube
(
GLuint
*
VAO
,
GLuint
*
VertBuffer
,
GLuint
*
IndexBuffer
);
GLenum
SetupInfoCube
(
GLuint
*
VAO
,
GLuint
*
VertBuffer
,
GLuint
*
IndexBuffer
);
bool
PrepareUnitCellAtomShader
(
GLuint
*
AtomP
,
GLuint
*
cellP
,
GLuint
*
MarkerP
,
...
...
@@ -44,7 +48,6 @@ bool PrepareMarkerShader (GLuint *MP, GLint *MMatrixLocation);
void
GetDisplacement
(
int
p
[
3
],
float
f
[
3
]);
int
getAtomTimesteps
();
inline
int
getTotalAtomsInTexture
()
{
return
atomsInPeriodicTable
+
extraAtomNames
.
size
();
...
...
OpenVR/README.md
View file @
419fea85
This repository contains the demos for HTC vive using openvr version 0.9.19
https://github.com/ValveSoftware/openvr
Clone that repository and add the content of this one inside the samples directory.
Clone that repository and add the content of this one inside the samples
directory.
After compilation, copy ..
\t
extures
\d
igits_64x7_l_blank.png to the exe's
location.
List of directories
TimestepData:
...
...
OpenVR/TimestepData/hellovr_opengl_main.cpp
View file @
419fea85
...
...
@@ -5,7 +5,7 @@
/*This code is therefore licensed under Apache 2.0*/
/*
# Copyright 2016-2018 Ruben Jesus Garcia
Hernandez
# Copyright 2016-2018 Ruben Jesus Garcia
-
Hernandez
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
...
...
@@ -36,7 +36,6 @@
#include <SDL.h>
#include <GL/glew.h>
#include <SDL_opengl.h>
//#include <SDL_ttf.h>
#include <gl/glu.h>
#include <stdio.h>
#include <string>
...
...
@@ -70,25 +69,13 @@
#define TESSSUB 16
//TTF_Font* font;
//#define LOCALTEST
/*#ifdef LOCALTEST
#define PATH "Y:\\v2t\\datasets\\mpcdf_CO2_CaO\\cubes-bigger\\IsosurfacesFixed\\"
#else
#define PATH "data\\CO2-CaO-B\\"
//#define PATH "C:\\Users\\mobile\\Desktop\\openvrDemos\\win64\\data\\CO2-CaO-B\\"
#endif
*/
#define ZLAYERS transparencyquality
#define NUMBERTEXTURE "digits_64x7_l_blank.png"
//png
#define MAXGPU 300
//shown on https://www.vbw-bayern.de/vbw/Aktionsfelder/Innovation-F-T/Forschung-und-Technologie/Zukunft-digital-Big-Data.jsp
#define GRID 1
#define NUMLODS 1
...
...
@@ -147,11 +134,14 @@ public:
bool
SetupDepthPeeling
();
void
SetupScene
();
void
CleanScene
();
void
SetupIsosurfaces
();
void
SetupAtoms
();
void
SetupUnitCell
();
void
SetupMarker
();
void
SetupInfoCube
();
void
SetupInfoBoxTexture
();
void
DrawControllers
();
...
...
@@ -220,8 +210,9 @@ private: // OpenGL bookkeeping
int
m_iValidPoseCount
;
int
m_iValidPoseCount_Last
;
bool
m_bShowCubes
;
bool
buttonPressed
[
2
][
vr
::
k_unMaxTrackedDeviceCount
];
//grip, application menu
bool
AtomsButtonPressed
[
2
];
bool
buttonPressed
[
3
][
vr
::
k_unMaxTrackedDeviceCount
];
//grip, application menu, nextConfig (up/down in circle)
//bool AtomsButtonPressed[3];
bool
showAtoms
;
std
::
string
m_strPoseClasses
;
// what classes we saw poses for this frame
char
m_rDevClassChar
[
vr
::
k_unMaxTrackedDeviceCount
];
// for each device, a character representing its class
...
...
@@ -320,6 +311,7 @@ private: // OpenGL bookkeeping
GLint
m_nUnitCellMatrixLocation
,
m_nUnitCellColourLocation
;
GLint
m_nMarkerMatrixLocation
;
GLint
m_nTotalatomsLocation
;
GLint
m_nSelectedAtomLocation
;
struct
FramebufferDesc
{
...
...
@@ -343,6 +335,19 @@ private: // OpenGL bookkeeping
char
*
pixels
,
*
pixels2
;
//for saving screenshots to disk
int
framecounter
;
bool
savetodisk
;
int
selectedAtom
;
GLuint
numbersTexture
;
bool
PrepareControllerGlyph
(
const
vr
::
Hmd_Eye
nEye
,
const
int
controller
,
Vector3
*
pos
);
void
RenderControllerGlyph
(
const
vr
::
Hmd_Eye
nEye
,
const
int
controller
);
void
RenderControllerGlyphs
(
vr
::
Hmd_Eye
nEye
);
int
LoadConfigFile
(
const
char
*
c
);
int
myargc
;
char
**
myargv
;
int
currentConfig
;
};
const
float
CMainApplication
::
videospeed
=
0.01
f
;
...
...
@@ -393,6 +398,40 @@ void eprintf( const char *fmt, ... )
MessageBoxA
(
0
,
buffer
,
"Warning"
,
0
);
}
int
CMainApplication
::
LoadConfigFile
(
const
char
*
c
)
{
//change cwd so that relative paths work
const
char
*
myc
=
c
;
std
::
string
s
(
c
);
std
::
string
::
size_type
l
=
s
.
find_last_of
(
"
\\
/"
);
std
::
string
mys
;
if
(
l
!=
s
.
npos
)
{
SetCurrentDirectoryA
(
s
.
substr
(
0
,
l
).
c_str
());
mys
=
s
.
substr
(
l
+
1
);
myc
=
mys
.
c_str
();
}
int
r
;
if
((
r
=
loadConfigFile
(
myc
))
<
0
)
{
if
(
-
100
<
r
)
MessageBoxA
(
0
,
loadConfigFileErrors
[
-
r
],
"Config file reading error"
,
0
);
else
if
(
-
200
<
r
)
MessageBoxA
(
0
,
readAtomsXYZErrors
[
-
r
-
100
],
"XYZ file reading error"
,
0
);
else
if
(
-
300
<
r
)
MessageBoxA
(
0
,
readAtomsCubeErrors
[
-
r
-
200
],
"Cube file reading error"
,
0
);
else
if
(
-
400
<
r
)
MessageBoxA
(
0
,
readAtomsJsonErrors
[
-
r
-
300
],
"Encyclopedia Json reading error"
,
0
);
else
MessageBoxA
(
0
,
readAtomsAnalyticsJsonErrors
[
-
r
-
400
],
"Analytics Json reading error"
,
0
);
return
-
100
+
r
;
}
if
(
solid
)
MessageBoxA
(
0
,
"Only spheres implemented as atom glyphs in HTC Vive"
,
"Atom Glyph"
,
0
);
return
r
;
}
//-----------------------------------------------------------------------------
// Purpose: Constructor
//-----------------------------------------------------------------------------
...
...
@@ -456,8 +495,14 @@ CMainApplication::CMainApplication(int argc, char *argv[])
,
pixels
(
0
)
,
framecounter
(
0
)
,
savetodisk
(
false
)
,
numbersTexture
(
0
)
,
selectedAtom
(
-
1
)
,
myargc
(
argc
)
,
myargv
(
argv
)
,
currentConfig
(
1
)
{
for
(
int
j
=
0
;
j
<
2
;
j
++
)
LoadConfigFile
(
argv
[
currentConfig
]);
for
(
int
j
=
0
;
j
<
3
;
j
++
)
for
(
int
i
=
0
;
i
<
vr
::
k_unMaxTrackedDeviceCount
;
i
++
)
{
buttonPressed
[
j
][
i
]
=
false
;
}
...
...
@@ -672,7 +717,8 @@ bool CMainApplication::BInitGL()
GLenum
e
;
SetupTexturemaps
();
if
(
!
SetupTexturemaps
())
eprintf
(
"Problem loading textures"
);
e
=
glGetError
();
if
(
e
!=
GL_NO_ERROR
)
eprintf
(
"gl error %d, %s %d"
,
e
,
__FILE__
,
__LINE__
);
...
...
@@ -747,32 +793,12 @@ void CMainApplication::Shutdown()
}
m_vecRenderModels
.
clear
();
if
(
vertdataarray
)
{
for
(
int
i
=
0
;
i
<
NUMLODS
;
i
++
)
if
(
vertdataarray
[
i
])
delete
[]
vertdataarray
[
i
];
delete
[]
vertdataarray
;
vertdataarray
=
0
;
}
if
(
vertindicesarray
){
for
(
int
i
=
0
;
i
<
NUMLODS
;
i
++
)
if
(
vertindicesarray
[
i
])
delete
[]
vertindicesarray
[
i
];
delete
[]
vertindicesarray
;
vertindicesarray
=
0
;
}
CleanScene
();
if
(
m_pContext
)
{
glDebugMessageControl
(
GL_DONT_CARE
,
GL_DONT_CARE
,
GL_DONT_CARE
,
0
,
nullptr
,
GL_FALSE
);
glDebugMessageCallback
(
nullptr
,
nullptr
);
if
(
m_glSceneVertBuffer
)
{
for
(
int
i
=
0
;
i
<
NUMLODS
;
i
++
)
{
glDeleteBuffers
(
NUMPLY
,
m_glSceneVertBuffer
[
i
]);
delete
[]
(
m_glSceneVertBuffer
[
i
]);
}
delete
[]
m_glSceneVertBuffer
;
m_glSceneVertBuffer
=
nullptr
;
}
glDeleteBuffers
(
1
,
&
m_glIDVertBuffer
);
glDeleteBuffers
(
1
,
&
m_glIDIndexBuffer
);
...
...
@@ -846,14 +872,7 @@ void CMainApplication::Shutdown()
{
glDeleteVertexArrays
(
1
,
&
m_unControllerVAO
);
}
if
(
m_unSceneVAOIndices
!=
0
)
{
for
(
int
i
=
0
;
i
<
NUMLODS
;
i
++
)
{
glDeleteBuffers
(
NUMPLY
,
m_unSceneVAOIndices
[
i
]);
delete
[]
m_unSceneVAOIndices
[
i
];
}
delete
[]
m_unSceneVAOIndices
;
}
if
(
m_iTexture
!=
0
)
{
glDeleteTextures
(
3
+
ZLAYERS
+
1
,
m_iTexture
);
delete
[]
m_iTexture
;
...
...
@@ -873,22 +892,6 @@ void CMainApplication::Shutdown()
m_pWindow
=
NULL
;
}
if
(
m_uiVertcount
!=
0
)
{
for
(
int
i
=
0
;
i
<
NUMLODS
;
i
++
)
{
delete
[]
m_uiVertcount
[
i
];
}
delete
[]
m_uiVertcount
;
}
if
(
numAtoms
!=
0
)
{
for
(
int
i
=
0
;
i
<
getAtomTimesteps
();
i
++
)
{
delete
[]
atoms
[
i
];
}
delete
[]
atoms
;
delete
[]
numAtoms
;
numAtoms
=
0
;
atoms
=
0
;
}
if
(
pixels
!=
0
)
delete
[]
pixels
;
SDL_Quit
();
...
...
@@ -977,17 +980,56 @@ bool CMainApplication::HandleInput()
//this hides the controllers when buttons are pressed. Why?! ->
//rgh: the name of the variable seems to make it so :o) Possibly so that a different model can be used with the correct deformation
//m_rbShowTrackedDevice[unDevice] = state.ulButtonPressed == 0;
bool
x
=
(
state
.
ulButtonPressed
&
(
vr
::
ButtonMaskFromId
(
vr
::
k_EButton_Axis0
)
|
vr
::
ButtonMaskFromId
(
vr
::
k_EButton_ApplicationMenu
)
|
vr
::
ButtonMaskFromId
(
vr
::
k_EButton_Grip
)))
!=
0ull
;
if
(
x
)
{
if
(
firstdevice
==-
1
)
firstdevice
=
unDevice
;
else
if
(
unDevice
!=
firstdevice
&&
seconddevice
==-
1
)
seconddevice
=
unDevice
;
}
if
(
unDevice
==
firstdevice
)
{
if
(
buttonPressed
[
2
][
unDevice
]
&&
/*(state.ulButtonTouched&vr::ButtonMaskFromId(vr::k_EButton_Axis0)) == 0 &&*/
(
state
.
ulButtonPressed
&
vr
::
ButtonMaskFromId
(
vr
::
k_EButton_Axis0
))
==
0
)
buttonPressed
[
2
][
unDevice
]
=
false
;
if
(
!
buttonPressed
[
2
][
unDevice
]
&&
(
/*state.ulButtonTouched&vr::ButtonMaskFromId(vr::k_EButton_Axis0) || */
state
.
ulButtonPressed
&
vr
::
ButtonMaskFromId
(
vr
::
k_EButton_Axis0
)
)){
buttonPressed
[
2
][
unDevice
]
=
true
;
if
(
state
.
rAxis
[
0
].
y
>
-
0.4
&&
state
.
rAxis
[
0
].
y
<
0.4
&&
state
.
rAxis
[
0
].
x
<-
0.7
)
{
selectedAtom
=-
1
;
}
else
if
(
state
.
rAxis
[
0
].
y
>
0.7
&&
state
.
rAxis
[
0
].
x
>
-
0.4
&&
state
.
rAxis
[
0
].
x
<
0.4
)
{
//next config file
currentConfig
++
;
if
(
currentConfig
>=
myargc
)
currentConfig
=
1
;
CleanScene
();
LoadConfigFile
(
myargv
[
currentConfig
]);
SetupScene
();
}
else
if
(
state
.
rAxis
[
0
].
y
<
-
0.7
&&
state
.
rAxis
[
0
].
x
>
-
0.4
&&
state
.
rAxis
[
0
].
x
<
0.4
)
{
//prev config file
currentConfig
--
;
if
(
currentConfig
<=
0
)
currentConfig
=
myargc
-
1
;
CleanScene
();
LoadConfigFile
(
myargv
[
currentConfig
]);
SetupScene
();
}
}
}
if
(
!
buttonPressed
[
1
][
unDevice
]
&&
(
state
.
ulButtonTouched
&
vr
::
ButtonMaskFromId
(
vr
::
k_EButton_ApplicationMenu
)
||
state
.
ulButtonPressed
&
vr
::
ButtonMaskFromId
(
vr
::
k_EButton_ApplicationMenu
))
)
{
buttonPressed
[
1
][
unDevice
]
=
true
;
if
(
firstdevice
==
-
1
)
/*
if (firstdevice == -1)
firstdevice = unDevice;
else if(unDevice !=firstdevice && seconddevice==-1)
seconddevice=unDevice;
*/
if
(
firstdevice
==
unDevice
)
savetodisk
=
!
savetodisk
;
else
...
...
@@ -1009,11 +1051,11 @@ bool CMainApplication::HandleInput()
)
{
buttonPressed
[
0
][
unDevice
]
=
true
;
if
(
firstdevice
==
-
1
)
/*
if (firstdevice == -1)
firstdevice = unDevice;
else if(unDevice !=firstdevice && seconddevice==-1)
seconddevice=unDevice;
*/