btDebugDraw.h

Engine/source/T3D/physics/bullet/btDebugDraw.h

More...

Classes:

Detailed Description

 1
 2//-----------------------------------------------------------------------------
 3// Copyright (c) 2012 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 _T3D_PHYSICS_BTDEBUGDRAW_H_
25#define _T3D_PHYSICS_BTDEBUGDRAW_H_
26
27#ifndef _BULLET_H_
28#include "T3D/physics/bullet/bt.h"
29#endif
30
31class Frustum;
32
33
34class BtDebugDraw : public btIDebugDraw
35{
36protected:
37
38   /// The number of verts we've used in rendering.
39   U32 mVertexCount;
40
41   /// The frustum to use for culling or NULL.
42   const Frustum *mCuller;
43
44public:
45
46   BtDebugDraw()
47      :  mVertexCount( 0 ),
48         mCuller( NULL )
49   {
50   }
51
52   /// Sets the culler which we use to cull out primitives
53   /// that are completely offscreen.
54   void setCuller( const Frustum *culler ) { mCuller = culler; }
55
56   /// Call this after debug drawing to submit any
57   /// remaining primitives for rendering.
58   void flush();
59
60   // btIDebugDraw
61   virtual void drawLine( const btVector3 &from, const btVector3 &to, const btVector3 &color );
62   virtual void drawTriangle(const btVector3& v0,const btVector3& v1,const btVector3& v2,const btVector3& color, btScalar /*alpha*/);
63   virtual void drawContactPoint( const btVector3 &PointOnB, const btVector3 &normalOnB, btScalar distance, int lifeTime, const btVector3 &color );
64   virtual void reportErrorWarning( const char *warningString ) {}
65   virtual void draw3dText( const btVector3 &location, const char *textString ) {}
66   virtual void setDebugMode( int debugMode ) {}
67   virtual int getDebugMode() const { return DBG_DrawWireframe; }
68};
69
70
71#endif // _T3D_PHYSICS_BTDEBUGDRAW_H_
72