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
417d1506
Commit
417d1506
authored
Dec 11, 2012
by
Pierre Kraemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SCHNApps: view bounding box updated on map link/unlink
parent
568468b0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
59 additions
and
55 deletions
+59
-55
SCHNApps/Plugins/import/import.cpp
SCHNApps/Plugins/import/import.cpp
+2
-2
SCHNApps/Plugins/render/render.cpp
SCHNApps/Plugins/render/render.cpp
+1
-1
SCHNApps/include/view.h
SCHNApps/include/view.h
+6
-8
SCHNApps/src/view.cpp
SCHNApps/src/view.cpp
+50
-44
No files found.
SCHNApps/Plugins/import/import.cpp
View file @
417d1506
...
...
@@ -30,9 +30,9 @@ void ImportPlugin::cb_import()
std
::
vector
<
std
::
string
>
attrNames
;
CGoGN
::
Algo
::
Import
::
importMesh
<
PFP
>
(
*
m
,
fileName
.
toUtf8
().
constData
(),
attrNames
);
CGoGN
::
VertexAttribute
<
PFP
::
VEC3
>
position
=
m
->
getAttribute
<
PFP
::
VEC3
,
CGoGN
::
VERTEX
>
(
attrNames
[
0
]);
CGoGN
::
VertexAttribute
<
VEC3
>
position
=
m
->
getAttribute
<
VEC3
,
CGoGN
::
VERTEX
>
(
attrNames
[
0
]);
CGoGN
::
Geom
::
BoundingBox
<
PFP
::
VEC3
>
bb
=
CGoGN
::
Algo
::
Geometry
::
computeBoundingBox
<
PFP
>
(
*
m
,
position
)
;
CGoGN
::
Geom
::
BoundingBox
<
VEC3
>
bb
=
CGoGN
::
Algo
::
Geometry
::
computeBoundingBox
<
PFP
>
(
*
m
,
position
)
;
qglviewer
::
Vec
min
(
bb
.
min
()[
0
],
bb
.
min
()[
1
],
bb
.
min
()[
2
]);
qglviewer
::
Vec
max
(
bb
.
max
()[
0
],
bb
.
max
()[
1
],
bb
.
max
()[
2
]);
...
...
SCHNApps/Plugins/render/render.cpp
View file @
417d1506
...
...
@@ -45,7 +45,7 @@ void RenderPlugin::redraw(View* view)
CGoGN
::
Utils
::
VBO
*
positionVBO
=
m
->
getVBO
(
"position"
);
if
(
params
->
renderVertices
)
{
m_pointSprite
->
setSize
(
m
->
getBBdiagSize
()
/
1
00.0
f
*
params
->
verticesScaleFactor
);
m_pointSprite
->
setSize
(
m
->
getBBdiagSize
()
/
2
00.0
f
*
params
->
verticesScaleFactor
);
m_pointSprite
->
setAttributePosition
(
positionVBO
);
m_pointSprite
->
predraw
(
CGoGN
::
Geom
::
Vec3f
(
0.0
f
,
0.0
f
,
1.0
f
));
m
->
draw
(
m_pointSprite
,
CGoGN
::
Algo
::
Render
::
GL2
::
POINTS
);
...
...
SCHNApps/include/view.h
View file @
417d1506
...
...
@@ -75,17 +75,18 @@ public:
const
QList
<
MapHandlerGen
*>&
getLinkedMaps
()
const
{
return
l_maps
;
}
bool
isLinkedToMap
(
MapHandlerGen
*
map
)
const
{
return
l_maps
.
contains
(
map
);
}
void
updateViewBB
();
void
updateTextInfo
();
/*********************************************************
* MANAGE MATRICES
*********************************************************/
glm
::
mat4
getCurrentModelViewMatrix
()
const
;
glm
::
mat4
getCurrentProjectionMatrix
()
const
;
glm
::
mat4
getCurrentModelViewProjectionMatrix
()
const
;
void
setCurrentModelViewMatrix
(
const
glm
::
mat4
&
mvm
);
void
setCurrentProjectionMatrix
(
const
glm
::
mat4
&
pm
);
//
void setCurrentModelViewMatrix(const glm::mat4& mvm);
//
void setCurrentProjectionMatrix(const glm::mat4& pm);
protected:
QString
m_name
;
...
...
@@ -95,9 +96,6 @@ protected:
QList
<
Plugin
*>
l_plugins
;
QList
<
MapHandlerGen
*>
l_maps
;
qglviewer
::
Vec
bbmin
;
qglviewer
::
Vec
bbmax
;
ViewButtonArea
*
m_buttonArea
;
ViewButton
*
m_cameraButton
;
...
...
SCHNApps/src/view.cpp
View file @
417d1506
...
...
@@ -91,8 +91,6 @@ void View::init()
delete
c
;
this
->
setBackgroundColor
(
QColor
(
0
,
0
,
0
));
updateTextInfo
();
}
void
View
::
preDraw
()
...
...
@@ -120,7 +118,6 @@ void View::postDraw()
{
glPushAttrib
(
GL_ALL_ATTRIB_BITS
);
drawButtons
();
drawText
();
if
(
isCurrentView
())
drawFrame
();
glPopAttrib
();
...
...
@@ -135,12 +132,6 @@ void View::resizeGL(int width, int height)
m_buttonArea
->
setTopRightPosition
(
width
,
0
);
}
void
View
::
drawText
()
{
glColor3f
(
1.0
f
,
1.0
f
,
1.0
f
);
QGLViewer
::
drawText
(
10
,
20
,
m_textInfo
);
}
void
View
::
drawButtons
()
{
glEnable
(
GL_TEXTURE_2D
);
...
...
@@ -224,7 +215,6 @@ void View::setCurrentCamera(Camera* c)
{
m_currentCamera
=
c
;
this
->
setCamera
(
m_currentCamera
);
updateTextInfo
();
updateGL
();
}
}
...
...
@@ -259,30 +249,46 @@ void View::linkMap(MapHandlerGen* map)
if
(
map
&&
!
l_maps
.
contains
(
map
))
{
l_maps
.
push_back
(
map
);
// TODO : update view global BB
setSceneBoundingBox
(
map
->
getBBmin
(),
map
->
getBBmax
());
showEntireScene
();
updateViewBB
();
}
}
void
View
::
unlinkMap
(
MapHandlerGen
*
map
)
{
l_maps
.
removeOne
(
map
);
// TODO : update view global BB
updateViewBB
();
}
void
View
::
updateTextInfo
()
void
View
::
updateViewBB
()
{
m_textInfo
=
QString
(
"view: "
)
+
m_name
+
QString
(
" / camera: "
)
+
m_currentCamera
->
getName
();
qglviewer
::
Vec
bbMin
(
0
,
0
,
0
);
qglviewer
::
Vec
bbMax
(
1
,
1
,
1
);
if
(
!
l_maps
.
empty
())
{
bbMin
=
l_maps
[
0
]
->
getBBmin
();
bbMax
=
l_maps
[
0
]
->
getBBmax
();
for
(
int
i
=
1
;
i
<
l_maps
.
size
();
++
i
)
{
MapHandlerGen
*
m
=
l_maps
[
i
];
qglviewer
::
Vec
min
=
m
->
getBBmin
();
qglviewer
::
Vec
max
=
m
->
getBBmax
();
for
(
unsigned
int
dim
=
0
;
dim
<
3
;
++
dim
)
{
if
(
min
[
dim
]
<
bbMin
[
dim
])
bbMin
[
dim
]
=
min
[
dim
];
if
(
max
[
dim
]
>
bbMax
[
dim
])
bbMax
[
dim
]
=
max
[
dim
];
}
}
}
setSceneBoundingBox
(
bbMin
,
bbMax
);
showEntireScene
();
}
/*********************************************************
* MANAGE MATRICES
*********************************************************/
glm
::
mat4
View
::
getCurrentModelViewMatrix
()
const
{
GLdouble
gl_mvm
[
16
];
...
...
@@ -322,27 +328,27 @@ glm::mat4 View::getCurrentModelViewProjectionMatrix() const
return
mvpm
;
}
void
View
::
setCurrentModelViewMatrix
(
const
glm
::
mat4
&
mvm
)
{
GLdouble
gl_mvm
[
16
];
for
(
unsigned
int
i
=
0
;
i
<
4
;
++
i
)
{
for
(
unsigned
int
j
=
0
;
j
<
4
;
++
j
)
gl_mvm
[
i
*
4
+
j
]
=
mvm
[
i
][
j
];
}
camera
()
->
setFromModelViewMatrix
(
gl_mvm
);
}
void
View
::
setCurrentProjectionMatrix
(
const
glm
::
mat4
&
pm
)
{
float
gl_pm
[
12
];
for
(
unsigned
int
i
=
0
;
i
<
3
;
++
i
)
{
for
(
unsigned
int
j
=
0
;
j
<
4
;
++
j
)
gl_pm
[
i
*
3
+
j
]
=
pm
[
i
][
j
];
}
camera
()
->
setFromProjectionMatrix
(
gl_pm
);
}
//
void View::setCurrentModelViewMatrix(const glm::mat4& mvm)
//
{
//
GLdouble gl_mvm[16];
//
for(unsigned int i = 0; i < 4; ++i)
//
{
//
for(unsigned int j = 0; j < 4; ++j)
//
gl_mvm[i*4+j] = mvm[i][j];
//
}
//
camera()->setFromModelViewMatrix(gl_mvm);
//
}
//
//
void View::setCurrentProjectionMatrix(const glm::mat4& pm)
//
{
//
float gl_pm[12];
//
for(unsigned int i = 0; i < 3; ++i)
//
{
//
for(unsigned int j = 0; j < 4; ++j)
//
gl_pm[i*3+j] = pm[i][j];
//
}
//
camera()->setFromProjectionMatrix(gl_pm);
//
}
void
View
::
cb_cameraView
(
int
x
,
int
y
,
int
globalX
,
int
globalY
)
{
...
...
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