torque Torque Game Engine Documentation
TGE Version 1.5.2

AbstractPolyList Class Reference

#include <abstractPolyList.h>

Inheritance diagram for AbstractPolyList:

Inheritance graph
[legend]

Detailed Description

A polygon filtering interface.

The various AbstractPolyList subclasses are used in Torque as an interface to handle spatial queries. SceneObject::buildPolyList() takes an implementor of AbstractPolyList (such as ConcretePolyList, ClippedPolyList, etc.) and a bounding volume. The function runs geometry data from all the objects in the bounding volume through the passed PolyList.

This interface only provides a method to get data INTO your implementation. Different subclasses provide different interfaces to get data back out, depending on their specific quirks.

The physics engine now uses convex hulls for collision detection.

See also:
Convex


Public Member Functions

 AbstractPolyList ()
virtual ~AbstractPolyList ()
Common Interface
void setBaseTransform (const MatrixF &mat)
void setTransform (const MatrixF *mat, const Point3F &scale)
 Sets the transform applying to the current stream of vertices.
void getTransform (MatrixF *mat, Point3F *scale)
 Gets the transform applying to the current stream of vertices.
void setObject (SceneObject *)
 This is called by the object which is currently feeding us vertices, to tell us who it is.
void addBox (const Box3F &box)
 Add a box via the query interface (below).
void doConstruct ()
Query Interface
It is through this interface that geometry data is fed to the PolyList.

The order of calls are:

  • begin()
  • One or more calls to vertex() and one call to plane(), in any order.
  • end()

   // Example code that adds data to a PolyList.
   // See AbstractPolyList::addBox() for the function this was taken from.

   // First, we add points... (note that we use base to track the start of adding.)
   U32 base = addPoint(pos);
   pos.y += dy; addPoint(pos);
   pos.x += dx; addPoint(pos);
   pos.y -= dy; addPoint(pos);
   pos.z += dz; addPoint(pos);
   pos.x -= dx; addPoint(pos);
   pos.y += dy; addPoint(pos);
   pos.x += dx; addPoint(pos);

   // Now we add our surfaces. (there are six, as we are adding a cube here)
   for (S32 i = 0; i < 6; i++) {
      // Begin a surface
      begin(0,i);

      // Calculate the vertex ids; we have a lookup table to tell us offset from base.
      // In your own code, you might use a different method.
      S32 v1 = base + PolyFace[i][0];
      S32 v2 = base + PolyFace[i][1];
      S32 v3 = base + PolyFace[i][2];
      S32 v4 = base + PolyFace[i][3];

      // Reference the four vertices that make up this surface.
      vertex(v1);
      vertex(v2);
      vertex(v3);
      vertex(v4);

      // Indicate the plane of this surface.
      plane(v1,v2,v3);

      // End the surface.
      end();
   }


virtual bool isEmpty () const=0
 Are we empty of data?
virtual U32 addPoint (const Point3F &p)=0
 Adds a point to the poly list, and returns an ID number for that point.
virtual U32 addPlane (const PlaneF &plane)=0
 Adds a plane to the poly list, and returns an ID number for that point.
virtual void begin (U32 material, U32 surfaceKey)=0
 Start a surface.
virtual void plane (U32 v1, U32 v2, U32 v3)=0
 Indicate the plane of the surface.
virtual void plane (const PlaneF &p)=0
 Indicate the plane of the surface.
virtual void plane (const U32 index)=0
 Indicate the plane of the surface.
virtual void vertex (U32 vi)=0
 Reference a vertex which is in this surface.
virtual void end ()=0
 Mark the end of a surface.
virtual bool getMapping (MatrixF *, Box3F *)
 Return list transform and bounds in list space.
Interest
This is a mechanism to let you specify interest in a specific normal.

If you set a normal you're interested in, then any planes facing "away" from that normal are culled from the results.

