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
KennethVanhoey
CGoGN
Commits
7bbd4da3
Commit
7bbd4da3
authored
Jun 06, 2013
by
Sylvain Thery
Browse files
render topo3 primal final
parent
745e55e3
Changes
3
Hide whitespace changes
Inline
Side-by-side
include/Algo/Render/GL2/topo3PrimalRender.h
View file @
7bbd4da3
...
...
@@ -106,6 +106,11 @@ protected:
*/
Geom
::
Vec3f
m_dartsColor
;
/**
* initial darts color for boundary (set in update)
*/
Geom
::
Vec3f
m_boundaryDartsColor
;
/**
* attribute index to get easy correspondence dart/color
*/
...
...
@@ -203,6 +208,8 @@ public:
*/
void
setInitialDartsColor
(
float
r
,
float
g
,
float
b
);
void
setInitialBoundaryDartsColor
(
float
r
,
float
g
,
float
b
);
/**
* overdraw a dart with given width and color
* @param d the dart
...
...
include/Algo/Render/GL2/topo3PrimalRender.hpp
View file @
7bbd4da3
...
...
@@ -56,27 +56,24 @@ void Topo3PrimalRender::setDartsIdColor(typename PFP::MAP& map)
for
(
Dart
d
=
map
.
begin
();
d
!=
map
.
end
();
map
.
next
(
d
))
{
if
(
!
map
.
isBoundaryMarked3
(
d
))
// topo3 Render do not traverse boundary
if
(
nb
<
m_nbDarts
)
{
if
(
nb
<
m_nbDarts
)
{
float
r
,
g
,
b
;
dartToCol
(
d
,
r
,
g
,
b
);
float
*
local
=
colorBuffer
+
3
*
m_attIndex
[
d
];
// get the right position in VBO
*
local
++
=
r
;
*
local
++
=
g
;
*
local
++
=
b
;
*
local
++
=
r
;
*
local
++
=
g
;
*
local
++
=
b
;
nb
++
;
}
else
{
CGoGNerr
<<
"Error buffer too small for color picking (change the selector parameter ?)"
<<
CGoGNendl
;
break
;
}
float
r
,
g
,
b
;
dartToCol
(
d
,
r
,
g
,
b
);
float
*
local
=
colorBuffer
+
3
*
m_attIndex
[
d
];
// get the right position in VBO
*
local
++
=
r
;
*
local
++
=
g
;
*
local
++
=
b
;
*
local
++
=
r
;
*
local
++
=
g
;
*
local
++
=
b
;
nb
++
;
}
else
{
CGoGNerr
<<
"Error buffer too small for color picking (change the selector parameter ?)"
<<
CGoGNendl
;
break
;
}
}
glUnmapBuffer
(
GL_ARRAY_BUFFER
);
...
...
@@ -91,18 +88,15 @@ void Topo3PrimalRender::updateColors(typename PFP::MAP& map, const VertexAttribu
for
(
Dart
d
=
map
.
begin
();
d
!=
map
.
end
();
map
.
next
(
d
))
{
if
(
!
map
.
isBoundaryMarked3
(
d
))
// topo3 Render do not traverse boundary
if
(
nb
<
m_nbDarts
)
{
if
(
nb
<
m_nbDarts
)
{
colorBuffer
[
m_attIndex
[
d
]]
=
colors
[
d
];
nb
++
;
}
else
{
CGoGNerr
<<
"Error buffer too small for color picking (change the selector parameter ?)"
<<
CGoGNendl
;
break
;
}
colorBuffer
[
m_attIndex
[
d
]]
=
colors
[
d
];
nb
++
;
}
else
{
CGoGNerr
<<
"Error buffer too small for color picking (change the selector parameter ?)"
<<
CGoGNendl
;
break
;
}
}
glUnmapBuffer
(
GL_ARRAY_BUFFER
);
...
...
@@ -198,22 +192,40 @@ void Topo3PrimalRender::updateData(typename PFP::MAP& mapx, const VertexAttribut
*
positionDartBuf
++
=
P
;
*
positionDartBuf
++
=
PP
;
*
positionDartBuf
++
=
Q
;
*
positionDartBuf
++
=
QQ
;
*
colorDartBuf
++
=
m_dartsColor
;
*
colorDartBuf
++
=
m_dartsColor
;
*
colorDartBuf
++
=
m_dartsColor
;
*
colorDartBuf
++
=
m_dartsColor
;
if
(
map
.
isBoundaryMarked3
(
d
))
{
*
colorDartBuf
++
=
m_boundaryDartsColor
;
*
colorDartBuf
++
=
m_boundaryDartsColor
;
}
else
{
*
colorDartBuf
++
=
m_dartsColor
;
*
colorDartBuf
++
=
m_dartsColor
;
}
m_attIndex
[
d
]
=
posDBI
;
posDBI
+=
2
;
fv2
[
d
]
=
(
P
+
PP
)
*
0.5
f
;
*
positionDartBuf
++
=
Q
;
*
positionDartBuf
++
=
QQ
;
Dart
dx
=
map
.
phi3
(
d
);
fv2
[
dx
]
=
(
Q
+
QQ
)
*
0.5
f
;
if
(
map
.
isBoundaryMarked3
(
dx
))
{
*
colorDartBuf
++
=
m_boundaryDartsColor
;
*
colorDartBuf
++
=
m_boundaryDartsColor
;
}
else
{
*
colorDartBuf
++
=
m_dartsColor
;
*
colorDartBuf
++
=
m_dartsColor
;
}
m_attIndex
[
dx
]
=
posDBI
;
posDBI
+=
2
;
fv2
[
dx
]
=
(
Q
+
QQ
)
*
0.5
f
;
d
=
mapx
.
phi1
(
d
);
}
...
...
src/Algo/Render/topo3PrimalRender.cpp
View file @
7bbd4da3
...
...
@@ -48,6 +48,7 @@ Topo3PrimalRender::Topo3PrimalRender():
m_topo_relation_width
(
3.0
f
),
m_color_save
(
NULL
),
m_dartsColor
(
1.0
f
,
1.0
f
,
1.0
f
),
m_boundaryDartsColor
(
0.5
f
,
0.5
f
,
0.5
f
),
m_bufferDartPosition
(
NULL
)
{
m_vbo0
=
new
Utils
::
VBO
();
...
...
@@ -127,7 +128,6 @@ void Topo3PrimalRender::setAllDartsColor(float r, float g, float b)
*
colorDartBuf
++
=
b
;
}
glUnmapBufferARB
(
GL_ARRAY_BUFFER
);
}
void
Topo3PrimalRender
::
setInitialDartsColor
(
float
r
,
float
g
,
float
b
)
...
...
@@ -135,6 +135,12 @@ void Topo3PrimalRender::setInitialDartsColor(float r, float g, float b)
m_dartsColor
=
Geom
::
Vec3f
(
r
,
g
,
b
);
}
void
Topo3PrimalRender
::
setInitialBoundaryDartsColor
(
float
r
,
float
g
,
float
b
)
{
m_boundaryDartsColor
=
Geom
::
Vec3f
(
r
,
g
,
b
);
}
void
Topo3PrimalRender
::
drawDarts
()
{
if
(
m_nbDarts
==
0
)
...
...
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