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
72f0a449
Commit
72f0a449
authored
Mar 17, 2015
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add clipping plane to pointSprite
parent
77aaa844
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
1 deletion
+34
-1
CGoGN/include/Utils/Shaders/shaderSimpleColor.h
CGoGN/include/Utils/Shaders/shaderSimpleColor.h
+3
-0
CGoGN/include/Utils/pointSprite.geom
CGoGN/include/Utils/pointSprite.geom
+6
-1
CGoGN/include/Utils/pointSprite.h
CGoGN/include/Utils/pointSprite.h
+10
-0
CGoGN/include/Utils/pointSprite.vert
CGoGN/include/Utils/pointSprite.vert
+3
-0
CGoGN/src/Utils/pointSprite.cpp
CGoGN/src/Utils/pointSprite.cpp
+12
-0
No files found.
CGoGN/include/Utils/Shaders/shaderSimpleColor.h
View file @
72f0a449
...
...
@@ -67,6 +67,9 @@ public:
unsigned
int
setAttributePosition
(
VBO
*
vbo
);
void
setClippingPlane
(
const
Geom
::
Vec4f
&
plane
);
inline
void
setNoClippingPlane
()
{
setClippingPlane
(
Geom
::
Vec4f
(
0.0
f
,
0.0
f
,
0.0
f
,
0.0
f
));
}
};
}
// namespace Utils
...
...
CGoGN/include/Utils/pointSprite.geom
View file @
72f0a449
...
...
@@ -3,6 +3,9 @@
uniform
float
size
;
uniform
mat4
ModelViewMatrix
;
uniform
mat4
ProjectionMatrix
;
uniform
vec4
planeClip
;
VARYING_IN
vec3
posClip
[
1
];
#ifdef WITH_PLANE
uniform
vec3
eyePos
;
...
...
@@ -37,10 +40,11 @@ void corner( vec4 center, float x, float y)
void
main
()
{
if
(
dot
(
planeClip
,
vec4
(
posClip
[
0
],
1
.
0
))
<
0
.
0
)
{
#ifdef WITH_COLOR_PER_VERTEX
colorsprite
=
color
[
0
];
#endif
vec4
posCenter
=
ModelViewMatrix
*
POSITION_IN
(
0
);
sphereCenter
=
posCenter
.
xyz
;
...
...
@@ -65,5 +69,6 @@ void main()
#endif
EndPrimitive
();
}
}
CGoGN/include/Utils/pointSprite.h
View file @
72f0a449
...
...
@@ -63,6 +63,11 @@ protected:
Geom
::
Vec3f
m_ambiant
;
Geom
::
Vec3f
m_eyePos
;
/// clipping
CGoGNGLuint
m_unif_planeClip
;
Geom
::
Vec4f
m_planeClip
;
void
getLocations
();
void
sendParams
();
...
...
@@ -93,6 +98,11 @@ public:
* set the plane of rendering for VR rendering
*/
void
setEyePosition
(
const
Geom
::
Vec3f
&
ep
);
void
setClippingPlane
(
const
Geom
::
Vec4f
&
plane
);
inline
void
setNoClippingPlane
()
{
setClippingPlane
(
Geom
::
Vec4f
(
0.0
f
,
0.0
f
,
0.0
f
,
0.0
f
));
}
};
}
// namespace Utils
...
...
CGoGN/include/Utils/pointSprite.vert
View file @
72f0a449
...
...
@@ -6,8 +6,11 @@ ATTRIBUTE vec3 VertexPosition;
VARYING_VERT
vec4
color
;
#endif
VARYING_VERT
vec3
posClip
;
void
main
()
{
posClip
=
VertexPosition
;
gl_Position
=
vec4
(
VertexPosition
,
1
.
0
);
#ifdef WITH_COLOR_PER_VERTEX
color
=
VertexColor
;
...
...
CGoGN/src/Utils/pointSprite.cpp
View file @
72f0a449
...
...
@@ -79,6 +79,7 @@ void PointSprite::getLocations()
*
m_uniform_lightPos
=
glGetUniformLocation
(
program_handler
(),
"lightPos"
);
if
(
plane
)
*
m_uniform_eyePos
=
glGetUniformLocation
(
program_handler
(),
"eyePos"
);
*
m_unif_planeClip
=
glGetUniformLocation
(
this
->
program_handler
(),
"planeClip"
);
unbind
();
}
...
...
@@ -92,6 +93,8 @@ void PointSprite::sendParams()
glUniform3fv
(
*
m_uniform_lightPos
,
1
,
m_lightPos
.
data
());
if
(
plane
)
glUniform3fv
(
*
m_uniform_eyePos
,
1
,
m_eyePos
.
data
());
if
(
*
m_unif_planeClip
>
0
)
glUniform4fv
(
*
m_unif_planeClip
,
1
,
m_planeClip
.
data
());
unbind
();
}
...
...
@@ -163,6 +166,15 @@ void PointSprite::setEyePosition(const Geom::Vec3f& ep)
}
}
void
PointSprite
::
setClippingPlane
(
const
Geom
::
Vec4f
&
plane
)
{
m_planeClip
=
plane
;
bind
();
glUniform4fv
(
*
m_unif_planeClip
,
1
,
plane
.
data
());
unbind
();
}
void
PointSprite
::
restoreUniformsAttribs
()
{
getLocations
();
...
...
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