Mesh shape is intended for debugging and for collision detection.
More...
Inherits G3D::Shape.
|
| MeshShape (const Array< Vector3 > &vertex, const Array< int > &index) |
| Copies the geometry from the arrays. More...
|
|
| MeshShape (const String &filename, float scale=1.0f) |
|
| MeshShape (const CPUVertexArray &vertexArray, const Array< Tri > &tri) |
| Copies the triangle array. More...
|
|
| MeshShape (const class ParseOBJ &parseOBJ) |
|
virtual float | area () const |
| Slow the first time it is called because the BSP tree must be computed. More...
|
|
virtual CoordinateFrame & | axes () |
|
virtual AABox | boundingAABox () const |
| Bounding axis aligned box of this object. More...
|
|
virtual Sphere | boundingSphere () const |
| Bounding sphere of this object. More...
|
|
virtual Box & | box () |
|
virtual const Box & | box () const |
|
virtual const shared_ptr< TriTree > & | bspTree () const |
| Not computed until the first call to bspTree, area, or getRandomSurfacePoint. More...
|
|
virtual Capsule & | capsule () |
|
virtual const Capsule & | capsule () const |
|
virtual Vector3 | center () const |
| Center of mass for this object. More...
|
|
virtual Cylinder & | cylinder () |
|
virtual const Cylinder & | cylinder () const |
|
virtual void | getRandomSurfacePoint (Vector3 &P, Vector3 &N=Vector3::ignore, Random &rnd=Random::common()) const |
| A point selected uniformly at random with respect to the surface area of this object. More...
|
|
virtual void | getRandomSurfacePoint (Vector3 &P, Vector3 &N, int &triangleStartIndex, Vector3 &barycentricWeights, Random &rnd=Random::common()) const |
|
const Array< int > & | indexArray () const |
| Tri-list index array into vertexArray(). More...
|
|
virtual Plane & | plane () |
|
virtual const Plane & | plane () const |
|
virtual Vector3 & | point () |
|
virtual const Vector3 & | point () const |
|
virtual Vector3 | randomInteriorPoint (Random &rnd=Random::common()) const |
| Returns a point on the surface. More...
|
|
virtual Ray & | ray () |
|
virtual const Ray & | ray () const |
|
virtual void | render (RenderDevice *rd, const CoordinateFrame &cframe, Color4 solidColor=Color4(0.5f, 0.5f, 0, 0.5f), Color4 wireColor=Color3::black()) |
|
virtual Sphere & | sphere () |
|
virtual const Sphere & | sphere () const |
|
virtual Triangle & | triangle () |
|
virtual const Triangle & | triangle () const |
|
virtual Type | type () const |
|
const Array< Vector3 > & | vertexArray () const |
|
virtual float | volume () const |
| No volume; Mesh is treated as a 2D surface. More...
|
|
|
template<class T , class ... ArgTypes> |
static shared_ptr< T > | createShared (ArgTypes &&... args) |
| Like std::make_shared, but works for protected constructors. More...
|
|
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
◆ MeshShape() [1/4]
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.
◆ MeshShape() [2/4]
G3D::MeshShape::MeshShape |
( |
const String & |
filename, |
|
|
float |
scale = 1.0f |
|
) |
| |
|
explicit |
◆ MeshShape() [3/4]
Copies the triangle array.
◆ MeshShape() [4/4]
G3D::MeshShape::MeshShape |
( |
const class ParseOBJ & |
parseOBJ | ) |
|
|
explicit |
◆ area()
virtual float G3D::MeshShape::area |
( |
| ) |
const |
|
virtual |
Slow the first time it is called because the BSP tree must be computed.
Implements G3D::Shape.
◆ axes()
◆ boundingAABox()
virtual AABox G3D::MeshShape::boundingAABox |
( |
| ) |
const |
|
virtual |
Bounding axis aligned box of this object.
Implements G3D::Shape.
◆ boundingSphere()
virtual Sphere G3D::MeshShape::boundingSphere |
( |
| ) |
const |
|
virtual |
Bounding sphere of this object.
Implements G3D::Shape.
◆ box() [1/2]
virtual Box& G3D::Shape::box |
( |
| ) |
|
|
inlinevirtualinherited |
◆ box() [2/2]
virtual const Box& G3D::Shape::box |
( |
| ) |
const |
|
inlinevirtualinherited |
◆ bspTree()
virtual const shared_ptr<TriTree>& G3D::MeshShape::bspTree |
( |
| ) |
const |
|
inlinevirtual |
Not computed until the first call to bspTree, area, or getRandomSurfacePoint.
◆ capsule() [1/2]
virtual Capsule& G3D::Shape::capsule |
( |
| ) |
|
|
inlinevirtualinherited |
◆ capsule() [2/2]
virtual const Capsule& G3D::Shape::capsule |
( |
| ) |
const |
|
inlinevirtualinherited |
◆ center()
virtual Vector3 G3D::MeshShape::center |
( |
| ) |
const |
|
virtual |
Center of mass for this object.
Implements G3D::Shape.
◆ createShared()
template<class T , class ... ArgTypes>
static shared_ptr<T> G3D::ReferenceCountedObject::createShared |
( |
ArgTypes &&... |
args | ) |
|
|
inlinestaticprotectedinherited |
Like std::make_shared, but works for protected constructors.
Call as createShared<myclass>.
◆ cylinder() [1/2]
virtual Cylinder& G3D::Shape::cylinder |
( |
| ) |
|
|
inlinevirtualinherited |
◆ cylinder() [2/2]
virtual const Cylinder& G3D::Shape::cylinder |
( |
| ) |
const |
|
inlinevirtualinherited |
◆ getRandomSurfacePoint() [1/2]
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.
◆ getRandomSurfacePoint() [2/2]
- Parameters
-
triangleStartIndex | The first element of the index array describing this triangle. The next two indices are the others defining the returned triangle. |
◆ indexArray()
const Array<int>& G3D::MeshShape::indexArray |
( |
| ) |
const |
|
inlinevirtual |
◆ plane() [1/2]
virtual Plane& G3D::Shape::plane |
( |
| ) |
|
|
inlinevirtualinherited |
◆ plane() [2/2]
virtual const Plane& G3D::Shape::plane |
( |
| ) |
const |
|
inlinevirtualinherited |
◆ point() [1/2]
virtual Vector3& G3D::Shape::point |
( |
| ) |
|
|
inlinevirtualinherited |
◆ point() [2/2]
virtual const Vector3& G3D::Shape::point |
( |
| ) |
const |
|
inlinevirtualinherited |
◆ randomInteriorPoint()
Returns a point on the surface.
The process is done by random sampling and will only sample a set number of points. If none of the points sampled are found to be on the interior of the mesh than a nan value is returned. If this function consitently returns a nan value, it is probaly because the mesh shape is poorly constructed
Implements G3D::Shape.
◆ ray() [1/2]
virtual Ray& G3D::Shape::ray |
( |
| ) |
|
|
inlinevirtualinherited |
◆ ray() [2/2]
virtual const Ray& G3D::Shape::ray |
( |
| ) |
const |
|
inlinevirtualinherited |
◆ render()
◆ sphere() [1/2]
virtual Sphere& G3D::Shape::sphere |
( |
| ) |
|
|
inlinevirtualinherited |
◆ sphere() [2/2]
virtual const Sphere& G3D::Shape::sphere |
( |
| ) |
const |
|
inlinevirtualinherited |
◆ triangle() [1/2]
virtual Triangle& G3D::Shape::triangle |
( |
| ) |
|
|
inlinevirtualinherited |
◆ triangle() [2/2]
virtual const Triangle& G3D::Shape::triangle |
( |
| ) |
const |
|
inlinevirtualinherited |
◆ type()
virtual Type G3D::MeshShape::type |
( |
| ) |
const |
|
inlinevirtual |
◆ typeToString()
◆ vertexArray()
◆ volume()
virtual float G3D::MeshShape::volume |
( |
| ) |
const |
|
virtual |
No volume; Mesh is treated as a 2D surface.
Implements G3D::Shape.