Пример #1
0
void OpenGLRenderInterface::compileList(dynamics::BodyNode* _node) {
    if(_node == 0)
        return;

    for (size_t i = 0; i < _node->getNumVisualizationShapes(); i++)
        compileList(_node->getVisualizationShape(i));
    for (size_t i = 0; i < _node->getNumCollisionShapes(); i++)
        compileList(_node->getCollisionShape(i));
}
Пример #2
0
//FIXME: Use polymorphism instead of switch statements
void OpenGLRenderInterface::compileList(dynamics::Shape* _shape) {
    if(_shape == 0)
        return;

    switch(_shape->getShapeType()) {
        case dynamics::Shape::BOX:
            break;
        case dynamics::Shape::CYLINDER:
            break;
        case dynamics::Shape::ELLIPSOID:
            break;
        case dynamics::Shape::PLANE:
            dterr << "PLANE is not supported yet." << std::endl;
            break;
        case dynamics::Shape::SOFT_MESH:
            // Do nothing
            break;
        case dynamics::Shape::MESH:
        {
            //FIXME: Separate these calls once BodyNode is refactored to contain
            // both a col Shape and vis Shape.
            dynamics::MeshShape* shapeMesh = dynamic_cast<dynamics::MeshShape*>(_shape);

            if(shapeMesh == 0)
                return;

            shapeMesh->setDisplayList(compileList(shapeMesh->getScale(), shapeMesh->getMesh()));

            break;
        }
        case dynamics::Shape::LINE_SEGMENT:
            // Do nothing
            break;
    }
}
Пример #3
0
void OpenGLRenderInterface::compileList(dynamics::Skeleton* _skel) {
    if(_skel == 0)
        return;

    for (size_t i = 0; i < _skel->getNumBodyNodes(); i++) {
        compileList(_skel->getBodyNode(i));
    }
}
Пример #4
0
//==============================================================================
void OpenGLRenderInterface::compileList(dynamics::BodyNode* node)
{
  if(node == 0)
    return;

  for (auto childFrame : node->getChildFrames())
  {
    auto shapeFrame = dynamic_cast<dynamics::ShapeFrame*>(childFrame);
    if (shapeFrame)
      compileList(shapeFrame->getShape().get());
  }

  for (auto i = 0u; i < node->getNumNodes<dynamics::ShapeNode>(); ++i)
  {
    auto shapeNode = node->getNode<dynamics::ShapeNode>(i);
    compileList(shapeNode->getShape().get());
  }
}
void PEquilateralTriangle::draw()
{
	if (display_list==0) compileList();
	glPushMatrix();
	glTranslatef(centerx, centery, 0);
	glRotatef(theta*180/PI,0,0,1);
	glCallList(display_list);
	glPopMatrix();
}
Пример #6
0
//==============================================================================
void OpenGLRenderInterface::compileList(dynamics::Shape* shape)
{
  if (!shape)
    return;

  if (shape->getType() == dynamics::MeshShape::getStaticType())
  {
    assert(dynamic_cast<dynamics::MeshShape*>(shape));

    auto* mesh = static_cast<dynamics::MeshShape*>(shape);
    mesh->setDisplayList(compileList(mesh->getScale(), mesh->getMesh()));
  }
  else
  {
    dtwarn << "[OpenGLRenderInterface::compileList] Attempting to compile "
           << "OpenGL list for an unsupported shape type ["
           << shape->getType() << "].\n";
  }
}