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
C
CGoGN
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
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
David Cazier
CGoGN
Commits
7c02936c
Commit
7c02936c
authored
Nov 14, 2012
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update pointsprite for VR
parent
0952c461
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
15 deletions
+8
-15
include/Utils/pointSprite.frag
include/Utils/pointSprite.frag
+0
-7
include/Utils/pointSprite.geom
include/Utils/pointSprite.geom
+2
-2
include/Utils/pointSprite.h
include/Utils/pointSprite.h
+2
-2
src/Utils/pointSprite.cpp
src/Utils/pointSprite.cpp
+4
-4
No files found.
include/Utils/pointSprite.frag
View file @
7c02936c
...
...
@@ -5,8 +5,6 @@ uniform vec3 lightPos;
uniform
vec3
ambiant
;
uniform
float
size
;
#ifdef WITH_PLANE
uniform
vec3
eyePos
;
uniform
vec3
eyeY
;
VARYING_FRAG
vec3
eyePosFrag
;
#endif
...
...
@@ -21,18 +19,14 @@ uniform float size;
VARYING_FRAG
vec2
texCoord
;
VARYING_FRAG
vec3
sphereCenter
;
void
main
(
void
)
{
vec3
billboard_frag_pos
=
sphereCenter
+
vec3
(
texCoord
,
0
.
0
)
*
size
;
#ifdef WITH_PLANE
vec3
ray_direction
=
normalize
(
billboard_frag_pos
-
eyePosFrag
;);
#else
vec3
ray_direction
=
normalize
(
billboard_frag_pos
);
#endif
float
TD
=
-
dot
(
ray_direction
,
sphereCenter
);
float
c
=
dot
(
sphereCenter
,
sphereCenter
)
-
size
*
size
;
float
arg
=
TD
*
TD
-
c
;
...
...
@@ -50,5 +44,4 @@ void main(void)
float
lambertTerm
=
dot
(
N
,
L
);
gl_FragColor
=
vec4
(
colorsprite
*
lambertTerm
+
ambiant
,
1
.
0
);
}
include/Utils/pointSprite.geom
View file @
7c02936c
...
...
@@ -5,7 +5,6 @@ uniform mat4 ModelViewMatrix;
uniform
mat4
ProjectionMatrix
;
#ifdef WITH_PLANE
uniform
vec3
eyePos
;
uniform
vec3
eyeY
;
VARYING_OUT
vec4
eyePosFrag
;
#endif
...
...
@@ -51,7 +50,8 @@ void main()
vec3
V
=
sphereCenter
-
eyePosFrag
;
V
.
normalize
();
vec3
planeX
=
cross
(
V
,
eyeY
);
// vec3 planeX = cross(V, vec3(0.0,1.0,0.0));
vec3
planeX
=
vec3
(
-
V
[
2
],
0
.
0
,
V
[
0
]);
vec3
planeY
=
cross
(
X
,
V
);
corner
(
posCenter
,
planeX
,
planeY
,
-
1
.
0
,
1
.
0
);
corner
(
posCenter
,
planeX
,
planeY
,
-
1
.
0
,
-
1
.
0
);
...
...
include/Utils/pointSprite.h
View file @
7c02936c
...
...
@@ -64,7 +64,7 @@ protected:
CGoGNGLuint
m_uniform_EyePos
;
CGoGNGLuint
m_uniform_EyeY
;
//
CGoGNGLuint m_uniform_EyeY;
CGoGNGLuint
m_uniform_ambiant
;
...
...
@@ -109,7 +109,7 @@ public:
/**
* set the plane of rendering for VR rendering
*/
void
setEyePosition
(
const
Geom
::
Vec3f
&
ox
,
const
Geom
::
Vec3f
&
oy
);
void
setEyePosition
(
const
Geom
::
Vec3f
&
ep
);
/**
...
...
src/Utils/pointSprite.cpp
View file @
7c02936c
...
...
@@ -94,7 +94,7 @@ PointSprite::PointSprite(bool withColorPervertex, float radius, bool with_plane
if
(
with_plane
)
{
*
m_uniform_EyePos
=
glGetUniformLocation
(
program_handler
(),
"eyePos"
);
*
m_uniform_EyeY
=
glGetUniformLocation
(
program_handler
(),
"eyeY"
);
//
*m_uniform_EyeY = glGetUniformLocation(program_handler(),"eyeY");
}
*
m_uniform_ambiant
=
glGetUniformLocation
(
program_handler
(),
"ambiant"
);
...
...
@@ -156,11 +156,11 @@ void PointSprite::setSize(float radius)
unbind
();
}
void
PointSprite
::
setEyePosition
(
const
Geom
::
Vec3f
&
ox
,
const
Geom
::
Vec3f
&
oy
)
void
PointSprite
::
setEyePosition
(
const
Geom
::
Vec3f
&
ep
)
{
bind
();
glUniform3fv
(
*
m_uniform_EyePos
,
1
,
ox
.
data
());
glUniform3fv
(
*
m_uniform_EyeY
,
1
,
oy
.
data
());
glUniform3fv
(
*
m_uniform_EyePos
,
1
,
ep
.
data
());
//
glUniform3fv(*m_uniform_EyeY, 1, oy.data());
unbind
();
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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