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
Hurstel
CGoGN
Commits
3647ee4b
Commit
3647ee4b
authored
Feb 13, 2012
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug in topo picking use dart.index
parent
e0942ffc
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
56 additions
and
32 deletions
+56
-32
include/Algo/Render/GL2/topo3Render.h
include/Algo/Render/GL2/topo3Render.h
+7
-3
include/Algo/Render/GL2/topo3Render.hpp
include/Algo/Render/GL2/topo3Render.hpp
+1
-14
include/Algo/Render/GL2/topoRender.h
include/Algo/Render/GL2/topoRender.h
+19
-2
include/Algo/Render/GL2/topoRender.hpp
include/Algo/Render/GL2/topoRender.hpp
+1
-13
src/Algo/Render/topo3Render.cpp
src/Algo/Render/topo3Render.cpp
+15
-0
src/Algo/Render/topoRender.cpp
src/Algo/Render/topoRender.cpp
+13
-0
No files found.
include/Algo/Render/GL2/topo3Render.h
View file @
3647ee4b
...
...
@@ -255,11 +255,15 @@ public:
Dart
picking
(
typename
PFP
::
MAP
&
map
,
int
x
,
int
y
,
const
FunctorSelect
&
good
=
allDarts
);
/**
* compute dart from color (for picking)
*/
Dart
colToDart
(
float
*
color
);
template
<
typename
PFP
>
void
dartToCol
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
float
&
r
,
float
&
g
,
float
&
b
);
/**
* compute color from dart (for picking)
*/
void
dartToCol
(
Dart
d
,
float
&
r
,
float
&
g
,
float
&
b
);
...
...
include/Algo/Render/GL2/topo3Render.hpp
View file @
3647ee4b
...
...
@@ -253,19 +253,6 @@ void Topo3Render::updateDataMap3(typename PFP::MAP& mapx, const typename PFP::TV
}
template
<
typename
PFP
>
void
Topo3Render
::
dartToCol
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
float
&
r
,
float
&
g
,
float
&
b
)
{
// unsigned int lab = d.index + 1; // add one to avoid picking the black of screen
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
Topo3Render
::
setDartsIdColor
(
typename
PFP
::
MAP
&
map
,
const
FunctorSelect
&
good
)
...
...
@@ -281,7 +268,7 @@ void Topo3Render::setDartsIdColor(typename PFP::MAP& map, const FunctorSelect& g
if
(
nb
<
m_nbDarts
)
{
float
r
,
g
,
b
;
dartToCol
<
PFP
>
(
map
,
d
,
r
,
g
,
b
);
dartToCol
(
d
,
r
,
g
,
b
);
float
*
local
=
colorBuffer
+
3
*
m_attIndex
[
d
];
// get the right position in VBO
*
local
++
=
r
;
...
...
include/Algo/Render/GL2/topoRender.h
View file @
3647ee4b
...
...
@@ -115,18 +115,35 @@ protected:
Utils
::
ShaderColorPerVertex
*
m_shader2
;
/**
* compute color from dart index (for color picking)
*/
Dart
colToDart
(
float
*
color
);
template
<
typename
PFP
>
void
dartToCol
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
float
&
r
,
float
&
g
,
float
&
b
);
/**
* compute dart from color (for color picking)
*/
void
dartToCol
(
Dart
d
,
float
&
r
,
float
&
g
,
float
&
b
);
/**
* pick the color in the rendered image
*/
Dart
pickColor
(
unsigned
int
x
,
unsigned
int
y
);
/**
* affect a color to each dart
*/
template
<
typename
PFP
>
void
setDartsIdColor
(
typename
PFP
::
MAP
&
map
,
const
FunctorSelect
&
good
);
/**
* save colors before picking
*/
void
pushColors
();
/**
* restore colors after picking
*/
void
popColors
();
public:
...
...
include/Algo/Render/GL2/topoRender.hpp
View file @
3647ee4b
...
...
@@ -361,18 +361,6 @@ 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
>
...
...
@@ -389,7 +377,7 @@ void TopoRender::setDartsIdColor(typename PFP::MAP& map, const FunctorSelect& go
if
(
nb
<
m_nbDarts
)
{
float
r
,
g
,
b
;
dartToCol
<
PFP
>
(
map
,
d
,
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
;
...
...
src/Algo/Render/topo3Render.cpp
View file @
3647ee4b
...
...
@@ -322,6 +322,21 @@ Dart Topo3Render::colToDart(float* color)
}
void
Topo3Render
::
dartToCol
(
Dart
d
,
float
&
r
,
float
&
g
,
float
&
b
)
{
// here use dart.index beacause it is what we want (and not map.dartIndex(d) !!)
unsigned
int
lab
=
d
.
index
+
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
;
}
Dart
Topo3Render
::
pickColor
(
unsigned
int
x
,
unsigned
int
y
)
{
//more easy picking for
...
...
src/Algo/Render/topoRender.cpp
View file @
3647ee4b
...
...
@@ -215,6 +215,19 @@ Dart TopoRender::colToDart(float* color)
}
void
TopoRender
::
dartToCol
(
Dart
d
,
float
&
r
,
float
&
g
,
float
&
b
)
{
// here use d.index beacause it is what we want (and not map.dartIndex(d) !!)
unsigned
int
lab
=
d
.
index
+
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
;
}
Dart
TopoRender
::
pickColor
(
unsigned
int
x
,
unsigned
int
y
)
{
...
...
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