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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Sauvage
CGoGN
Commits
7893575b
Commit
7893575b
authored
Mar 14, 2013
by
Pierre Kraemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow PointSprite to draw transparent spheres
parent
e6fb3a99
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
37 additions
and
28 deletions
+37
-28
Apps/Examples/viewer.cpp
Apps/Examples/viewer.cpp
+1
-1
Apps/Tuto/tuto5.cpp
Apps/Tuto/tuto5.cpp
+1
-1
SCHNApps/Plugins/render/src/render.cpp
SCHNApps/Plugins/render/src/render.cpp
+1
-1
SCHNApps/Plugins/surfaceDeformation/include/surfaceDeformation.h
...s/Plugins/surfaceDeformation/include/surfaceDeformation.h
+5
-1
SCHNApps/Plugins/surfaceDeformation/src/surfaceDeformation.cpp
...pps/Plugins/surfaceDeformation/src/surfaceDeformation.cpp
+22
-19
include/Utils/pointSprite.frag
include/Utils/pointSprite.frag
+4
-2
include/Utils/pointSprite.h
include/Utils/pointSprite.h
+1
-1
src/Utils/pointSprite.cpp
src/Utils/pointSprite.cpp
+2
-2
No files found.
Apps/Examples/viewer.cpp
View file @
7893575b
...
...
@@ -128,7 +128,7 @@ void Viewer::cb_redraw()
{
float
size
=
vertexScaleFactor
;
m_pointSprite
->
setSize
(
size
)
;
m_pointSprite
->
predraw
(
Geom
::
Vec
3f
(
0.0
f
,
0
.0
f
,
1.0
f
))
;
m_pointSprite
->
predraw
(
Geom
::
Vec
4f
(
0.0
f
,
0.0
f
,
1
.0
f
,
1.0
f
))
;
m_render
->
draw
(
m_pointSprite
,
Algo
::
Render
::
GL2
::
POINTS
)
;
m_pointSprite
->
postdraw
()
;
}
...
...
Apps/Tuto/tuto5.cpp
View file @
7893575b
...
...
@@ -200,7 +200,7 @@ void MyQT::cb_redraw()
if
(
render_balls
)
{
m_sprite
->
predraw
(
Geom
::
Vec
3f
(
1.0
f
,
0.0
f
,
0
.0
f
));
m_sprite
->
predraw
(
Geom
::
Vec
4f
(
1.0
f
,
0.0
f
,
0.0
f
,
1
.0
f
));
m_render
->
draw
(
m_sprite
,
Algo
::
Render
::
GL2
::
POINTS
);
m_sprite
->
postdraw
();
}
...
...
SCHNApps/Plugins/render/src/render.cpp
View file @
7893575b
...
...
@@ -99,7 +99,7 @@ void RenderPlugin::redraw(View* view)
{
m_pointSprite
->
setSize
(
m
->
getBBdiagSize
()
/
200.0
f
*
p
->
verticesScaleFactor
);
m_pointSprite
->
setAttributePosition
(
p
->
positionVBO
);
m_pointSprite
->
predraw
(
CGoGN
::
Geom
::
Vec
3f
(
0.0
f
,
0
.0
f
,
1.0
f
));
m_pointSprite
->
predraw
(
CGoGN
::
Geom
::
Vec
4f
(
0.0
f
,
0.0
f
,
1
.0
f
,
1.0
f
));
m
->
draw
(
m_pointSprite
,
CGoGN
::
Algo
::
Render
::
GL2
::
POINTS
);
m_pointSprite
->
postdraw
();
}
...
...
SCHNApps/Plugins/surfaceDeformation/include/surfaceDeformation.h
View file @
7893575b
...
...
@@ -8,13 +8,14 @@
#include "mapHandler.h"
#include "Utils/pointSprite.h"
#include "Container/fakeAttribute.h"
#include "NL/nl.h"
#include "Algo/LinearSolving/basic.h"
#include "Eigen/Dense"
namespace
CGoGN
{
...
...
@@ -111,8 +112,11 @@ protected:
SurfaceDeformationDockTab
*
m_dockTab
;
QHash
<
View
*
,
ParameterSet
*>
h_viewParams
;
Utils
::
PointSprite
*
m_pointSprite
;
Utils
::
Drawer
*
m_drawer
;
Utils
::
VBO
*
selectionSphereVBO
;
bool
selecting
;
PFP2
::
VEC3
selectionCenter
;
PFP2
::
REAL
selectionRadius
;
...
...
SCHNApps/Plugins/surfaceDeformation/src/surfaceDeformation.cpp
View file @
7893575b
...
...
@@ -110,6 +110,11 @@ bool SurfaceDeformationPlugin::enable()
m_dockTab
=
new
SurfaceDeformationDockTab
(
m_window
,
this
);
addTabInDock
(
m_dockTab
,
"Surface Deformation"
);
selectionSphereVBO
=
new
Utils
::
VBO
();
m_pointSprite
=
new
CGoGN
::
Utils
::
PointSprite
();
registerShader
(
m_pointSprite
);
m_drawer
=
new
Utils
::
Drawer
();
registerShader
(
m_drawer
->
getShader
());
...
...
@@ -122,6 +127,7 @@ bool SurfaceDeformationPlugin::enable()
void
SurfaceDeformationPlugin
::
disable
()
{
delete
m_pointSprite
;
delete
m_drawer
;
}
...
...
@@ -129,25 +135,22 @@ void SurfaceDeformationPlugin::redraw(View* view)
{
if
(
selecting
)
{
glDisable
(
GL_LIGHTING
)
;
m_drawer
->
newList
(
GL_COMPILE_AND_EXECUTE
)
;
m_drawer
->
lineWidth
(
2.0
f
)
;
m_drawer
->
begin
(
GL_LINES
)
;
m_drawer
->
color3f
(
0.0
f
,
0.0
f
,
1.0
f
)
;
m_drawer
->
vertex
(
selectionCenter
)
;
m_drawer
->
vertex
(
selectionCenter
+
selectionRadius
*
PFP2
::
VEC3
(
1
,
0
,
0
))
;
m_drawer
->
vertex
(
selectionCenter
)
;
m_drawer
->
vertex
(
selectionCenter
+
selectionRadius
*
PFP2
::
VEC3
(
-
1
,
0
,
0
))
;
m_drawer
->
vertex
(
selectionCenter
)
;
m_drawer
->
vertex
(
selectionCenter
+
selectionRadius
*
PFP2
::
VEC3
(
0
,
1
,
0
))
;
m_drawer
->
vertex
(
selectionCenter
)
;
m_drawer
->
vertex
(
selectionCenter
+
selectionRadius
*
PFP2
::
VEC3
(
0
,
-
1
,
0
))
;
m_drawer
->
vertex
(
selectionCenter
)
;
m_drawer
->
vertex
(
selectionCenter
+
selectionRadius
*
PFP2
::
VEC3
(
0
,
0
,
1
))
;
m_drawer
->
vertex
(
selectionCenter
)
;
m_drawer
->
vertex
(
selectionCenter
+
selectionRadius
*
PFP2
::
VEC3
(
0
,
0
,
-
1
))
;
m_drawer
->
end
()
;
m_drawer
->
endList
()
;
std
::
vector
<
PFP2
::
VEC3
>
selectionPoint
;
selectionPoint
.
push_back
(
selectionCenter
);
selectionSphereVBO
->
updateData
(
selectionPoint
);
m_pointSprite
->
setSize
(
selectionRadius
);
m_pointSprite
->
setAttributePosition
(
selectionSphereVBO
);
m_pointSprite
->
predraw
(
CGoGN
::
Geom
::
Vec4f
(
0.0
f
,
0.0
f
,
1.0
f
,
0.5
f
));
m_pointSprite
->
enableVertexAttribs
();
glEnable
(
GL_BLEND
);
glBlendFunc
(
GL_SRC_ALPHA
,
GL_ONE_MINUS_SRC_ALPHA
);
glDrawArrays
(
GL_POINTS
,
0
,
1
);
glDisable
(
GL_BLEND
);
m_pointSprite
->
disableVertexAttribs
();
m_pointSprite
->
postdraw
();
}
ParameterSet
*
params
=
h_viewParams
[
view
];
...
...
include/Utils/pointSprite.frag
View file @
7893575b
...
...
@@ -12,7 +12,7 @@ uniform float size;
#ifdef WITH_COLOR_PER_VERTEX
VARYING_FRAG
vec3
colorsprite
;
#else
uniform
vec
3
colorsprite
;
uniform
vec
4
colorsprite
;
#endif
VARYING_FRAG
vec2
spriteCoord
;
...
...
@@ -51,6 +51,8 @@ void main(void)
vec3
L
=
normalize
(
lightPos
-
frag_position_eye
);
float
lambertTerm
=
dot
(
N
,
L
);
gl_FragColor
=
vec4
(
colorsprite
*
lambertTerm
+
ambiant
,
1
.
0
);
vec4
result
=
colorsprite
*
lambertTerm
;
result
.
xyz
+=
ambiant
;
gl_FragColor
=
result
;
}
include/Utils/pointSprite.h
View file @
7893575b
...
...
@@ -88,7 +88,7 @@ public:
* call once before sending points to gpu
* @param color set global color of sprites
*/
void
predraw
(
const
Geom
::
Vec
3
f
&
color
);
void
predraw
(
const
Geom
::
Vec
4
f
&
color
);
/**
* call once before sending points to gpu
...
...
src/Utils/pointSprite.cpp
View file @
7893575b
...
...
@@ -124,11 +124,11 @@ unsigned int PointSprite::setAttributeColor(VBO* vbo)
return
bindVA_VBO
(
"VertexColor"
,
vbo
);
}
void
PointSprite
::
predraw
(
const
Geom
::
Vec
3
f
&
color
)
void
PointSprite
::
predraw
(
const
Geom
::
Vec
4
f
&
color
)
{
bind
();
glUniform1i
(
*
m_uniform_texture
,
0
);
glUniform
3
fv
(
*
m_uniform_color
,
1
,
color
.
data
());
glUniform
4
fv
(
*
m_uniform_color
,
1
,
color
.
data
());
glActiveTexture
(
GL_TEXTURE0
);
glBindTexture
(
GL_TEXTURE_2D
,
*
m_idTexture
);
glEnable
(
GL_TEXTURE_2D
);
...
...
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