コード例 #1
0
/*Set position of Sphere - radius */
void SphereShape::setPosition(osg::Vec3 position, float radius)
{

	_sphere->setRadius(radius);
	_sphere->setCenter(position);

	_radius = radius;
	_center = position;

	//for update purposes
	dirtyDisplayList();

}
コード例 #2
0
ファイル: BoxShapeNode.cpp プロジェクト: jpgr87/dart
//==============================================================================
void BoxShapeDrawable::refresh(bool firstTime)
{
  if(mBoxShape->getDataVariance() == dart::dynamics::Shape::STATIC)
    setDataVariance(osg::Object::STATIC);
  else
    setDataVariance(osg::Object::DYNAMIC);

  if(mBoxShape->checkDataVariance(dart::dynamics::Shape::DYNAMIC_PRIMITIVE)
     || firstTime)
  {
    const Eigen::Vector3d& d = mBoxShape->getSize();
    osg::ref_ptr<osg::Box> osg_shape = new osg::Box(osg::Vec3(0,0,0),
                                                    d[0], d[1], d[2]);
    setShape(osg_shape);
    dirtyDisplayList();
  }

  if(mBoxShape->checkDataVariance(dart::dynamics::Shape::DYNAMIC_COLOR)
     || firstTime)
  {
    setColor(eigToOsgVec4(mBoxShape->getRGBA()));
  }
}
コード例 #3
0
ファイル: CylinderShapeNode.cpp プロジェクト: jeffeb3/dart
//==============================================================================
void CylinderShapeDrawable::refresh(bool firstTime)
{
  if(mCylinderShape->getDataVariance() == dart::dynamics::Shape::STATIC)
    setDataVariance(osg::Object::STATIC);
  else
    setDataVariance(osg::Object::DYNAMIC);

  if(mCylinderShape->checkDataVariance(dart::dynamics::Shape::DYNAMIC_PRIMITIVE)
     || firstTime)
  {
    double R = mCylinderShape->getRadius();
    double h = mCylinderShape->getHeight();
    osg::ref_ptr<osg::Cylinder> osg_shape =
        new osg::Cylinder(osg::Vec3(0,0,0), R, h);
    setShape(osg_shape);
    dirtyDisplayList();
  }

  if(mCylinderShape->checkDataVariance(dart::dynamics::Shape::DYNAMIC_COLOR)
     || firstTime)
  {
    setColor(eigToOsgVec4(mCylinderShape->getRGBA()));
  }
}
コード例 #4
0
//==============================================================================
void EllipsoidShapeDrawable::refresh(bool firstTime)
{
  if(mEllipsoidShape->getDataVariance() == dart::dynamics::Shape::STATIC)
    setDataVariance(::osg::Object::STATIC);
  else
    setDataVariance(::osg::Object::DYNAMIC);

  if(mEllipsoidShape->checkDataVariance(dart::dynamics::Shape::DYNAMIC_PRIMITIVE)
     || firstTime)
  {
    ::osg::ref_ptr<::osg::Sphere> osg_shape = nullptr;
    osg_shape = new ::osg::Sphere(::osg::Vec3(0,0,0),
                          0.5*smallestComponent(mEllipsoidShape->getSize()));

    setShape(osg_shape);
    dirtyDisplayList();
  }

  if(mEllipsoidShape->checkDataVariance(dart::dynamics::Shape::DYNAMIC_COLOR)
     || firstTime)
  {
    setColor(eigToOsgVec4(mVisualAspect->getRGBA()));
  }
}