Support Forum       Library Source       SourceForge Page       G3D Web Page     
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Static Public Member Functions | List of all members
G3D::MeshShape Class Reference

Mesh shape is intended for debugging and for collision detection. More...

Inherits G3D::Shape.

Public Types

typedef shared_ptr< ShapeRef
 
enum  Type {
  NONE = 0,
  MESH = 1,
  BOX,
  CYLINDER,
  SPHERE,
  RAY,
  ARROW,
  CAPSULE,
  PLANE,
  AXES,
  POINT,
  TRIANGLE
}
 

Public Member Functions

 MeshShape (const Array< Vector3 > &vertex, const Array< int > &index)
 Copies the geometry from the arrays.
 
 MeshShape (const CPUVertexArray &vertexArray, const Array< Tri > &tri)
 Copies the triangle array.
 
virtual float area () const
 Slow the first time it is called because the BSP tree must be computed.
 
virtual CoordinateFrameaxes ()
 
virtual AABox boundingAABox () const
 Bounding axis aligned box of this object.
 
virtual Sphere boundingSphere () const
 Bounding sphere of this object.
 
virtual Boxbox ()
 
virtual const Boxbox () const
 
virtual const KDTree< Triangle > & bspTree () const
 Not computed until the first call to bspTree, area, or getRandomSurfacePoint.
 
virtual Capsulecapsule ()
 
virtual const Capsulecapsule () const
 
virtual Vector3 center () const
 Center of mass for this object.
 
virtual Cylindercylinder ()
 
virtual const Cylindercylinder () const
 
virtual void getRandomSurfacePoint (Vector3 &P, Vector3 &N=Vector3::ignore()) const
 A point selected uniformly at random with respect to the surface area of this object.
 
const Array< int > & indexArray () const
 Tri-list index array into vertexArray().
 
virtual Planeplane ()
 
virtual const Planeplane () const
 
virtual Vector3point ()
 
virtual const Vector3point () const
 
virtual Vector3 randomInteriorPoint () const
 Returns a point on the surface.
 
virtual Rayray ()
 
virtual const Rayray () const
 
virtual void render (RenderDevice *rd, const CoordinateFrame &cframe, Color4 solidColor=Color4(.5,.5, 0,.5), Color4 wireColor=Color3::black())
 
virtual Spheresphere ()
 
virtual const Spheresphere () const
 
virtual Triangletriangle ()
 
virtual const Triangletriangle () const
 
virtual Type type () const
 
const Array< Vector3 > & vertexArray () const
 
virtual float volume () const
 No volume; Mesh is treated as a 2D surface.
 

Static Public Member Functions

static std::string typeToString (Type t)
 

Detailed Description

Mesh shape is intended for debugging and for collision detection.

It is not a general purpose mesh.

See Also
G3D::Surface, G3D::ArticulatedModel, G3D::IFSModel, G3D::MD2Model, G3D::MeshAlg

Member Typedef Documentation

typedef shared_ptr<Shape> G3D::Shape::Ref
inherited

Member Enumeration Documentation

enum G3D::Shape::Type
inherited
Enumerator:
NONE 
MESH 
BOX 
CYLINDER 
SPHERE 
RAY 
ARROW 
CAPSULE 
PLANE 
AXES 
POINT 
TRIANGLE 

Constructor & Destructor Documentation

G3D::MeshShape::MeshShape ( const Array< Vector3 > &  vertex,
const Array< int > &  index 
)

Copies the geometry from the arrays.

The index array must describe a triangle list; you can convert other primitives using the MeshAlg methods.

G3D::MeshShape::MeshShape ( const CPUVertexArray vertexArray,
const Array< Tri > &  tri 
)

Copies the triangle array.

Member Function Documentation

virtual float G3D::MeshShape::area ( ) const
virtual

Slow the first time it is called because the BSP tree must be computed.

Implements G3D::Shape.

virtual CoordinateFrame& G3D::Shape::axes ( )
inlinevirtualinherited

Reimplemented in G3D::AxesShape.

virtual AABox G3D::MeshShape::boundingAABox ( ) const
virtual

Bounding axis aligned box of this object.

