Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
VR-demos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nomad-lab
VR-demos
Commits
13f24519
Commit
13f24519
authored
Feb 26, 2018
by
Ruben Jesus Garcia Hernandez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add NOMAD License to various files.
Add InfoCube to Vive.
parent
70378f53
Changes
29
Hide whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
742 additions
and
92 deletions
+742
-92
NOMADVRLib/CompileGLShader.cpp
NOMADVRLib/CompileGLShader.cpp
+17
-0
NOMADVRLib/CompileGLShader.h
NOMADVRLib/CompileGLShader.h
+17
-0
NOMADVRLib/ConfigFile.cpp
NOMADVRLib/ConfigFile.cpp
+45
-0
NOMADVRLib/ConfigFile.h
NOMADVRLib/ConfigFile.h
+29
-0
NOMADVRLib/Grid.cpp
NOMADVRLib/Grid.cpp
+17
-0
NOMADVRLib/Grid.h
NOMADVRLib/Grid.h
+17
-0
NOMADVRLib/IsoShaders.cpp
NOMADVRLib/IsoShaders.cpp
+19
-12
NOMADVRLib/IsoShaders.h
NOMADVRLib/IsoShaders.h
+17
-0
NOMADVRLib/IsosurfacesGL.cpp
NOMADVRLib/IsosurfacesGL.cpp
+21
-9
NOMADVRLib/IsosurfacesGL.h
NOMADVRLib/IsosurfacesGL.h
+17
-0
NOMADVRLib/MyGL.h
NOMADVRLib/MyGL.h
+16
-0
NOMADVRLib/TessShaders.cpp
NOMADVRLib/TessShaders.cpp
+18
-18
NOMADVRLib/TessShaders.h
NOMADVRLib/TessShaders.h
+16
-0
NOMADVRLib/UnitCellShaders.cpp
NOMADVRLib/UnitCellShaders.cpp
+16
-0
NOMADVRLib/UnitCellShaders.h
NOMADVRLib/UnitCellShaders.h
+16
-0
NOMADVRLib/atoms.cpp
NOMADVRLib/atoms.cpp
+17
-0
NOMADVRLib/atoms.hpp
NOMADVRLib/atoms.hpp
+16
-0
NOMADVRLib/atomsGL.cpp
NOMADVRLib/atomsGL.cpp
+90
-0
NOMADVRLib/atomsGL.h
NOMADVRLib/atomsGL.h
+23
-0
NOMADVRLib/eprintf.h
NOMADVRLib/eprintf.h
+17
-0
NOMADVRLib/markerShaders.cpp
NOMADVRLib/markerShaders.cpp
+17
-4
NOMADVRLib/markerShaders.h
NOMADVRLib/markerShaders.h
+17
-0
NOMADVRLib/polyhedron.cpp
NOMADVRLib/polyhedron.cpp
+20
-1
NOMADVRLib/polyhedron.h
NOMADVRLib/polyhedron.h
+19
-1
OpenVR/TimestepData/LoadPNG.cpp
OpenVR/TimestepData/LoadPNG.cpp
+50
-0
OpenVR/TimestepData/LoadPNG.h
OpenVR/TimestepData/LoadPNG.h
+7
-0
OpenVR/TimestepData/hellovr_opengl_main.cpp
OpenVR/TimestepData/hellovr_opengl_main.cpp
+151
-15
OpenVR/TimestepData/hsv.c
OpenVR/TimestepData/hsv.c
+0
-31
OpenVR/TimestepData/hsv.h
OpenVR/TimestepData/hsv.h
+0
-1
No files found.
NOMADVRLib/CompileGLShader.cpp
View file @
13f24519
/*
# Copyright 2016-2018 The NOMAD Developers Group
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
*/
#include <stdio.h>
#include "MyGL.h"
#include "eprintf.h"
...
...
NOMADVRLib/CompileGLShader.h
View file @
13f24519
/*
# Copyright 2016-2018 The NOMAD Developers Group
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
*/
#include "MyGL.h"
#define SHADERNAME 0
...
...
NOMADVRLib/ConfigFile.cpp
View file @
13f24519
/*
# Copyright 2016-2018 The NOMAD Developers Group
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
*/
#include <algorithm>
#include <errno.h>
#include <string.h>
...
...
@@ -46,6 +63,8 @@ int voxelSize[3];
float
unitcellcolour
[
4
];
float
supercellcolour
[
4
];
float
infolinecolour
[
4
];
int
repetitions
[
3
];
Solid
*
solid
;
...
...
@@ -65,6 +84,8 @@ float cubetrans[3];
float
animationspeed
;
float
movementspeed
;
std
::
vector
<
information
>
info
;
const
char
*
loadConfigFileErrors
[]
=
{
"All Ok"
,
//0
...
...
@@ -214,6 +235,11 @@ void initState()
animationspeed
=
1.0
f
;
movementspeed
=
1.0
f
;
infolinecolour
[
0
]
=
1.0
f
;
infolinecolour
[
1
]
=
1.0
f
;
infolinecolour
[
2
]
=
0.0
f
;
infolinecolour
[
3
]
=
1.0
f
;
}
int
loadConfigFile
(
const
char
*
f
)
...
...
@@ -609,6 +635,10 @@ int loadConfigFile(const char * f)
r
=
fscanf
(
F
,
"%f %f %f"
,
atomtrajectorycolour
,
atomtrajectorycolour
+
1
,
atomtrajectorycolour
+
2
);
if
(
r
<
3
)
eprintf
(
"Error reading atomtrajectorycolour value"
);
}
else
if
(
!
strcmp
(
s
,
"infolinecolour"
))
{
r
=
fscanf
(
F
,
"%f %f %f"
,
infolinecolour
,
infolinecolour
+
1
,
infolinecolour
+
2
);
if
(
r
<
3
)
eprintf
(
"Error reading atomtrajectorycolour value"
);
}
else
if
(
!
strcmp
(
s
,
"animationspeed"
))
{
r
=
fscanf
(
F
,
"%f"
,
&
animationspeed
);
if
(
r
<
1
)
...
...
@@ -617,6 +647,21 @@ int loadConfigFile(const char * f)
r
=
fscanf
(
F
,
"%f"
,
&
movementspeed
);
if
(
r
<
1
)
eprintf
(
"Error reading movementspeed"
);
#ifdef WIN32
}
else
if
(
!
strcmp
(
s
,
"info"
))
{
information
i
;
r
=
fscanf
(
F
,
"%f %f %f %f %d"
,
i
.
pos
,
i
.
pos
+
1
,
i
.
pos
+
2
,
&
(
i
.
size
),
&
(
i
.
atom
));
if
(
r
<
5
)
eprintf
(
"Error reading info"
);
r
=
readString
(
F
,
s
);
if
(
r
!=
0
)
eprintf
(
"Error reading info"
);
char
file
[
256
];
sprintf
(
file
,
"%s%s"
,
PATH
,
s
);
i
.
filename
=
strdup
(
file
);
//i.tex=LoadPNG(i.filename); //opengl not initialized yet
info
.
push_back
(
i
);
#endif
}
else
if
(
!
strcmp
(
s
,
"
\x0d
"
))
{
//discard windows newline (problem in Sebastian Kokott's phone (?!)
continue
;
}
else
{
...
...
NOMADVRLib/ConfigFile.h
View file @
13f24519
/*
# Copyright 2016-2018 The NOMAD Developers Group
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
*/
#ifndef __CONFIGFILE_H
#define __CONFIGFILE_H
#include <vector>
#include "MyGL.h"
#include "polyhedron.h"
extern
const
char
*
PATH
;
...
...
@@ -40,6 +57,8 @@ extern float markerscaling;
extern
float
unitcellcolour
[
4
];
extern
float
supercellcolour
[
4
];
extern
float
infolinecolour
[
4
];
extern
int
repetitions
[
3
];
extern
Solid
*
solid
;
...
...
@@ -67,4 +86,14 @@ extern const char * loadConfigFileErrors[];
int
loadConfigFile
(
const
char
*
f
);
struct
information
{
float
pos
[
3
];
float
size
;
int
atom
;
//-1=do not draw line
const
char
*
filename
;
GLuint
tex
;
};
extern
std
::
vector
<
information
>
info
;
#endif //__CONFIGFILE_H
NOMADVRLib/Grid.cpp
View file @
13f24519
/*
# Copyright 2016-2018 The NOMAD Developers Group
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
*/
#include "Grid.h"
#include "atoms.hpp" //for radius
#include <math.h>
...
...
NOMADVRLib/Grid.h
View file @
13f24519
/*
# Copyright 2016-2018 The NOMAD Developers Group
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
*/
#include <vector>
class
grid
...
...
NOMADVRLib/IsoShaders.cpp
View file @
13f24519
/*
# Copyright 2016-2018 The NOMAD Developers Group
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
*/
#include "IsoShaders.h"
#define GRIDSTR "1"
...
...
@@ -55,21 +71,15 @@ const char *const IsoTransparentShaders [] = {"Iso Transparent Renderer",
"layout(location = 0) in vec4 position;
\n
"
"layout(location = 1) in vec3 normalsIn;
\n
"
"layout(location = 2) in vec4 colorIn;
\n
"
// "layout(location = 3) in vec2 uvIn;\n"
"out vec4 color;
\n
"
"out vec3 n;
\n
"
"out highp vec4 pos;
\n
"
// "out vec2 uv;\n"
"void main()
\n
"
"{
\n
"
" color = vec4(colorIn.rgba);
\n
"
" n=normalize(normalsIn);
\n
"
// " uv=uvIn;\n"
// "int i=gl_InstanceID / " GRIDSTR ";\n"
// "int j=gl_InstanceID % " GRIDSTR ";\n"
" pos = matrix * (position /*+ vec4 (float(i)*0.15*101.0, 0, float(j)*0.15*101.0, 0)*/);
\n
"
" pos = matrix * position;
\n
"
" gl_Position = pos;
\n
"
//" gl_Position = matrix * position;\n"
"}
\n
"
,
// Fragment Shader
...
...
@@ -86,16 +96,13 @@ const char *const IsoTransparentShaders [] = {"Iso Transparent Renderer",
"void main()
\n
"
"{
\n
"
"highp vec4 mytex=texture(diffuse, vec2(pos.x/pos.w*0.5+0.5, pos.y/pos.w*0.5+0.5));
\n
"
//http://www.gamedev.net/topic/556521-glsl-manual-shadow-map-biasscale/
//"vec2 d=vec2(dFdx(pos.z), dFdy(pos.z));\n"
//"highp float m=sqrt(d.x*d.x + d.y*d.y);\n"
"if ((pos.z/pos.w+1.0)/2.0 <= mytex.r+0.0001 ) discard;
\n
"
"if ((pos.z/pos.w+1.0)/2.0 <= mytex.r+0.00001 ) discard;
\n
"
"lowp vec3 nn=normalize(n);"
"lowp float a=max(0.0, dot(nn, vec3(0,sqrt(2.0)/2.0,sqrt(2.0)/2.0)));
\n
"
"lowp float b=max(0.0, dot(nn, vec3(0,0,1)));
\n
"
"highp vec4 res=color;
\n
"
//"outputColor = vec4(pos.x/pos.w*0.5+0.5, pos.y/pos.w*0.5+0.5, 0,1);\n"
" outputColor = vec4 ((res.rgb) * (0.2 + 0.2*a + 0.3*b), color.a);
\n
"
"}
\n
"
,
...
...
NOMADVRLib/IsoShaders.h
View file @
13f24519
/*
# Copyright 2016-2018 The NOMAD Developers Group
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
*/
extern
const
char
*
const
IsoShaders
[];
extern
const
char
*
const
IsoTransparentShaders
[];
extern
const
char
*
const
IsoBlendShaders
[];
NOMADVRLib/IsosurfacesGL.cpp
View file @
13f24519
//#if 0
/*Uses code from rply which uses the MIT license*/
/*http://w3.impa.br/~diego/software/rply/*/
/*This license is compatible with Apache 2.0*/
/*
# Copyright 2016-2018 The NOMAD Developers Group
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
*/
#include <vector>
#include <math.h>
...
...
@@ -153,11 +171,7 @@ int vertex_cb(p_ply_argument argument) {
int
face_cb
(
p_ply_argument
argument
)
{
long
length
,
value_index
;
// int v;
ply_get_argument_property
(
argument
,
nullptr
,
&
length
,
&
value_index
);
//discard the first call with a 3
//if (value_index == 0 && 3 != (v = (int)ply_get_argument_value(argument)))
// dprintf("Non-triangular face: %d vertices\n", v);
if
(
value_index
>=
0
&&
value_index
<=
2
)
CubeIndices
[
CurrentIndex
++
]
=
(
int
)(
ply_get_argument_value
(
argument
));
...
...
@@ -350,13 +364,11 @@ if ((e = glGetError()) != GL_NO_ERROR)
#else
void
CleanDepthTexture
(
GLuint
t
,
int
width
,
int
height
)
{
//eprintf ("CleanDepthTexture, t %d, w %d, h %d\n", t, width, height);
GLenum
e
;
const
std
::
vector
<
float
>
z
(
width
*
height
*
4
,
0.0
f
);
glBindTexture
(
GL_TEXTURE_2D
,
t
);
if
((
e
=
glGetError
())
!=
GL_NO_ERROR
)
eprintf
(
"CleanDepthTexture: Gl error after glBindTexture: %d
\n
"
,
e
);
//rgh FIXME: invalid operation here:
glTexSubImage2D
(
GL_TEXTURE_2D
,
0
,
0
,
0
,
width
,
height
,
GL_DEPTH_COMPONENT
,
GL_FLOAT
,
z
.
data
());
if
((
e
=
glGetError
())
!=
GL_NO_ERROR
)
eprintf
(
"CleanDepthTexture: Gl error after glTexSubImage2D: %d
\n
"
,
e
);
...
...
@@ -416,7 +428,7 @@ return glGetError();
GLenum
SetupBlending
(
GLuint
*
vao
,
GLuint
*
vertex
,
GLuint
*
indices
)
{
GLenum
e
;
float
z
=
0.0
f
;
//(m_fNearClip + m_fFarClip) / 2.0f;
float
z
=
0.0
f
;
const
float
points
[]
=
{
-
1
,
-
1
,
z
,
0
,
0
,
-
1
,
1
,
z
,
0
,
1
,
...
...
@@ -482,4 +494,4 @@ if ((e = glGetError()) != GL_NO_ERROR)
eprintf
(
"Gl error BlendTextures glDrawElements: %d
\n
"
,
e
);
}
}
//#endif
NOMADVRLib/IsosurfacesGL.h
View file @
13f24519
/*
# Copyright 2016-2018 The NOMAD Developers Group
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
*/
#ifndef __ISOSURFACESGL_H
#define __ISOSURFACESGL_H
...
...
NOMADVRLib/MyGL.h
View file @
13f24519
/*
# Copyright 2016-2018 The NOMAD Developers Group
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
*/
#ifndef __MYGL_H
#define __MYGL_H
...
...
NOMADVRLib/TessShaders.cpp
View file @
13f24519
/*
# Copyright 2016-2018 The NOMAD Developers Group
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
*/
#include "TessShaders.h"
/*rgh: for now default tesselation control, using
...
...
@@ -16,18 +32,16 @@ const char * const AtomShaders [] = {
"#version 300 es
\n
"
#endif
"uniform sampler2D atomData;
\n
"
"uniform float totalatoms;
\n
"
//(float)atomsInPeriodicTable
"uniform float totalatoms;
\n
"
//(float)atomsInPeriodicTable
"layout(location = 0) in vec3 center;
\n
"
"layout(location = 1) in float atomIn;
\n
"
"out vec4 vcolor;
\n
"
//color , radius
"out vec3 vcen;"
"void main()
\n
"
"{
\n
"
//"gl_Position = matrix * vec4(position+center, 1);\n"
"float coord=atomIn/totalatoms+0.5/totalatoms;
\n
"
"vcolor=vec4(texture(atomData, vec2(coord, 0)));
\n
"
"vcen=center;
\n
"
//"color.a=1;\n"
"}
\n
"
,
//fragment shader
...
...
@@ -37,20 +51,14 @@ const char * const AtomShaders [] = {
"#version 300 es
\n
"
#endif
"in lowp vec4 color;
\n
"
// "in highp vec3 vertex;"
"in highp vec3 normal;"
"out lowp vec4 outputColor;
\n
"
"void main()
\n
"
"{
\n
"
//"vec3 U = dFdx(vertex); "
//"vec3 V = dFdy(vertex); "
"highp vec3 nn = normalize(normal);"
//"vec3 nn = normalize(cross(U,V));"
"lowp float a=abs(dot(nn, vec3(0,sqrt(2.0)/2.0,sqrt(2.0)/2.0)));
\n
"
"lowp float b=max(0.0, dot(nn, vec3(0,0,1)));
\n
"
"highp vec4 res=color;
\n
"
//rgh FIXME: make this depend on the background colour. Otherwise looks almost black with white background
//version for white background:
" outputColor = vec4 ((res.rgb) * (0.4 + 0.3*a + 0.3*b), color.a);
\n
"
"}
\n
"
,
...
...
@@ -60,18 +68,13 @@ const char * const AtomShaders [] = {
#else
"#version 320 es
\n
"
#endif
//"layout(triangles, equal_spacing, cw) in;\n"
"layout(quads, equal_spacing, cw) in;
\n
"
"#define pi 3.1415926535897932384626433832795
\n
"
"uniform mat4 matrix;
\n
"
//"uniform mat4 mv;\n"
"in vec4 vcolor[];
\n
"
//color , radius
"in vec3 vcen[];"
"out vec4 color;
\n
"
//color
"out vec3 normal;
\n
"
// "out vec3 vertex;"
// "uniform mat4 Projection;\n"
// "uniform mat4 Modelview;\n"
"void main()
\n
"
"{
\n
"
...
...
@@ -87,8 +90,6 @@ const char * const AtomShaders [] = {
const
char
*
const
AtomShadersNoTess
[]
=
{
"Atom Renderer No Tess"
,
//No Tess means smooth shading looks very strange. Better use per-face lighting
// vertex shader
//Android 21 gives error: only supports up to '310 es'
#if defined(WIN32) || defined(CAVE)
"#version 410
\n
"
...
...
@@ -97,7 +98,7 @@ const char * const AtomShadersNoTess [] = {
#endif
"uniform sampler2D atomData;
\n
"
"uniform mat4 matrix;
\n
"
"uniform float totalatoms;
\n
"
//(float)atomsInPeriodicTable
"uniform float totalatoms;
\n
"
//(float)atomsInPeriodicTable
"layout(location = 0) in vec3 pos;
\n
"
"layout(location = 1) in vec3 normalIn;
\n
"
"layout(location = 2) in float atomIn;
\n
"
...
...
@@ -128,7 +129,6 @@ const char * const AtomShadersNoTess [] = {
"{
\n
"
"highp vec3 U = dFdx(vertex); "
"highp vec3 V = dFdy(vertex); "
//"highp vec3 nn = normalize(normal);\n"
"highp vec3 nn = normalize(cross(U,V));"
"lowp float a=abs(dot(nn, vec3(0,sqrt(2.0)/2.0,sqrt(2.0)/2.0)));
\n
"
"lowp float b=max(0.0, dot(nn, vec3(0,0,1)));
\n
"
...
...
NOMADVRLib/TessShaders.h
View file @
13f24519
/*
# Copyright 2016-2018 The NOMAD Developers Group
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
*/
extern
const
char
*
const
AtomShaders
[];
extern
const
char
*
const
AtomShadersNoTess
[];
NOMADVRLib/UnitCellShaders.cpp
View file @
13f24519
/*
# Copyright 2016-2018 The NOMAD Developers Group
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
*/
#include "UnitCellShaders.h"
const
char
*
const
UnitCellShaders
[]
=
{
"Unit Cell Renderer"
,
...
...
NOMADVRLib/UnitCellShaders.h
View file @
13f24519
/*
# Copyright 2016-2018 The NOMAD Developers Group
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
*/
extern
const
char
*
const
UnitCellShaders
[];
\ No newline at end of file
NOMADVRLib/atoms.cpp
View file @
13f24519
/*
# Copyright 2016-2018 The NOMAD Developers Group
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
*/
#define NOMINMAX
#include <stdio.h>
...
...
NOMADVRLib/atoms.hpp
View file @
13f24519
/*
# Copyright 2016-2018 The NOMAD Developers Group
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
*/
//Data from https://gitlab.rzg.mpg.de/nomad-lab/encyclopedia-gui/blob/lauri_viz/viztools/structure/build/js/structureviewer.js
//rgb radius for easy transference to a texture
//jmol colours from https://gitlab.com/ase/ase/blob/master/ase/data/colors.py
...
...
NOMADVRLib/atomsGL.cpp
View file @
13f24519
/*
# Copyright 2016-2018 The NOMAD Developers Group
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
*/
#include <math.h>
#include "eprintf.h"
...
...
@@ -423,6 +440,79 @@ GLenum SetupAtoms(GLuint **AtomVAO /*[4]*/, GLuint **AtomVertBuffer /*[3]*/, GLu
return
e
;
}
GLenum
SetupInfoCube
(
GLuint
*
VAO
,
GLuint
*
VertBuffer
,
GLuint
*
IndexBuffer
)
{
glGenVertexArrays
(
1
,
VAO
);
glGenBuffers
(
1
,
VertBuffer
);
glGenBuffers
(
1
,
IndexBuffer
);
glBindVertexArray
(
*
VAO
);
glBindBuffer
(
GL_ELEMENT_ARRAY_BUFFER
,
*
IndexBuffer
);
glBindBuffer
(
GL_ARRAY_BUFFER
,
*
VertBuffer
);
glEnableVertexAttribArray
(
0
);
glEnableVertexAttribArray
(
1
);
glEnableVertexAttribArray
(
2
);
glDisableVertexAttribArray
(
3
);
//vec4 pos, vec3 normal, vec2 uv
const
int
Nvert
=
9
*
26
;
const
GLfloat
vert
[]
=
{
-
1
,
+
1
,
-
1
,
0
,
0
,
0
,
-
1
,
0
,
1
,
//-z
-
1
,
-
1
,
-
1
,
0
,
0
,
0
,
-
1
,
0
,
0
,
+
1
,
+
1
,
-
1
,
0
,
0
,
0
,
-
1
,
1
,
1
,
+
1
,
-
1
,
-
1
,
0
,
0
,
0
,
-
1
,
1
,
0
,
-
1
,
+
1
,
+
1
,
0
,
0
,
0
,
1
,
0
,
0
,
//+z
-
1
,
-
1
,
+
1
,
0
,
0
,
0
,
1
,
0
,
1
,
+
1
,
+
1
,
+
1
,
0
,
0
,
0
,
1
,
1
,
0
,
+
1
,
-
1
,
+
1
,
0
,
0
,
0
,
1
,
1
,
1
,
+
1
,
-
1
,
-
1
,
0
,
+
1
,
0
,
0
,
0
,
1
,
//+x
+
1
,
-
1
,
+
1
,
0
,
+
1
,
0
,
0
,
0
,
0
,
//+x
+
1
,
+
1
,
-
1
,
0
,
+
1
,
0
,