This is handy if you're using this to do a physics check, as you're not interested in polygons facing away from you (since you don't collide with the backsides/insides of things).

void setInterestNormal (const Point3F &normal)
void clearInterestNormal ()
virtual bool isInterestedInPlane (const PlaneF &plane)
virtual bool isInterestedInPlane (const U32 index)

Protected Member Functions

virtual const PlaneFgetIndexedPlane (const U32 index)=0
 A helper function to convert a plane index to a PlaneF structure.

Protected Attributes

SceneObjectmCurrObject
MatrixF mBaseMatrix
MatrixF mTransformMatrix
MatrixF mMatrix
Point3F mScale
PlaneTransformer mPlaneTransformer
bool mInterestNormalRegistered
Point3F mInterestNormal


Constructor & Destructor Documentation

AbstractPolyList::AbstractPolyList (  )  [inline]

virtual AbstractPolyList::~AbstractPolyList (  )  [virtual]


Member Function Documentation

void AbstractPolyList::setBaseTransform ( const MatrixF mat  )  [inline]

void AbstractPolyList::setTransform ( const MatrixF mat,
const Point3F scale 
) [inline]

Sets the transform applying to the current stream of vertices.

Parameters:
mat Transformation of the object. (in)
scale Scaling of the object. (in)

void AbstractPolyList::getTransform ( MatrixF mat,
Point3F scale 
) [inline]

Gets the transform applying to the current stream of vertices.

Parameters:
mat Transformation of the object. (out)
scale Scaling of the object. (out)

void AbstractPolyList::setObject ( SceneObject  )  [inline]

This is called by the object which is currently feeding us vertices, to tell us who it is.

void AbstractPolyList::addBox ( const Box3F box  ) 

Add a box via the query interface (below).

This wraps some calls to addPoint and addPlane.

void AbstractPolyList::doConstruct (  )  [inline]

virtual bool AbstractPolyList::isEmpty (  )  const [pure virtual]

virtual U32 AbstractPolyList::addPoint ( const Point3F p  )  [pure virtual]

Adds a point to the poly list, and returns an ID number for that point.

Implemented in ClippedPolyList, ConcretePolyList, EarlyOutPolyList, ExtrudedPolyList, OptimizedPolyList, and PlaneExtractorPolyList.

virtual U32 AbstractPolyList::addPlane ( const PlaneF plane  )  [pure virtual]

Adds a plane to the poly list, and returns an ID number for that point.

Implemented in ClippedPolyList, ConcretePolyList, EarlyOutPolyList, ExtrudedPolyList, OptimizedPolyList, and PlaneExtractorPolyList.

virtual void AbstractPolyList::begin ( U32  material,
U32  surfaceKey 
) [pure virtual]

Start a surface.

Parameters:
material A material ID for this surface.
surfaceKey A key value to associate with this surface.

Implemented in ClippedPolyList, ConcretePolyList, EarlyOutPolyList, ExtrudedPolyList, OptimizedPolyList, and PlaneExtractorPolyList.

virtual void AbstractPolyList::plane ( U32  v1,
U32  v2,
U32  v3 
) [pure virtual]

virtual void AbstractPolyList::plane ( const PlaneF p  )  [pure virtual]

virtual void AbstractPolyList::plane ( const U32  index  )  [pure virtual]

virtual void AbstractPolyList::vertex ( U32  vi  )  [pure virtual]

Reference a vertex which is in this surface.

Implemented in ClippedPolyList, ConcretePolyList, EarlyOutPolyList, ExtrudedPolyList, OptimizedPolyList, and PlaneExtractorPolyList.

virtual void AbstractPolyList::end (  )  [pure virtual]

virtual bool AbstractPolyList::getMapping ( MatrixF ,
Box3F  
) [virtual]

Return list transform and bounds in list space.

Returns:
False if no data is available.

Reimplemented in DepthSortList.

void AbstractPolyList::setInterestNormal ( const Point3F normal  ) 

void AbstractPolyList::clearInterestNormal (  )  [inline]

virtual bool AbstractPolyList::isInterestedInPlane ( const PlaneF plane  )  [virtual]

virtual bool AbstractPolyList::isInterestedInPlane ( const U32  index  )  [virtual]

virtual const PlaneF& AbstractPolyList::getIndexedPlane ( const U32  index  )  [protected, pure virtual]

A helper function to convert a plane index to a PlaneF structure.

Implemented in ClippedPolyList, ConcretePolyList, EarlyOutPolyList, ExtrudedPolyList, OptimizedPolyList, and PlaneExtractorPolyList.


Field Documentation




All Rights Reserved GarageGames.com, Inc. 1999-2005
Auto-magically Generated with Doxygen