Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Thomas Pitiot
CGoGN
Commits
bf5c4d2d
Commit
bf5c4d2d
authored
Feb 25, 2011
by
kenneth
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of cgogn:~cgogn/CGoGN
Conflicts: include/Topology/generic/cellmarker.h
parents
9b52ecd2
6346fca0
Changes
327
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
75 changed files
with
18440 additions
and
31 deletions
+18440
-31
Apps/Examples/Debug/CMakeLists.txt
Apps/Examples/Debug/CMakeLists.txt
+1
-0
Apps/Examples/Release/CMakeLists.txt
Apps/Examples/Release/CMakeLists.txt
+1
-0
Apps/Examples/Viewer.cpp
Apps/Examples/Viewer.cpp
+7
-7
Apps/Examples/extrusionView.cpp
Apps/Examples/extrusionView.cpp
+1
-1
Apps/Examples/miniTest.cpp
Apps/Examples/miniTest.cpp
+99
-4
Apps/Tuto/CMakeLists.txt
Apps/Tuto/CMakeLists.txt
+15
-0
Apps/Tuto/tp_master.cpp
Apps/Tuto/tp_master.cpp
+3
-4
Apps/Tuto/tuto_mt.cpp
Apps/Tuto/tuto_mt.cpp
+345
-0
Apps/Tuto/tuto_ogl2.cpp
Apps/Tuto/tuto_ogl2.cpp
+184
-0
Apps/Tuto/tuto_ogl3.cpp
Apps/Tuto/tuto_ogl3.cpp
+249
-0
Apps/Tuto/tuto_subdivision.cpp
Apps/Tuto/tuto_subdivision.cpp
+1
-1
README.TXT
README.TXT
+1
-1
ThirdParty/Assimp/code/CMakeLists.txt
ThirdParty/Assimp/code/CMakeLists.txt
+4
-4
ThirdParty/CMakeLists.txt
ThirdParty/CMakeLists.txt
+11
-2
ThirdParty/Numerical/CMakeLists.txt
ThirdParty/Numerical/CMakeLists.txt
+0
-1
ThirdParty/Numerical/C_BLAS_LAPACK/BLAS/SRC/CMakeLists.txt
ThirdParty/Numerical/C_BLAS_LAPACK/BLAS/SRC/CMakeLists.txt
+1
-1
ThirdParty/Numerical/C_BLAS_LAPACK/F2CLIBS/libf2c/CMakeLists.txt
...rty/Numerical/C_BLAS_LAPACK/F2CLIBS/libf2c/CMakeLists.txt
+3
-2
ThirdParty/Numerical/C_BLAS_LAPACK/SRC/CMakeLists.txt
ThirdParty/Numerical/C_BLAS_LAPACK/SRC/CMakeLists.txt
+0
-1
ThirdParty/Zinri/Build/CMakeLists.txt
ThirdParty/Zinri/Build/CMakeLists.txt
+0
-2
ThirdParty/glm/glm/core/_detail.hpp
ThirdParty/glm/glm/core/_detail.hpp
+323
-0
ThirdParty/glm/glm/core/_swizzle.hpp
ThirdParty/glm/glm/core/_swizzle.hpp
+1085
-0
ThirdParty/glm/glm/core/_swizzle.inl
ThirdParty/glm/glm/core/_swizzle.inl
+20
-0
ThirdParty/glm/glm/core/dummy.cpp
ThirdParty/glm/glm/core/dummy.cpp
+17
-0
ThirdParty/glm/glm/core/func_common.hpp
ThirdParty/glm/glm/core/func_common.hpp
+274
-0
ThirdParty/glm/glm/core/func_common.inl
ThirdParty/glm/glm/core/func_common.inl
+1542
-0
ThirdParty/glm/glm/core/func_exponential.hpp
ThirdParty/glm/glm/core/func_exponential.hpp
+71
-0
ThirdParty/glm/glm/core/func_exponential.inl
ThirdParty/glm/glm/core/func_exponential.inl
+358
-0
ThirdParty/glm/glm/core/func_geometric.hpp
ThirdParty/glm/glm/core/func_geometric.hpp
+92
-0
ThirdParty/glm/glm/core/func_geometric.inl
ThirdParty/glm/glm/core/func_geometric.inl
+290
-0
ThirdParty/glm/glm/core/func_integer.hpp
ThirdParty/glm/glm/core/func_integer.hpp
+142
-0
ThirdParty/glm/glm/core/func_integer.inl
ThirdParty/glm/glm/core/func_integer.inl
+600
-0
ThirdParty/glm/glm/core/func_matrix.hpp
ThirdParty/glm/glm/core/func_matrix.hpp
+92
-0
ThirdParty/glm/glm/core/func_matrix.inl
ThirdParty/glm/glm/core/func_matrix.inl
+559
-0
ThirdParty/glm/glm/core/func_noise.hpp
ThirdParty/glm/glm/core/func_noise.hpp
+53
-0
ThirdParty/glm/glm/core/func_noise.inl
ThirdParty/glm/glm/core/func_noise.inl
+305
-0
ThirdParty/glm/glm/core/func_packing.hpp
ThirdParty/glm/glm/core/func_packing.hpp
+45
-0
ThirdParty/glm/glm/core/func_packing.inl
ThirdParty/glm/glm/core/func_packing.inl
+94
-0
ThirdParty/glm/glm/core/func_trigonometric.hpp
ThirdParty/glm/glm/core/func_trigonometric.hpp
+125
-0
ThirdParty/glm/glm/core/func_trigonometric.inl
ThirdParty/glm/glm/core/func_trigonometric.inl
+745
-0
ThirdParty/glm/glm/core/func_vector_relational.hpp
ThirdParty/glm/glm/core/func_vector_relational.hpp
+189
-0
ThirdParty/glm/glm/core/func_vector_relational.inl
ThirdParty/glm/glm/core/func_vector_relational.inl
+20
-0
ThirdParty/glm/glm/core/hint.hpp
ThirdParty/glm/glm/core/hint.hpp
+21
-0
ThirdParty/glm/glm/core/type.hpp
ThirdParty/glm/glm/core/type.hpp
+283
-0
ThirdParty/glm/glm/core/type_float.hpp
ThirdParty/glm/glm/core/type_float.hpp
+72
-0
ThirdParty/glm/glm/core/type_gentype.hpp
ThirdParty/glm/glm/core/type_gentype.hpp
+150
-0
ThirdParty/glm/glm/core/type_gentype.inl
ThirdParty/glm/glm/core/type_gentype.inl
+347
-0
ThirdParty/glm/glm/core/type_half.hpp
ThirdParty/glm/glm/core/type_half.hpp
+85
-0
ThirdParty/glm/glm/core/type_half.inl
ThirdParty/glm/glm/core/type_half.inl
+357
-0
ThirdParty/glm/glm/core/type_int.hpp
ThirdParty/glm/glm/core/type_int.hpp
+130
-0
ThirdParty/glm/glm/core/type_mat.hpp
ThirdParty/glm/glm/core/type_mat.hpp
+56
-0
ThirdParty/glm/glm/core/type_mat.inl
ThirdParty/glm/glm/core/type_mat.inl
+0
-0
ThirdParty/glm/glm/core/type_mat2x2.hpp
ThirdParty/glm/glm/core/type_mat2x2.hpp
+245
-0
ThirdParty/glm/glm/core/type_mat2x2.inl
ThirdParty/glm/glm/core/type_mat2x2.inl
+610
-0
ThirdParty/glm/glm/core/type_mat2x3.hpp
ThirdParty/glm/glm/core/type_mat2x3.hpp
+212
-0
ThirdParty/glm/glm/core/type_mat2x3.inl
ThirdParty/glm/glm/core/type_mat2x3.inl
+541
-0
ThirdParty/glm/glm/core/type_mat2x4.hpp
ThirdParty/glm/glm/core/type_mat2x4.hpp
+212
-0
ThirdParty/glm/glm/core/type_mat2x4.inl
ThirdParty/glm/glm/core/type_mat2x4.inl
+569
-0
ThirdParty/glm/glm/core/type_mat3x2.hpp
ThirdParty/glm/glm/core/type_mat3x2.hpp
+214
-0
ThirdParty/glm/glm/core/type_mat3x2.inl
ThirdParty/glm/glm/core/type_mat3x2.inl
+575
-0
ThirdParty/glm/glm/core/type_mat3x3.hpp
ThirdParty/glm/glm/core/type_mat3x3.hpp
+244
-0
ThirdParty/glm/glm/core/type_mat3x3.inl
ThirdParty/glm/glm/core/type_mat3x3.inl
+704
-0
ThirdParty/glm/glm/core/type_mat3x4.hpp
ThirdParty/glm/glm/core/type_mat3x4.hpp
+214
-0
ThirdParty/glm/glm/core/type_mat3x4.inl
ThirdParty/glm/glm/core/type_mat3x4.inl
+609
-0
ThirdParty/glm/glm/core/type_mat4x2.hpp
ThirdParty/glm/glm/core/type_mat4x2.hpp
+216
-0
ThirdParty/glm/glm/core/type_mat4x2.inl
ThirdParty/glm/glm/core/type_mat4x2.inl
+618
-0
ThirdParty/glm/glm/core/type_mat4x3.hpp
ThirdParty/glm/glm/core/type_mat4x3.hpp
+216
-0
ThirdParty/glm/glm/core/type_mat4x3.inl
ThirdParty/glm/glm/core/type_mat4x3.inl
+623
-0
ThirdParty/glm/glm/core/type_mat4x4.hpp
ThirdParty/glm/glm/core/type_mat4x4.hpp
+244
-0
ThirdParty/glm/glm/core/type_mat4x4.inl
ThirdParty/glm/glm/core/type_mat4x4.inl
+759
-0
ThirdParty/glm/glm/core/type_size.hpp
ThirdParty/glm/glm/core/type_size.hpp
+24
-0
ThirdParty/glm/glm/core/type_vec.hpp
ThirdParty/glm/glm/core/type_vec.hpp
+22
-0
ThirdParty/glm/glm/core/type_vec.inl
ThirdParty/glm/glm/core/type_vec.inl
+0
-0
ThirdParty/glm/glm/core/type_vec1.hpp
ThirdParty/glm/glm/core/type_vec1.hpp
+172
-0
ThirdParty/glm/glm/core/type_vec1.inl
ThirdParty/glm/glm/core/type_vec1.inl
+879
-0
ThirdParty/glm/glm/core/type_vec2.hpp
ThirdParty/glm/glm/core/type_vec2.hpp
+250
-0
No files found.
Apps/Examples/Debug/CMakeLists.txt
View file @
bf5c4d2d
...
...
@@ -15,6 +15,7 @@ include_directories(
${
CGoGN_ROOT_DIR
}
/ThirdParty/AntTweakBar/include
${
CGoGN_ROOT_DIR
}
/ThirdParty/OpenCTM
${
CGoGN_ROOT_DIR
}
/ThirdParty/Assimp/include
${
CGoGN_ROOT_DIR
}
/ThirdParty/glm
)
# define libs path
...
...
Apps/Examples/Release/CMakeLists.txt
View file @
bf5c4d2d
...
...
@@ -16,6 +16,7 @@ include_directories(
${
CGoGN_ROOT_DIR
}
/ThirdParty/AntTweakBar/include
${
CGoGN_ROOT_DIR
}
/ThirdParty/OpenCTM
${
CGoGN_ROOT_DIR
}
/ThirdParty/Assimp/include
${
CGoGN_ROOT_DIR
}
/ThirdParty/glm
)
...
...
Apps/Examples/Viewer.cpp
View file @
bf5c4d2d
...
...
@@ -246,7 +246,7 @@ void myGlutWin::myKeyboard(unsigned char keycode, int, int)
case
's'
:
{
GLint
t1
=
glutGet
(
GLUT_ELAPSED_TIME
);
Algo
::
Modelisation
::
CatmullClarkSubdivision
<
PFP
,
AttributeHandler
<
PFP
::
VEC3
>
,
PFP
::
VEC3
>
(
myMap
,
position
);
Algo
::
Modelisation
::
CatmullClarkSubdivision
<
PFP
>
(
myMap
,
position
);
GLint
t2
=
glutGet
(
GLUT_ELAPSED_TIME
);
GLfloat
seconds
=
(
t2
-
t1
)
/
1000.0
f
;
std
::
cout
<<
"catmull-clark: "
<<
seconds
<<
"sec"
<<
std
::
endl
;
...
...
@@ -259,11 +259,11 @@ void myGlutWin::myKeyboard(unsigned char keycode, int, int)
case
'l'
:
{
GLint
t1
=
glutGet
(
GLUT_ELAPSED_TIME
);
Algo
::
Modelisation
::
LoopSubdivision
<
PFP
,
AttributeHandler
<
PFP
::
VEC3
>
,
PFP
::
VEC3
>
(
myMap
,
position
);
Algo
::
Modelisation
::
LoopSubdivision
<
PFP
,
AttributeHandler
<
PFP
::
VEC3
>
,
PFP
::
VEC3
>
(
myMap
,
position
);
Algo
::
Modelisation
::
LoopSubdivision
<
PFP
,
AttributeHandler
<
PFP
::
VEC3
>
,
PFP
::
VEC3
>
(
myMap
,
position
);
Algo
::
Modelisation
::
LoopSubdivision
<
PFP
,
AttributeHandler
<
PFP
::
VEC3
>
,
PFP
::
VEC3
>
(
myMap
,
position
);
Algo
::
Modelisation
::
LoopSubdivision
<
PFP
,
AttributeHandler
<
PFP
::
VEC3
>
,
PFP
::
VEC3
>
(
myMap
,
position
);
Algo
::
Modelisation
::
LoopSubdivision
<
PFP
>
(
myMap
,
position
);
Algo
::
Modelisation
::
LoopSubdivision
<
PFP
>
(
myMap
,
position
);
Algo
::
Modelisation
::
LoopSubdivision
<
PFP
>
(
myMap
,
position
);
Algo
::
Modelisation
::
LoopSubdivision
<
PFP
>
(
myMap
,
position
);
Algo
::
Modelisation
::
LoopSubdivision
<
PFP
>
(
myMap
,
position
);
GLint
t2
=
glutGet
(
GLUT_ELAPSED_TIME
);
GLfloat
seconds
=
(
t2
-
t1
)
/
1000.0
f
;
std
::
cout
<<
"loop: "
<<
seconds
<<
"sec"
<<
std
::
endl
;
...
...
@@ -276,7 +276,7 @@ void myGlutWin::myKeyboard(unsigned char keycode, int, int)
case
'd'
:
{
GLint
t1
=
glutGet
(
GLUT_ELAPSED_TIME
);
Algo
::
Modelisation
::
Sqrt3Subdivision
<
PFP
,
AttributeHandler
<
PFP
::
VEC3
>
,
PFP
::
VEC3
>
(
myMap
,
position
);
Algo
::
Modelisation
::
Sqrt3Subdivision
<
PFP
>
(
myMap
,
position
);
GLint
t2
=
glutGet
(
GLUT_ELAPSED_TIME
);
GLfloat
seconds
=
(
t2
-
t1
)
/
1000.0
f
;
std
::
cout
<<
"dual: "
<<
seconds
<<
"sec"
<<
std
::
endl
;
...
...
Apps/Examples/extrusionView.cpp
View file @
bf5c4d2d
...
...
@@ -118,7 +118,7 @@ void myGlutWin::init()
glClearColor
(
0.1
f
,
0.1
f
,
0.1
f
,
0.0
f
);
glEnable
(
GL_DEPTH_TEST
);
glEnable
(
GL_NORMALIZE
);
//
glEnable(GL_NORMALIZE);
glLightModeli
(
GL_LIGHT_MODEL_TWO_SIDE
,
GL_TRUE
);
glLightModeli
(
GL_LIGHT_MODEL_LOCAL_VIEWER
,
1
);
...
...
Apps/Examples/miniTest.cpp
View file @
bf5c4d2d
...
...
@@ -433,7 +433,7 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y)
case
'l'
:
{
GLint
t1
=
glutGet
(
GLUT_ELAPSED_TIME
);
Algo
::
Modelisation
::
LoopSubdivision
<
PFP
,
AttributeHandler
<
PFP
::
VEC3
>
,
PFP
::
VEC3
>
(
myMap
,
position
);
Algo
::
Modelisation
::
LoopSubdivision
<
PFP
>
(
myMap
,
position
);
GLint
t2
=
glutGet
(
GLUT_ELAPSED_TIME
);
GLfloat
seconds
=
(
t2
-
t1
)
/
1000.0
f
;
std
::
cout
<<
"loop: "
<<
seconds
<<
"sec"
<<
std
::
endl
;
...
...
@@ -454,7 +454,7 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y)
case
'c'
:
{
GLint
t1
=
glutGet
(
GLUT_ELAPSED_TIME
);
Algo
::
Modelisation
::
CatmullClarkSubdivision
<
PFP
,
AttributeHandler
<
PFP
::
VEC3
>
,
PFP
::
VEC3
>
(
myMap
,
position
);
Algo
::
Modelisation
::
CatmullClarkSubdivision
<
PFP
>
(
myMap
,
position
);
GLint
t2
=
glutGet
(
GLUT_ELAPSED_TIME
);
GLfloat
seconds
=
(
t2
-
t1
)
/
1000.0
f
;
std
::
cout
<<
"catmull-clark: "
<<
seconds
<<
"sec"
<<
std
::
endl
;
...
...
@@ -475,7 +475,7 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y)
case
't'
:
{
GLint
t1
=
glutGet
(
GLUT_ELAPSED_TIME
);
Algo
::
Modelisation
::
trianguleFaces
<
PFP
,
AttributeHandler
<
PFP
::
VEC3
>
,
PFP
::
VEC3
>
(
myMap
,
position
)
;
Algo
::
Modelisation
::
trianguleFaces
<
PFP
>
(
myMap
,
position
)
;
GLint
t2
=
glutGet
(
GLUT_ELAPSED_TIME
);
GLfloat
seconds
=
(
t2
-
t1
)
/
1000.0
f
;
std
::
cout
<<
"triangulation: "
<<
seconds
<<
"sec"
<<
std
::
endl
;
...
...
@@ -495,7 +495,7 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y)
case
'q'
:
{
GLint
t1
=
glutGet
(
GLUT_ELAPSED_TIME
);
Algo
::
Modelisation
::
quadranguleFaces
<
PFP
,
AttributeHandler
<
PFP
::
VEC3
>
,
PFP
::
VEC3
>
(
myMap
,
position
)
;
Algo
::
Modelisation
::
quadranguleFaces
<
PFP
>
(
myMap
,
position
)
;
GLint
t2
=
glutGet
(
GLUT_ELAPSED_TIME
);
GLfloat
seconds
=
(
t2
-
t1
)
/
1000.0
f
;
std
::
cout
<<
"quadrangulation: "
<<
seconds
<<
"sec"
<<
std
::
endl
;
...
...
@@ -534,6 +534,100 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y)
break
;
}
case
'd'
:
{
AttributeHandler
<
PFP
::
VEC3
>
positionF
=
myMap
.
getAttribute
<
PFP
::
VEC3
>
(
FACE_ORBIT
,
"position"
)
;
if
(
!
positionF
.
isValid
())
positionF
=
myMap
.
addAttribute
<
PFP
::
VEC3
>
(
FACE_ORBIT
,
"position"
)
;
Algo
::
Geometry
::
computeCentroidFaces
<
PFP
>
(
myMap
,
position
,
positionF
)
;
GLint
t1
=
glutGet
(
GLUT_ELAPSED_TIME
);
Algo
::
Modelisation
::
computeDual
<
PFP
>
(
myMap
)
;
GLint
t2
=
glutGet
(
GLUT_ELAPSED_TIME
);
GLfloat
seconds
=
(
t2
-
t1
)
/
1000.0
f
;
std
::
cout
<<
"dual computation: "
<<
seconds
<<
"sec"
<<
std
::
endl
;
position
=
myMap
.
getAttribute
<
PFP
::
VEC3
>
(
VERTEX_ORBIT
,
"position"
)
;
normal
=
myMap
.
getAttribute
<
PFP
::
VEC3
>
(
VERTEX_ORBIT
,
"normal"
)
;
if
(
!
normal
.
isValid
())
normal
=
myMap
.
addAttribute
<
PFP
::
VEC3
>
(
VERTEX_ORBIT
,
"normal"
)
;
laplacian
=
myMap
.
getAttribute
<
PFP
::
VEC3
>
(
VERTEX_ORBIT
,
"laplacian"
)
;
if
(
!
laplacian
.
isValid
())
laplacian
=
myMap
.
addAttribute
<
PFP
::
VEC3
>
(
VERTEX_ORBIT
,
"laplacian"
)
;
t1
=
glutGet
(
GLUT_ELAPSED_TIME
);
updateVBOprimitives
(
Algo
::
Render
::
VBO
::
TRIANGLES
|
Algo
::
Render
::
VBO
::
LINES
|
Algo
::
Render
::
VBO
::
POINTS
)
;
updateVBOdata
(
Algo
::
Render
::
VBO
::
POSITIONS
|
Algo
::
Render
::
VBO
::
NORMALS
)
;
topo_render
->
updateData
<
PFP
>
(
myMap
,
position
,
0.9
f
,
0.9
f
)
;
t2
=
glutGet
(
GLUT_ELAPSED_TIME
);
seconds
=
(
t2
-
t1
)
/
1000.0
f
;
std
::
cout
<<
"display update: "
<<
seconds
<<
"sec"
<<
std
::
endl
;
glutPostRedisplay
()
;
break
;
}
case
'3'
:
{
CellMarker
markVisit
(
myMap
,
VERTEX_CELL
)
;
CellMarker
markNoDelete
(
myMap
,
VERTEX_CELL
)
;
std
::
vector
<
Dart
>
visited
;
visited
.
reserve
(
myMap
.
getNbCells
(
VERTEX_CELL
))
;
visited
.
push_back
(
myMap
.
begin
())
;
markVisit
.
mark
(
myMap
.
begin
())
;
for
(
std
::
vector
<
Dart
>::
iterator
vertex
=
visited
.
begin
();
vertex
!=
visited
.
end
();
++
vertex
)
{
bool
deleteV
=
true
;
if
(
markNoDelete
.
isMarked
(
*
vertex
))
deleteV
=
false
;
Dart
vit
=
*
vertex
;
do
// add all vertex neighbors to the table
{
Dart
nv
=
myMap
.
phi1
(
vit
)
;
if
(
!
markVisit
.
isMarked
(
nv
))
{
visited
.
push_back
(
nv
)
;
markVisit
.
mark
(
nv
)
;
}
if
(
deleteV
)
markNoDelete
.
mark
(
nv
)
;
vit
=
myMap
.
alpha1
(
vit
)
;
}
while
(
vit
!=
*
vertex
)
;
if
(
deleteV
)
myMap
.
deleteVertex
(
*
vertex
)
;
}
// for(Dart d = myMap.begin(); d != myMap.end(); myMap.next(d))
// {
// if(!markVisit.isMarked(d))
// {
// Dart dd = myMap.phi1(d) ;
// myMap.deleteVertex(d) ;
// Dart fit = dd ;
// do
// {
// markVisit.mark(fit) ;
// fit = myMap.phi1(fit) ;
// } while(fit != dd) ;
// }
// }
updateVBOprimitives
(
Algo
::
Render
::
VBO
::
TRIANGLES
|
Algo
::
Render
::
VBO
::
LINES
|
Algo
::
Render
::
VBO
::
POINTS
)
;
updateVBOdata
(
Algo
::
Render
::
VBO
::
POSITIONS
|
Algo
::
Render
::
VBO
::
NORMALS
)
;
topo_render
->
updateData
<
PFP
>
(
myMap
,
position
,
0.9
f
,
0.9
f
)
;
glutPostRedisplay
()
;
break
;
}
case
'a'
:
{
Algo
::
Geometry
::
computeLaplacianVertices
<
PFP
>
(
myMap
,
Algo
::
Geometry
::
TOPOLOGICAL
,
position
,
laplacian
)
;
...
...
@@ -633,6 +727,7 @@ int main(int argc, char** argv)
std
::
cerr
<<
"could not import "
<<
filename
<<
std
::
endl
;
return
1
;
}
mgw
->
position
=
myMap
.
getAttribute
<
PFP
::
VEC3
>
(
VERTEX_ORBIT
,
attrNames
[
0
])
;
GLint
t2
=
glutGet
(
GLUT_ELAPSED_TIME
)
;
GLfloat
seconds
=
(
t2
-
t1
)
/
1000.0
f
;
...
...
Apps/Tuto/CMakeLists.txt
View file @
bf5c4d2d
...
...
@@ -4,6 +4,8 @@ project(Tutos)
#SET (COMMON_LIBS ${GLUT_LIBRARY} ${OPENGL_LIBRARY} ${GLEW_LIBRARY} ${DEVIL_LIBRARIES} ${ZLIB_LIBRARIES} ${LIBXML2_LIBRARIES} gzstream AntTweakBar openctm)
#SET (CMAKE_BUILD_TYPE Debug)
SET
(
CMAKE_BUILD_TYPE Release
)
SET
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-DNOTOPOWARNING"
)
...
...
@@ -14,6 +16,7 @@ include_directories(
${
CGoGN_ROOT_DIR
}
/ThirdParty/gzstream
${
CGoGN_ROOT_DIR
}
/ThirdParty/OpenCTM
${
CGoGN_ROOT_DIR
}
/ThirdParty/Assimp/include
${
CGoGN_ROOT_DIR
}
/ThirdParty/glm
${
CGoGN_ROOT_DIR
}
/include
)
...
...
@@ -49,3 +52,15 @@ target_link_libraries( tuto_subdivision
add_executable
(
tp_master tp_master.cpp
)
target_link_libraries
(
tp_master
container topology utils algo
${
COMMON_LIBS
}
)
add_executable
(
tuto_mt tuto_mt.cpp
)
target_link_libraries
(
tuto_mt
container topology utils algo
${
COMMON_LIBS
}
boost_thread-mt
)
add_executable
(
tuto_ogl3 tuto_ogl3.cpp
)
target_link_libraries
(
tuto_ogl3
container topology utils algo
${
COMMON_LIBS
}
)
add_executable
(
tuto_ogl2 tuto_ogl2.cpp
)
target_link_libraries
(
tuto_ogl2
container topology utils algo
${
COMMON_LIBS
}
)
Apps/Tuto/tp_master.cpp
View file @
bf5c4d2d
...
...
@@ -100,6 +100,7 @@ Dart d_maison;
Dart
Carre
()
{
return
Dart
::
nil
();
}
...
...
@@ -107,7 +108,7 @@ Dart Carre()
Dart
Triangle
()
{
return
Dart
::
nil
();
}
...
...
@@ -141,7 +142,7 @@ void ColleMilieu(Dart d, Dart e)
Dart
Maison
()
{
return
Dart
::
nil
();
}
...
...
@@ -634,7 +635,6 @@ void myGlutWin::myKeyboard(unsigned char keycode, int x, int y)
/// calcul du rayon
getOrthoScreenRay
(
x
,
y
,
rayA
,
rayB
);
PFP
::
VEC3
AB
=
rayB
-
rayA
;
float
AB2
=
AB
.
norm2
();
d_faces
.
clear
();
d_edges
.
clear
();
...
...
@@ -678,7 +678,6 @@ void myGlutWin::myKeyboard(unsigned char keycode, int x, int y)
/// Rayon
getOrthoScreenRay
(
x
,
y
,
rayA
,
rayB
);
PFP
::
VEC3
AB
=
rayB
-
rayA
;
float
AB2
=
AB
.
norm2
();
d_faces
.
clear
();
d_edges
.
clear
();
...
...
Apps/Tuto/tuto_mt.cpp
0 → 100644
View file @
bf5c4d2d
/*******************************************************************************
* 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 "Algo/Import/import.h"
#include "Algo/Geometry/boundingbox.h"
#include "Algo/Render/vbo_MapRender.h"
#include "Algo/Geometry/area.h"
#include "Algo/Geometry/normal.h"
#include "Algo/Parallel/parallel_foreach.h"
using
namespace
CGoGN
;
/**
* Struct that contains some informations about the types of the manipulated objects
* Mainly here to be used by the algorithms that are parameterized by it
*/
struct
PFP
:
public
PFP_STANDARD
{
// definition of the map
typedef
EmbeddedMap2
<
Map2
>
MAP
;
};
/**
* A class for a little interface and rendering
*/
class
MyGlutWin
:
public
Utils
::
SimpleGlutWin
{
public:
void
myRedraw
();
PFP
::
REAL
gWidthObj
;
PFP
::
VEC3
gPosObj
;
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
()
{
if
(
m_render
!=
NULL
)
delete
m_render
;
}
};
// Routine d'affichage
void
MyGlutWin
::
myRedraw
()
{
glClear
(
GL_COLOR_BUFFER_BIT
|
GL_DEPTH_BUFFER_BIT
);
glPushMatrix
();
// center the object
float
sc
=
50.0
f
/
gWidthObj
;
glScalef
(
sc
,
sc
,
sc
);
glTranslatef
(
-
gPosObj
[
0
],
-
gPosObj
[
1
],
-
gPosObj
[
2
]);
glPolygonMode
(
GL_FRONT_AND_BACK
,
GL_FILL
);
glDisable
(
GL_LIGHTING
);
// draw the lines
glColor3f
(
1.0
f
,
1.0
f
,
0.0
f
);
m_render
->
draw
(
Algo
::
Render
::
VBO
::
LINES
);
// draw the faces
glEnable
(
GL_POLYGON_OFFSET_FILL
);
glPolygonOffset
(
1.0
f
,
1.0
f
);
glColor3f
(
0.0
f
,
0.5
f
,
0.0
f
);
m_render
->
draw
(
Algo
::
Render
::
VBO
::
TRIANGLES
);
glDisable
(
GL_POLYGON_OFFSET_FILL
);
glPopMatrix
();
}
template
<
typename
XXX
>
class
ThreadArea
:
public
Algo
::
Parallel
::
CGoGNThread
<
typename
XXX
::
MAP
>
{
protected:
const
typename
XXX
::
TVEC3
&
m_positions
;
float
area
;
public:
ThreadArea
(
typename
XXX
::
MAP
&
map
,
const
typename
XXX
::
TVEC3
&
pos
,
unsigned
int
th
)
:
Algo
::
Parallel
::
CGoGNThread
<
typename
XXX
::
MAP
>
(
map
,
th
),
m_positions
(
pos
),
area
(
0.0
f
)
{}
void
operator
()()
{
// 3 times just for fun !!!
area
+=
Algo
::
Geometry
::
totalArea
<
XXX
>
(
this
->
m_map
,
m_positions
,
SelectorTrue
(),
this
->
m_threadId
);
area
+=
Algo
::
Geometry
::
totalArea
<
XXX
>
(
this
->
m_map
,
m_positions
,
SelectorTrue
(),
this
->
m_threadId
);
area
+=
Algo
::
Geometry
::
totalArea
<
XXX
>
(
this
->
m_map
,
m_positions
,
SelectorTrue
(),
this
->
m_threadId
);
}
float
getTripleValue
()
{
return
area
;}
};
template
<
typename
XXX
>
class
ThreadNormals
:
public
Algo
::
Parallel
::
CGoGNThread
<
typename
XXX
::
MAP
>
{
protected:
const
typename
XXX
::
TVEC3
&
m_positions
;
typename
XXX
::
TVEC3
&
m_normals
;
public:
ThreadNormals
(
typename
XXX
::
MAP
&
map
,
const
typename
XXX
::
TVEC3
&
pos
,
typename
XXX
::
TVEC3
&
norm
,
unsigned
int
th
)
:
Algo
::
Parallel
::
CGoGNThread
<
typename
XXX
::
MAP
>
(
map
,
th
),
m_positions
(
pos
),
m_normals
(
norm
)
{}
void
operator
()()
{
Algo
::
Geometry
::
computeNormalVertices
<
XXX
>
(
this
->
m_map
,
m_positions
,
m_normals
,
SelectorTrue
(),
this
->
m_threadId
);
}
};
//
//template<typename XXX>
//class Thread0
//{
//protected:
// typename XXX::MAP& m_map;
// MyGlutWin& m_mgw;
// unsigned int m_th;
// SelectorTrue m_selt;
//public:
// Thread0(typename XXX::MAP& map,MyGlutWin& mgw, unsigned int th):
// m_map(map), m_mgw(mgw), m_th(th) {}
//
// void operator()()
// {
// std::cout << "Begin render init"<<std::endl;
// m_mgw.useContext();
//
// // instanciation of the renderer (here using VBOs)
// m_mgw.m_render = new Algo::Render::VBO::MapRender_VBO();
//
// // update the renderer (geometry and primitives)
// m_mgw.m_render->updateData(Algo::Render::VBO::POSITIONS, position);
//
// m_mgw.m_render->initPrimitives<PFP>(m_map, m_selt, Algo::Render::VBO::TRIANGLES,m_th);
// m_mgw.m_render->initPrimitives<PFP>(m_map, m_selt, Algo::Render::VBO::LINES,m_th);
//
// m_mgw.releaseContext();
// std::cout<< "Render OK "<< std::endl;
//
// }
//};
template
<
typename
XXX
>
class
calculFunctor1
:
public
Algo
::
Parallel
::
FunctorMapThreaded
<
typename
XXX
::
MAP
>
{
protected:
typename
XXX
::
TVEC3
&
m_positions
;
typename
XXX
::
TVEC3
&
m_normals
;
public:
calculFunctor1
(
typename
XXX
::
MAP
&
map
,
typename
XXX
::
TVEC3
&
pos
,
typename
XXX
::
TVEC3
&
norm
,
unsigned
int
id
=
0
)
:
Algo
::
Parallel
::
FunctorMapThreaded
<
typename
XXX
::
MAP
>
(
map
,
id
),
m_positions
(
pos
),
m_normals
(
norm
)
{}
bool
operator
()(
Dart
d
)
{
typename
XXX
::
VEC3
n1
=
Algo
::
Geometry
::
vertexNormal
<
XXX
>
(
this
->
m_map
,
d
,
m_positions
);
typename
XXX
::
VEC3
n2
=
Algo
::
Geometry
::
vertexNormal
<
XXX
>
(
this
->
m_map
,
this
->
m_map
.
phi1
(
d
),
m_positions
);
typename
XXX
::
VEC3
n3
=
Algo
::
Geometry
::
vertexNormal
<
XXX
>
(
this
->
m_map
,
this
->
m_map
.
phi_1
(
d
),
m_positions
);
typename
XXX
::
VEC3
n
=
n1
+
n2
+
n3
;
n1
=
Algo
::
Geometry
::
vertexNormal
<
XXX
>
(
this
->
m_map
,
d
,
m_positions
);
n2
=
Algo
::
Geometry
::
vertexNormal
<
XXX
>
(
this
->
m_map
,
this
->
m_map
.
phi1
(
d
),
m_positions
);
n3
=
Algo
::
Geometry
::
vertexNormal
<
XXX
>
(
this
->
m_map
,
this
->
m_map
.
phi_1
(
d
),
m_positions
);
n
+=
n1
+
n2
+
n3
;
n
.
normalize
();
m_normals
[
d
]
=
n
;
// m_normals[d] = Algo::Geometry::vertexNormal<XXX>(this->m_map, d, m_positions);
return
false
;
}
Algo
::
Parallel
::
FunctorMapThreaded
<
typename
XXX
::
MAP
>*
duplicate
(
unsigned
int
id
)
{
calculFunctor1
<
XXX
>*
copy
=
new
calculFunctor1
<
XXX
>
(
this
->
m_map
,
m_positions
,
m_normals
,
id
);
return
reinterpret_cast
<
Algo
::
Parallel
::
FunctorMapThreaded
<
typename
XXX
::
MAP
>*>
(
copy
);
}
};
template
<
typename
XXX
>
class
LengthEdgeFunctor
:
public
Algo
::
Parallel
::
FunctorMapThreadedResult
<
typename
XXX
::
MAP
,
std
::
pair
<
double
,
unsigned
int
>
>
{
protected:
typename
XXX
::
TVEC3
&
m_positions
;
double
m_length
;
unsigned
int
m_nb
;
public:
LengthEdgeFunctor
(
typename
XXX
::
MAP
&
map
,
typename
XXX
::
TVEC3
&
pos
,
unsigned
int
id
=
0
)
:
Algo
::
Parallel
::
FunctorMapThreadedResult
<
typename
XXX
::
MAP
,
std
::
pair
<
double
,
unsigned
int
>
>
(
map
,
id
),
m_positions
(
pos
),
m_length
(
0.0
),
m_nb
(
0
)
{}
bool
operator
()(
Dart
d
)
{
Dart
dd
=
this
->
m_map
.
phi2
(
d
);
typename
XXX
::
VEC3
V
=
m_positions
[
dd
]
-
m_positions
[
d
];
m_length
+=
V
.
norm
();
m_nb
++
;
return
false
;
}
Algo
::
Parallel
::
FunctorMapThreaded
<
typename
XXX
::
MAP
>*
duplicate
(
unsigned
int
id
)
{
LengthEdgeFunctor
<
XXX
>*
copy
=
new
LengthEdgeFunctor
<
XXX
>
(
this
->
m_map
,
m_positions
,
id
);
return
reinterpret_cast
<
Algo
::
Parallel
::
FunctorMapThreaded
<
typename
XXX
::
MAP
>*>
(
copy
);
}
std
::
pair
<
double
,
unsigned
int
>
getResult
()
{
return
std
::
pair
<
double
,
unsigned
int
>
(
m_length
,
m_nb
);}
};
int
main
(
int
argc
,
char
**
argv
)
{
if
(
argc
<
2
)
{
std
::
cerr
<<
argv
[
0
]
<<
" mesh"
<<
std
::
endl
;
exit
(
1
);
}
// declaration of the map
PFP
::
MAP
myMap
;
// this selector is going to select all the darts
SelectorTrue
allDarts
;
// instanciation of the interface
MyGlutWin
mgw
(
&
argc
,
argv
,
800
,
800
);
glewInit
();
std
::
vector
<
std
::
string
>
attrNames
;
if
(
!
Algo
::
Import
::
importMesh
<
PFP
>
(
myMap
,
argv
[
1
],
attrNames
))
{
std
::
cerr
<<
"could not import "
<<
argv
[
1
]
<<
std
::
endl
;
return
1
;
}
AttributeHandler
<
PFP
::
VEC3
>
position
;
AttributeHandler
<
PFP
::
VEC3
>
facesnormals
;
// cree un handler d'attribut pour la position des points (créé lors de l'import)