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
David Cazier
CGoGN
Commits
aac0ab43
Commit
aac0ab43
authored
Jun 13, 2013
by
Sylvain Thery
Browse files
add svg of Edges in explodeVolumeRender
parent
96ca248e
Changes
8
Hide whitespace changes
Inline
Side-by-side
include/Algo/Render/GL2/explodeVolumeRender.h
View file @
aac0ab43
...
...
@@ -35,6 +35,7 @@
#include
"Utils/Shaders/shaderExplodeSmoothVolumes.h"
#include
"Utils/Shaders/shaderExplodeVolumes.h"
#include
"Utils/Shaders/shaderExplodeVolumesLines.h"
#include
"Utils/svg.h"
namespace
CGoGN
{
...
...
@@ -78,9 +79,17 @@ protected:
*/
GLuint
m_nbTris
;
/**
*number of lines to draw
*/
GLuint
m_nbLines
;
Geom
::
Vec3f
m_globalColor
;
/**
* explode volume factor
*/
float
m_explodeV
;
template
<
typename
PFP
>
void
computeFace
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
positions
,
...
...
@@ -185,6 +194,20 @@ public:
* set color parameter for edge drawing
*/
void
setColorLine
(
const
Geom
::
Vec4f
&
col
)
;
/**
* @brief svgout2D
* @param filename name of svg file
* @param model modelview matrix
* @param proj projection matrix
*/
void
svgoutEdges
(
const
std
::
string
&
filename
,
const
glm
::
mat4
&
model
,
const
glm
::
mat4
&
proj
);
/**
* @brief toSVG
* @param svg svg struct reference
*/
void
toSVG
(
Utils
::
SVG
::
SVGOut
&
svg
);
};
}
//end namespace GL2
...
...
include/Algo/Render/GL2/explodeVolumeRender.hpp
View file @
aac0ab43
...
...
@@ -624,6 +624,7 @@ inline void ExplodeVolumeRender::drawEdges()
inline
void
ExplodeVolumeRender
::
setExplodeVolumes
(
float
explode
)
{
m_explodeV
=
explode
;
if
(
m_smooth
)
m_shaderS
->
setExplodeVolumes
(
explode
);
else
...
...
@@ -697,6 +698,40 @@ inline Utils::GLSLShader* ExplodeVolumeRender::shaderLines()
return
m_shaderL
;
}
inline
void
ExplodeVolumeRender
::
svgoutEdges
(
const
std
::
string
&
filename
,
const
glm
::
mat4
&
model
,
const
glm
::
mat4
&
proj
)
{
Utils
::
SVG
::
SVGOut
svg
(
filename
,
model
,
proj
);
toSVG
(
svg
);
svg
.
write
();
}
inline
void
ExplodeVolumeRender
::
toSVG
(
Utils
::
SVG
::
SVGOut
&
svg
)
{
Utils
::
SVG
::
SvgGroup
*
svg2
=
new
Utils
::
SVG
::
SvgGroup
(
"alpha2"
,
svg
.
m_model
,
svg
.
m_proj
);
Geom
::
Vec3f
*
ptr
=
reinterpret_cast
<
Geom
::
Vec3f
*>
(
m_vboPosLine
->
lockPtr
());
svg2
->
setWidth
(
1.0
f
);
svg2
->
beginLines
();
const
Geom
::
Vec4f
&
col4
=
m_shaderL
->
getColor
();
Geom
::
Vec3f
col3
(
col4
[
0
],
col4
[
1
],
col4
[
2
]);
float
XexplV
=
(
1.0
f
-
m_explodeV
);
for
(
unsigned
int
i
=
0
;
i
<
m_nbLines
;
++
i
)
{
Geom
::
Vec3f
C
=
ptr
[
3
*
i
];
Geom
::
Vec3f
P
=
XexplV
*
C
+
m_explodeV
*
ptr
[
3
*
i
+
1
];
Geom
::
Vec3f
Q
=
XexplV
*
C
+
m_explodeV
*
ptr
[
3
*
i
+
2
];
svg2
->
addLine
(
P
,
Q
,
col3
);
}
svg2
->
endLines
();
m_vboPosLine
->
releasePtr
();
svg
.
addGroup
(
svg2
);
}
}
//end namespace VBO
}
//end namespace Algo
...
...
include/Container/attributeContainer.h
View file @
aac0ab43
...
...
@@ -39,6 +39,18 @@ namespace CGoGN
{
class
RegisteredBaseAttribute
;
class
AttributeContainer
;
class
ContainerBrowser
{
public:
virtual
unsigned
int
begin
()
const
=
0
;
virtual
unsigned
int
end
()
const
=
0
;
virtual
void
next
(
unsigned
int
&
it
)
const
=
0
;
virtual
void
enable
()
=
0
;
virtual
void
disable
()
=
0
;
};
/**
* Container for AttributeMultiVectors
...
...
@@ -84,6 +96,8 @@ protected:
*/
std
::
vector
<
unsigned
int
>
m_tableBlocksEmpty
;
ContainerBrowser
*
m_currentBrowser
;
/**
* orbit of the container
*/
...
...
@@ -129,6 +143,8 @@ public:
void
setRegistry
(
std
::
map
<
std
::
string
,
RegisteredBaseAttribute
*>*
re
);
void
setContainerBrowser
(
ContainerBrowser
*
bro
)
{
m_currentBrowser
=
bro
;}
/**************************************
* BASIC FEATURES *
**************************************/
...
...
@@ -224,6 +240,25 @@ public:
*/
void
next
(
unsigned
int
&
it
)
const
;
/**
* return the index of the first line of the container
*/
unsigned
int
realBegin
()
const
;
/**
* return the index of the last line of the container
*/
unsigned
int
realEnd
()
const
;
/**
* get the index of the line after it in the container
* MUST BE USED INSTEAD OF ++ !
*/
void
realNext
(
unsigned
int
&
it
)
const
;
/**************************************
* INFO ABOUT ATTRIBUTES *
**************************************/
...
...
include/Container/attributeContainer.hpp
View file @
aac0ab43
...
...
@@ -231,7 +231,50 @@ inline bool AttributeContainer::used(unsigned int index) const
* CONTAINER TRAVERSAL *
**************************************/
//inline unsigned int AttributeContainer::begin() const
//{
// unsigned int it = 0;
// while ((it < m_maxSize) && (!used(it)))
// ++it;
// return it;
//}
//inline unsigned int AttributeContainer::end() const
//{
// return m_maxSize;
//}
//inline void AttributeContainer::next(unsigned int &it) const
//{
// do
// {
// ++it;
// } while ((it < m_maxSize) && (!used(it)));
//}
inline
unsigned
int
AttributeContainer
::
begin
()
const
{
if
(
m_currentBrowser
!=
NULL
)
return
m_currentBrowser
->
begin
();
return
AttributeContainer
::
realBegin
();
}
inline
unsigned
int
AttributeContainer
::
end
()
const
{
if
(
m_currentBrowser
!=
NULL
)
return
m_currentBrowser
->
end
();
return
AttributeContainer
::
realEnd
();
}
inline
void
AttributeContainer
::
next
(
unsigned
int
&
it
)
const
{
if
(
m_currentBrowser
!=
NULL
)
m_currentBrowser
->
next
(
it
);
else
AttributeContainer
::
realNext
(
it
);
}
inline
unsigned
int
AttributeContainer
::
realBegin
()
const
{
unsigned
int
it
=
0
;
while
((
it
<
m_maxSize
)
&&
(
!
used
(
it
)))
...
...
@@ -239,12 +282,12 @@ inline unsigned int AttributeContainer::begin() const
return
it
;
}
inline
unsigned
int
AttributeContainer
::
e
nd
()
const
inline
unsigned
int
AttributeContainer
::
realE
nd
()
const
{
return
m_maxSize
;
}
inline
void
AttributeContainer
::
n
ext
(
unsigned
int
&
it
)
const
inline
void
AttributeContainer
::
realN
ext
(
unsigned
int
&
it
)
const
{
do
{
...
...
include/Topology/generic/traversorCell.hpp
View file @
aac0ab43
...
...
@@ -104,45 +104,48 @@ Dart TraversorCell<MAP, ORBIT>::end()
template
<
typename
MAP
,
unsigned
int
ORBIT
>
Dart
TraversorCell
<
MAP
,
ORBIT
>::
next
()
{
if
(
current
!=
NIL
)
assert
(
current
!=
NIL
);
// if(current != NIL)
// {
if
(
quickTraversal
!=
NULL
)
{
if
(
quickTraversal
!=
NULL
)
{
cont
->
next
(
qCurrent
)
;
cont
->
next
(
qCurrent
)
;
if
(
qCurrent
!=
cont
->
end
())
current
=
(
*
quickTraversal
)[
qCurrent
]
;
}
else
else
current
=
NIL
;
}
else
{
if
(
dmark
)
{
if
(
dmark
)
bool
ismarked
=
dmark
->
isMarked
(
current
)
;
while
(
current
!=
NIL
&&
(
ismarked
||
m
.
template
isBoundaryMarked
<
MAP
::
DIMENSION
>(
current
)))
{
bool
ismarked
=
dmark
->
isMarked
(
current
)
;
while
(
current
!=
NIL
&&
(
ismarked
||
m
.
template
isBoundaryMarked
<
MAP
::
DIMENSION
>(
current
)))
{
m
.
next
(
current
)
;
if
(
current
==
m
.
end
())
current
=
NIL
;
else
ismarked
=
dmark
->
isMarked
(
current
)
;
}
if
(
current
!=
NIL
)
dmark
->
markOrbit
<
ORBIT
>
(
current
)
;
m
.
next
(
current
)
;
if
(
current
==
m
.
end
())
current
=
NIL
;
else
ismarked
=
dmark
->
isMarked
(
current
)
;
}
else
if
(
current
!=
NIL
)
dmark
->
markOrbit
<
ORBIT
>
(
current
)
;
}
else
{
bool
ismarked
=
cmark
->
isMarked
(
current
)
;
while
(
current
!=
NIL
&&
(
ismarked
||
m
.
template
isBoundaryMarked
<
MAP
::
DIMENSION
>(
current
)
))
{
bool
ismarked
=
cmark
->
isMarked
(
current
)
;
while
(
current
!=
NIL
&&
(
ismarked
||
m
.
template
isBoundaryMarked
<
MAP
::
DIMENSION
>(
current
)
))
{
m
.
next
(
current
)
;
if
(
current
==
m
.
end
())
current
=
NIL
;
else
ismarked
=
cmark
->
isMarked
(
current
)
;
}
if
(
current
!=
NIL
)
cmark
->
mark
(
current
)
;
m
.
next
(
current
)
;
if
(
current
==
m
.
end
())
current
=
NIL
;
else
ismarked
=
cmark
->
isMarked
(
current
)
;
}
if
(
current
!=
NIL
)
cmark
->
mark
(
current
)
;
}
}
// }
return
current
;
}
...
...
@@ -237,45 +240,48 @@ Dart TraversorCell<GenericMap, ORBIT>::end()
template
<
unsigned
int
ORBIT
>
Dart
TraversorCell
<
GenericMap
,
ORBIT
>::
next
()
{
if
(
current
!=
NIL
)
assert
(
current
!=
NIL
);
// if(current != NIL)
// {
if
(
quickTraversal
!=
NULL
)
{
if
(
quickTraversal
!=
NULL
)
{
cont
->
next
(
qCurrent
)
;
cont
->
next
(
qCurrent
)
;
if
(
qCurrent
!=
cont
->
end
())
current
=
(
*
quickTraversal
)[
qCurrent
]
;
}
else
else
current
=
NIL
;
}
else
{
if
(
dmark
)
{
if
(
dmark
)
bool
ismarked
=
dmark
->
isMarked
(
current
)
;
while
(
current
!=
NIL
&&
(
ismarked
||
m
.
isBoundaryMarkedCurrent
(
current
)
))
{
bool
ismarked
=
dmark
->
isMarked
(
current
)
;
while
(
current
!=
NIL
&&
(
ismarked
||
m
.
isBoundaryMarkedCurrent
(
current
)
))
{
m
.
next
(
current
)
;
if
(
current
==
m
.
end
())
current
=
NIL
;
else
ismarked
=
dmark
->
isMarked
(
current
)
;
}
if
(
current
!=
NIL
)
dmark
->
markOrbit
<
ORBIT
>
(
current
)
;
m
.
next
(
current
)
;
if
(
current
==
m
.
end
())
current
=
NIL
;
else
ismarked
=
dmark
->
isMarked
(
current
)
;
}
else
if
(
current
!=
NIL
)
dmark
->
markOrbit
<
ORBIT
>
(
current
)
;
}
else
{
bool
ismarked
=
cmark
->
isMarked
(
current
)
;
while
(
current
!=
NIL
&&
(
ismarked
||
m
.
isBoundaryMarkedCurrent
(
current
)
))
{
bool
ismarked
=
cmark
->
isMarked
(
current
)
;
while
(
current
!=
NIL
&&
(
ismarked
||
m
.
isBoundaryMarkedCurrent
(
current
)
))
{
m
.
next
(
current
)
;
if
(
current
==
m
.
end
())
current
=
NIL
;
else
ismarked
=
cmark
->
isMarked
(
current
)
;
}
if
(
current
!=
NIL
)
cmark
->
mark
(
current
)
;
m
.
next
(
current
)
;
if
(
current
==
m
.
end
())
current
=
NIL
;
else
ismarked
=
cmark
->
isMarked
(
current
)
;
}
if
(
current
!=
NIL
)
cmark
->
mark
(
current
)
;
}
}
// }
return
current
;
}
...
...
include/Utils/Shaders/shaderExplodeVolumesLines.h
View file @
aac0ab43
...
...
@@ -64,6 +64,8 @@ public:
void
setColor
(
const
Geom
::
Vec4f
&
color
);
const
Geom
::
Vec4f
&
getColor
()
const
;
void
setClippingPlane
(
const
Geom
::
Vec4f
&
plane
);
void
setParams
(
float
explodeV
,
const
Geom
::
Vec4f
&
color
,
const
Geom
::
Vec4f
&
plane
);
...
...
src/Container/attributeContainer.cpp
View file @
aac0ab43
...
...
@@ -35,6 +35,7 @@ namespace CGoGN
{
AttributeContainer
::
AttributeContainer
()
:
m_currentBrowser
(
NULL
),
m_orbit
(
0
),
m_nbAttributes
(
0
),
m_nbUnknown
(
0
),
...
...
src/Utils/Shaders/shaderExplodeVolumesLines.cpp
View file @
aac0ab43
...
...
@@ -112,6 +112,11 @@ void ShaderExplodeVolumesLines::setColor(const Geom::Vec4f& color)
unbind
();
}
const
Geom
::
Vec4f
&
ShaderExplodeVolumesLines
::
getColor
()
const
{
return
m_color
;
}
void
ShaderExplodeVolumesLines
::
setClippingPlane
(
const
Geom
::
Vec4f
&
plane
)
{
m_plane
=
plane
;
...
...
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