Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix incorrect alpha value update of InteractiveFrame #1297

Merged
merged 3 commits into from
Apr 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

* Added heightmap support to OSG renderer: [#1293](https://github.com/dartsim/dart/pull/1293)
* Improved voxel grid and point cloud rendering performance: [#1294](https://github.com/dartsim/dart/pull/1294)
* Fixed incorrect alpha value update of InteractiveFrame: [#1297](https://github.com/dartsim/dart/pull/1297)

#### Compilers Tested

Expand Down
2 changes: 1 addition & 1 deletion dart/dynamics/MeshShape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ void MeshShape::notifyAlphaUpdated(double alpha)
{
aiMesh* mesh = mMesh->mMeshes[i];
for(std::size_t j=0; j<mesh->mNumVertices; ++j)
mesh->mColors[0][j][3] = alpha;
mesh->mColors[0][j].a = alpha;
}
}

Expand Down
6 changes: 2 additions & 4 deletions dart/gui/osg/InteractiveFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,6 @@ void InteractiveFrame::createStandardVisualizationShapes(double size,
for(std::size_t a=0; a<3; ++a)
{
Eigen::Vector3d tail(Eigen::Vector3d::Zero());
// tail[a] = 1.2*plane_length;
tail[a] = ring_inner_scale;
Eigen::Vector3d head(Eigen::Vector3d::Zero());
head[a] = size;
Expand All @@ -302,7 +301,6 @@ void InteractiveFrame::createStandardVisualizationShapes(double size,
dart::dynamics::ShapePtr(
new dart::dynamics::ArrowShape(tail, head, p, color, 100)));

// tail[a] = -1.2*plane_length;
tail[a] = -ring_inner_scale;
head[a] = -size;

Expand Down Expand Up @@ -363,8 +361,8 @@ void InteractiveFrame::createStandardVisualizationShapes(double size,
}
color1[r] = 1.0;
color2[r] = 0.6;
color1[3] = getTool(InteractiveTool::ANGULAR,r)->getDefaultAlpha();
color2[3] = getTool(InteractiveTool::ANGULAR,r)->getDefaultAlpha();
color1.a = getTool(InteractiveTool::ANGULAR,r)->getDefaultAlpha();
color2.a = getTool(InteractiveTool::ANGULAR,r)->getDefaultAlpha();
mesh->mColors[0][4*i+j] = ((4*i+j)%2 == 0)? color1 : color2;
mesh->mColors[0][4*i+j+R] = ((4*i+j+R)%2 == 0)? color1 : color2;
mesh->mColors[0][4*i+2+j] = ((4*i+2+j)%2 == 0)? color1 : color2;
Expand Down
2 changes: 1 addition & 1 deletion dart/gui/osg/render/MeshShapeNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ std::ostream& operator<<(std::ostream& str, const aiColor4D& c)
//==============================================================================
bool checkSpecularSanity(const aiColor4D& c)
{
if(c[0] >= 1.0 && c[1] >= 1.0 && c[2] >= 1.0 && c[3] >= 1.0)
if(c.r >= 1.0 && c.g >= 1.0 && c.b >= 1.0 && c.a >= 1.0)
return false;

return true;
Expand Down