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

[SofaBase] Package SofaBaseCollision #1653

Merged
merged 9 commits into from
Dec 17, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
use rgbacolor
  • Loading branch information
fredroy committed Dec 17, 2020
commit 316ba9ccf8dc9ea9b6ed7a5702254dbfac7d024d
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ void CapsuleCollisionModel<DataTypes>::computeBoundingTree(int maxDepth)
template<class DataTypes>
void CapsuleCollisionModel<DataTypes>::draw(const core::visual::VisualParams* vparams, Index index)
{
sofa::defaulttype::Vec<4,float> col4f(getColor4f());
sofa::helper::types::RGBAColor col4f(getColor4f()[0], getColor4f()[1], getColor4f()[2], getColor4f()[3]);
vparams->drawTool()->drawCapsule(point1(index),point2(index),(float)radius(index),col4f);
}

Expand All @@ -175,7 +175,7 @@ void CapsuleCollisionModel<DataTypes>::draw(const core::visual::VisualParams* vp
{
if (vparams->displayFlags().getShowCollisionModels())
{
sofa::defaulttype::Vec<4,float> col4f(getColor4f());
sofa::helper::types::RGBAColor col4f(getColor4f()[0], getColor4f()[1], getColor4f()[2], getColor4f()[3]);
vparams->drawTool()->setPolygonMode(0,vparams->displayFlags().getShowWireFrame());//maybe ??
vparams->drawTool()->setLightingEnabled(true); //Enable lightning

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ template<class DataTypes>
void CylinderCollisionModel<DataTypes>::draw(const core::visual::VisualParams* vparams, Index i)
{
using namespace sofa::defaulttype;
Vec<4,float> colour(getColor4f());
sofa::helper::types::RGBAColor colour(getColor4f()[0], getColor4f()[1], getColor4f()[2], getColor4f()[3]);
SReal h2 = height(i)/2.0;

Vector3 p1(center(i));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,17 +143,13 @@ void OBBCollisionModel<DataTypes>::draw(const core::visual::VisualParams* vparam
std::vector<Coord> p;
vertices(index,p);

Vec4f col4f(getColor4f());
sofa::helper::types::RGBAColor col4f(getColor4f()[0], getColor4f()[1], getColor4f()[2], getColor4f()[3]);

std::vector<Vector3> n;
n.push_back(axis(index,1));
//n.push_back(n.back());
n.push_back(axis(index,0));
//n.push_back(n.back());
n.push_back(-n[0]);
// n.push_back(n.back());
n.push_back(-n[2]);
// n.push_back(n.back());
n.push_back(n.front());

std::vector<Vector3> points;
Expand All @@ -168,7 +164,7 @@ void OBBCollisionModel<DataTypes>::draw(const core::visual::VisualParams* vparam
points.push_back(p[3]);
points.push_back(p[0]);

vparams->drawTool()->drawTriangleStrip(points,n,col4f);
vparams->drawTool()->drawTriangleStrip(points,n, col4f);

n.clear();
points.clear();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ void CapsuleCollisionModel<sofa::defaulttype::StdRigidTypes<3,MyReal> >::compute
template<class MyReal>
void CapsuleCollisionModel<sofa::defaulttype::StdRigidTypes<3,MyReal> >::draw(const core::visual::VisualParams* vparams, Index index)
{
sofa::defaulttype::Vec<4,float> col4f(getColor4f());
sofa::helper::types::RGBAColor col4f(getColor4f()[0], getColor4f()[1], getColor4f()[2], getColor4f()[3]);
vparams->drawTool()->drawCapsule(point1(index),point2(index),(float)radius(index),col4f);
}

Expand All @@ -164,7 +164,7 @@ void CapsuleCollisionModel<sofa::defaulttype::StdRigidTypes<3,MyReal> >::draw(co
{
if (vparams->displayFlags().getShowCollisionModels())
{
sofa::defaulttype::Vec<4,float> col4f(getColor4f());
sofa::helper::types::RGBAColor col4f(getColor4f()[0], getColor4f()[1], getColor4f()[2], getColor4f()[3]);
vparams->drawTool()->setPolygonMode(0,vparams->displayFlags().getShowWireFrame());//maybe ??
vparams->drawTool()->setLightingEnabled(true); //Enable lightning

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,9 @@ void SphereCollisionModel<DataTypes>::draw(const core::visual::VisualParams* vpa

vparams->drawTool()->setLightingEnabled(true); //Enable lightning
if(d_showImpostors.getValue())
vparams->drawTool()->drawFakeSpheres(points, radius, Vec<4,float>(getColor4f()));
vparams->drawTool()->drawFakeSpheres(points, radius, sofa::helper::types::RGBAColor(getColor4f()[0], getColor4f()[1], getColor4f()[2], getColor4f()[3]));
else
vparams->drawTool()->drawSpheres(points, radius, Vec<4, float>(getColor4f()));
vparams->drawTool()->drawSpheres(points, radius, sofa::helper::types::RGBAColor(getColor4f()[0], getColor4f()[1], getColor4f()[2], getColor4f()[3]));
vparams->drawTool()->setLightingEnabled(false); //Disable lightning

}
Expand Down