Implements G3D::Shape.

virtual Sphere G3D::MeshShape::boundingSphere ( ) const
virtual

Bounding sphere of this object.

Implements G3D::Shape.

virtual Box& G3D::Shape::box ( )
inlinevirtualinherited

Reimplemented in G3D::BoxShape.

virtual const Box& G3D::Shape::box ( ) const
inlinevirtualinherited

Reimplemented in G3D::BoxShape.

virtual const KDTree<Triangle>& G3D::MeshShape::bspTree ( ) const
inlinevirtual

Not computed until the first call to bspTree, area, or getRandomSurfacePoint.

virtual Capsule& G3D::Shape::capsule ( )
inlinevirtualinherited

Reimplemented in G3D::CapsuleShape.

virtual const Capsule& G3D::Shape::capsule ( ) const
inlinevirtualinherited

Reimplemented in G3D::CapsuleShape.

virtual Vector3 G3D::MeshShape::center ( ) const
virtual

Center of mass for this object.

Implements G3D::Shape.

virtual Cylinder& G3D::Shape::cylinder ( )
inlinevirtualinherited

Reimplemented in G3D::CylinderShape.

virtual const Cylinder& G3D::Shape::cylinder ( ) const
inlinevirtualinherited

Reimplemented in G3D::CylinderShape.

virtual void G3D::MeshShape::getRandomSurfacePoint ( Vector3 P,
Vector3 N = Vector3::ignore() 
) const
virtual

A point selected uniformly at random with respect to the surface area of this object.

Not available on the Plane or Ray, which have infinite extent. The normal has unit length and points out of the surface.

Implements G3D::Shape.

const Array<int>& G3D::MeshShape::indexArray ( ) const
inlinevirtual

Tri-list index array into vertexArray().

Reimplemented from G3D::Shape.

virtual Plane& G3D::Shape::plane ( )
inlinevirtualinherited

Reimplemented in G3D::PlaneShape.

virtual const Plane& G3D::Shape::plane ( ) const
inlinevirtualinherited

Reimplemented in G3D::PlaneShape.

virtual Vector3& G3D::Shape::point ( )
inlinevirtualinherited

Reimplemented in G3D::PointShape.

virtual const Vector3& G3D::Shape::point ( ) const
inlinevirtualinherited

Reimplemented in G3D::PointShape, and G3D::ArrowShape.

virtual Vector3 G3D::MeshShape::randomInteriorPoint ( ) const
virtual

Returns a point on the surface.

Implements G3D::Shape.

virtual Ray& G3D::Shape::ray ( )
inlinevirtualinherited

Reimplemented in G3D::RayShape.

virtual const Ray& G3D::Shape::ray ( ) const
inlinevirtualinherited

Reimplemented in G3D::RayShape.

virtual void G3D::MeshShape::render ( RenderDevice rd,
const CoordinateFrame cframe,
Color4  solidColor = Color4(.5,.5, 0,.5),
Color4  wireColor = Color3::black() 
)
virtual

Implements G3D::Shape.

virtual Sphere& G3D::Shape::sphere ( )
inlinevirtualinherited

Reimplemented in G3D::SphereShape.

virtual const Sphere& G3D::Shape::sphere ( ) const
inlinevirtualinherited

Reimplemented in G3D::SphereShape.

virtual Triangle& G3D::Shape::triangle ( )
inlinevirtualinherited

Reimplemented in G3D::TriangleShape.

virtual const Triangle& G3D::Shape::triangle ( ) const
inlinevirtualinherited

Reimplemented in G3D::TriangleShape.

virtual Type G3D::MeshShape::type ( ) const
inlinevirtual

Implements G3D::Shape.

static std::string G3D::Shape::typeToString ( Type  t)
staticinherited
const Array<Vector3>& G3D::MeshShape::vertexArray ( ) const
inlinevirtual

Reimplemented from G3D::Shape.

virtual float G3D::MeshShape::volume ( ) const
virtual

No volume; Mesh is treated as a 2D surface.

Implements G3D::Shape.


documentation generated on Sat Jan 12 2013 22:49:56 using doxygen 1.8.2