Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Atte Sillanpaeae
VR-demos
Commits
b38a4b4e
Commit
b38a4b4e
authored
Apr 04, 2018
by
Ruben Jesus Garcia Hernandez
Browse files
Atom bonds in Google Cardboard
bondthickness parameter
parent
c579efe9
Changes
6
Hide whitespace changes
Inline
Side-by-side
GoogleCardboardAndroid/NOMADgvrT/src/main/jni/treasure_hunt_renderer.cc
View file @
b38a4b4e
...
...
@@ -1089,6 +1089,25 @@ void TreasureHuntRenderer::RenderAtoms(const float *m) //m[16]
if
((
e
=
glGetError
())
!=
GL_NO_ERROR
)
eprintf
(
"Gl error after Render cloned Atom timestep =%d: %d
\n
"
,
currentSet
,
e
);
}
// painting cloned atoms
//now bonds
if
(
numBonds
&&
displaybonds
/*&& showAtoms*/
)
{
glLineWidth
(
bondThickness
);
glBindVertexArray
(
AtomTVAO
[
2
]);
glUseProgram
(
UnitCellP
);
glUniformMatrix4fv
(
UnitCellMatrixLoc
,
1
,
GL_FALSE
,
m
);
glUniform4fv
(
UnitCellColourLoc
,
1
,
bondscolours
);
if
((
e
=
glGetError
())
!=
GL_NO_ERROR
)
eprintf
(
"Gl error after Render Atom bonds uniform timestep =%d: %d
\n
"
,
currentSet
,
e
);
if
(
currentSet
==
0
||
fixedAtoms
)
glDrawElements
(
GL_LINES
,
numBonds
[
0
],
GL_UNSIGNED_INT
,
(
void
*
)
0
);
else
glDrawElements
(
GL_LINES
,
numBonds
[
currentSet
]
-
numBonds
[
currentSet
-
1
],
GL_UNSIGNED_INT
,
(
void
*
)(
sizeof
(
int
)
*
numBonds
[
currentSet
-
1
])
);
glLineWidth
(
1.0
f
);
if
((
e
=
glGetError
())
!=
GL_NO_ERROR
)
eprintf
(
"Gl error after Render Atom bonds timestep =%d: %d
\n
"
,
currentSet
,
e
);
glBindVertexArray
(
0
);
}
}
// no tess
}
...
...
GoogleCardboardAndroid/NOMADgvrT/src/main/jni/treasure_hunt_renderer.h
View file @
b38a4b4e
...
...
@@ -130,8 +130,6 @@ void loadConfigFile(void);
//gles 2 does not have vao, porting demo to gles3
int
currentset
;
gvr
::
Mat4f
head_view_
;
gvr
::
Mat4f
model_cube_
;
gvr
::
Mat4f
camera_
;
...
...
NOMADVRLib/ConfigFile.cpp
View file @
b38a4b4e
...
...
@@ -240,6 +240,7 @@ void initState()
menubutton
=
Record
;
bondscaling
=
0.7
f
;
bondThickness
=
1.0
f
;
}
int
loadConfigFile
(
const
char
*
f
)
...
...
@@ -649,12 +650,17 @@ int loadConfigFile(const char * f)
if
(
r
<
1
)
eprintf
(
"Error reading animationspeed"
);
}
else
if
(
!
strcmp
(
s
,
""
))
{
else
if
(
!
strcmp
(
s
,
"
bondscaling
"
))
{
r
=
fscanf
(
F
,
"%f"
,
&
bondscaling
);
if
(
r
<
1
)
eprintf
(
"Error reading bondscaling"
);
bondscaling
=
sqrt
(
bondscaling
);
}
else
if
(
!
strcmp
(
s
,
"menubutton"
))
{
}
else
if
(
!
strcmp
(
s
,
"bondthickness"
))
{
r
=
fscanf
(
F
,
"%f"
,
&
bondThickness
);
if
(
r
<
1
)
eprintf
(
"Error reading bondthickness"
);
}
else
if
(
!
strcmp
(
s
,
"menubutton"
))
{
r
=
fscanf
(
F
,
"%s"
,
s
);
if
(
!
strcmp
(
s
,
"Record"
))
menubutton
=
Record
;
...
...
NOMADVRLib/ConfigFileAtoms.cpp
View file @
b38a4b4e
...
...
@@ -14,6 +14,8 @@
# limitations under the License.
*/
#include
"ConfigFileAtoms.h"
float
abc
[
3
][
3
];
//basis vectors
bool
has_abc
=
false
;
...
...
@@ -26,4 +28,5 @@ float cubetrans[3];
float
supercell
[
3
];
int
voxelSize
[
3
];
float
bondscaling
;
\ No newline at end of file
float
bondscaling
;
float
bondThickness
;
NOMADVRLib/ConfigFileAtoms.h
View file @
b38a4b4e
...
...
@@ -30,5 +30,6 @@ extern int voxelSize[3];
extern
float
supercell
[
3
];
extern
float
bondscaling
;
extern
float
bondThickness
;
#endif //CONFIGFILEATOMS_H
NOMADVRLib/atomsGL.cpp
View file @
b38a4b4e
...
...
@@ -546,7 +546,7 @@ GLenum SetupMarkerNoTess(GLuint *MarkerVAO, GLuint *MarkerVertBuffer, GLuint *Ma
for
(
int
j
=
0
;
j
<
MARKERSOLID
::
nVerts
;
j
++
)
{
for
(
int
k
=
0
;
k
<
3
;
k
++
)
{
//pos
float
s
=
getMarkerLobeScaling
(
l
,
k
);
*
current
++
=
s
*
MARKERSOLID
::
Verts
[
j
*
3
+
k
]
*
markerscaling
*
atomScaling
/*
* atomRadius(0)
*/
+
*
current
++
=
s
*
MARKERSOLID
::
Verts
[
j
*
3
+
k
]
*
markerscaling
*
atomScaling
*
atomRadius
(
0
)
+
markers
[
i
][
k
];
}
float
length
=
0
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment