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
CGoGN
CGoGN
Commits
9b825529
Commit
9b825529
authored
Apr 26, 2012
by
Pierre Kraemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
orbit as template -> tuto1 OK
parent
273fc127
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
32 additions
and
40 deletions
+32
-40
Apps/Tuto/tuto1.cpp
Apps/Tuto/tuto1.cpp
+8
-15
Apps/Tuto/tuto1.h
Apps/Tuto/tuto1.h
+11
-9
include/Algo/Render/GL2/topoRender.h
include/Algo/Render/GL2/topoRender.h
+0
-4
include/Algo/Render/GL2/topoRender.hpp
include/Algo/Render/GL2/topoRender.hpp
+4
-2
include/Topology/generic/attributeHandler.hpp
include/Topology/generic/attributeHandler.hpp
+1
-2
include/Topology/generic/cellmarker.h
include/Topology/generic/cellmarker.h
+8
-8
No files found.
Apps/Tuto/tuto1.cpp
View file @
9b825529
...
...
@@ -27,7 +27,6 @@
using
namespace
CGoGN
;
int
main
(
int
argc
,
char
**
argv
)
{
// // interface
...
...
@@ -45,8 +44,6 @@ int main(int argc, char **argv)
return
app
.
exec
();
}
void
MyQT
::
createMap
()
{
// creation of 2 new faces: 1 triangle and 1 square
...
...
@@ -57,16 +54,15 @@ void MyQT::createMap()
myMap
.
sewFaces
(
d1
,
d2
);
// creation of a new attribute on vertices of type 3D vector for position.
// a handler to this attribute is returned (TVEC3 is a typdef of AttributeHandler<PFP::VEC3>)
PFP
::
TVEC3
position
=
myMap
.
addAttribute
<
PFP
::
VEC3
>
(
VERTEX
,
"position"
);
//warning: at the end of scope of variable position, handler is destroyed but attribute stay
// a handler to this attribute is returned
position
=
myMap
.
addAttribute
<
VEC3
,
VERTEX
>
(
"position"
);
// affect position by moving in the map
position
[
d1
]
=
PFP
::
VEC3
(
0
,
0
,
0
);
position
[
PHI1
(
d1
)]
=
PFP
::
VEC3
(
2
,
0
,
0
);
position
[
PHI_1
(
d1
)]
=
PFP
::
VEC3
(
1
,
2
,
0
);
position
[
PHI
<
11
>
(
d2
)]
=
PFP
::
VEC3
(
0
,
-
2
,
0
);
position
[
PHI_1
(
d2
)]
=
PFP
::
VEC3
(
2
,
-
2
,
0
);
position
[
d1
]
=
VEC3
(
0
,
0
,
0
);
position
[
PHI1
(
d1
)]
=
VEC3
(
2
,
0
,
0
);
position
[
PHI_1
(
d1
)]
=
VEC3
(
1
,
2
,
0
);
position
[
PHI
<
11
>
(
d2
)]
=
VEC3
(
0
,
-
2
,
0
);
position
[
PHI_1
(
d2
)]
=
VEC3
(
2
,
-
2
,
0
);
// bounding box of scene
Geom
::
BoundingBox
<
PFP
::
VEC3
>
bb
=
Algo
::
Geometry
::
computeBoundingBox
<
PFP
>
(
myMap
,
position
);
...
...
@@ -81,10 +77,9 @@ void MyQT::createMap()
// render the topo of the map without boundary darts
SelectorDartNoBoundary
<
PFP
::
MAP
>
nb
(
myMap
);
m_render_topo
->
updateData
<
PFP
>
(
myMap
,
position
,
0.9
f
,
0.9
f
,
nb
);
m_render_topo
->
updateData
<
PFP
>
(
myMap
,
position
,
0.9
f
,
0.9
f
,
nb
);
}
// initialization GL callback
void
MyQT
::
cb_initGL
()
{
...
...
@@ -96,5 +91,3 @@ void MyQT::cb_redraw()
{
m_render_topo
->
drawTopo
();
}
Apps/Tuto/tuto1.h
View file @
9b825529
...
...
@@ -56,9 +56,10 @@ struct PFP: public PFP_STANDARD
#endif
};
typedef
PFP
::
MAP
MAP
;
typedef
PFP
::
VEC3
VEC3
;
class
MyQT
:
public
Utils
::
QT
::
SimpleQT
class
MyQT
:
public
Utils
::
QT
::
SimpleQT
{
Q_OBJECT
public:
...
...
@@ -69,23 +70,24 @@ public:
protected:
// declaration of the map
PFP
::
MAP
myMap
;
MAP
myMap
;
// attribute for vertices positions
AttributeHandler
<
VEC3
,
VERTEX
>
position
;
// render (for the topo)
Algo
::
Render
::
GL2
::
TopoRender
*
m_render_topo
;
// just for more compact writing
inline
Dart
PHI1
(
Dart
d
)
{
return
myMap
.
phi1
(
d
);}
inline
Dart
PHI_1
(
Dart
d
)
{
return
myMap
.
phi_1
(
d
);}
inline
Dart
PHI2
(
Dart
d
)
{
return
myMap
.
phi2
(
d
);}
inline
Dart
PHI1
(
Dart
d
)
{
return
myMap
.
phi1
(
d
);
}
inline
Dart
PHI_1
(
Dart
d
)
{
return
myMap
.
phi_1
(
d
);
}
inline
Dart
PHI2
(
Dart
d
)
{
return
myMap
.
phi2
(
d
);
}
template
<
int
X
>
Dart
PHI
(
Dart
d
)
{
return
myMap
.
phi
<
X
>
(
d
);}
Dart
PHI
(
Dart
d
)
{
return
myMap
.
phi
<
X
>
(
d
);
}
public:
// example of simple map creation
void
createMap
();
};
#endif
include/Algo/Render/GL2/topoRender.h
View file @
9b825529
...
...
@@ -86,7 +86,6 @@ protected:
*/
GLuint
m_nbRel2
;
/**
* width of lines use to draw darts
*/
...
...
@@ -102,7 +101,6 @@ protected:
*/
Geom
::
Vec3f
m_dartsColor
;
float
*
m_color_save
;
/**
...
...
@@ -113,7 +111,6 @@ protected:
Utils
::
ShaderSimpleColor
*
m_shader1
;
Utils
::
ShaderColorPerVertex
*
m_shader2
;
/**
* compute color from dart index (for color picking)
*/
...
...
@@ -258,7 +255,6 @@ public:
typedef
TopoRender
TopoRenderMapD
;
typedef
TopoRender
TopoRenderGMap
;
}
// namespace GL2
}
// namespace Render
...
...
include/Algo/Render/GL2/topoRender.hpp
View file @
9b825529
...
...
@@ -48,12 +48,14 @@ void TopoRender::updateData(typename PFP::MAP& map, const AttributeHandler<typen
Map2
*
ptrMap2
=
dynamic_cast
<
Map2
*>
(
&
map
);
if
(
ptrMap2
!=
NULL
)
{
updateDataMap
<
PFP
>
(
map
,
positions
,
ke
,
kf
,
good
);
updateDataMap
<
PFP
>
(
map
,
positions
,
ke
,
kf
,
good
);
return
;
}
GMap2
*
ptrGMap2
=
dynamic_cast
<
GMap2
*>
(
&
map
);
if
(
ptrGMap2
!=
NULL
)
{
updateDataGMap
<
PFP
>
(
map
,
positions
,
ke
,
kf
,
good
);
updateDataGMap
<
PFP
>
(
map
,
positions
,
ke
,
kf
,
good
);
return
;
}
}
...
...
include/Topology/generic/attributeHandler.hpp
View file @
9b825529
...
...
@@ -58,10 +58,9 @@ template <typename T, unsigned int ORBIT>
AttributeHandler
<
T
,
ORBIT
>::
AttributeHandler
(
GenericMap
*
m
,
AttributeMultiVector
<
T
>*
amv
)
:
AttributeHandlerGen
(
m
,
false
),
m_attrib
(
amv
)
{
assert
(
ORBIT
==
amv
->
getOrbit
()
||
!
"AttributeHandler: orbit incompatibility"
)
;
if
(
m
!=
NULL
&&
amv
!=
NULL
&&
amv
->
getIndex
()
!=
AttributeContainer
::
UNKNOWN
)
{
assert
(
ORBIT
==
amv
->
getOrbit
()
||
!
"AttributeHandler: orbit incompatibility"
)
;
valid
=
true
;
registerInMap
()
;
}
...
...
include/Topology/generic/cellmarker.h
View file @
9b825529
...
...
@@ -240,8 +240,8 @@ protected:
public:
virtual
void
unmarkAll
()
{
assert
(
m_map
.
getMarkerSet
(
CELL
,
this
->
m_thread
).
testMark
(
this
->
m_mark
));
assert
(
m_markVector
!=
NULL
);
assert
(
this
->
m_map
.
template
getMarkerSet
<
CELL
>(
this
->
m_thread
).
testMark
(
this
->
m_mark
));
assert
(
this
->
m_markVector
!=
NULL
);
AttributeContainer
&
cont
=
this
->
m_map
.
template
getAttributeContainer
<
CELL
>()
;
for
(
unsigned
int
i
=
cont
.
begin
();
i
!=
cont
.
end
();
cont
.
next
(
i
))
...
...
@@ -269,7 +269,7 @@ public:
{
unmarkAll
()
;
// assert(isAllUnmarked);
CGoGN_ASSERT
(
isAllUnmarked
())
CGoGN_ASSERT
(
this
->
isAllUnmarked
())
}
protected:
...
...
@@ -291,8 +291,8 @@ public:
void
unmarkAll
()
{
assert
(
m_map
.
getMarkerSet
(
CELL
,
this
->
m_thread
).
testMark
(
this
->
m_mark
));
assert
(
m_markVector
!=
NULL
);
assert
(
this
->
m_map
.
template
getMarkerSet
<
CELL
>(
this
->
m_thread
).
testMark
(
this
->
m_mark
));
assert
(
this
->
m_markVector
!=
NULL
);
for
(
std
::
vector
<
unsigned
int
>::
iterator
it
=
m_markedCells
.
begin
();
it
!=
m_markedCells
.
end
();
++
it
)
this
->
m_markVector
->
operator
[](
*
it
).
unsetMark
(
this
->
m_mark
)
;
...
...
@@ -314,7 +314,7 @@ public:
virtual
~
CellMarkerNoUnmark
()
{
// assert(isAllUnmarked()) ;
CGoGN_ASSERT
(
isAllUnmarked
())
CGoGN_ASSERT
(
this
->
isAllUnmarked
())
}
protected:
...
...
@@ -324,8 +324,8 @@ protected:
public:
void
unmarkAll
()
{
assert
(
m_map
.
getMarkerSet
(
CELL
,
this
->
m_thread
).
testMark
(
this
->
m_mark
));
assert
(
m_markVector
!=
NULL
);
assert
(
this
->
m_map
.
template
getMarkerSet
<
CELL
>(
this
->
m_thread
).
testMark
(
this
->
m_mark
));
assert
(
this
->
m_markVector
!=
NULL
);
AttributeContainer
&
cont
=
this
->
m_map
.
template
getAttributeContainer
<
CELL
>()
;
for
(
unsigned
int
i
=
cont
.
begin
();
i
!=
cont
.
end
();
cont
.
next
(
i
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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