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
Thomas Pitiot
CGoGN
Commits
a3a475f3
Commit
a3a475f3
authored
Feb 01, 2011
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ajout exemple: polyhedron, extrusion, scene
ajout d'un mini graphe de scene OGL dans Utils vbo_MapRender plus template
parent
564c44b6
Changes
44
Hide whitespace changes
Inline
Side-by-side
Showing
44 changed files
with
1332 additions
and
900 deletions
+1332
-900
Apps/Examples/Debug/CMakeLists.txt
Apps/Examples/Debug/CMakeLists.txt
+11
-0
Apps/Examples/FilterExamples.cpp
Apps/Examples/FilterExamples.cpp
+3
-3
Apps/Examples/FilterExamples.h
Apps/Examples/FilterExamples.h
+3
-15
Apps/Examples/MeshVBO.cpp
Apps/Examples/MeshVBO.cpp
+2
-2
Apps/Examples/Release/CMakeLists.txt
Apps/Examples/Release/CMakeLists.txt
+12
-0
Apps/Examples/SocialAgents/include/env_map.h
Apps/Examples/SocialAgents/include/env_map.h
+3
-11
Apps/Examples/SocialAgents/include/viewer.h
Apps/Examples/SocialAgents/include/viewer.h
+2
-2
Apps/Examples/SocialAgents/src/viewer.cpp
Apps/Examples/SocialAgents/src/viewer.cpp
+4
-4
Apps/Examples/Viewer.cpp
Apps/Examples/Viewer.cpp
+6
-18
Apps/Examples/convert2tbgz.cpp
Apps/Examples/convert2tbgz.cpp
+1
-1
Apps/Examples/decimationVolumique.cpp
Apps/Examples/decimationVolumique.cpp
+8
-8
Apps/Examples/decimationVolumique.h
Apps/Examples/decimationVolumique.h
+3
-14
Apps/Examples/extrusionView.cpp
Apps/Examples/extrusionView.cpp
+242
-0
Apps/Examples/first.cpp
Apps/Examples/first.cpp
+3
-15
Apps/Examples/ihmView.cpp
Apps/Examples/ihmView.cpp
+7
-15
Apps/Examples/linearTest.cpp
Apps/Examples/linearTest.cpp
+3
-3
Apps/Examples/linearTest.h
Apps/Examples/linearTest.h
+3
-15
Apps/Examples/miniTest.cpp
Apps/Examples/miniTest.cpp
+8
-20
Apps/Examples/pmView.cpp
Apps/Examples/pmView.cpp
+11
-11
Apps/Examples/pmView.h
Apps/Examples/pmView.h
+3
-14
Apps/Examples/polyhedronsView.cpp
Apps/Examples/polyhedronsView.cpp
+252
-0
Apps/Examples/scene.cpp
Apps/Examples/scene.cpp
+270
-0
Apps/Examples/simpleEMap3.cpp
Apps/Examples/simpleEMap3.cpp
+1
-14
Apps/Examples/simpleGMap2.cpp
Apps/Examples/simpleGMap2.cpp
+2
-14
Apps/Examples/simpleXMap.h
Apps/Examples/simpleXMap.h
+1
-1
Apps/Examples/squelette3carte.cpp
Apps/Examples/squelette3carte.cpp
+3
-3
Apps/Examples/squelette3carte.h
Apps/Examples/squelette3carte.h
+3
-15
Apps/Examples/ter_meshes.cpp
Apps/Examples/ter_meshes.cpp
+6
-18
Apps/Examples/triangulation.cpp
Apps/Examples/triangulation.cpp
+7
-18
Apps/Examples/volumeViewer.h
Apps/Examples/volumeViewer.h
+3
-14
Apps/Tuto/tp_master.cpp
Apps/Tuto/tp_master.cpp
+12
-24
Apps/Tuto/tuto1.cpp
Apps/Tuto/tuto1.cpp
+6
-13
Apps/Tuto/tuto2.cpp
Apps/Tuto/tuto2.cpp
+7
-17
Apps/Tuto/tuto3.cpp
Apps/Tuto/tuto3.cpp
+7
-17
Apps/Tuto/tuto4.cpp
Apps/Tuto/tuto4.cpp
+7
-17
Apps/Tuto/tuto5.cpp
Apps/Tuto/tuto5.cpp
+26
-69
Apps/Tuto/tuto_subdivision.cpp
Apps/Tuto/tuto_subdivision.cpp
+2
-14
ThirdParty/Assimp/code/cmake_install.cmake
ThirdParty/Assimp/code/cmake_install.cmake
+1
-79
include/Algo/Modelisation/polyhedron.h
include/Algo/Modelisation/polyhedron.h
+15
-4
include/Algo/Modelisation/polyhedron.hpp
include/Algo/Modelisation/polyhedron.hpp
+3
-3
include/Algo/Render/vbo_MapRender.h
include/Algo/Render/vbo_MapRender.h
+22
-22
include/Algo/Render/vbo_MapRender.hpp
include/Algo/Render/vbo_MapRender.hpp
+75
-353
include/Topology/generic/parameters.h
include/Topology/generic/parameters.h
+51
-0
include/Utils/scene_graph.h
include/Utils/scene_graph.h
+212
-0
No files found.
Apps/Examples/Debug/CMakeLists.txt
View file @
a3a475f3
...
...
@@ -73,3 +73,14 @@ add_executable( ter_meshesD ../ter_meshes.cpp)
target_link_libraries
(
ter_meshesD
containerD topologyD utilsD algoD
${
COMMON_LIBS
}
)
add_executable
(
polyhedronsViewD ../polyhedronsView.cpp
)
target_link_libraries
(
polyhedronsViewD
containerD topologyD utilsD algoD
${
COMMON_LIBS
}
)
add_executable
(
extrusionViewD ../extrusionView.cpp
)
target_link_libraries
(
extrusionViewD
containerD topologyD utilsD algoD
${
COMMON_LIBS
}
)
add_executable
(
sceneD ../scene.cpp
)
target_link_libraries
(
sceneD
containerD topologyD utilsD algoD
${
COMMON_LIBS
}
)
Apps/Examples/FilterExamples.cpp
View file @
a3a475f3
...
...
@@ -237,9 +237,9 @@ void MyGlutWin::init()
myMap
.
copyAttribute
(
originalPosition
,
position
)
;
vbo_render
=
new
Algo
::
Render
::
VBO
::
MapRender_VBO
<
PFP
>
(
myMap
,
allDarts
)
;
vbo_render
->
initPrimitives
(
Algo
::
Render
::
VBO
::
TRIANGLES
)
;
vbo_render
->
initPrimitives
(
Algo
::
Render
::
VBO
::
LINES
)
;
vbo_render
=
new
Algo
::
Render
::
VBO
::
MapRender_VBO
(
)
;
vbo_render
->
initPrimitives
<
PFP
>
(
myMap
,
allDarts
,
Algo
::
Render
::
VBO
::
TRIANGLES
)
;
vbo_render
->
initPrimitives
<
PFP
>
(
myMap
,
allDarts
,
Algo
::
Render
::
VBO
::
LINES
)
;
updateVBOdata
(
Algo
::
Render
::
VBO
::
POSITIONS
|
Algo
::
Render
::
VBO
::
NORMALS
)
;
}
...
...
Apps/Examples/FilterExamples.h
View file @
a3a475f3
...
...
@@ -27,6 +27,7 @@
#include "Utils/glutwin_atb.h"
#include "Topology/generic/parameters.h"
#include "Topology/map/map2.h"
#include "Geometry/vector_gen.h"
#include "Geometry/matrix.h"
...
...
@@ -44,23 +45,10 @@
using
namespace
CGoGN
;
struct
PFP
struct
PFP
:
public
PFP_STANDARD
{
// definition of the map
typedef
Map2
MAP
;
// definition of the type of real value
typedef
float
REAL
;
// other types definitions
typedef
Geom
::
Vector
<
3
,
REAL
>
VEC3
;
typedef
Geom
::
Vector
<
6
,
REAL
>
VEC6
;
typedef
Geom
::
Matrix
<
3
,
3
,
REAL
>
MATRIX33
;
typedef
Geom
::
Matrix
<
4
,
4
,
REAL
>
MATRIX44
;
typedef
Geom
::
Matrix
<
3
,
6
,
REAL
>
MATRIX36
;
typedef
AttributeHandler
<
VEC3
>
TVEC3
;
typedef
AttributeHandler
<
REAL
>
TREAL
;
};
...
...
@@ -105,7 +93,7 @@ public:
PFP
::
TVEC3
faceNormal
;
PFP
::
TVEC3
faceCentroid
;
Algo
::
Render
::
VBO
::
MapRender_VBO
<
PFP
>
*
vbo_render
;
Algo
::
Render
::
VBO
::
MapRender_VBO
*
vbo_render
;
GLuint
dl_norm
;
MyGlutWin
(
int
*
argc
,
char
**
argv
,
int
winX
,
int
winY
)
;
...
...
Apps/Examples/MeshVBO.cpp
View file @
a3a475f3
...
...
@@ -236,8 +236,8 @@ void myGlutWin::initDL(void)
vbor
=
new
VBORenderType
(
myMap
,
allDarts
,
my_vbo_cb
);
vbor
->
initData
(
0
,
invertedNormals
);
vbor
->
initPrimitives
(
Algo
::
Render
::
VBO
::
VBO_TRIANGLES
);
vbor
->
initPrimitives
(
Algo
::
Render
::
VBO
::
VBO_LINES
);
vbor
->
initPrimitives
<
PFP
>
(
myMap
,
good
,
Algo
::
Render
::
VBO
::
VBO_TRIANGLES
);
vbor
->
initPrimitives
<
PFP
>
(
myMap
,
good
,
Algo
::
Render
::
VBO
::
VBO_LINES
);
// vbor->initEmb_Flat_Exploded(myMap.getNbDarts() , true, invertedNormals,0.8f);
...
...
Apps/Examples/Release/CMakeLists.txt
View file @
a3a475f3
...
...
@@ -141,3 +141,15 @@ 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
)
target_link_libraries
(
polyhedronsView
container topology utils algo
${
COMMON_LIBS
}
)
add_executable
(
extrusionView ../extrusionView.cpp
)
target_link_libraries
(
extrusionView
container topology utils algo
${
COMMON_LIBS
}
)
add_executable
(
scene ../scene.cpp
)
target_link_libraries
(
scene
container topology utils algo
${
COMMON_LIBS
}
)
Apps/Examples/SocialAgents/include/env_map.h
View file @
a3a475f3
...
...
@@ -4,6 +4,7 @@
#include <iostream>
// #include "Definitions.h"
#include "Topology/generic/parameters.h"
#include "Topology/map/map2.h"
#include "Topology/generic/embeddedMap2.h"
...
...
@@ -23,28 +24,19 @@ using namespace CGoGN;
class
Agent
;
struct
PFP
{
struct
PFP
:
public
PFP_STANDARD
{
// definition de la carte
// typedef EmbeddedMap2<Map2> MAP;
typedef
Algo
::
IHM
::
ImplicitHierarchicalMap
MAP
;
// definition du type de reel utilise
typedef
float
REAL
;
// definition du type de vecteur (point) utilise
typedef
Geom
::
Vec3f
VEC3
;
// definition des listes d'agent
// typedef std::vector<Agent *> AGENTS;
typedef
std
::
vector
<
Agent
*
>
AGENTS
;
typedef
NoMathIONameAttribute
<
AGENTS
>
AGENTVECT
;
typedef
AttributeHandler
<
VEC3
>
TVEC3
;
typedef
AttributeHandler
<
AGENTVECT
>
TAB_AGENTVECT
;
// definition des cellules abstraites
// typedef MAP::EVertex EVERTEX;
// typedef MAP::EEdge EEDGE;
// typedef MAP::EFace EFACE;
// typedef MAP::EVolume EVOLUME;
};
typedef
PFP
::
VEC3
VEC3
;
...
...
Apps/Examples/SocialAgents/include/viewer.h
View file @
a3a475f3
...
...
@@ -72,8 +72,8 @@ public:
void
myKeyboard
(
unsigned
char
keycode
,
int
x
,
int
y
);
void
myMouse
(
int
button
,
int
state
,
int
x
,
int
y
);
Algo
::
Render
::
VBO
::
MapRender_VBO
<
PFP
>
*
m_render
;
Algo
::
Render
::
VBO
::
MapRender_VBO
<
PFP
>
*
m_render_line
;
Algo
::
Render
::
VBO
::
MapRender_VBO
*
m_render
;
Algo
::
Render
::
VBO
::
MapRender_VBO
*
m_render_line
;
// Algo::Render::VBO::topo_MD2_VBORender<PFP>* topo_render ;
// Algo::Render::VBO::topo_VBORenderMapD* topo_render ;
...
...
Apps/Examples/SocialAgents/src/viewer.cpp
View file @
a3a475f3
...
...
@@ -63,15 +63,15 @@ void MyGlutWin::init()
// topo_render = new Algo::Render::VBO::topo_VBORenderMapD() ;
// m_render = new Algo::Render::VBO::MapRender_VBO
<PFP>
(sim->envMap.map, allDarts) ;
// m_render->initPrimitives
(
Algo::Render::VBO::TRIANGLES) ;
// m_render = new Algo::Render::VBO::MapRender_VBO(sim->envMap.map, allDarts) ;
// m_render->initPrimitives
<PFP>(myMap, good,
Algo::Render::VBO::TRIANGLES) ;
// m_render->updateData(Algo::Render::VBO::POSITIONS, sim->envMap.position) ;
// Algo::Geometry::computeNormalFaces<PFP>(sim->envMap.map, sim->envMap.position, sim->envMap.normal) ;
// m_render->updateData(Algo::Render::VBO::NORMALS, sim->envMap.normal) ;;
// m_render->initPrimitives
(
Algo::Render::VBO::TRIANGLES) ;
// m_render->initPrimitives
(
Algo::Render::VBO::LINES) ;
// m_render->initPrimitives
<PFP>(myMap, good,
Algo::Render::VBO::TRIANGLES) ;
// m_render->initPrimitives
<PFP>(myMap, good,
Algo::Render::VBO::LINES) ;
}
void
MyGlutWin
::
initGUI
()
...
...
Apps/Examples/Viewer.cpp
View file @
a3a475f3
...
...
@@ -28,6 +28,7 @@
#include "Utils/GLSLShader.h"
#include "Utils/glutwin.h"
#include "Topology/generic/parameters.h"
#include "Topology/map/map2.h"
#include "Topology/generic/embeddedMap2.h"
...
...
@@ -55,23 +56,10 @@
using
namespace
CGoGN
;
struct
PFP
struct
PFP
:
public
PFP_STANDARD
{
// definition of the map
typedef
EmbeddedMap2
<
Map2
>
MAP
;
// definition of the type of real value
typedef
float
REAL
;
// other types definitions
typedef
Geom
::
Vector
<
3
,
REAL
>
VEC3
;
typedef
Geom
::
Vector
<
6
,
REAL
>
VEC6
;
typedef
Geom
::
Matrix
<
3
,
3
,
REAL
>
MATRIX33
;
typedef
Geom
::
Matrix
<
4
,
4
,
REAL
>
MATRIX44
;
typedef
Geom
::
Matrix
<
3
,
6
,
REAL
>
MATRIX36
;
typedef
AttributeHandler
<
VEC3
>
TVEC3
;
typedef
AttributeHandler
<
REAL
>
TREAL
;
};
...
...
@@ -149,7 +137,7 @@ public:
*/
int
renderStyle
;
Algo
::
Render
::
VBO
::
MapRender_VBO
<
PFP
>
*
m_render
;
Algo
::
Render
::
VBO
::
MapRender_VBO
*
m_render
;
/**
* render mode enum
...
...
@@ -165,13 +153,13 @@ public:
if
(
this
->
shaderOk
)
shaders
[
0
].
loadShaders
(
"phong_vs.txt"
,
"phong_ps.txt"
);
// m_cb = new Algo::Render::VBO::VBO_CB_PositionNormal<PFP>(myMap);
// m_render = new Algo::Render::VBO::MapRender_VBO
<PFP>
(myMap, allDarts, m_cb);
// m_render = new Algo::Render::VBO::MapRender_VBO(myMap, allDarts, m_cb);
//
// m_render->initBuffers();
// m_render->updateData(Algo::Render::VBO::POSITIONS, position );
// m_render->updateData(Algo::Render::VBO::NORMALS, normal );
// m_render->initPrimitives
(
Algo::Render::VBO::TRIANGLES);
// m_render->initPrimitives
(
Algo::Render::VBO::LINES);
// m_render->initPrimitives
<PFP>(myMap, good,
Algo::Render::VBO::TRIANGLES);
// m_render->initPrimitives
<PFP>(myMap, good,
Algo::Render::VBO::LINES);
}
};
...
...
Apps/Examples/convert2tbgz.cpp
View file @
a3a475f3
...
...
@@ -40,7 +40,7 @@
gmtl
::
Vec3f
gMax
;
gmtl
::
Vec3f
gMin
;
struct
PFP
struct
PFP
:
public
PFP_STANDARD
{
typedef
DartObj
<
DP
::
DefaultDartParameters
>
DART
;
typedef
e0mapd2
<
DART
>
MAP
;
...
...
Apps/Examples/decimationVolumique.cpp
View file @
a3a475f3
...
...
@@ -148,12 +148,12 @@ void MyGlutWin::myRedraw(void)
if
(
render_obj
)
{
m_render
->
updateData
(
Algo
::
Render
::
VBO
::
POSITIONS
,
position
);
//m_render->initPrimitives
(
Algo::Render::VBO::POINTS);
//m_render->initPrimitives
<PFP>(myMap, good,
Algo::Render::VBO::POINTS);
if
(
renderObjStyle
==
O_ALL
)
{
m_render
->
initPrimitives
(
Algo
::
Render
::
VBO
::
TRIANGLES
);
m_render
->
initPrimitives
(
Algo
::
Render
::
VBO
::
LINES
);
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
allDarts
,
Algo
::
Render
::
VBO
::
TRIANGLES
);
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
allDarts
,
Algo
::
Render
::
VBO
::
LINES
);
glEnable
(
GL_POLYGON_OFFSET_FILL
);
glPolygonOffset
(
1.0
f
,
1.0
f
);
...
...
@@ -171,7 +171,7 @@ void MyGlutWin::myRedraw(void)
}
else
if
(
renderObjStyle
==
O_FACES
)
{
m_render
->
initPrimitives
(
Algo
::
Render
::
VBO
::
TRIANGLES
);
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
allDarts
,
Algo
::
Render
::
VBO
::
TRIANGLES
);
glEnable
(
GL_POLYGON_OFFSET_FILL
);
glPolygonOffset
(
1.0
f
,
1.0
f
);
...
...
@@ -182,7 +182,7 @@ void MyGlutWin::myRedraw(void)
}
else
if
(
renderObjStyle
==
O_LINE
)
{
m_render
->
initPrimitives
(
Algo
::
Render
::
VBO
::
LINES
);
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
allDarts
,
Algo
::
Render
::
VBO
::
LINES
);
// on trace les ligne devant
glDisable
(
GL_POLYGON_OFFSET_FILL
);
...
...
@@ -277,8 +277,8 @@ void MyGlutWin::initRender()
std
::
cout
<<
"updateData: "
<<
seconds
<<
"sec"
<<
std
::
endl
;
// creation des primitives de rendu a partir de la carte
t1
=
glutGet
(
GLUT_ELAPSED_TIME
);
m_render
->
initPrimitives
(
Algo
::
Render
::
VBO
::
TRIANGLES
);
m_render
->
initPrimitives
(
Algo
::
Render
::
VBO
::
LINES
);
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
allDarts
,
Algo
::
Render
::
VBO
::
TRIANGLES
);
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
allDarts
,
Algo
::
Render
::
VBO
::
LINES
);
t2
=
glutGet
(
GLUT_ELAPSED_TIME
);
seconds
=
(
t2
-
t1
)
/
1000.0
f
;
std
::
cout
<<
"initPrimitives: "
<<
seconds
<<
"sec"
<<
std
::
endl
;
...
...
@@ -414,7 +414,7 @@ int main(int argc, char **argv)
// allocation des objets necessaires pour le rendu
mgw
->
m_render
=
new
Algo
::
Render
::
VBO
::
MapRender_VBO
<
PFP
>
(
myMap
,
allDarts
);
mgw
->
m_render
=
new
Algo
::
Render
::
VBO
::
MapRender_VBO
(
);
//mgw->m_render_topo = new Algo::Render::VBO::topo3_VBORenderMap<PFP::MAP>();
mgw
->
m_render_topo
=
new
Algo
::
Render
::
VBO
::
topo3_VBORenderMapD
();
...
...
Apps/Examples/decimationVolumique.h
View file @
a3a475f3
...
...
@@ -29,6 +29,7 @@
#include "Utils/glutwin_atb.h"
#include "Topology/generic/parameters.h"
#include "Topology/map/map3.h"
#include "Topology/generic/cellmarker.h"
...
...
@@ -46,23 +47,11 @@
using
namespace
CGoGN
;
struct
PFP
struct
PFP
:
public
PFP_STANDARD
{
// definition of the map
typedef
Map3
MAP
;
// definition of the type of real value
typedef
float
REAL
;
// other types definitions
typedef
Geom
::
Vector
<
3
,
REAL
>
VEC3
;
typedef
Geom
::
Vector
<
6
,
REAL
>
VEC6
;
typedef
Geom
::
Matrix
<
3
,
3
,
REAL
>
MATRIX33
;
typedef
Geom
::
Matrix
<
4
,
4
,
REAL
>
MATRIX44
;
typedef
Geom
::
Matrix
<
3
,
6
,
REAL
>
MATRIX36
;
typedef
AttributeHandler
<
VEC3
>
TVEC3
;
typedef
AttributeHandler
<
REAL
>
TREAL
;
};
PFP
::
MAP
myMap
;
...
...
@@ -143,7 +132,7 @@ public:
/*
* VBO Object rendering
*/
Algo
::
Render
::
VBO
::
MapRender_VBO
<
PFP
>
*
m_render
;
Algo
::
Render
::
VBO
::
MapRender_VBO
*
m_render
;
/*
* VBO Topo rendering
...
...
Apps/Examples/extrusionView.cpp
0 → 100644
View file @
a3a475f3
/*******************************************************************************
* 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 *
* *
*******************************************************************************/
#include <iostream>
#include "Utils/glutwin.h"
#include "Topology/generic/parameters.h"
#include "Topology/map/map2.h"
#include "Topology/generic/embeddedMap2.h"
#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/Modelisation/extrusion.h"
#include "Topology/generic/parameters.h"
#include <vector>
using
namespace
CGoGN
;
struct
PFP
:
public
PFP_STANDARD
{
// definition de la carte
typedef
EmbeddedMap2
<
Map2
>
MAP
;
};
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
::
VBO
::
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
()
{
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
()
{
SelectorTrue
allDarts
;
// create the renderer (first call only)
if
(
m_render
==
NULL
)
m_render
=
new
Algo
::
Render
::
VBO
::
MapRender_VBO
()
;
// update buffer op vertices positions
m_render
->
updateData
(
Algo
::
Render
::
VBO
::
POSITIONS
,
position
);
// update flat faces primtives (warning need position buffer)
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
SelectorTrue
(),
Algo
::
Render
::
VBO
::
FLAT_TRIANGLES
);
// update lines primitives
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
SelectorTrue
(),
Algo
::
Render
::
VBO
::
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
]);
// DRAW LINES OF OBJECTS
glDisable
(
GL_LIGHTING
);
glColor3f
(
1.0
f
,
1.0
f
,
0.0
f
);
m_render
->
draw
(
Algo
::
Render
::
VBO
::
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
::
VBO
::
FLAT_TRIANGLES
)
;
glDisable
(
GL_POLYGON_OFFSET_FILL
);
glPopMatrix
();
}
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
();
mgw
.
position
=
myMap
.
addAttribute
<
PFP
::
VEC3
>
(
VERTEX_ORBIT
,
"position"
)
;
// define the face extruded (here a cross)
std
::
vector
<
PFP
::
VEC3
>
objV
;
objV
.
push_back
(
PFP
::
VEC3
(
-
1
,
0
,
-
1
));
objV
.
push_back
(
PFP
::
VEC3
(
-
1
,
0
,
-
2
));
objV
.
push_back
(
PFP
::
VEC3
(
+
1
,
0
,
-
2
));
objV
.
push_back
(
PFP
::
VEC3
(
+
1
,
0
,
-
1
));
objV
.
push_back
(
PFP
::
VEC3
(
+
2
,
0
,
-
1
));
objV
.
push_back
(
PFP
::
VEC3
(
+
2
,
0
,
+
1
));
objV
.
push_back
(
PFP
::
VEC3
(
+
1
,
0
,
+
1
));
objV
.
push_back
(
PFP
::
VEC3
(
+
1
,
0
,
+
2
));
objV
.
push_back
(
PFP
::
VEC3
(
-
1
,
0
,
+
2
));
objV
.
push_back
(
PFP
::
VEC3
(
-
1
,
0
,
+
1
));
objV
.
push_back
(
PFP
::
VEC3
(
-
2
,
0
,
+
1
));
objV
.
push_back
(
PFP
::
VEC3
(
-
2
,
0
,
-
1
));
// define a path (here an helicoid)
std
::
vector
<
PFP
::
VEC3
>
pathV
;
// and a varying radius
std
::
vector
<
float
>
pathRadius
;
for
(
int
i
=
0
;
i
<
200
;
++
i
)
{
PFP
::
REAL
alpha
=
3.141592
/
20.0
*
i
;
PFP
::
REAL
rad
=
20.0
-
0.2
*
i
;
pathV
.
push_back
(
PFP
::
VEC3
(
rad
*
cos
(
alpha
),
rad
*
sin
(
alpha
),
0.5
*
i
));
pathRadius
.
push_back
(
1.5
f
+
0.7
*
cos
(
alpha
));
}
// 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
);
// update renderer
mgw
.
updateRender
();
// 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
);
mgw
.
mainLoop
();
return
0
;
}
Apps/Examples/first.cpp
View file @
a3a475f3
...
...
@@ -29,6 +29,7 @@
#include "Utils/GLSLShader.h"
#include "Utils/glutwin.h"
#include "Topology/generic/parameters.h"
#include "Topology/map/map2.h"
#include "Geometry/vector_gen.h"
...
...
@@ -82,23 +83,10 @@ inline X lerp( X u, X v, double a )
struct
PFP
struct
PFP
:
public
PFP_STANDARD
{
// definition of the map
typedef
Map2
MAP
;
// definition of the type of real value
typedef
float
REAL
;
// other types definitions
typedef
Geom
::
Vector
<
3
,
REAL
>
VEC3
;
typedef
Geom
::
Vector
<
6
,
REAL
>
VEC6
;
typedef
Geom
::
Matrix
<
3
,
3
,
REAL
>
MATRIX33
;
typedef
Geom
::
Matrix
<
4
,
4
,
REAL
>
MATRIX44
;
typedef
Geom
::
Matrix
<
3
,
6
,
REAL
>
MATRIX36
;
typedef
AttributeHandler
<
VEC3
>
TVEC3
;
typedef
AttributeHandler
<
REAL
>
TREAL
;
};
...
...
@@ -526,7 +514,7 @@ int main(int argc, char **argv)
// Algo::Render::VBO::mapRender<PFP> mr(myMap, allDarts, &vbocb) ;
//
// mr.initBuffers();
// mr.initPrimitives
(
Algo::Render::VBO::TRIANGLES);
// mr.initPrimitives
<PFP>(myMap, good,
Algo::Render::VBO::TRIANGLES);
// mr.updateData(Algo::Render::VBO::POSITIONS, codePositions);
// mr.updateData(Algo::Render::VBO::NORMALS, codeNormals);
// mr.draw(Algo::Render::VBO::TRIANGLES);
...
...
Apps/Examples/ihmView.cpp
View file @
a3a475f3
...
...
@@ -26,6 +26,7 @@
#include "Utils/glutwin_atb.h"