Torque3D Documentation / _generateds / recastPolyList.h

recastPolyList.h

Engine/source/navigation/recastPolyList.h

More...

Classes:

class

Represents polygons in the same manner as the .obj file format.

Detailed Description

  1
  2//-----------------------------------------------------------------------------
  3// Copyright (c) 2013 GarageGames, LLC
  4//
  5// Permission is hereby granted, free of charge, to any person obtaining a copy
  6// of this software and associated documentation files (the "Software"), to
  7// deal in the Software without restriction, including without limitation the
  8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  9// sell copies of the Software, and to permit persons to whom the Software is
 10// furnished to do so, subject to the following conditions:
 11//
 12// The above copyright notice and this permission notice shall be included in
 13// all copies or substantial portions of the Software.
 14//
 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 21// IN THE SOFTWARE.
 22//-----------------------------------------------------------------------------
 23
 24#ifndef _RECAST_POLYLIST_H_
 25#define _RECAST_POLYLIST_H_
 26
 27#include "collision/abstractPolyList.h"
 28#include "core/util/tVector.h"
 29
 30/// Represents polygons in the same manner as the .obj file format. Handy for
 31/// padding data to Recast, since it expects this data format. At the moment,
 32/// this class only accepts triangles.
 33/// @see AbstractPolyList
 34class RecastPolyList : public AbstractPolyList {
 35public:
 36   /// @name AbstractPolyList
 37   /// @{
 38
 39   bool isEmpty() const;
 40
 41   U32 addPoint(const Point3F &p);
 42   U32 addPlane(const PlaneF &plane);
 43
 44   void begin(BaseMatInstance *material, U32 surfaceKey);
 45
 46   void plane(U32 v1, U32 v2, U32 v3);
 47   void plane(const PlaneF& p);
 48   void plane(const U32 index);
 49
 50   void vertex(U32 vi);
 51
 52   void end();
 53
 54   /// @}
 55
 56   /// @name Data interface
 57   /// @{
 58   U32 getVertCount() const;
 59   const F32 *getVerts() const;
 60
 61   U32 getTriCount() const;
 62   const S32 *getTris() const;
 63
 64   void clear();
 65   /// @}
 66
 67   void renderWire() const;
 68
 69   /// Default constructor.
 70   RecastPolyList();
 71   /// Default destructor.
 72   ~RecastPolyList();
 73
 74protected:
 75   /// Number of vertices defined.
 76   U32 nverts;
 77   /// Array of vertex coordinates. Size nverts*3
 78   F32 *verts;
 79   /// Size of vertex array.
 80   U32 vertcap;
 81
 82   /// Number of triangles defined.
 83   U32 ntris;
 84   /// Array of triangle vertex indices. Size ntris*3
 85   S32 *tris;
 86   /// Size of triangle array.
 87   U32 tricap;
 88
 89   /// Index of vertex we're adding to the current triangle.
 90   U8 vidx;
 91
 92   /// Store a list of planes - not actually used.
 93   Vector<PlaneF> planes;
 94   /// Another inherited utility function.
 95   const PlaneF& getIndexedPlane(const U32 index) { return planes[index]; }
 96
 97private:
 98};
 99
100#endif
101