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
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
CGoGN
CGoGN
Commits
79d7fc0c
Commit
79d7fc0c
authored
Aug 30, 2013
by
Pierre Kraemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
associate a manipulated frame to each map
parent
014790e9
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
108 additions
and
68 deletions
+108
-68
SCHNApps/Plugins/surface_render/include/surface_render.h
SCHNApps/Plugins/surface_render/include/surface_render.h
+2
-1
SCHNApps/Plugins/surface_render/src/surface_render.cpp
SCHNApps/Plugins/surface_render/src/surface_render.cpp
+35
-40
SCHNApps/include/mapHandler.h
SCHNApps/include/mapHandler.h
+22
-3
SCHNApps/include/mapHandler.hpp
SCHNApps/include/mapHandler.hpp
+8
-0
SCHNApps/include/plugin_interaction.h
SCHNApps/include/plugin_interaction.h
+2
-1
SCHNApps/include/view.h
SCHNApps/include/view.h
+2
-0
SCHNApps/src/mapHandler.cpp
SCHNApps/src/mapHandler.cpp
+4
-1
SCHNApps/src/view.cpp
SCHNApps/src/view.cpp
+33
-22
No files found.
SCHNApps/Plugins/surface_render/include/surface_render.h
View file @
79d7fc0c
...
...
@@ -62,7 +62,8 @@ private:
virtual
bool
enable
();
virtual
void
disable
();
virtual
void
redraw
(
View
*
view
);
virtual
void
draw
(
View
*
view
)
{}
virtual
void
drawMap
(
View
*
view
,
MapHandlerGen
*
map
);
virtual
void
keyPress
(
View
*
view
,
QKeyEvent
*
event
)
{}
virtual
void
keyRelease
(
View
*
view
,
QKeyEvent
*
event
)
{}
...
...
SCHNApps/Plugins/surface_render/src/surface_render.cpp
View file @
79d7fc0c
...
...
@@ -59,27 +59,23 @@ void SurfaceRenderPlugin::disable()
mapRemoved
(
map
);
}
void
SurfaceRenderPlugin
::
redraw
(
View
*
view
)
void
SurfaceRenderPlugin
::
drawMap
(
View
*
view
,
MapHandlerGen
*
map
)
{
const
QHash
<
MapHandlerGen
*
,
MapParameters
>&
viewParamSet
=
h_viewParameterSet
[
view
];
foreach
(
MapHandlerGen
*
m
,
view
->
getLinkedMaps
())
{
const
MapParameters
&
p
=
viewParamSet
[
m
];
const
MapParameters
&
p
=
h_viewParameterSet
[
view
][
map
];
if
(
p
.
positionVBO
)
{
if
(
p
.
renderVertices
)
{
m_pointSprite
->
setSize
(
m
->
getBBdiagSize
()
/
200.0
f
*
p
.
verticesScaleFactor
);
m_pointSprite
->
setSize
(
map
->
getBBdiagSize
()
/
200.0
f
*
p
.
verticesScaleFactor
);
m_pointSprite
->
setAttributePosition
(
p
.
positionVBO
);
m_pointSprite
->
setColor
(
CGoGN
::
Geom
::
Vec4f
(
0.0
f
,
0.0
f
,
1.0
f
,
1.0
f
));
m
->
draw
(
m_pointSprite
,
CGoGN
::
Algo
::
Render
::
GL2
::
POINTS
);
map
->
draw
(
m_pointSprite
,
CGoGN
::
Algo
::
Render
::
GL2
::
POINTS
);
}
if
(
p
.
renderEdges
)
{
glLineWidth
(
1.0
f
);
m_simpleColorShader
->
setAttributePosition
(
p
.
positionVBO
);
m
->
draw
(
m_simpleColorShader
,
CGoGN
::
Algo
::
Render
::
GL2
::
LINES
);
map
->
draw
(
m_simpleColorShader
,
CGoGN
::
Algo
::
Render
::
GL2
::
LINES
);
}
if
(
p
.
renderFaces
)
{
...
...
@@ -91,21 +87,20 @@ void SurfaceRenderPlugin::redraw(View* view)
{
case
MapParameters
::
FLAT
:
m_flatShader
->
setAttributePosition
(
p
.
positionVBO
);
m
->
draw
(
m_flatShader
,
CGoGN
::
Algo
::
Render
::
GL2
::
TRIANGLES
);
map
->
draw
(
m_flatShader
,
CGoGN
::
Algo
::
Render
::
GL2
::
TRIANGLES
);
break
;
case
MapParameters
::
PHONG
:
if
(
p
.
normalVBO
!=
NULL
)
{
m_phongShader
->
setAttributePosition
(
p
.
positionVBO
)
;
m_phongShader
->
setAttributeNormal
(
p
.
normalVBO
)
;
m
->
draw
(
m_phongShader
,
CGoGN
::
Algo
::
Render
::
GL2
::
TRIANGLES
);
map
->
draw
(
m_phongShader
,
CGoGN
::
Algo
::
Render
::
GL2
::
TRIANGLES
);
}
break
;
}
glDisable
(
GL_POLYGON_OFFSET_FILL
);
}
}
}
}
...
...
SCHNApps/include/mapHandler.h
View file @
79d7fc0c
...
...
@@ -11,11 +11,13 @@
#include "Topology/generic/attribmap.h"
#include "Topology/generic/functor.h"
#include "Topology/generic/attributeHandler.h"
#include "Utils/vbo.h"
#include "Algo/Render/GL2/mapRender.h"
#include "Utils/drawer.h"
#include "Algo/Geometry/boundingbox.h"
#include "Utils/vbo.h"
#include "Utils/drawer.h"
namespace
CGoGN
{
...
...
@@ -45,6 +47,7 @@ public slots:
const
qglviewer
::
Vec
&
getBBmin
()
const
{
return
m_bbMin
;
}
const
qglviewer
::
Vec
&
getBBmax
()
const
{
return
m_bbMax
;
}
float
getBBdiagSize
()
const
{
return
m_bbDiagSize
;
}
Utils
::
GLSLShader
*
getBBDrawerShader
()
const
{
if
(
m_bbDrawer
)
...
...
@@ -53,6 +56,20 @@ public slots:
return
NULL
;
}
qglviewer
::
ManipulatedFrame
*
getFrame
()
const
{
return
m_frame
;
}
glm
::
mat4
getFrameMatrix
()
const
{
GLdouble
m
[
16
];
m_frame
->
getMatrix
(
m
);
glm
::
mat4
matrix
;
for
(
unsigned
int
i
=
0
;
i
<
4
;
++
i
)
{
for
(
unsigned
int
j
=
0
;
j
<
4
;
++
j
)
matrix
[
i
][
j
]
=
(
float
)
m
[
i
*
4
+
j
];
}
return
matrix
;
}
const
QList
<
View
*>&
getLinkedViews
()
const
{
return
l_views
;
}
bool
isLinkedToView
(
View
*
view
)
const
{
return
l_views
.
contains
(
view
);
}
...
...
@@ -149,9 +166,11 @@ protected:
qglviewer
::
Vec
m_bbMin
;
qglviewer
::
Vec
m_bbMax
;
float
m_bbDiagSize
;
Utils
::
Drawer
*
m_bbDrawer
;
qglviewer
::
ManipulatedFrame
*
m_frame
;
Algo
::
Render
::
GL2
::
MapRender
*
m_render
;
Utils
::
Drawer
*
m_bbDrawer
;
QList
<
View
*>
l_views
;
...
...
SCHNApps/include/mapHandler.hpp
View file @
79d7fc0c
...
...
@@ -57,7 +57,10 @@ void MapHandler<PFP>::draw(Utils::GLSLShader* shader, int primitive)
if
(
!
m_render
->
isPrimitiveUpToDate
(
primitive
))
m_render
->
initPrimitives
<
PFP
>
(
*
(
static_cast
<
typename
PFP
::
MAP
*>
(
m_map
)),
primitive
)
;
glPushMatrix
();
glMultMatrixd
(
m_frame
->
matrix
());
m_render
->
draw
(
shader
,
primitive
);
glPopMatrix
();
}
template
<
typename
PFP
>
...
...
@@ -68,7 +71,12 @@ void MapHandler<PFP>::drawBB()
m_bbDrawer
=
new
Utils
::
Drawer
();
updateBBDrawer
();
}
glPushMatrix
();
glMultMatrixd
(
m_frame
->
matrix
());
QGLViewer
::
drawAxis
();
m_bbDrawer
->
callList
();
glPopMatrix
();
}
template
<
typename
PFP
>
...
...
SCHNApps/include/plugin_interaction.h
View file @
79d7fc0c
...
...
@@ -29,7 +29,8 @@ public slots:
const
QList
<
Utils
::
GLSLShader
*>
getShaders
()
const
{
return
l_shaders
;
}
private:
virtual
void
redraw
(
View
*
view
)
=
0
;
virtual
void
draw
(
View
*
view
)
=
0
;
virtual
void
drawMap
(
View
*
view
,
MapHandlerGen
*
map
)
=
0
;
virtual
void
keyPress
(
View
*
view
,
QKeyEvent
*
event
)
=
0
;
virtual
void
keyRelease
(
View
*
view
,
QKeyEvent
*
event
)
=
0
;
...
...
SCHNApps/include/view.h
View file @
79d7fc0c
...
...
@@ -86,6 +86,8 @@ private:
void
updateCurrentCameraBB
();
private
slots
:
void
selectedMapChanged
(
MapHandlerGen
*
prev
,
MapHandlerGen
*
cur
);
void
ui_verticalSplitView
(
int
x
,
int
y
,
int
globalX
,
int
globalY
);
void
ui_horizontalSplitView
(
int
x
,
int
y
,
int
globalX
,
int
globalY
);
void
ui_closeView
(
int
x
,
int
y
,
int
globalX
,
int
globalY
);
...
...
SCHNApps/src/mapHandler.cpp
View file @
79d7fc0c
...
...
@@ -10,9 +10,12 @@ MapHandlerGen::MapHandlerGen(const QString& name, SCHNApps* s, GenericMap* map)
m_name
(
name
),
m_schnapps
(
s
),
m_map
(
map
),
m_frame
(
NULL
),
m_render
(
NULL
),
m_bbDrawer
(
NULL
)
{}
{
m_frame
=
new
qglviewer
::
ManipulatedFrame
();
}
MapHandlerGen
::~
MapHandlerGen
()
{
...
...
SCHNApps/src/view.cpp
View file @
79d7fc0c
...
...
@@ -34,7 +34,7 @@ View::View(const QString& name, SCHNApps* s, const QGLWidget* shareWidget) :
m_currentCamera
=
m_schnapps
->
addCamera
();
connect
(
m_schnapps
,
SIGNAL
(
selectedMapChanged
(
MapHandlerGen
*
,
MapHandlerGen
*
)),
this
,
SLOT
(
updateGL
(
)));
connect
(
m_schnapps
,
SIGNAL
(
selectedMapChanged
(
MapHandlerGen
*
,
MapHandlerGen
*
)),
this
,
SLOT
(
selectedMapChanged
(
MapHandlerGen
*
,
MapHandlerGen
*
)));
}
View
::~
View
()
...
...
@@ -196,23 +196,6 @@ void View::preDraw()
{
m_currentCamera
->
setScreenWidthAndHeight
(
width
(),
height
());
glm
::
mat4
mm
=
getCurrentModelViewMatrix
();
glm
::
mat4
pm
=
getCurrentProjectionMatrix
();
MapHandlerGen
*
map
=
m_schnapps
->
getSelectedMap
();
if
(
map
)
{
Utils
::
GLSLShader
*
bbShader
=
map
->
getBBDrawerShader
();
if
(
bbShader
)
bbShader
->
updateMatrices
(
pm
,
mm
);
}
foreach
(
PluginInteraction
*
plugin
,
l_plugins
)
{
foreach
(
Utils
::
GLSLShader
*
shader
,
plugin
->
getShaders
())
shader
->
updateMatrices
(
pm
,
mm
);
}
QGLViewer
::
preDraw
();
}
...
...
@@ -227,12 +210,33 @@ void View::draw()
}
}
MapHandlerGen
*
map
=
m_schnapps
->
getSelectedMap
();
if
(
map
&&
isLinkedToMap
(
map
))
glm
::
mat4
mm
=
getCurrentModelViewMatrix
();
glm
::
mat4
pm
=
getCurrentProjectionMatrix
();
MapHandlerGen
*
selectedMap
=
m_schnapps
->
getSelectedMap
();
foreach
(
MapHandlerGen
*
map
,
l_maps
)
{
glm
::
mat4
map_mm
=
mm
*
map
->
getFrameMatrix
();
if
(
map
==
selectedMap
)
{
Utils
::
GLSLShader
*
bbShader
=
map
->
getBBDrawerShader
();
if
(
bbShader
)
bbShader
->
updateMatrices
(
pm
,
map_mm
);
map
->
drawBB
();
}
foreach
(
PluginInteraction
*
plugin
,
l_plugins
)
{
foreach
(
Utils
::
GLSLShader
*
shader
,
plugin
->
getShaders
())
shader
->
updateMatrices
(
pm
,
map_mm
);
plugin
->
drawMap
(
this
,
map
);
}
}
foreach
(
PluginInteraction
*
plugin
,
l_plugins
)
plugin
->
re
draw
(
this
);
plugin
->
draw
(
this
);
}
void
View
::
postDraw
()
...
...
@@ -424,6 +428,13 @@ void View::updateCurrentCameraBB()
camera
()
->
showEntireScene
();
}
void
View
::
selectedMapChanged
(
MapHandlerGen
*
prev
,
MapHandlerGen
*
cur
)
{
if
(
cur
&&
isLinkedToMap
(
cur
))
setManipulatedFrame
(
cur
->
getFrame
());
updateGL
();
}
void
View
::
ui_verticalSplitView
(
int
x
,
int
y
,
int
globalX
,
int
globalY
)
{
m_schnapps
->
splitView
(
m_name
,
Qt
::
Horizontal
);
...
...
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