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 SofaBaseMechanics #1680

Merged
merged 12 commits into from
Dec 23, 2020
Merged
Prev Previous commit
Next Next commit
use rgbacolor
  • Loading branch information
fredroy committed Dec 23, 2020
commit 6ab54533efe2c97a34a59cc9962df063e39bfc2b
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ void BarycentricMapperMeshTopology<In,Out>::draw (const core::visual::VisualPar
}
}
}
vparams->drawTool()->drawLines ( points, 1, sofa::defaulttype::Vec<4,float> ( 0,1,0,1 ) );
vparams->drawTool()->drawLines ( points, 1, sofa::helper::types::RGBAColor::green());
}

template <class In, class Out>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ void BarycentricMapperRegularGridTopology<In,Out>::draw (const core::visual::Vi
}
}
}
vparams->drawTool()->drawLines ( points, 1, sofa::defaulttype::Vec<4,float> ( 0,0,1,1 ) );
vparams->drawTool()->drawLines ( points, 1, sofa::helper::types::RGBAColor::blue());
}

template <class In, class Out>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ void BarycentricMapperSparseGridTopology<In,Out>::draw (const VisualParams* vpa
}
}
}
vparams->drawTool()->drawLines ( points, 1, Vec<4,float> ( 0,0,1,1 ) );
vparams->drawTool()->drawLines ( points, 1, sofa::helper::types::RGBAColor::blue());
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ void BarycentricMapperTopologyContainer<In,Out,MappingDataType,Element>::draw (
}
}
}
vparams->drawTool()->drawLines ( points, 1, defaulttype::Vec<4,float> ( 0,1,0,1 ) );
vparams->drawTool()->drawLines ( points, 1, sofa::helper::types::RGBAColor::green());
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ void BarycentricMapping<TIn, TOut>::draw(const core::visual::VisualParams* vpara
{
points.push_back ( OutDataTypes::getCPos(out[i]) );
}
vparams->drawTool()->drawPoints ( points, 7, sofa::defaulttype::Vec<4,float> ( 1,1,0,1 ) );
vparams->drawTool()->drawPoints ( points, 7, sofa::helper::types::RGBAColor::yellow());

// Draw mapping line between models
const InVecCoord& in = this->fromModel->read(core::ConstVecCoordId::position())->getValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,8 @@ void DiagonalMass<RigidTypes, RigidMass>::drawRigid3dImpl(const VisualParams* vp
if(d_showCenterOfGravity.getValue())
{
gravityCenter /= totalMass;
const sofa::defaulttype::Vec4f color(1.0,1.0,0.0,1.0);

vparams->drawTool()->drawCross(gravityCenter, d_showAxisSize.getValue(), color);
vparams->drawTool()->drawCross(gravityCenter, d_showAxisSize.getValue(), sofa::helper::types::RGBAColor::yellow());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1498,7 +1498,6 @@ void DiagonalMass<DataTypes, MassType>::draw(const core::visual::VisualParams* v
if ( d_showCenterOfGravity.getValue() )
{
gravityCenter /= totalMass;
const sofa::defaulttype::Vec4f color(1.0,1.0,0.0,1.0);

Real axisSize = d_showAxisSize.getValue();
sofa::defaulttype::Vector3 temp;
Expand All @@ -1507,7 +1506,7 @@ void DiagonalMass<DataTypes, MassType>::draw(const core::visual::VisualParams* v
if(i < Coord::spatial_dimensions )
temp[i] = gravityCenter[i];

vparams->drawTool()->drawCross(temp, axisSize, color);
vparams->drawTool()->drawCross(temp, axisSize, sofa::helper::types::RGBAColor::yellow());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,27 +215,27 @@ void MechanicalObject<defaulttype::Rigid3Types>::draw(const core::visual::Visual

if (getContext()->isSleeping())
{
vparams->drawTool()->drawFrame ( Vector3(), Quat(), Vector3 ( 1,1,1 ), Vec4f(0.5,0.5,0.5,1) );
vparams->drawTool()->drawFrame ( Vector3(), Quat(), Vector3 ( 1,1,1 ), sofa::helper::types::RGBAColor::gray());
}
else switch( drawMode.getValue() )
{
case 1:
vparams->drawTool()->drawFrame ( Vector3(), Quat(), Vector3 ( 1,1,1 ), Vec4f(0,1,0,1) );
vparams->drawTool()->drawFrame ( Vector3(), Quat(), Vector3 ( 1,1,1 ), sofa::helper::types::RGBAColor::green());
break;
case 2:
vparams->drawTool()->drawFrame ( Vector3(), Quat(), Vector3 ( 1,1,1 ), Vec4f(1,0,0,1) );
vparams->drawTool()->drawFrame ( Vector3(), Quat(), Vector3 ( 1,1,1 ), sofa::helper::types::RGBAColor::red());
break;
case 3:
vparams->drawTool()->drawFrame ( Vector3(), Quat(), Vector3 ( 1,1,1 ), Vec4f(0,0,1,1) );
vparams->drawTool()->drawFrame ( Vector3(), Quat(), Vector3 ( 1,1,1 ), sofa::helper::types::RGBAColor::blue());
break;
case 4:
vparams->drawTool()->drawFrame ( Vector3(), Quat(), Vector3 ( 1,1,1 ), Vec4f(1,1,0,1) );
vparams->drawTool()->drawFrame ( Vector3(), Quat(), Vector3 ( 1,1,1 ), sofa::helper::types::RGBAColor::yellow());
break;
case 5:
vparams->drawTool()->drawFrame ( Vector3(), Quat(), Vector3 ( 1,1,1 ), Vec4f(1,0,1,1) );
vparams->drawTool()->drawFrame ( Vector3(), Quat(), Vector3 ( 1,1,1 ), sofa::helper::types::RGBAColor::magenta());
break;
case 6:
vparams->drawTool()->drawFrame ( Vector3(), Quat(), Vector3 ( 1,1,1 ), Vec4f(0,1,1,1) );
vparams->drawTool()->drawFrame ( Vector3(), Quat(), Vector3 ( 1,1,1 ), sofa::helper::types::RGBAColor::cyan());
break;
default:
vparams->drawTool()->drawFrame ( Vector3(), Quat(), Vector3 ( 1,1,1 ) );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2753,13 +2753,13 @@ inline void MechanicalObject<DataTypes>::drawVectors(const core::visual::VisualP
case 0:
points[0] = p1;
points[1] = p2;
vparams->drawTool()->drawLines(points, 1, defaulttype::Vec<4,float>(1.0,1.0,1.0,1.0));
vparams->drawTool()->drawLines(points, 1, sofa::helper::types::RGBAColor::white());
break;
case 1:
vparams->drawTool()->drawCylinder(p1, p2, rad, defaulttype::Vec<4,float>(1.0,1.0,1.0,1.0));
vparams->drawTool()->drawCylinder(p1, p2, rad, sofa::helper::types::RGBAColor::white());
break;
case 2:
vparams->drawTool()->drawArrow(p1, p2, rad, defaulttype::Vec<4,float>(1.0,1.0,1.0,1.0));
vparams->drawTool()->drawArrow(p1, p2, rad, sofa::helper::types::RGBAColor::white());
break;
default:
msg_error() << "No proper drawing mode found!";
Expand Down Expand Up @@ -2794,23 +2794,23 @@ inline void MechanicalObject<DataTypes>::draw(const core::visual::VisualParams*
switch (drawMode.getValue())
{
case 0:
vparams->drawTool()->drawPoints(positions,scale,defaulttype::Vec<4,float>(d_color.getValue()));
vparams->drawTool()->drawPoints(positions,scale, d_color.getValue());
break;
case 1:
vparams->drawTool()->setLightingEnabled(true);
vparams->drawTool()->drawSpheres(positions,scale,defaulttype::Vec<4,float>(d_color.getValue()));
vparams->drawTool()->drawSpheres(positions,scale, d_color.getValue());
break;
case 2:
vparams->drawTool()->setLightingEnabled(true);
vparams->drawTool()->drawSpheres(positions,scale,defaulttype::Vec<4,float>(1.0,0.0,0.0,1.0));
vparams->drawTool()->drawSpheres(positions,scale, sofa::helper::types::RGBAColor::red());
break;
case 3:
vparams->drawTool()->setLightingEnabled(true);
vparams->drawTool()->drawSpheres(positions,scale,defaulttype::Vec<4,float>(0.0,1.0,0.0,1.0));
vparams->drawTool()->drawSpheres(positions,scale, sofa::helper::types::RGBAColor::green());
break;
case 4:
vparams->drawTool()->setLightingEnabled(true);
vparams->drawTool()->drawSpheres(positions,scale,defaulttype::Vec<4,float>(0.0,0.0,1.0,1.0));
vparams->drawTool()->drawSpheres(positions,scale, sofa::helper::types::RGBAColor::blue());
break;
default:
msg_error() << "No proper drawing mode found!";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ void UniformMass<RigidTypes, MassType>::drawRigid3DImpl(const VisualParams* vpar
for (unsigned int i=0; i<indices.size(); i++)
{
if (getContext()->isSleeping())
vparams->drawTool()->drawFrame(x[indices[i]].getCenter(), x[indices[i]].getOrientation(), len*d_showAxisSize.getValue(), Vec4f(0.5,0.5,0.5,1) );
vparams->drawTool()->drawFrame(x[indices[i]].getCenter(), x[indices[i]].getOrientation(), len*d_showAxisSize.getValue(), sofa::helper::types::RGBAColor::gray());
else
vparams->drawTool()->drawFrame(x[indices[i]].getCenter(), x[indices[i]].getOrientation(), len*d_showAxisSize.getValue() );
gravityCenter += (x[indices[i]].getCenter());
Expand All @@ -269,9 +269,8 @@ void UniformMass<RigidTypes, MassType>::drawRigid3DImpl(const VisualParams* vpar
if(d_showCenterOfGravity.getValue())
{
gravityCenter /= x.size();
const sofa::defaulttype::Vec4f color(1.0,1.0,0.0,1.0);

vparams->drawTool()->drawCross(gravityCenter, d_showAxisSize.getValue(), color);
vparams->drawTool()->drawCross(gravityCenter, d_showAxisSize.getValue(), sofa::helper::types::RGBAColor::yellow());
}
}

Expand Down