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
Thomas Pitiot
CGoGN
Commits
e26736d1
Commit
e26736d1
authored
Jul 17, 2013
by
Sylvain Thery
Browse files
update old GL1 to GL2 code
parent
99facfe2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Apps/Examples/simpleGMap3.cpp
View file @
e26736d1
...
...
@@ -40,21 +40,7 @@ SimpleGMap3::SimpleGMap3()
Dart
d
=
primCat
.
hexaGrid_topo
(
3
,
1
,
1
);
primCat
.
embedHexaGrid
(
2
,
1
,
1
);
myMap
.
check
();
// DartMarker markOrient(myMap);
// std::vector<Dart> orient;
// FunctorStore fs(orient);
// d = 49;
// myMap.foreach_dart_of_oriented_volume(d, fs);
// for(std::vector<Dart>::iterator it = orient.begin() ; it != orient.end() ; ++it)
// markOrient.mark(*it);
// SelectorMarked sm(markOrient);
// std::cout << "AAA"<< std::endl;
// Algo::Modelisation::catmullClarkVol<PFP,PFP::TVEC3,PFP::VEC3>(myMap, position, sm);
// Geom::Plane3D<PFP::REAL> pl(VEC3(0.5,0.14,0.5),VEC3(1.5,0.45,0.5),VEC3(0.5,0.15,1.5));
Geom
::
Plane3D
<
PFP
::
REAL
>
pl
(
VEC3
(
-
1
,
-
0.5
,
-
0.5
),
VEC3
(
-
1
,
-
0.5
,
0.5
),
VEC3
(
1
,
0.5
,
0.5
));
Algo
::
Volume
::
Modelisation
::
sliceConvexVolume
<
PFP
>
(
myMap
,
position
,
d
,
pl
);
...
...
@@ -104,7 +90,7 @@ void SimpleGMap3::initGUI()
void
SimpleGMap3
::
cb_initGL
()
{
Utils
::
GLSLShader
::
setCurrentOGLVersion
(
1
)
;
Utils
::
GLSLShader
::
setCurrentOGLVersion
(
2
)
;
Geom
::
BoundingBox
<
PFP
::
VEC3
>
bb
=
Algo
::
Geometry
::
computeBoundingBox
<
PFP
>
(
myMap
,
position
)
;
VEC3
gPosObj
=
bb
.
center
()
;
...
...
@@ -113,20 +99,18 @@ void SimpleGMap3::cb_initGL()
float
tailleZ
=
bb
.
size
(
2
)
;
float
gWidthObj
=
std
::
max
<
float
>
(
std
::
max
<
float
>
(
tailleX
,
tailleY
),
tailleZ
)
;
setParamObject
(
gWidthObj
,
gPosObj
.
data
());
m_render_topo
=
new
Algo
::
Render
::
GL2
::
Topo3Render
();
m_render_topo
->
setDartWidth
(
2.0
f
);
m_render_topo
->
setInitialDartsColor
(
1.0
f
,
1.0
f
,
1.0
f
);
m_render_topo
->
updateData
<
PFP
>
(
myMap
,
position
,
0.9
f
,
0.9
f
,
0.9
f
);
}
void
SimpleGMap3
::
cb_redraw
()
{
glDisable
(
GL_LIGHTING
);
glLineWidth
(
1.0
f
);
Algo
::
Render
::
GL1
::
renderTopoGMD3
<
PFP
>
(
myMap
,
position
,
true
,
true
,
true
,
true
,
0.9
f
,
0.9
f
,
0.9
f
,
0.9
f
);
// Algo::Render::GL1::renderTopoMD3<PFP>(myMap, position, true, true, true, 0.9f, 0.9f, 0.9f);
// glDisable(GL_LIGHTING);
// glColor3f(1.0f, 1.0f, 1.0f);
// glLineWidth(1.0f);
// glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
// Algo::Render::GL1::renderTriQuadPoly<PFP>(myMap, Algo::Render::GL1::LINE, 1.0,position, normal);
m_render_topo
->
drawTopo
();
}
/**********************************************************************************************
...
...
Apps/Examples/simpleGMap3.h
View file @
e26736d1
...
...
@@ -32,8 +32,7 @@
#include
"Geometry/vector_gen.h"
#include
"Algo/Render/GL1/map_glRender.h"
#include
"Algo/Render/GL1/topo_render.h"
#include
"Algo/Render/GL2/topo3Render.h"
using
namespace
CGoGN
;
...
...
@@ -41,7 +40,6 @@ struct PFP: public PFP_STANDARD
{
// definition of the map
typedef
EmbeddedGMap3
MAP
;
// typedef EmbeddedMap3 MAP ;
};
typedef
PFP
::
MAP
MAP
;
...
...
@@ -58,6 +56,8 @@ public:
VertexAttribute
<
VEC3
>
normal
;
VolumeAttribute
<
VEC3
>
volume
;
Algo
::
Render
::
GL2
::
Topo3Render
*
m_render_topo
;
SimpleGMap3
()
;
void
initGUI
()
;
...
...
Apps/Examples/simpleMap3.cpp
View file @
e26736d1
...
...
@@ -35,6 +35,7 @@ SimpleMap3::SimpleMap3()
Algo
::
Volume
::
Modelisation
::
Primitive3D
<
PFP
>
primCat
(
myMap
,
position
);
Dart
d
=
primCat
.
hexaGrid_topo
(
2
,
1
,
1
);
primCat
.
embedHexaGrid
(
1
,
1
,
1
);
myMap
.
closeMap
();
unsigned
int
nb
=
0
;
for
(
unsigned
int
i
=
position
.
begin
();
i
!=
position
.
end
();
position
.
next
(
i
))
...
...
@@ -43,6 +44,7 @@ SimpleMap3::SimpleMap3()
std
::
cout
<<
"Nb vertices (equals 12) : "
<<
nb
<<
std
::
endl
;
assert
(
nb
==
12
);
d
=
myMap
.
phi2
(
myMap
.
phi1
(
myMap
.
phi1
(
myMap
.
phi2
(
d
))));
Dart
dd
=
myMap
.
phi3
(
d
);
...
...
@@ -68,6 +70,7 @@ SimpleMap3::SimpleMap3()
std
::
cout
<<
"Nb vertices after resew (equals 12) : "
<<
nb
<<
std
::
endl
;
assert
(
nb
==
12
);
}
void
SimpleMap3
::
initGUI
()
...
...
@@ -76,7 +79,7 @@ void SimpleMap3::initGUI()
void
SimpleMap3
::
cb_initGL
()
{
Utils
::
GLSLShader
::
setCurrentOGLVersion
(
1
)
;
Utils
::
GLSLShader
::
setCurrentOGLVersion
(
2
)
;
Geom
::
BoundingBox
<
PFP
::
VEC3
>
bb
=
Algo
::
Geometry
::
computeBoundingBox
<
PFP
>
(
myMap
,
position
)
;
VEC3
gPosObj
=
bb
.
center
()
;
...
...
@@ -85,13 +88,26 @@ void SimpleMap3::cb_initGL()
float
tailleZ
=
bb
.
size
(
2
)
;
float
gWidthObj
=
std
::
max
<
float
>
(
std
::
max
<
float
>
(
tailleX
,
tailleY
),
tailleZ
)
;
setParamObject
(
gWidthObj
,
gPosObj
.
data
());
m_render_topo
=
new
Algo
::
Render
::
GL2
::
Topo3Render
();
m_render_topo
->
setDartWidth
(
2.0
f
);
m_render_topo
->
setInitialDartsColor
(
1.0
f
,
1.0
f
,
1.0
f
);
m_render_topo
->
updateData
<
PFP
>
(
myMap
,
position
,
0.9
f
,
0.9
f
,
0.9
f
);
m_render_topo_boundary
=
new
Algo
::
Render
::
GL2
::
TopoRender
();
m_render_topo_boundary
->
setDartWidth
(
2.0
f
);
m_render_topo_boundary
->
setInitialDartsColor
(
0.4
f
,
0.8
f
,
0.4
f
);
m_render_topo_boundary
->
updateDataBoundary
<
PFP
>
(
myMap
,
position
,
0.9
f
,
0.9
f
,
bb
.
maxSize
()
/
50.0
f
);
}
void
SimpleMap3
::
cb_redraw
()
{
glDisable
(
GL_LIGHTING
);
glLineWidth
(
1.0
f
);
Algo
::
Render
::
GL1
::
renderTopoMD3
<
PFP
>
(
myMap
,
position
,
true
,
true
,
true
,
0.9
f
,
0.9
f
,
0.9
f
);
m_render_topo
->
drawTopo
();
m_render_topo_boundary
->
drawTopo
();
}
/**********************************************************************************************
...
...
Apps/Examples/simpleMap3.h
View file @
e26736d1
...
...
@@ -32,7 +32,8 @@
#include
"Geometry/vector_gen.h"
#include
"Algo/Render/GL1/topo_render.h"
#include
"Algo/Render/GL2/topo3Render.h"
#include
"Algo/Render/GL2/topoRender.h"
using
namespace
CGoGN
;
...
...
@@ -55,6 +56,9 @@ public:
VertexAttribute
<
VEC3
>
position
;
Algo
::
Render
::
GL2
::
Topo3Render
*
m_render_topo
;
Algo
::
Render
::
GL2
::
TopoRender
*
m_render_topo_boundary
;
SimpleMap3
()
;
void
initGUI
()
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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