Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
David Cazier
CGoGN
Commits
aeffa662
Commit
aeffa662
authored
Apr 15, 2011
by
Sylvain Thery
Browse files
utilisation des nouvelles classes de rendu et de Qt
parent
604a068c
Changes
58
Hide whitespace changes
Inline
Side-by-side
Apps/CMakeLists.txt
View file @
aeffa662
...
...
@@ -2,6 +2,9 @@ SET(EXECUTABLE_OUTPUT_PATH ${CGoGN_ROOT_DIR}/bin)
SET
(
COMMON_LIBS
${
GLUT_LIBRARY
}
${
OPENGL_LIBRARY
}
${
GLEW_LIBRARY
}
${
DEVIL_LIBRARIES
}
${
ZLIB_LIBRARIES
}
${
LIBXML2_LIBRARIES
}
gzstream AntTweakBar openctm assimp
)
SET
(
CGoGN_LIBS_D topologyD algoD containerD utilsD
)
SET
(
CGoGN_LIBS_R topology algo container utils
)
IF
(
WIN32
)
add_subdirectory
(
Examples/Release
)
add_subdirectory
(
Tuto
)
...
...
Apps/Examples/Release/CMakeLists.txt
View file @
aeffa662
...
...
@@ -5,8 +5,16 @@ project(examples)
SET
(
CMAKE_BUILD_TYPE Release
)
SET
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-DNOTOPOWARNING"
)
# FOR Qt4
FIND_PACKAGE
(
Qt4 REQUIRED
)
SET
(
QT_USE_QTOPENGL TRUE
)
INCLUDE
(
${
QT_USE_FILE
}
)
ADD_DEFINITIONS
(
${
QT_DEFINITIONS
}
)
# define includes path
include_directories
(
${
CMAKE_CURRENT_BINARY_DIR
}
/usr/include/libxml2/
${
CGoGN_ROOT_DIR
}
/include
${
CGoGN_ROOT_DIR
}
/ThirdParty/Numerical
...
...
@@ -57,14 +65,16 @@ target_link_libraries( triangulation
add_executable
(
ter_meshes ../ter_meshes.cpp
)
target_link_libraries
(
ter_meshes
container topology utils algo
${
COMMON_LIBS
}
)
add_executable
(
polyhedronsView ../polyhedronsView.cpp
)
QT4_WRAP_CPP
(
polyhedronsView_moc ../polyhedronsView.h
)
add_executable
(
polyhedronsView ../polyhedronsView.cpp
${
polyhedronsView_moc
}
)
target_link_libraries
(
polyhedronsView
container topology utils algo
${
COMMON_LIB
S
}
)
${
CGoGN_LIBS_R
}
${
COMMON_LIBS
}
${
QT_LIBRARIE
S
}
)
add_executable
(
extrusionView ../extrusionView.cpp
)
QT4_WRAP_CPP
(
extrusionView_moc ../extrusionView.h
)
add_executable
(
extrusionView ../extrusionView.cpp
${
extrusionView_moc
}
)
target_link_libraries
(
extrusionView
container topology utils algo
${
COMMON_LIB
S
}
)
${
CGoGN_LIBS_R
}
${
COMMON_LIBS
}
${
QT_LIBRARIE
S
}
)
add_executable
(
scene ../scene.cpp
)
target_link_libraries
(
scene
...
...
Apps/Examples/extrusionView.cpp
View file @
aeffa662
...
...
@@ -24,7 +24,7 @@
#include
<iostream>
#include
"
Utils/glutwin
.h"
#include
"
extrusionView
.h"
#include
"Topology/generic/parameters.h"
#include
"Topology/map/map2.h"
...
...
@@ -33,12 +33,15 @@
#include
"Geometry/vector_gen.h"
#include
"Geometry/matrix.h"
#include
"Geometry/transfo.h"
#include
"Algo/Geometry/boundingbox.h"
#include
"Algo/
Render/vbo_MapRender
.h"
#include
"Algo/
Geometry/boundingbox
.h"
#include
"Algo/Modelisation/extrusion.h"
#include
"Topology/generic/parameters.h"
#include
"Algo/Render/GL2/mapRender.h"
#include
"Utils/shaderFlat.h"
#include
"Utils/shaderSimpleColor.h"
#include
<vector>
using
namespace
CGoGN
;
...
...
@@ -55,147 +58,58 @@ struct PFP: public PFP_STANDARD
PFP
::
MAP
myMap
;
class
myGlutWin
:
public
Utils
::
SimpleGlutWin
void
MyQT
::
cb_initGL
()
{
public:
/**
* position of object
*/
Geom
::
Vec3f
gPosObj
;
/**
* width of object
*/
float
gWidthObj
;
/**
* redraw CB
*/
void
myRedraw
();
// choose to use GL version 2
Utils
::
GLSLShader
::
setCurrentOGLVersion
(
2
);
/**
* keyboard CB
*/
void
myKeyboard
(
unsigned
char
keycode
,
int
x
,
int
y
);
// create the render
m_render
=
new
Algo
::
Render
::
GL2
::
MapRender
();
/**
* Update VBO buffers for map
*/
void
updateRender
();
// create VBO for position
m_positionVBO
=
new
Utils
::
VBO
();
/**
* GL initialization
*/
void
init
();
// position handler
PFP
::
TVEC3
position
;
m_shader
=
new
Utils
::
ShaderFlat
();
m_shader
->
setAttributePosition
(
m_positionVBO
);
m_shader
->
setDiffuse
(
Geom
::
Vec4f
(
0.
,
1.
,
0.
,
0.
));
// using simple shader with color
m_shader2
=
new
Utils
::
ShaderSimpleColor
();
m_shader2
->
setAttributePosition
(
m_positionVBO
);
m_shader2
->
setColor
(
Geom
::
Vec4f
(
1.
,
1.
,
0.
,
0.
));
/**
* render object
*/
Algo
::
Render
::
GL2
::
MapRender_VBO
*
m_render
;
myGlutWin
(
int
*
argc
,
char
**
argv
,
int
winX
,
int
winY
)
:
SimpleGlutWin
(
argc
,
argv
,
winX
,
winY
),
m_render
(
NULL
)
{
}
~
myGlutWin
();
};
myGlutWin
::~
myGlutWin
()
{
if
(
m_render
)
delete
m_render
;
registerRunning
(
m_shader
);
registerRunning
(
m_shader2
);
}
void
myGlutWin
::
init
()
{
glClearColor
(
0.1
f
,
0.1
f
,
0.1
f
,
0.0
f
);
glEnable
(
GL_DEPTH_TEST
);
// glEnable(GL_NORMALIZE);
glLightModeli
(
GL_LIGHT_MODEL_TWO_SIDE
,
GL_TRUE
);
glLightModeli
(
GL_LIGHT_MODEL_LOCAL_VIEWER
,
1
);
glLightfv
(
GL_LIGHT0
,
GL_DIFFUSE
,
lightZeroColor
);
glLightfv
(
GL_LIGHT0
,
GL_POSITION
,
lightZeroPosition
);
glEnable
(
GL_LIGHT0
);
}
void
myGlutWin
::
updateRender
()
void
MyQT
::
cb_redraw
()
{
SelectorTrue
allDarts
;
// create the renderer (first call only)
if
(
m_render
==
NULL
)
m_render
=
new
Algo
::
Render
::
GL2
::
MapRender_VBO
()
;
// update buffer op vertices positions
m_render
->
updateData
(
Algo
::
Render
::
GL2
::
POSITIONS
,
position
);
// update flat faces primtives (warning need position buffer)
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
SelectorTrue
(),
Algo
::
Render
::
GL2
::
FLAT_TRIANGLES
);
// update lines primitives
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
SelectorTrue
(),
Algo
::
Render
::
GL2
::
LINES
);
}
void
myGlutWin
::
myRedraw
(
void
)
{
glClear
(
GL_COLOR_BUFFER_BIT
|
GL_DEPTH_BUFFER_BIT
);
glPushMatrix
();
// center the scene
float
sc
=
50.
/
gWidthObj
;
glScalef
(
sc
,
sc
,
sc
);
glTranslatef
(
-
gPosObj
[
0
],
-
gPosObj
[
1
],
-
gPosObj
[
2
]);
glPolygonMode
(
GL_FRONT_AND_BACK
,
GL_FILL
);
glEnable
(
GL_LIGHTING
);
// DRAW LINES OF OBJECTS
glDisable
(
GL_LIGHTING
);
glColor3f
(
1.0
f
,
1.0
f
,
0.0
f
);
m_render
->
draw
(
Algo
::
Render
::
GL2
::
LINES
)
;
m_render
->
draw
(
m_shader2
,
Algo
::
Render
::
GL2
::
LINES
);
//shit for nice line rendering
glEnable
(
GL_POLYGON_OFFSET_FILL
);
glPolygonOffset
(
1.0
f
,
1.0
f
);
// DRAW FACES OF OBJECTS
glEnable
(
GL_LIGHTING
);
glEnable
(
GL_COLOR_MATERIAL
);
glColorMaterial
(
GL_FRONT_AND_BACK
,
GL_DIFFUSE
);
glColor3f
(
0.0
f
,
0.0
f
,
0.9
f
);
m_render
->
draw
(
Algo
::
Render
::
GL2
::
FLAT_TRIANGLES
)
;
glDisable
(
GL_POLYGON_OFFSET_FILL
);
m_render
->
draw
(
m_shader
,
Algo
::
Render
::
GL2
::
TRIANGLES
);
gl
PopMatrix
(
);
gl
Disable
(
GL_POLYGON_OFFSET_FILL
);
}
void
myGlutWin
::
myKeyboard
(
unsigned
char
keycode
,
int
x
,
int
y
)
{
switch
(
keycode
)
{
case
27
:
exit
(
0
);
default:
break
;
}
}
int
main
(
int
argc
,
char
**
argv
)
{
//
/ init glut
interface
and
myGlutWin
mgw
(
&
argc
,
argv
,
800
,
800
);
mgw
.
init
()
;
// interface
:
QApplication
app
(
argc
,
argv
);
MyQT
sqt
;
mgw
.
position
=
myMap
.
addAttribute
<
PFP
::
VEC3
>
(
VERTEX_ORBIT
,
"position"
)
;
PFP
::
TVEC3
position
=
myMap
.
addAttribute
<
PFP
::
VEC3
>
(
VERTEX_ORBIT
,
"position"
)
;
// define the face extruded (here a cross)
std
::
vector
<
PFP
::
VEC3
>
objV
;
...
...
@@ -225,18 +139,31 @@ int main(int argc, char **argv)
}
// extrusion
Dart
d
=
Algo
::
Modelisation
::
extrusion_scale
<
PFP
>
(
myMap
,
mgw
.
position
,
objV
,
PFP
::
VEC3
(
0.0
,
0.0
,
0.0
),
PFP
::
VEC3
(
0.0
,
1.0
,
0.0
),
true
,
pathV
,
false
,
pathRadius
);
Dart
d
=
Algo
::
Modelisation
::
extrusion_scale
<
PFP
>
(
myMap
,
position
,
objV
,
PFP
::
VEC3
(
0.0
,
0.0
,
0.0
),
PFP
::
VEC3
(
0.0
,
1.0
,
0.0
),
true
,
pathV
,
false
,
pathRadius
);
// update renderer
mgw
.
updateRender
();
// bounding box
Geom
::
BoundingBox
<
PFP
::
VEC3
>
bb
=
Algo
::
Geometry
::
computeBoundingBox
<
PFP
>
(
myMap
,
position
);
float
lWidthObj
=
std
::
max
<
PFP
::
REAL
>
(
std
::
max
<
PFP
::
REAL
>
(
bb
.
size
(
0
),
bb
.
size
(
1
)),
bb
.
size
(
2
));
Geom
::
Vec3f
lPosObj
=
(
bb
.
min
()
+
bb
.
max
())
/
PFP
::
REAL
(
2
);
// envoit info BB a l'interface
sqt
.
setParamObject
(
lWidthObj
,
lPosObj
.
data
());
// show 1 pour GL context
sqt
.
show
();
// update du VBO position (context GL necessaire)
sqt
.
m_positionVBO
->
updateData
(
position
);
// update des primitives du renderer
SelectorTrue
allDarts
;
sqt
.
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
allDarts
,
Algo
::
Render
::
GL2
::
TRIANGLES
);
sqt
.
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
allDarts
,
Algo
::
Render
::
GL2
::
LINES
);
// compute BB and store it for object positionning in screen
Geom
::
BoundingBox
<
PFP
::
VEC3
>
bb
=
Algo
::
Geometry
::
computeBoundingBox
<
PFP
>
(
myMap
,
mgw
.
position
)
;
mgw
.
gWidthObj
=
std
::
max
<
PFP
::
REAL
>
(
std
::
max
<
PFP
::
REAL
>
(
bb
.
size
(
0
),
bb
.
size
(
1
)),
bb
.
size
(
2
));
mgw
.
gPosObj
=
(
bb
.
min
()
+
bb
.
max
())
/
PFP
::
REAL
(
2
);
// show final pour premier redraw
sqt
.
show
();
mgw
.
mainLoop
();
// et on attend la fin.
return
app
.
exec
();
return
0
;
}
Apps/Examples/extrusionView.h
0 → 100644
View file @
aeffa662
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: https://iggservis.u-strasbg.fr/CGoGN/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#ifndef EXTRUSIONVIEW_H_
#define EXTRUSIONVIEW_H_
#include
<iostream>
#include
"Utils/qtSimple.h"
// forward definitions (minimize includes)
namespace
CGoGN
{
namespace
Algo
{
namespace
Render
{
namespace
GL2
{
class
MapRender
;
}}}}
namespace
CGoGN
{
namespace
Utils
{
class
VBO
;
}
}
namespace
CGoGN
{
namespace
Utils
{
class
ShaderFlat
;
}
}
namespace
CGoGN
{
namespace
Utils
{
class
ShaderSimpleColor
;
}
}
using
namespace
CGoGN
;
/**
* A class for a little interface and rendering
*/
class
MyQT
:
public
Utils
::
QT
::
SimpleQT
{
Q_OBJECT
public:
// render
Algo
::
Render
::
GL2
::
MapRender
*
m_render
;
// VBO
Utils
::
VBO
*
m_positionVBO
;
//2 shaders
Utils
::
ShaderFlat
*
m_shader
;
Utils
::
ShaderSimpleColor
*
m_shader2
;
MyQT
()
:
m_render
(
NULL
),
m_positionVBO
(
NULL
),
m_shader
(
NULL
),
m_shader2
(
NULL
){}
// callbacks of simpleQT to overdefine:
void
cb_redraw
();
void
cb_initGL
();
};
#endif
Apps/Examples/polyhedronsView.cpp
View file @
aeffa662
...
...
@@ -24,7 +24,7 @@
#include
<iostream>
#include
"
Utils/glutwin
.h"
#include
"
polyhedronsView
.h"
#include
"Topology/generic/parameters.h"
#include
"Topology/map/map2.h"
...
...
@@ -35,10 +35,13 @@
#include
"Geometry/transfo.h"
#include
"Algo/Geometry/boundingbox.h"
#include
"Algo/Render/vbo_MapRender.h"
#include
"Algo/Modelisation/polyhedron.h"
#include
"Topology/generic/parameters.h"
#include
"Algo/Render/GL2/mapRender.h"
#include
"Utils/shaderFlat.h"
#include
"Utils/shaderSimpleColor.h"
using
namespace
CGoGN
;
...
...
@@ -53,156 +56,66 @@ struct PFP: public PFP_STANDARD
PFP
::
MAP
myMap
;
class
myGlutWin
:
public
Utils
::
SimpleGlutWin
{
public:
/**
* position of object
*/
Geom
::
Vec3f
gPosObj
;
/**
* width of object
*/
float
gWidthObj
;
/**
* redraw CB
*/
void
myRedraw
();
/**
* keyboard CB
*/
void
myKeyboard
(
unsigned
char
keycode
,
int
x
,
int
y
);
/**
* Update VBO buffers for map
*/
void
updateRender
();
/**
* GL initialization
*/
void
init
();
// position handler
PFP
::
TVEC3
position
;
/**
* render object
*/
Algo
::
Render
::
GL2
::
MapRender_VBO
*
m_render
;
myGlutWin
(
int
*
argc
,
char
**
argv
,
int
winX
,
int
winY
)
:
SimpleGlutWin
(
argc
,
argv
,
winX
,
winY
),
m_render
(
NULL
)
{
}
~
myGlutWin
();
};
myGlutWin
::~
myGlutWin
()
{
if
(
m_render
)
delete
m_render
;
}
void
myGlutWin
::
init
()
void
MyQT
::
cb_initGL
()
{
// choose to use GL version 2
Utils
::
GLSLShader
::
setCurrentOGLVersion
(
2
);
glClearColor
(
0.1
f
,
0.1
f
,
0.1
f
,
0.0
f
);
glEnable
(
GL_DEPTH_TEST
);
glEnable
(
GL_NORMALIZE
);
// create the render
m_render
=
new
Algo
::
Render
::
GL2
::
MapRender
();
glLightModeli
(
GL_LIGHT_MODEL_TWO_SIDE
,
GL_TRUE
);
glLightModeli
(
GL_LIGHT_MODEL_LOCAL_VIEWER
,
1
);
glLightfv
(
GL_LIGHT0
,
GL_DIFFUSE
,
lightZeroColor
);
glLightfv
(
GL_LIGHT0
,
GL_POSITION
,
lightZeroPosition
);
glEnable
(
GL_LIGHT0
);
}
// create VBO for position
m_positionVBO
=
new
Utils
::
VBO
();
void
myGlutWin
::
updateRender
()
{
SelectorTrue
allDarts
;
m_shader
=
new
Utils
::
ShaderFlat
()
;
m_shader
->
setAttributePosition
(
m_positionVBO
);
m_shader
->
setDiffuse
(
Geom
::
Vec4f
(
0.
,
1.
,
0.
,
0.
))
;
// create the renderer (first call only)
if
(
m_render
==
NULL
)
m_render
=
new
Algo
::
Render
::
GL2
::
MapRender_VBO
()
;
// using simple shader with color
m_shader2
=
new
Utils
::
ShaderSimpleColor
();
m_shader2
->
setAttributePosition
(
m_positionVBO
);
m_shader2
->
setColor
(
Geom
::
Vec4f
(
1.
,
1.
,
0.
,
0.
));
// update buffer op vertices positions
m_render
->
updateData
(
Algo
::
Render
::
GL2
::
POSITIONS
,
position
);
// update flat faces primtives (warning need position buffer)
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
allDarts
,
Algo
::
Render
::
GL2
::
FLAT_TRIANGLES
);
// update lines primitives
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
allDarts
,
Algo
::
Render
::
GL2
::
LINES
);
registerRunning
(
m_shader
);
registerRunning
(
m_shader2
);
}
void
myGlutWin
::
myR
edraw
(
void
)
void
MyQT
::
cb_r
edraw
()
{
glClear
(
GL_COLOR_BUFFER_BIT
|
GL_DEPTH_BUFFER_BIT
);
glPushMatrix
();
// center the scene
float
sc
=
50.
/
gWidthObj
;
glScalef
(
sc
,
sc
,
sc
);
glTranslatef
(
-
gPosObj
[
0
],
-
gPosObj
[
1
],
-
gPosObj
[
2
]);
glPolygonMode
(
GL_FRONT_AND_BACK
,
GL_FILL
);
glEnable
(
GL_LIGHTING
);
// DRAW LINES OF OBJECTS
glDisable
(
GL_LIGHTING
);
glColor3f
(
1.0
f
,
1.0
f
,
0.0
f
);
m_render
->
draw
(
Algo
::
Render
::
GL2
::
LINES
)
;
m_render
->
draw
(
m_shader2
,
Algo
::
Render
::
GL2
::
LINES
);
//shit for nice line rendering
glEnable
(
GL_POLYGON_OFFSET_FILL
);
glPolygonOffset
(
1.0
f
,
1.0
f
);
// DRAW FACES OF OBJECTS
glEnable
(
GL_LIGHTING
);
glEnable
(
GL_COLOR_MATERIAL
);
glColorMaterial
(
GL_FRONT_AND_BACK
,
GL_DIFFUSE
);
glColor3f
(
0.0
f
,
0.0
f
,
0.9
f
);
m_render
->
draw
(
Algo
::
Render
::
GL2
::
FLAT_TRIANGLES
)
;
glDisable
(
GL_POLYGON_OFFSET_FILL
);
m_render
->
draw
(
m_shader
,
Algo
::
Render
::
GL2
::
TRIANGLES
);
gl
PopMatrix
(
);
gl
Disable
(
GL_POLYGON_OFFSET_FILL
);
}
void
myGlutWin
::
myKeyboard
(
unsigned
char
keycode
,
int
x
,
int
y
)
{
switch
(
keycode
)
{
case
27
:
exit
(
0
);
default:
break
;
}
}
int
main
(
int
argc
,
char
**
argv
)
{
//
/ init glut
interface
and
myGlutWin
mgw
(
&
argc
,
argv
,
800
,
800
);
mgw
.
init
()
;
// interface
:
QApplication
app
(
argc
,
argv
);
MyQT
sqt
;
mgw
.
position
=
myMap
.
addAttribute
<
PFP
::
VEC3
>
(
VERTEX_ORBIT
,
"position"
)
;
PFP
::
TVEC3
position
=
myMap
.
addAttribute
<
PFP
::
VEC3
>
(
VERTEX_ORBIT
,
"position"
)
;
// create a cylinder
Algo
::
Modelisation
::
Polyhedron
<
PFP
>
prim1
(
myMap
,
mgw
.
position
);
Algo
::
Modelisation
::
Polyhedron
<
PFP
>
prim1
(
myMap
,
position
);
prim1
.
cylinder_topo
(
16
,
8
,
true
,
false
);
prim1
.
embedCylinder
(
30.0
f
,
10.0
f
,
70.0
f
);
// create a sphere
Algo
::
Modelisation
::
Polyhedron
<
PFP
>
prim2
(
myMap
,
mgw
.
position
);
Algo
::
Modelisation
::
Polyhedron
<
PFP
>
prim2
(
myMap
,
position
);
prim2
.
cylinder_topo
(
16
,
16
,
true
,
true
);
// topo of sphere is a closed cylinder
prim2
.
embedSphere
(
40.0
f
);
...
...
@@ -214,7 +127,7 @@ int main(int argc, char **argv)
prim2
.
transform
(
trf
);
// create a tore
Algo
::
Modelisation
::
Polyhedron
<
PFP
>
prim3
(
myMap
,
mgw
.
position
);
Algo
::
Modelisation
::
Polyhedron
<
PFP
>
prim3
(
myMap
,
position
);
prim3
.
tore_topo
(
16
,
12
);
prim3
.
embedTore
(
30.0
f
,
10.0
f
);
// transformation
...
...
@@ -225,7 +138,7 @@ int main(int argc, char **argv)
prim3
.
transform
(
trf
);
// create a subdivided cube
Algo
::
Modelisation
::
Polyhedron
<
PFP
>
prim4
(
myMap
,
mgw
.
position
);
Algo
::
Modelisation
::
Polyhedron
<
PFP
>
prim4
(
myMap
,
position
);
prim4
.
cube_topo
(
4
,
5
,
6
);
prim4
.
embedCube
(
50.0
f
,
50.0
f
,
50.0
f
);
...
...
@@ -235,16 +148,32 @@ int main(int argc, char **argv)
Geom
::
translate
<
float
>
(
270.0
f
,
0.0
,
0.0
,
trf
);
prim4
.
transform
(
trf
);
// update renderer
mgw
.
updateRender
();
// bounding box
Geom
::
BoundingBox
<
PFP
::
VEC3
>
bb
=
Algo
::
Geometry
::
computeBoundingBox
<
PFP
>
(
myMap
,
position
);
float
lWidthObj
=
std
::
max
<
PFP
::
REAL
>
(
std
::
max
<
PFP
::
REAL
>
(
bb
.
size
(
0
),
bb
.
size
(
1
)),
bb
.
size
(
2
));
Geom
::
Vec3f
lPosObj
=
(
bb
.
min
()
+
bb
.
max
())
/
PFP
::
REAL
(
2
);
// envoit info BB a l'interface
sqt
.
setParamObject
(
lWidthObj
,
lPosObj
.
data
());
// show 1 pour GL context
sqt
.
show
();
// update du VBO position (context GL necessaire)
sqt
.
m_positionVBO
->
updateData
(
position
);
// update des primitives du renderer
SelectorTrue
allDarts
;
sqt
.
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
allDarts
,
Algo
::
Render
::
GL2
::
TRIANGLES
);
sqt
.
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
allDarts
,
Algo
::
Render
::
GL2
::
LINES
);
// show final pour premier redraw