Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RobotAPI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software
ArmarX
RobotAPI
Commits
d33e1737
Commit
d33e1737
authored
4 years ago
by
Fabian Paus
Browse files
Options
Downloads
Patches
Plain Diff
ArViz: VisualizationRobot cache current color and only change if needed
parent
4ed8b38c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
source/RobotAPI/components/ArViz/Coin/VisualizationRobot.cpp
+24
-17
24 additions, 17 deletions
source/RobotAPI/components/ArViz/Coin/VisualizationRobot.cpp
source/RobotAPI/components/ArViz/Coin/VisualizationRobot.h
+1
-0
1 addition, 0 deletions
source/RobotAPI/components/ArViz/Coin/VisualizationRobot.h
with
25 additions
and
17 deletions
source/RobotAPI/components/ArViz/Coin/VisualizationRobot.cpp
+
24
−
17
View file @
d33e1737
...
...
@@ -136,26 +136,33 @@ namespace armarx::viz::coin
if
(
loadedDrawStyle
&
data
::
ModelDrawStyle
::
OVERRIDE_COLOR
)
{
int
numChildren
=
node
->
getNumChildren
();
for
(
int
i
=
0
;
i
<
numChildren
;
i
++
)
if
(
loadedColor
.
r
!=
element
.
color
.
r
||
loadedColor
.
g
!=
element
.
color
.
g
||
loadedColor
.
b
!=
element
.
color
.
b
||
loadedColor
.
a
!=
element
.
color
.
a
)
{
SoSeparator
*
nodeSep
=
static_cast
<
SoSeparator
*>
(
node
->
getChild
(
i
));
// The first entry must be a SoMaterial (see recreateVisualizationNodes)
SoMaterial
*
m
=
dynamic_cast
<
SoMaterial
*>
(
nodeSep
->
getChild
(
0
));
if
(
!
m
)
int
numChildren
=
node
->
getNumChildren
();
for
(
int
i
=
0
;
i
<
numChildren
;
i
++
)
{
ARMARX_WARNING
<<
"Error at node with index: "
<<
i
;
continue
;
SoSeparator
*
nodeSep
=
static_cast
<
SoSeparator
*>
(
node
->
getChild
(
i
));
// The first entry must be a SoMaterial (see recreateVisualizationNodes)
SoMaterial
*
m
=
dynamic_cast
<
SoMaterial
*>
(
nodeSep
->
getChild
(
0
));
if
(
!
m
)
{
ARMARX_WARNING
<<
"Error at node with index: "
<<
i
;
continue
;
}
auto
color
=
element
.
color
;
const
float
conv
=
1.0
f
/
255.0
f
;
float
a
=
color
.
a
*
conv
;
SbColor
coinColor
(
conv
*
color
.
r
,
conv
*
color
.
g
,
conv
*
color
.
b
);
m
->
diffuseColor
=
coinColor
;
m
->
ambientColor
=
coinColor
;
m
->
transparency
=
1.0
f
-
a
;
m
->
setOverride
(
true
);
}
auto
color
=
element
.
color
;
const
float
conv
=
1.0
f
/
255.0
f
;
float
a
=
color
.
a
*
conv
;
SbColor
coinColor
(
conv
*
color
.
r
,
conv
*
color
.
g
,
conv
*
color
.
b
);
m
->
diffuseColor
=
coinColor
;
m
->
ambientColor
=
coinColor
;
m
->
transparency
=
1.0
f
-
a
;
m
->
setOverride
(
true
);
loadedColor
=
element
.
color
;
}
}
IceUtil
::
Time
time_color
=
IceUtil
::
Time
::
now
();
...
...
This diff is collapsed.
Click to expand it.
source/RobotAPI/components/ArViz/Coin/VisualizationRobot.h
+
1
−
0
View file @
d33e1737
...
...
@@ -25,6 +25,7 @@ namespace armarx::viz::coin
LoadedRobot
loaded
;
int
loadedDrawStyle
=
data
::
ModelDrawStyle
::
ORIGINAL
;
armarx
::
viz
::
data
::
Color
loadedColor
{
0
,
0
,
0
,
0
};
};
void
clearRobotCache
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment