| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
#ifndef SAMPLEINTERFACES_H |
| 20 |
#define SAMPLEINTERFACES_H |
| 21 |
|
| 22 |
#include "DebugDraw.h" |
| 23 |
#include "Recast.h" |
| 24 |
#include "RecastDump.h" |
| 25 |
#include "PerfTimer.h" |
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
class BuildContext : public rcContext |
| 31 |
{ |
| 32 |
TimeVal m_startTime[RC_MAX_TIMERS]; |
| 33 |
TimeVal m_accTime[RC_MAX_TIMERS]; |
| 34 |
|
| 35 |
static const int MAX_MESSAGES = 1000; |
| 36 |
const char* m_messages[MAX_MESSAGES]; |
| 37 |
int m_messageCount; |
| 38 |
static const int TEXT_POOL_SIZE = 8000; |
| 39 |
char m_textPool[TEXT_POOL_SIZE]; |
| 40 |
int m_textPoolSize; |
| 41 |
|
| 42 |
public: |
| 43 |
BuildContext(); |
| 44 |
|
| 45 |
|
| 46 |
void dumpLog(const char* format, ...); |
| 47 |
|
| 48 |
int getLogCount() const; |
| 49 |
|
| 50 |
const char* getLogText(const int i) const; |
| 51 |
|
| 52 |
protected: |
| 53 |
|
| 54 |
|
| 55 |
virtual void doResetLog(); |
| 56 |
virtual void doLog(const rcLogCategory category, const char* msg, const int len); |
| 57 |
virtual void doResetTimers(); |
| 58 |
virtual void doStartTimer(const rcTimerLabel label); |
| 59 |
virtual void doStopTimer(const rcTimerLabel label); |
| 60 |
virtual int doGetAccumulatedTime(const rcTimerLabel label) const; |
| 61 |
|
| 62 |
}; |
| 63 |
|
| 64 |
|
| 65 |
class DebugDrawGL : public duDebugDraw |
| 66 |
{ |
| 67 |
public: |
| 68 |
virtual void depthMask(bool state); |
| 69 |
virtual void texture(bool state); |
| 70 |
virtual void begin(duDebugDrawPrimitives prim, float size = 1.0f); |
| 71 |
virtual void vertex(const float* pos, unsigned int color); |
| 72 |
virtual void vertex(const float x, const float y, const float z, unsigned int color); |
| 73 |
virtual void vertex(const float* pos, unsigned int color, const float* uv); |
| 74 |
virtual void vertex(const float x, const float y, const float z, unsigned int color, const float u, const float v); |
| 75 |
virtual void end(); |
| 76 |
}; |
| 77 |
|
| 78 |
|
| 79 |
class FileIO : public duFileIO |
| 80 |
{ |
| 81 |
FILE* m_fp; |
| 82 |
int m_mode; |
| 83 |
public: |
| 84 |
FileIO(); |
| 85 |
virtual ~FileIO(); |
| 86 |
bool openForWrite(const char* path); |
| 87 |
bool openForRead(const char* path); |
| 88 |
virtual bool isWriting() const; |
| 89 |
virtual bool isReading() const; |
| 90 |
virtual bool write(const void* ptr, const size_t size); |
| 91 |
virtual bool read(void* ptr, const size_t size); |
| 92 |
private: |
| 93 |
|
| 94 |
FileIO(const FileIO&); |
| 95 |
FileIO& operator=(const FileIO&); |
| 96 |
}; |
| 97 |
|
| 98 |
#endif |
| 99 |
|