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
CGoGN
CGoGN
Commits
5d78847f
Commit
5d78847f
authored
Jul 17, 2013
by
Thery Sylvain
Browse files
Merge branch 'master' of CGoGN:CGoGN
parents
7152b670
1e81b6fd
Changes
27
Expand all
Hide whitespace changes
Inline
Side-by-side
Apps/CMakeLists.txt
View file @
5d78847f
...
...
@@ -28,6 +28,9 @@ ENDIF(WIN32)
IF
(
WITH_QT
)
add_subdirectory
(
Tuto
)
add_subdirectory
(
Examples/Release
)
IF
(
NOT DONOT_COMPILE_SANDBOX
)
add_subdirectory
(
SandBox
)
ENDIF
(
NOT DONOT_COMPILE_SANDBOX
)
ENDIF
(
WITH_QT
)
add_subdirectory
(
Examples/Tests
)
Apps/Examples/Debug/CMakeLists.txt
View file @
5d78847f
...
...
@@ -73,3 +73,9 @@ target_link_libraries( mcmeshD ${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS})
QT4_WRAP_CPP
(
concave_rendering_moc ../concave_rendering.h
)
add_executable
(
concave_renderingD ../concave_rendering.cpp
${
concave_rendering_moc
}
${
concave_rendering_ui
}
)
target_link_libraries
(
concave_renderingD
${
CGoGN_LIBS_D
}
${
CGoGN_EXT_LIBS
}
)
QT4_WRAP_CPP
(
viewerOBJ_moc ../viewerOBJ.h
)
add_executable
(
viewerOBJD ../viewerOBJ.cpp
${
viewerOBJ_moc
}
)
target_link_libraries
(
viewerOBJD
${
CGoGN_LIBS_R
}
${
CGoGN_EXT_LIBS
}
)
Apps/Examples/Release/CMakeLists.txt
View file @
5d78847f
...
...
@@ -66,3 +66,8 @@ target_link_libraries( mcmesh ${CGoGN_LIBS_R} ${CGoGN_EXT_LIBS} )
QT4_WRAP_CPP
(
concave_rendering_moc ../concave_rendering.h
)
add_executable
(
concave_rendering ../concave_rendering.cpp
${
concave_rendering_moc
}
${
concave_rendering_ui
}
)
target_link_libraries
(
concave_rendering
${
CGoGN_LIBS_R
}
${
CGoGN_EXT_LIBS
}
)
QT4_WRAP_CPP
(
viewerOBJ_moc ../viewerOBJ.h
)
add_executable
(
viewerOBJ ../viewerOBJ.cpp
${
viewerOBJ_moc
}
)
target_link_libraries
(
viewerOBJ
${
CGoGN_LIBS_R
}
${
CGoGN_EXT_LIBS
}
)
Apps/Examples/extrusionView.cpp
View file @
5d78847f
...
...
@@ -107,18 +107,18 @@ int main(int argc, char **argv)
// 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
));
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
));
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
));
// define a path (here an helicoid)
std
::
vector
<
PFP
::
VEC3
>
pathV
;
...
...
@@ -129,7 +129,7 @@ int main(int argc, char **argv)
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
));
pathRadius
.
push_back
(
2.0
f
+
0.
3
*
cos
(
alpha
));
}
// extrusion
...
...
Apps/Examples/simpleGMap3.cpp
View file @
5d78847f
...
...
@@ -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 @
5d78847f
...
...
@@ -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 @
5d78847f
...
...
@@ -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 @
5d78847f
...
...
@@ -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
()
;
...
...
Apps/Examples/viewerOBJ.cpp
0 → 100644
View file @
5d78847f
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, 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: http://cgogn.unistra.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#include
"viewerOBJ.h"
#include
"Algo/Geometry/boundingbox.h"
#include
"Algo/Modelisation/polyhedron.h"
#include
"Utils/vbo.h"
ObjView
::
ObjView
()
:
m_obj
(
myMap
),
m_positionVBO
(
NULL
),
m_normalVBO
(
NULL
),
m_texcoordVBO
(
NULL
),
m_shader
(
NULL
),
m_shader2
(
NULL
)
{}
ObjView
::~
ObjView
()
{
if
(
m_shader
!=
NULL
)
delete
m_shader
;
if
(
m_shader2
!=
NULL
)
delete
m_shader2
;
if
(
m_phongShader
!=
NULL
)
delete
m_phongShader
;
if
(
m_positionVBO
!=
NULL
)
delete
m_positionVBO
;
if
(
m_normalVBO
!=
NULL
)
delete
m_normalVBO
;
if
(
m_texcoordVBO
!=
NULL
)
delete
m_texcoordVBO
;
}
void
ObjView
::
cb_initGL
()
{
// choose to use GL version 2
Utils
::
GLSLShader
::
setCurrentOGLVersion
(
2
);
// create VBO for position
m_positionVBO
=
new
Utils
::
VBO
;
m_texcoordVBO
=
new
Utils
::
VBO
;
m_normalVBO
=
new
Utils
::
VBO
;
// m_shader = new Utils::ShaderSimpleTexture();
// m_shader->setAttributePosition(m_positionVBO);
// m_shader->setAttributeTexCoord(m_texcoordVBO);
// m_shader->setTextureUnit(GL_TEXTURE0);
// registerShader(m_shader);
m_shader2
=
new
Utils
::
ShaderPhongTexture
();
m_shader2
->
setAttributePosition
(
m_positionVBO
);
m_shader2
->
setAttributeTexCoord
(
m_texcoordVBO
);
m_shader2
->
setAttributeNormal
(
m_normalVBO
);
m_shader2
->
setTextureUnit
(
GL_TEXTURE1
);
m_shader2
->
setShininess
(
10.0
f
);
m_shader2
->
setAmbient
(
0.1
f
);
m_shader2
->
setSpecular
(
Geom
::
Vec4f
(
0.5
));
registerShader
(
m_shader2
);
m_phongShader
=
new
Utils
::
ShaderPhong
()
;
m_phongShader
->
setAttributePosition
(
m_positionVBO
)
;
m_phongShader
->
setAttributeNormal
(
m_normalVBO
)
;
registerShader
(
m_phongShader
);
glEnable
(
GL_TEXTURE_2D
);
m_obj
.
createGroupMatVBO_PTN
(
m_positionVBO
,
m_texcoordVBO
,
m_normalVBO
);
}
void
ObjView
::
cb_redraw
()
{
glPolygonMode
(
GL_FRONT_AND_BACK
,
GL_FILL
);
unsigned
int
nb
=
m_obj
.
nbMatGroups
();
const
std
::
vector
<
Algo
::
Surface
::
Import
::
MaterialOBJ
*>&
mats
=
m_obj
.
getMaterials
();
for
(
unsigned
int
i
=
0
;
i
<
nb
;
++
i
)
{
if
(
mats
[
i
]
->
textureDiffuse
!=
NULL
)
{
m_shader2
->
setTexture
(
mats
[
i
]
->
textureDiffuse
);
m_shader2
->
setShininess
(
mats
[
i
]
->
shininess
);
m_shader2
->
setAmbient
(
0.3
f
);
m_shader2
->
activeTexture
();
m_shader2
->
enableVertexAttribs
();
glDrawArrays
(
GL_TRIANGLES
,
m_obj
.
beginIndex
(
i
),
m_obj
.
nbIndices
(
i
));
m_shader2
->
disableVertexAttribs
();
}
else
{
Geom
::
Vec4f
v
;
v
[
0
]
=
mats
[
i
]
->
ambiantColor
[
0
];
v
[
1
]
=
mats
[
i
]
->
ambiantColor
[
1
];
v
[
2
]
=
mats
[
i
]
->
ambiantColor
[
2
];
v
[
3
]
=
0.0
f
;
m_phongShader
->
setAmbiant
(
v
)
;
v
[
0
]
=
mats
[
i
]
->
diffuseColor
[
0
];
v
[
1
]
=
mats
[
i
]
->
diffuseColor
[
1
];
v
[
2
]
=
mats
[
i
]
->
diffuseColor
[
2
];
v
[
3
]
=
0.0
f
;
m_phongShader
->
setDiffuse
(
v
)
;
v
[
0
]
=
mats
[
i
]
->
specularColor
[
0
];
v
[
1
]
=
mats
[
i
]
->
specularColor
[
1
];
v
[
2
]
=
mats
[
i
]
->
specularColor
[
2
];
v
[
3
]
=
0.0
f
;
m_phongShader
->
setSpecular
(
v
)
;
m_phongShader
->
setShininess
(
mats
[
i
]
->
shininess
)
;
m_phongShader
->
enableVertexAttribs
();
glDrawArrays
(
GL_TRIANGLES
,
m_obj
.
beginIndex
(
i
),
m_obj
.
nbIndices
(
i
));
m_phongShader
->
disableVertexAttribs
();
}
}
}
void
ObjView
::
init
(
const
std
::
string
&
fnm
)
{
std
::
vector
<
std
::
string
>
attrNames
;
m_obj
.
import
(
fnm
,
attrNames
);
Geom
::
BoundingBox
<
PFP
::
VEC3
>
bb
=
Algo
::
Geometry
::
computeBoundingBox
<
PFP
>
(
myMap
,
m_obj
.
m_positions
);
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
);
// send BB info to interface for centering on GL screen
setParamObject
(
lWidthObj
,
lPosObj
.
data
());
}
int
main
(
int
argc
,
char
**
argv
)
{
// interface:
QApplication
app
(
argc
,
argv
);
ObjView
tv
;
if
(
argc
==
2
)
{
tv
.
init
(
argv
[
1
]);
}
else
{
CGoGNerr
<<
argv
[
0
]
<<
" objFile"
<<
CGoGNendl
;
}
tv
.
show
();
// et on attend la fin.
return
app
.
exec
();
}
Apps/Examples/viewerOBJ.h
0 → 100644
View file @
5d78847f
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, 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: http://cgogn.unistra.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#ifndef _TEXTURE_EXAMPLE_
#define _TEXTURE_EXAMPLE_
#include
<iostream>
//#include "Utils/Qt/qtSimple.h"
#include
"Utils/Qt/qtQGLV.h"
#include
"Utils/textures.h"
#include
"Utils/Shaders/shaderSimpleTexture.h"
#include
"Utils/Shaders/shaderPhongTexture.h"
#include
"Utils/Shaders/shaderPhong.h"
#include
"Topology/generic/parameters.h"
#include
"Topology/map/embeddedMap2.h"
#include
"Algo/Render/GL2/mapRender.h"
#include
"Algo/Import/importObjTex.h"
// forward definitions (minimize includes)
namespace
CGoGN
{
namespace
Algo
{
namespace
Render
{
namespace
GL2
{
class
MapRender
;
}}}}
namespace
CGoGN
{
namespace
Utils
{
class
VBO
;
}
}
using
namespace
CGoGN
;
struct
PFP
:
public
PFP_STANDARD
{
// definition of the map
typedef
EmbeddedMap2
MAP
;
};
typedef
PFP
::
MAP
MAP
;
typedef
PFP
::
VEC3
VEC3
;
/**
* A class for a little interface and rendering
*/
//class ObjView: public Utils::QT::SimpleQT
class
ObjView
:
public
Utils
::
QT
::
SimpleQGLV
{
Q_OBJECT
public:
MAP
myMap
;
Algo
::
Surface
::
Import
::
OBJModel
<
PFP
>
m_obj
;
// VBO
Utils
::
VBO
*
m_positionVBO
;
Utils
::
VBO
*
m_normalVBO
;
Utils
::
VBO
*
m_texcoordVBO
;
// shader simple texture
Utils
::
ShaderSimpleTexture
*
m_shader
;
Utils
::
ShaderPhongTexture
*
m_shader2
;
Utils
::
ShaderPhong
*
m_phongShader
;
ObjView
();
~
ObjView
();
void
init
(
const
std
::
string
&
fnm
);
// callbacks of simpleQT to overdefine:
void
cb_redraw
();
void
cb_initGL
();
};
#endif
Apps/SandBox/CMakeLists.txt
0 → 100644
View file @
5d78847f
cmake_minimum_required
(
VERSION 2.8
)
project
(
SandBox
)
SET
(
CMAKE_BUILD_TYPE Debug
)
SET
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-DNOTOPOWARNING"
)
include_directories
(
${
CMAKE_CURRENT_BINARY_DIR
}
${
CGoGN_ROOT_DIR
}
/include
${
CGoGN_EXT_INCLUDES
}
)
# define libs path
IF
(
WIN32
)
link_directories
(
${
CGoGN_ROOT_DIR
}
/lib/$
(
ConfigurationName
)
${
Boost_LIBRARY_DIRS
}
)
ELSE
(
WIN32
)
link_directories
(
${
CGoGN_ROOT_DIR
}
/lib/Release
${
CGoGN_ROOT_DIR
}
/lib/Debug
)
ENDIF
(
WIN32
)
#define exec to compile
add_executable
(
multi_att multi_att.cpp
)
target_link_libraries
(
multi_att
${
CGoGN_LIBS_D
}
${
CGoGN_EXT_LIBS
}
)
# Example with Qt
#
#QT4_WRAP_CPP(tuto1_moc tuto1.h)
#add_executable( tuto1 tuto1.cpp ${tuto1_moc})
#target_link_libraries( tuto1 ${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS} )
#QT4_WRAP_CPP(tuto_mt_moc tuto_mt.h)
#add_executable( tuto_mt tuto_mt.cpp ${tuto_mt_moc})
#target_link_libraries( tuto_mt
# ${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS} ${Boost_THREAD_LIBRARY})
Apps/SandBox/multi_att.cpp
0 → 100644
View file @
5d78847f
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, 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: http://cgogn.unistra.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#include
<iostream>
#include
"Topology/generic/parameters.h"
#include
"Topology/map/embeddedMap2.h"
#include
"Geometry/vector_gen.h"
#include
"Algo/Import/import.h"
#include
"Topology/generic/multiAttribs.h"
#include
"Algo/Geometry/centroid.h"
#include
"Algo/Geometry/normal.h"
#include
"Algo/Modelisation/subdivision.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
MAP
;
};
/**
* Simple example of function that work with generic type of attribute
*/
template
<
typename
PFP
,
typename
V_ATT
>
typename
V_ATT
::
DATA_TYPE
smooth
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
V_ATT
&
attributs
)
{
typename
V_ATT
::
DATA_TYPE
res
(
0
);
int
count
=
0
;
if
(
attributs
.
getOrbit
()
==
VERTEX
)
{
Traversor2VVaE
<
typename
PFP
::
MAP
>
tra
(
map
,
d
);
for
(
Dart
e
=
tra
.
begin
();
e
!=
tra
.
end
();
e
=
tra
.
next
())
{
res
+=
attributs
[
d
];
count
++
;
}