Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CGoGN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
KennethVanhoey
CGoGN
Commits
4056172d
Commit
4056172d
authored
Jan 25, 2012
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update explodeVolumeRender
modification topoRender for using dartIndex
parent
9a7fe051
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
124 additions
and
50 deletions
+124
-50
include/Algo/Render/GL2/explodeVolumeRender.h
include/Algo/Render/GL2/explodeVolumeRender.h
+36
-13
include/Algo/Render/GL2/explodeVolumeRender.hpp
include/Algo/Render/GL2/explodeVolumeRender.hpp
+54
-22
include/Algo/Render/GL2/topo3Render.hpp
include/Algo/Render/GL2/topo3Render.hpp
+13
-10
include/Algo/Render/GL2/topoRender.h
include/Algo/Render/GL2/topoRender.h
+2
-1
include/Algo/Render/GL2/topoRender.hpp
include/Algo/Render/GL2/topoRender.hpp
+19
-4
No files found.
include/Algo/Render/GL2/explodeVolumeRender.h
View file @
4056172d
...
...
@@ -78,23 +78,23 @@ public:
* @param good functor that return true for darts of part to draw
* @param type_vbo vbo to alloc ( VBO_P, VBO_PN, VBO_PNC, VBO_PC ..)
*/
ExplodeVolumeRender
();
ExplodeVolumeRender
()
;
/**
* Destructor
*/
~
ExplodeVolumeRender
();
~
ExplodeVolumeRender
()
;
/**
* return a ptr on used shader do not forgot to register
*/
Utils
::
GLSLShader
*
shaderFaces
()
{
return
m_shader
;}
Utils
::
GLSLShader
*
shaderFaces
()
;
/**
* return a ptr on used shader do not forgot to register
*/
Utils
::
GLSLShader
*
shaderLines
()
{
return
m_shaderL
;}
Utils
::
GLSLShader
*
shaderLines
()
;
/**
...
...
@@ -104,29 +104,52 @@ public:
* @param good selector
*/
template
<
typename
PFP
>
void
updateData
(
typename
PFP
::
MAP
&
map
,
typename
PFP
::
TVEC3
&
positions
,
const
FunctorSelect
&
good
=
allDarts
);
void
updateData
(
typename
PFP
::
MAP
&
map
,
typename
PFP
::
TVEC3
&
positions
,
const
FunctorSelect
&
good
=
allDarts
)
;
/**
* draw edges
*/
void
drawEdges
();
void
drawEdges
()
;
/**
* draw edges
*/
void
drawFaces
();
void
drawFaces
()
;
void
setExplodeVolumes
(
float
explode
)
{
m_shader
->
setExplodeVolumes
(
explode
);
m_shaderL
->
setExplodeVolumes
(
explode
);}
/**
* set exploding volume coefficient parameter
*/
void
setExplodeVolumes
(
float
explode
)
;
void
setClippingPlane
(
const
Geom
::
Vec4f
&
p
)
{
m_shader
->
setClippingPlane
(
p
);
m_shaderL
->
setClippingPlane
(
p
);}
/**
* set clipping plane
*/
void
setClippingPlane
(
const
Geom
::
Vec4f
&
p
)
;
void
setNoClippingPlane
()
{
Geom
::
Vec4f
p
(
0.0
f
,
0.0
f
,
10000.0
f
,
100000000000000000000000000.0
f
);
m_shader
->
setClippingPlane
(
p
);
m_shaderL
->
setClippingPlane
(
p
);}
/**
* unset clipping plane
*/
void
setNoClippingPlane
()
;
void
setAmbiant
(
const
Geom
::
Vec4f
&
ambiant
)
{
m_shader
->
setAmbiant
(
ambiant
);}
/**
* set ambiant color parameter
*/
void
setAmbiant
(
const
Geom
::
Vec4f
&
ambiant
)
;
void
setDiffuse
(
const
Geom
::
Vec4f
&
diffuse
)
{
m_shader
->
setDiffuse
(
diffuse
);}
/**
* set diffuse color parameter
*/
void
setDiffuse
(
const
Geom
::
Vec4f
&
diffuse
)
;
void
setLightPosition
(
const
Geom
::
Vec3f
&
lp
)
{
m_shader
->
setLightPosition
(
lp
);}
/**
* set light position parameter
*/
void
setLightPosition
(
const
Geom
::
Vec3f
&
lp
)
;
/**
* set color parameter for edge drawing
*/
void
setColorLine
(
const
Geom
::
Vec4f
&
col
)
;
};
}
//end namespace GL2
...
...
include/Algo/Render/GL2/explodeVolumeRender.hpp
View file @
4056172d
...
...
@@ -83,7 +83,8 @@ void ExplodeVolumeRender::updateData(typename PFP::MAP& map, typename PFP::TVEC3
std
::
vector
<
VEC3
>
buffer
;
buffer
.
reserve
(
16384
);
TraversorOF
<
typename
PFP
::
MAP
>
traFace
(
map
,
good
);
TraversorCell
<
typename
PFP
::
MAP
>
traFace
(
map
,
PFP
::
MAP
::
ORBIT_IN_PARENT
(
FACE
),
good
);
for
(
Dart
d
=
traFace
.
begin
();
d
!=
traFace
.
end
();
d
=
traFace
.
next
())
{
Dart
a
=
d
;
...
...
@@ -115,33 +116,15 @@ void ExplodeVolumeRender::updateData(typename PFP::MAP& map, typename PFP::TVEC3
buffer
.
clear
();
// TraversorE<typename PFP::MAP> traEdge(map,good);
// for (Dart d=traEdge.begin(); d!=traEdge.end(); d=traEdge.next())
// {
// buffer.push_back(centerVolumes[d]);
// buffer.push_back(positions[d]);
// buffer.push_back(positions[ map.phi1(d)]);
// }
// TO A REFAIRE AVEC LE BON TRAVERSOR DE LA BONNE ORBITE QUAND ELLE EXISTERA
DartMarker
dm
(
map
);
for
(
Dart
d
=
map
.
begin
();
d
!=
map
.
end
();
map
.
next
(
d
))
TraversorCell
<
typename
PFP
::
MAP
>
traEdge
(
map
,
PFP
::
MAP
::
ORBIT_IN_PARENT
(
EDGE
),
good
);
for
(
Dart
d
=
traEdge
.
begin
();
d
!=
traEdge
.
end
();
d
=
traEdge
.
next
())
{
if
(
good
(
d
)
&&
!
dm
.
isMarked
(
d
))
{
buffer
.
push_back
(
centerVolumes
[
d
]);
buffer
.
push_back
(
positions
[
d
]);
buffer
.
push_back
(
positions
[
map
.
phi1
(
d
)]);
dm
.
mark
(
d
);
dm
.
mark
(
map
.
phi2
(
d
));
}
}
m_nbLines
=
buffer
.
size
()
/
3
;
m_vboPosLine
->
allocate
(
buffer
.
size
());
...
...
@@ -172,6 +155,55 @@ inline void ExplodeVolumeRender::drawEdges()
}
inline
void
ExplodeVolumeRender
::
setExplodeVolumes
(
float
explode
)
{
m_shader
->
setExplodeVolumes
(
explode
);
m_shaderL
->
setExplodeVolumes
(
explode
);
}
inline
void
ExplodeVolumeRender
::
setClippingPlane
(
const
Geom
::
Vec4f
&
p
)
{
m_shader
->
setClippingPlane
(
p
);
m_shaderL
->
setClippingPlane
(
p
);
}
inline
void
ExplodeVolumeRender
::
setNoClippingPlane
()
{
Geom
::
Vec4f
p
(
1.0
f
,
1.0
f
,
1.0
f
,
-
99999999.9
f
);
m_shader
->
setClippingPlane
(
p
);
m_shaderL
->
setClippingPlane
(
p
);
}
inline
void
ExplodeVolumeRender
::
setAmbiant
(
const
Geom
::
Vec4f
&
ambiant
)
{
m_shader
->
setAmbiant
(
ambiant
);
}
inline
void
ExplodeVolumeRender
::
setDiffuse
(
const
Geom
::
Vec4f
&
diffuse
)
{
m_shader
->
setDiffuse
(
diffuse
);
}
inline
void
ExplodeVolumeRender
::
setLightPosition
(
const
Geom
::
Vec3f
&
lp
)
{
m_shader
->
setLightPosition
(
lp
);
}
inline
void
ExplodeVolumeRender
::
setColorLine
(
const
Geom
::
Vec4f
&
col
)
{
m_shaderL
->
setColor
(
col
);
}
inline
Utils
::
GLSLShader
*
ExplodeVolumeRender
::
shaderFaces
()
{
return
m_shader
;
}
inline
Utils
::
GLSLShader
*
ExplodeVolumeRender
::
shaderLines
()
{
return
m_shaderL
;
}
}
//end namespace VBO
...
...
include/Algo/Render/GL2/topo3Render.hpp
View file @
4056172d
...
...
@@ -91,12 +91,14 @@ void Topo3Render::updateDataMap3(typename PFP::MAP& mapx, const typename PFP::TV
// compute center of each volumes
CellMarker
cmv
(
map
,
VOLUME
);
AutoAttributeHandler
<
VEC3
>
centerVolumes
(
map
,
VOLUME
,
"centerVolumes"
);
TraversorW
<
Map3
>
traVol
(
map
,
good
);
for
(
Dart
d
=
traVol
.
begin
();
d
!=
traVol
.
end
();
d
=
traVol
.
next
())
{
centerVolumes
[
d
]
=
Algo
::
Geometry
::
volumeCentroid
<
PFP
>
(
mapx
,
d
,
positions
);
}
// TraversorW<Map3> traVol(map,good);
// for (Dart d=traVol.begin(); d!=traVol.end(); d=traVol.next())
// {
// centerVolumes[d] = Algo::Geometry::volumeCentroid<PFP>(mapx, d, positions);
// }
Algo
::
Geometry
::
computeCentroidVolumes
<
PFP
>
(
mapx
,
positions
,
centerVolumes
,
good
);
// debut phi1
AutoAttributeHandler
<
VEC3
>
fv1
(
map
,
DART
);
...
...
@@ -347,11 +349,12 @@ void Topo3Render::updateDataGMap3(typename PFP::MAP& mapx, const typename PFP::T
// compute center of each volumes
AutoAttributeHandler
<
VEC3
>
centerVolumes
(
map
,
VOLUME
,
"centerVolumes"
);
TraversorW
<
GMap3
>
traVol
(
map
,
good
);
for
(
Dart
d
=
traVol
.
begin
();
d
!=
traVol
.
end
();
d
=
traVol
.
next
())
{
centerVolumes
[
d
]
=
Algo
::
Geometry
::
volumeCentroid
<
PFP
>
(
mapx
,
d
,
positions
);
}
// TraversorW<GMap3> traVol(map,good);
// for (Dart d=traVol.begin(); d!=traVol.end(); d=traVol.next())
// {
// centerVolumes[d] = Algo::Geometry::volumeCentroid<PFP>(mapx, d, positions);
// }
Algo
::
Geometry
::
computeCentroidVolumes
<
PFP
>
(
mapx
,
positions
,
centerVolumes
,
good
);
// beta1
...
...
include/Algo/Render/GL2/topoRender.h
View file @
4056172d
...
...
@@ -102,7 +102,8 @@ protected:
Dart
colToDart
(
float
*
color
);
void
dartToCol
(
Dart
d
,
float
&
r
,
float
&
g
,
float
&
b
);
template
<
typename
PFP
>
void
dartToCol
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
float
&
r
,
float
&
g
,
float
&
b
);
Dart
pickColor
(
unsigned
int
x
,
unsigned
int
y
);
...
...
include/Algo/Render/GL2/topoRender.hpp
View file @
4056172d
...
...
@@ -139,7 +139,7 @@ void TopoRender::updateDataMap(typename PFP::MAP& mapx, const typename PFP::TVEC
m_attIndex
[
d
]
=
indexDC
;
indexDC
+=
2
;
*
positionDartBuf
++
=
P
;
*
colorDartBuf
++
=
VEC3
(
1.
,
0.
,
0
.
);
*
colorDartBuf
++
=
VEC3
(
1.
,
1.
,
1
.
);
*
positionDartBuf
++
=
Q
;
*
colorDartBuf
++
=
VEC3
(
1.
,
1.
,
1.
);
VEC3
f
=
P
*
0.5
f
+
Q
*
0.5
f
;
...
...
@@ -179,7 +179,8 @@ void TopoRender::updateDataMap(typename PFP::MAP& mapx, const typename PFP::TVEC
Dart
e
=
map
.
phi2
(
d
);
if
(
good
(
e
)
&&
(
e
.
index
>
d
.
index
))
// if (good(e) && (e.index > d.index))
if
(
good
(
e
)
&&
(
d
<
e
))
{
*
positionF2
++
=
fv2
[
d
];
*
positionF2
++
=
fv2
[
e
];
...
...
@@ -340,7 +341,8 @@ void TopoRender::updateDataGMap(typename PFP::MAP& mapx, const typename PFP::TVE
Dart
e
=
map
.
beta2
(
d
);
if
(
good
(
e
)
&&
(
e
.
index
>
d
.
index
))
// if (good(e) && (e.index > d.index))
if
(
good
(
e
)
&&
(
d
<
e
))
{
*
positionF2
++
=
fv2
[
d
];
*
positionF2
++
=
fv2
[
e
];
...
...
@@ -360,6 +362,19 @@ void TopoRender::updateDataGMap(typename PFP::MAP& mapx, const typename PFP::TVE
}
template
<
typename
PFP
>
void
TopoRender
::
dartToCol
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
float
&
r
,
float
&
g
,
float
&
b
)
{
unsigned
int
lab
=
map
.
dartIndex
(
d
)
+
1
;
// add one to avoid picking the black of screen
r
=
float
(
lab
%
255
)
/
255.0
f
;
lab
=
lab
/
255
;
g
=
float
(
lab
%
255
)
/
255.0
f
;
lab
=
lab
/
255
;
b
=
float
(
lab
%
255
)
/
255.0
f
;
lab
=
lab
/
255
;
if
(
lab
!=
0
)
CGoGNerr
<<
"Error picking color, too many darts"
<<
CGoGNendl
;
}
template
<
typename
PFP
>
void
TopoRender
::
setDartsIdColor
(
typename
PFP
::
MAP
&
map
,
const
FunctorSelect
&
good
)
...
...
@@ -376,7 +391,7 @@ void TopoRender::setDartsIdColor(typename PFP::MAP& map, const FunctorSelect& go
if
(
nb
<
m_nbDarts
)
{
float
r
,
g
,
b
;
dartToCol
(
d
,
r
,
g
,
b
);
dartToCol
<
PFP
>
(
map
,
d
,
r
,
g
,
b
);
float
*
local
=
colorBuffer
+
3
*
m_attIndex
[
d
];
// get the right position in VBO
*
local
++
=
r
;
*
local
++
=
g
;
...
...
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