コード例 #1
0
    GLSphere(MT_Scalar radius) 
#if defined(USE_MARGIN)
      :	Shape(DT_NewPoint(MT_Vector3(0.0f, 0.0f, 0.0f))), 
#else
      :	Shape(DT_NewSphere(1.0f)), 
#endif
		m_radius(radius) 
	{}
コード例 #2
0
ファイル: Shape.cpp プロジェクト: Serge45/rl
			DT_ShapeHandle
			Shape::create(SoVRMLShape* shape)
			{
				SoVRMLGeometry* geometry = static_cast< SoVRMLGeometry* >(shape->geometry.getValue());
				
				if (geometry->isOfType(SoVRMLBox::getClassTypeId()))
				{
					SoVRMLBox* box = static_cast< SoVRMLBox* >(geometry);
					return DT_NewBox(box->size.getValue()[0], box->size.getValue()[1], box->size.getValue()[2]);
				}
				else if (geometry->isOfType(SoVRMLCone::getClassTypeId()))
				{
					SoVRMLCone* cone = static_cast< SoVRMLCone* >(geometry);
					return DT_NewCone(cone->bottomRadius.getValue(), cone->height.getValue());
				}
				else if (geometry->isOfType(SoVRMLCylinder::getClassTypeId()))
				{
					SoVRMLCylinder* cylinder = static_cast< SoVRMLCylinder* >(geometry);
					return DT_NewCylinder(cylinder->radius.getValue(), cylinder->height.getValue());
				}
				else if (geometry->isOfType(SoVRMLIndexedFaceSet::getClassTypeId()))
				{
					SoVRMLIndexedFaceSet* indexedFaceSet = static_cast< SoVRMLIndexedFaceSet* >(geometry);
					
					if (indexedFaceSet->convex.getValue())
					{
						return Shape::create(static_cast< SoVRMLCoordinate* >(indexedFaceSet->coord.getValue())->point);
					}
					else
					{
						this->complex = true;
						
						return Shape::create(static_cast< SoVRMLCoordinate* >(indexedFaceSet->coord.getValue())->point, indexedFaceSet->coordIndex);
					}
				}
				else if (geometry->isOfType(SoVRMLSphere::getClassTypeId()))
				{
					SoVRMLSphere* sphere = static_cast< SoVRMLSphere* >(geometry);
					return DT_NewSphere(sphere->radius.getValue());
				}
				
				return NULL;
			}