Fixes for many low-severity compiler warnings (#576)

* Fixes for many low-severity compiler warnings

Mostly a lot of pedantic things like end-of-file newlines and commas on the last enum value.  However some fixes like the weak v-tables warnings fixes might help with code gen.  It's unclear if the linker is able to elide multiple copies of the same type's v-table in different translation units, (sometimes it can) but these fixes ensure we don't have to rely on it.
This commit is contained in:
Graham Pentheny 2022-11-11 21:03:03 -05:00 committed by GitHub
parent ea7bfbee70
commit 5111139558
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 139 additions and 88 deletions

View File

@ -27,7 +27,7 @@ enum duDebugDrawPrimitives
DU_DRAW_POINTS, DU_DRAW_POINTS,
DU_DRAW_LINES, DU_DRAW_LINES,
DU_DRAW_TRIS, DU_DRAW_TRIS,
DU_DRAW_QUADS, DU_DRAW_QUADS
}; };
/// Abstract debug draw interface. /// Abstract debug draw interface.
@ -197,15 +197,15 @@ class duDisplayList : public duDebugDraw
int m_size; int m_size;
int m_cap; int m_cap;
bool m_depthMask;
duDebugDrawPrimitives m_prim; duDebugDrawPrimitives m_prim;
float m_primSize; float m_primSize;
bool m_depthMask;
void resize(int cap); void resize(int cap);
public: public:
duDisplayList(int cap = 512); duDisplayList(int cap = 512);
~duDisplayList(); virtual ~duDisplayList();
virtual void depthMask(bool state); virtual void depthMask(bool state);
virtual void begin(duDebugDrawPrimitives prim, float size = 1.0f); virtual void begin(duDebugDrawPrimitives prim, float size = 1.0f);
virtual void vertex(const float x, const float y, const float z, unsigned int color); virtual void vertex(const float x, const float y, const float z, unsigned int color);

View File

@ -27,7 +27,7 @@ enum DrawNavMeshFlags
{ {
DU_DRAWNAVMESH_OFFMESHCONS = 0x01, DU_DRAWNAVMESH_OFFMESHCONS = 0x01,
DU_DRAWNAVMESH_CLOSEDLIST = 0x02, DU_DRAWNAVMESH_CLOSEDLIST = 0x02,
DU_DRAWNAVMESH_COLOR_TILES = 0x04, DU_DRAWNAVMESH_COLOR_TILES = 0x04
}; };
void duDebugDrawNavMesh(struct duDebugDraw* dd, const dtNavMesh& mesh, unsigned char flags); void duDebugDrawNavMesh(struct duDebugDraw* dd, const dtNavMesh& mesh, unsigned char flags);

View File

@ -21,7 +21,7 @@
struct duFileIO struct duFileIO
{ {
virtual ~duFileIO() = 0; virtual ~duFileIO();
virtual bool isWriting() const = 0; virtual bool isWriting() const = 0;
virtual bool isReading() const = 0; virtual bool isReading() const = 0;
virtual bool write(const void* ptr, const size_t size) = 0; virtual bool write(const void* ptr, const size_t size) = 0;
@ -39,5 +39,4 @@ bool duReadCompactHeightfield(struct rcCompactHeightfield& chf, duFileIO* io);
void duLogBuildTimes(rcContext& ctx, const int totalTileUsec); void duLogBuildTimes(rcContext& ctx, const int totalTileUsec);
#endif // RECAST_DUMP_H #endif // RECAST_DUMP_H

View File

@ -530,9 +530,9 @@ duDisplayList::duDisplayList(int cap) :
m_color(0), m_color(0),
m_size(0), m_size(0),
m_cap(0), m_cap(0),
m_depthMask(true),
m_prim(DU_DRAW_LINES), m_prim(DU_DRAW_LINES),
m_primSize(1.0f) m_primSize(1.0f),
m_depthMask(true)
{ {
if (cap < 8) if (cap < 8)
cap = 8; cap = 8;

View File

@ -25,10 +25,9 @@
#include "RecastAlloc.h" #include "RecastAlloc.h"
#include "RecastDump.h" #include "RecastDump.h"
duFileIO::~duFileIO() duFileIO::~duFileIO()
{ {
// Empty // Defined out of line to fix the weak v-tables warning
} }
static void ioprintf(duFileIO* io, const char* format, ...) static void ioprintf(duFileIO* io, const char* format, ...)

View File

@ -99,7 +99,7 @@ static const int DT_MAX_AREAS = 64;
enum dtTileFlags enum dtTileFlags
{ {
/// The navigation mesh owns the tile memory and is responsible for freeing it. /// The navigation mesh owns the tile memory and is responsible for freeing it.
DT_TILE_FREE_DATA = 0x01, DT_TILE_FREE_DATA = 0x01
}; };
/// Vertex flags returned by dtNavMeshQuery::findStraightPath. /// Vertex flags returned by dtNavMeshQuery::findStraightPath.
@ -107,32 +107,32 @@ enum dtStraightPathFlags
{ {
DT_STRAIGHTPATH_START = 0x01, ///< The vertex is the start position in the path. DT_STRAIGHTPATH_START = 0x01, ///< The vertex is the start position in the path.
DT_STRAIGHTPATH_END = 0x02, ///< The vertex is the end position in the path. DT_STRAIGHTPATH_END = 0x02, ///< The vertex is the end position in the path.
DT_STRAIGHTPATH_OFFMESH_CONNECTION = 0x04, ///< The vertex is the start of an off-mesh connection. DT_STRAIGHTPATH_OFFMESH_CONNECTION = 0x04 ///< The vertex is the start of an off-mesh connection.
}; };
/// Options for dtNavMeshQuery::findStraightPath. /// Options for dtNavMeshQuery::findStraightPath.
enum dtStraightPathOptions enum dtStraightPathOptions
{ {
DT_STRAIGHTPATH_AREA_CROSSINGS = 0x01, ///< Add a vertex at every polygon edge crossing where area changes. DT_STRAIGHTPATH_AREA_CROSSINGS = 0x01, ///< Add a vertex at every polygon edge crossing where area changes.
DT_STRAIGHTPATH_ALL_CROSSINGS = 0x02, ///< Add a vertex at every polygon edge crossing. DT_STRAIGHTPATH_ALL_CROSSINGS = 0x02 ///< Add a vertex at every polygon edge crossing.
}; };
/// Options for dtNavMeshQuery::initSlicedFindPath and updateSlicedFindPath /// Options for dtNavMeshQuery::initSlicedFindPath and updateSlicedFindPath
enum dtFindPathOptions enum dtFindPathOptions
{ {
DT_FINDPATH_ANY_ANGLE = 0x02, ///< use raycasts during pathfind to "shortcut" (raycast still consider costs) DT_FINDPATH_ANY_ANGLE = 0x02 ///< use raycasts during pathfind to "shortcut" (raycast still consider costs)
}; };
/// Options for dtNavMeshQuery::raycast /// Options for dtNavMeshQuery::raycast
enum dtRaycastOptions enum dtRaycastOptions
{ {
DT_RAYCAST_USE_COSTS = 0x01, ///< Raycast should calculate movement cost along the ray and fill RaycastHit::cost DT_RAYCAST_USE_COSTS = 0x01 ///< Raycast should calculate movement cost along the ray and fill RaycastHit::cost
}; };
enum dtDetailTriEdgeFlags enum dtDetailTriEdgeFlags
{ {
DT_DETAIL_EDGE_BOUNDARY = 0x01, ///< Detail triangle edge is part of the poly boundary DT_DETAIL_EDGE_BOUNDARY = 0x01 ///< Detail triangle edge is part of the poly boundary
}; };
@ -146,7 +146,7 @@ enum dtPolyTypes
/// The polygon is a standard convex polygon that is part of the surface of the mesh. /// The polygon is a standard convex polygon that is part of the surface of the mesh.
DT_POLYTYPE_GROUND = 0, DT_POLYTYPE_GROUND = 0,
/// The polygon is an off-mesh connection consisting of two vertices. /// The polygon is an off-mesh connection consisting of two vertices.
DT_POLYTYPE_OFFMESH_CONNECTION = 1, DT_POLYTYPE_OFFMESH_CONNECTION = 1
}; };

View File

@ -152,7 +152,7 @@ struct dtRaycastHit
class dtPolyQuery class dtPolyQuery
{ {
public: public:
virtual ~dtPolyQuery() { } virtual ~dtPolyQuery();
/// Called for each batch of unique polygons touched by the search area in dtNavMeshQuery::queryPolygons. /// Called for each batch of unique polygons touched by the search area in dtNavMeshQuery::queryPolygons.
/// This can be called multiple times for a single query. /// This can be called multiple times for a single query.

View File

@ -25,7 +25,7 @@ enum dtNodeFlags
{ {
DT_NODE_OPEN = 0x01, DT_NODE_OPEN = 0x01,
DT_NODE_CLOSED = 0x02, DT_NODE_CLOSED = 0x02,
DT_NODE_PARENT_DETACHED = 0x04, // parent of the node is not adjacent. Found using raycast. DT_NODE_PARENT_DETACHED = 0x04 // parent of the node is not adjacent. Found using raycast.
}; };
typedef unsigned short dtNodeIndex; typedef unsigned short dtNodeIndex;

View File

@ -117,6 +117,11 @@ void dtFreeNavMeshQuery(dtNavMeshQuery* navmesh)
dtFree(navmesh); dtFree(navmesh);
} }
dtPolyQuery::~dtPolyQuery()
{
// Defined out of line to fix the weak v-tables warning
}
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
/// @class dtNavMeshQuery /// @class dtNavMeshQuery
@ -630,6 +635,8 @@ public:
{ {
} }
virtual ~dtFindNearestPolyQuery();
dtPolyRef nearestRef() const { return m_nearestRef; } dtPolyRef nearestRef() const { return m_nearestRef; }
const float* nearestPoint() const { return m_nearestPoint; } const float* nearestPoint() const { return m_nearestPoint; }
bool isOverPoly() const { return m_overPoly; } bool isOverPoly() const { return m_overPoly; }
@ -672,6 +679,11 @@ public:
} }
}; };
dtFindNearestPolyQuery::~dtFindNearestPolyQuery()
{
// Defined out of line to fix the weak v-tables warning
}
/// @par /// @par
/// ///
/// @note If the search box does not intersect any polygons the search will /// @note If the search box does not intersect any polygons the search will
@ -847,6 +859,8 @@ public:
{ {
} }
virtual ~dtCollectPolysQuery();
int numCollected() const { return m_numCollected; } int numCollected() const { return m_numCollected; }
bool overflowed() const { return m_overflow; } bool overflowed() const { return m_overflow; }
@ -868,6 +882,11 @@ public:
} }
}; };
dtCollectPolysQuery::~dtCollectPolysQuery()
{
// Defined out of line to fix the weak v-tables warning
}
/// @par /// @par
/// ///
/// If no polygons are found, the function will return #DT_SUCCESS with a /// If no polygons are found, the function will return #DT_SUCCESS with a

View File

@ -66,7 +66,7 @@ enum CrowdAgentState
{ {
DT_CROWDAGENT_STATE_INVALID, ///< The agent is not in a valid state. DT_CROWDAGENT_STATE_INVALID, ///< The agent is not in a valid state.
DT_CROWDAGENT_STATE_WALKING, ///< The agent is traversing a normal navigation mesh polygon. DT_CROWDAGENT_STATE_WALKING, ///< The agent is traversing a normal navigation mesh polygon.
DT_CROWDAGENT_STATE_OFFMESH, ///< The agent is traversing an off-mesh connection. DT_CROWDAGENT_STATE_OFFMESH ///< The agent is traversing an off-mesh connection.
}; };
/// Configuration parameters for a crowd agent. /// Configuration parameters for a crowd agent.
@ -108,7 +108,7 @@ enum MoveRequestState
DT_CROWDAGENT_TARGET_REQUESTING, DT_CROWDAGENT_TARGET_REQUESTING,
DT_CROWDAGENT_TARGET_WAITING_FOR_QUEUE, DT_CROWDAGENT_TARGET_WAITING_FOR_QUEUE,
DT_CROWDAGENT_TARGET_WAITING_FOR_PATH, DT_CROWDAGENT_TARGET_WAITING_FOR_PATH,
DT_CROWDAGENT_TARGET_VELOCITY, DT_CROWDAGENT_TARGET_VELOCITY
}; };
/// Represents an agent managed by a #dtCrowd object. /// Represents an agent managed by a #dtCrowd object.
@ -188,7 +188,7 @@ enum UpdateFlags
DT_CROWD_OBSTACLE_AVOIDANCE = 2, DT_CROWD_OBSTACLE_AVOIDANCE = 2,
DT_CROWD_SEPARATION = 4, DT_CROWD_SEPARATION = 4,
DT_CROWD_OPTIMIZE_VIS = 8, ///< Use #dtPathCorridor::optimizePathVisibility() to optimize the agent path. DT_CROWD_OPTIMIZE_VIS = 8, ///< Use #dtPathCorridor::optimizePathVisibility() to optimize the agent path.
DT_CROWD_OPTIMIZE_TOPO = 16, ///< Use dtPathCorridor::optimizePathTopology() to optimize the agent path. DT_CROWD_OPTIMIZE_TOPO = 16 ///< Use dtPathCorridor::optimizePathTopology() to optimize the agent path.
}; };
struct dtCrowdAgentDebugInfo struct dtCrowdAgentDebugInfo

View File

@ -3,16 +3,13 @@
#include "DetourStatus.h" #include "DetourStatus.h"
typedef unsigned int dtObstacleRef; typedef unsigned int dtObstacleRef;
typedef unsigned int dtCompressedTileRef; typedef unsigned int dtCompressedTileRef;
/// Flags for addTile /// Flags for addTile
enum dtCompressedTileFlags enum dtCompressedTileFlags
{ {
DT_COMPRESSEDTILE_FREE_DATA = 0x01, ///< Navmesh owns the tile memory and should free it. DT_COMPRESSEDTILE_FREE_DATA = 0x01 ///< Navmesh owns the tile memory and should free it.
}; };
struct dtCompressedTile struct dtCompressedTile
@ -32,14 +29,14 @@ enum ObstacleState
DT_OBSTACLE_EMPTY, DT_OBSTACLE_EMPTY,
DT_OBSTACLE_PROCESSING, DT_OBSTACLE_PROCESSING,
DT_OBSTACLE_PROCESSED, DT_OBSTACLE_PROCESSED,
DT_OBSTACLE_REMOVING, DT_OBSTACLE_REMOVING
}; };
enum ObstacleType enum ObstacleType
{ {
DT_OBSTACLE_CYLINDER, DT_OBSTACLE_CYLINDER,
DT_OBSTACLE_BOX, // AABB DT_OBSTACLE_BOX, // AABB
DT_OBSTACLE_ORIENTED_BOX, // OBB DT_OBSTACLE_ORIENTED_BOX // OBB
}; };
struct dtObstacleCylinder struct dtObstacleCylinder
@ -97,13 +94,10 @@ struct dtTileCacheParams
struct dtTileCacheMeshProcess struct dtTileCacheMeshProcess
{ {
virtual ~dtTileCacheMeshProcess() { } virtual ~dtTileCacheMeshProcess();
virtual void process(struct dtNavMeshCreateParams* params, unsigned char* polyAreas, unsigned short* polyFlags) = 0;
virtual void process(struct dtNavMeshCreateParams* params,
unsigned char* polyAreas, unsigned short* polyFlags) = 0;
}; };
class dtTileCache class dtTileCache
{ {
public: public:
@ -219,7 +213,7 @@ private:
enum ObstacleRequestAction enum ObstacleRequestAction
{ {
REQUEST_ADD, REQUEST_ADD,
REQUEST_REMOVE, REQUEST_REMOVE
}; };
struct ObstacleRequest struct ObstacleRequest

View File

@ -78,7 +78,7 @@ struct dtTileCachePolyMesh
struct dtTileCacheAlloc struct dtTileCacheAlloc
{ {
virtual ~dtTileCacheAlloc() {} virtual ~dtTileCacheAlloc();
virtual void reset() {} virtual void reset() {}
@ -95,7 +95,7 @@ struct dtTileCacheAlloc
struct dtTileCacheCompressor struct dtTileCacheCompressor
{ {
virtual ~dtTileCacheCompressor() { } virtual ~dtTileCacheCompressor();
virtual int maxCompressedSize(const int bufferSize) = 0; virtual int maxCompressedSize(const int bufferSize) = 0;
virtual dtStatus compress(const unsigned char* buffer, const int bufferSize, virtual dtStatus compress(const unsigned char* buffer, const int bufferSize,

View File

@ -239,6 +239,11 @@ const dtTileCacheObstacle* dtTileCache::getObstacleByRef(dtObstacleRef ref)
return ob; return ob;
} }
dtTileCacheMeshProcess::~dtTileCacheMeshProcess()
{
// Defined out of line to fix the weak v-tables warning
}
dtStatus dtTileCache::addTile(unsigned char* data, const int dataSize, unsigned char flags, dtCompressedTileRef* result) dtStatus dtTileCache::addTile(unsigned char* data, const int dataSize, unsigned char flags, dtCompressedTileRef* result)
{ {
// Make sure the data is in right format. // Make sure the data is in right format.

View File

@ -23,6 +23,15 @@
#include "DetourTileCacheBuilder.h" #include "DetourTileCacheBuilder.h"
#include <string.h> #include <string.h>
dtTileCacheAlloc::~dtTileCacheAlloc()
{
// Defined out of line to fix the weak v-tables warning
}
dtTileCacheCompressor::~dtTileCacheCompressor()
{
// Defined out of line to fix the weak v-tables warning
}
template<class T> class dtFixedArray template<class T> class dtFixedArray
{ {

View File

@ -28,7 +28,7 @@ enum rcLogCategory
{ {
RC_LOG_PROGRESS = 1, ///< A progress log entry. RC_LOG_PROGRESS = 1, ///< A progress log entry.
RC_LOG_WARNING, ///< A warning log entry. RC_LOG_WARNING, ///< A warning log entry.
RC_LOG_ERROR, ///< An error log entry. RC_LOG_ERROR ///< An error log entry.
}; };
/// Recast performance timer categories. /// Recast performance timer categories.
@ -101,7 +101,6 @@ enum rcTimerLabel
class rcContext class rcContext
{ {
public: public:
/// Contructor. /// Contructor.
/// @param[in] state TRUE if the logging and performance timers should be enabled. [Default: true] /// @param[in] state TRUE if the logging and performance timers should be enabled. [Default: true]
inline rcContext(bool state = true) : m_logEnabled(state), m_timerEnabled(state) {} inline rcContext(bool state = true) : m_logEnabled(state), m_timerEnabled(state) {}
@ -140,9 +139,8 @@ public:
inline int getAccumulatedTime(const rcTimerLabel label) const { return m_timerEnabled ? doGetAccumulatedTime(label) : -1; } inline int getAccumulatedTime(const rcTimerLabel label) const { return m_timerEnabled ? doGetAccumulatedTime(label) : -1; }
protected: protected:
/// Clears all log entries. /// Clears all log entries.
virtual void doResetLog() {} virtual void doResetLog();
/// Logs a message. /// Logs a message.
/// @param[in] category The category of the message. /// @param[in] category The category of the message.
@ -564,7 +562,7 @@ static const int RC_AREA_BORDER = 0x20000;
enum rcBuildContoursFlags enum rcBuildContoursFlags
{ {
RC_CONTOUR_TESS_WALL_EDGES = 0x01, ///< Tessellate solid (impassable) edges during contour simplification. RC_CONTOUR_TESS_WALL_EDGES = 0x01, ///< Tessellate solid (impassable) edges during contour simplification.
RC_CONTOUR_TESS_AREA_EDGES = 0x02, ///< Tessellate edges between areas during contour simplification. RC_CONTOUR_TESS_AREA_EDGES = 0x02 ///< Tessellate edges between areas during contour simplification.
}; };
/// Applied to the region id field of contour vertices in order to extract the region id. /// Applied to the region id field of contour vertices in order to extract the region id.

View File

@ -94,6 +94,11 @@ void rcContext::log(const rcLogCategory category, const char* format, ...)
doLog(category, msg, len); doLog(category, msg, len);
} }
void rcContext::doResetLog()
{
// Defined out of line to fix the weak v-tables warning
}
rcHeightfield* rcAllocHeightfield() rcHeightfield* rcAllocHeightfield()
{ {
return rcNew<rcHeightfield>(RC_ALLOC_PERM); return rcNew<rcHeightfield>(RC_ALLOC_PERM);

View File

@ -284,7 +284,7 @@ static unsigned short getHeight(const float fx, const float fy, const float fz,
enum EdgeValues enum EdgeValues
{ {
EV_UNDEF = -1, EV_UNDEF = -1,
EV_HULL = -2, EV_HULL = -2
}; };
static int findEdge(const int* edges, int nedges, int s, int t) static int findEdge(const int* edges, int nedges, int s, int t)

View File

@ -29,7 +29,7 @@ struct rcChunkyTriMeshNode
struct rcChunkyTriMesh struct rcChunkyTriMesh
{ {
inline rcChunkyTriMesh() : nodes(0), nnodes(0), tris(0), ntris(0), maxTrisPerChunk(0) {}; inline rcChunkyTriMesh() : nodes(0), nnodes(0), tris(0), ntris(0), maxTrisPerChunk(0) {}
inline ~rcChunkyTriMesh() { delete [] nodes; delete [] tris; } inline ~rcChunkyTriMesh() { delete [] nodes; delete [] tris; }
rcChunkyTriMeshNode* nodes; rcChunkyTriMeshNode* nodes;

View File

@ -122,7 +122,7 @@ class CrowdTool : public SampleTool
TOOLMODE_CREATE, TOOLMODE_CREATE,
TOOLMODE_MOVE_TARGET, TOOLMODE_MOVE_TARGET,
TOOLMODE_SELECT, TOOLMODE_SELECT,
TOOLMODE_TOGGLE_POLYS, TOOLMODE_TOGGLE_POLYS
}; };
ToolMode m_mode; ToolMode m_mode;

View File

@ -43,7 +43,7 @@ class NavMeshTesterTool : public SampleTool
TOOLMODE_DISTANCE_TO_WALL, TOOLMODE_DISTANCE_TO_WALL,
TOOLMODE_FIND_POLYS_IN_CIRCLE, TOOLMODE_FIND_POLYS_IN_CIRCLE,
TOOLMODE_FIND_POLYS_IN_SHAPE, TOOLMODE_FIND_POLYS_IN_SHAPE,
TOOLMODE_FIND_LOCAL_NEIGHBOURHOOD, TOOLMODE_FIND_LOCAL_NEIGHBOURHOOD
}; };
ToolMode m_toolMode; ToolMode m_toolMode;
@ -110,4 +110,5 @@ public:
void drawAgent(const float* pos, float r, float h, float c, const unsigned int col); void drawAgent(const float* pos, float r, float h, float c, const unsigned int col);
}; };
#endif // NAVMESHTESTERTOOL_H #endif // NAVMESHTESTERTOOL_H

View File

@ -29,4 +29,5 @@ typedef __int64 TimeVal;
TimeVal getPerfTime(); TimeVal getPerfTime();
int getPerfTimeUsec(const TimeVal duration); int getPerfTimeUsec(const TimeVal duration);
#endif // PERFTIMER_H #endif // PERFTIMER_H

View File

@ -47,7 +47,7 @@ enum SamplePolyAreas
SAMPLE_POLYAREA_ROAD, SAMPLE_POLYAREA_ROAD,
SAMPLE_POLYAREA_DOOR, SAMPLE_POLYAREA_DOOR,
SAMPLE_POLYAREA_GRASS, SAMPLE_POLYAREA_GRASS,
SAMPLE_POLYAREA_JUMP, SAMPLE_POLYAREA_JUMP
}; };
enum SamplePolyFlags enum SamplePolyFlags
{ {
@ -69,12 +69,12 @@ enum SamplePartitionType
{ {
SAMPLE_PARTITION_WATERSHED, SAMPLE_PARTITION_WATERSHED,
SAMPLE_PARTITION_MONOTONE, SAMPLE_PARTITION_MONOTONE,
SAMPLE_PARTITION_LAYERS, SAMPLE_PARTITION_LAYERS
}; };
struct SampleTool struct SampleTool
{ {
virtual ~SampleTool() {} virtual ~SampleTool();
virtual int type() = 0; virtual int type() = 0;
virtual void init(class Sample* sample) = 0; virtual void init(class Sample* sample) = 0;
virtual void reset() = 0; virtual void reset() = 0;
@ -88,7 +88,7 @@ struct SampleTool
}; };
struct SampleToolState { struct SampleToolState {
virtual ~SampleToolState() {} virtual ~SampleToolState();
virtual void init(class Sample* sample) = 0; virtual void init(class Sample* sample) = 0;
virtual void reset() = 0; virtual void reset() = 0;
virtual void handleRender() = 0; virtual void handleRender() = 0;

View File

@ -27,7 +27,7 @@ class TestCase
enum TestType enum TestType
{ {
TEST_PATHFIND, TEST_PATHFIND,
TEST_RAYCAST, TEST_RAYCAST
}; };
struct Test struct Test
@ -111,4 +111,4 @@ private:
TestCase& operator=(const TestCase&); TestCase& operator=(const TestCase&);
}; };
#endif // TESTCASE_H #endif // TESTCASE_H

View File

@ -47,4 +47,5 @@ void drawGraph(const GraphParams* p, const ValueHistory* graph,
int idx, const char* label, const unsigned int col); int idx, const char* label, const unsigned int col);
#endif // VALUEHISTORY_H #endif // VALUEHISTORY_H

View File

@ -22,14 +22,14 @@
enum imguiMouseButton enum imguiMouseButton
{ {
IMGUI_MBUT_LEFT = 0x01, IMGUI_MBUT_LEFT = 0x01,
IMGUI_MBUT_RIGHT = 0x02, IMGUI_MBUT_RIGHT = 0x02
}; };
enum imguiTextAlign enum imguiTextAlign
{ {
IMGUI_ALIGN_LEFT, IMGUI_ALIGN_LEFT,
IMGUI_ALIGN_CENTER, IMGUI_ALIGN_CENTER,
IMGUI_ALIGN_RIGHT, IMGUI_ALIGN_RIGHT
}; };
inline unsigned int imguiRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255) inline unsigned int imguiRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255)
@ -68,7 +68,7 @@ enum imguiGfxCmdType
IMGUI_GFXCMD_TRIANGLE, IMGUI_GFXCMD_TRIANGLE,
IMGUI_GFXCMD_LINE, IMGUI_GFXCMD_LINE,
IMGUI_GFXCMD_TEXT, IMGUI_GFXCMD_TEXT,
IMGUI_GFXCMD_SCISSOR, IMGUI_GFXCMD_SCISSOR
}; };
struct imguiGfxRect struct imguiGfxRect

View File

@ -23,4 +23,5 @@ bool imguiRenderGLInit(const char* fontpath);
void imguiRenderGLDestroy(); void imguiRenderGLDestroy();
void imguiRenderGLDraw(); void imguiRenderGLDraw();
#endif // IMGUI_RENDER_GL_H #endif // IMGUI_RENDER_GL_H

View File

@ -55,10 +55,10 @@ void scanDirectoryAppend(const string& path, const string& ext, vector<string>&
return; return;
} }
int extLen = strlen(ext.c_str()); size_t extLen = strlen(ext.c_str());
while ((current = readdir(dp)) != 0) while ((current = readdir(dp)) != 0)
{ {
int len = strlen(current->d_name); size_t len = strlen(current->d_name);
if (len > extLen && strncmp(current->d_name + len - extLen, ext.c_str(), extLen) == 0) if (len > extLen && strncmp(current->d_name + len - extLen, ext.c_str(), extLen) == 0)
{ {
filelist.push_back(current->d_name); filelist.push_back(current->d_name);

View File

@ -35,6 +35,16 @@
# define snprintf _snprintf # define snprintf _snprintf
#endif #endif
SampleTool::~SampleTool()
{
// Defined out of line to fix the weak v-tables warning
}
SampleToolState::~SampleToolState()
{
// Defined out of line to fix the weak v-tables warning
}
unsigned int SampleDebugDraw::areaToCol(unsigned int area) unsigned int SampleDebugDraw::areaToCol(unsigned int area)
{ {
switch(area) switch(area)

View File

@ -184,7 +184,7 @@ public:
} }
} }
}; };
GLCheckerTexture g_tex; static GLCheckerTexture g_tex;
void DebugDrawGL::depthMask(bool state) void DebugDrawGL::depthMask(bool state)

View File

@ -109,6 +109,8 @@ static int calcLayerBufferSize(const int gridWidth, const int gridHeight)
struct FastLZCompressor : public dtTileCacheCompressor struct FastLZCompressor : public dtTileCacheCompressor
{ {
virtual ~FastLZCompressor();
virtual int maxCompressedSize(const int bufferSize) virtual int maxCompressedSize(const int bufferSize)
{ {
return (int)(bufferSize* 1.05f); return (int)(bufferSize* 1.05f);
@ -129,6 +131,11 @@ struct FastLZCompressor : public dtTileCacheCompressor
} }
}; };
FastLZCompressor::~FastLZCompressor()
{
// Defined out of line to fix the weak v-tables warning
}
struct LinearAllocator : public dtTileCacheAlloc struct LinearAllocator : public dtTileCacheAlloc
{ {
unsigned char* buffer; unsigned char* buffer;
@ -141,10 +148,7 @@ struct LinearAllocator : public dtTileCacheAlloc
resize(cap); resize(cap);
} }
~LinearAllocator() virtual ~LinearAllocator();
{
dtFree(buffer);
}
void resize(const size_t cap) void resize(const size_t cap)
{ {
@ -176,6 +180,12 @@ struct LinearAllocator : public dtTileCacheAlloc
} }
}; };
LinearAllocator::~LinearAllocator()
{
// Defined out of line to fix the weak v-tables warning
dtFree(buffer);
}
struct MeshProcess : public dtTileCacheMeshProcess struct MeshProcess : public dtTileCacheMeshProcess
{ {
InputGeom* m_geom; InputGeom* m_geom;
@ -184,6 +194,8 @@ struct MeshProcess : public dtTileCacheMeshProcess
{ {
} }
virtual ~MeshProcess();
inline void init(InputGeom* geom) inline void init(InputGeom* geom)
{ {
m_geom = geom; m_geom = geom;
@ -228,8 +240,10 @@ struct MeshProcess : public dtTileCacheMeshProcess
} }
}; };
MeshProcess::~MeshProcess()
{
// Defined out of line to fix the weak v-tables warning
}
static const int MAX_LAYERS = 32; static const int MAX_LAYERS = 32;
@ -494,7 +508,7 @@ enum DrawDetailType
DRAWDETAIL_AREAS, DRAWDETAIL_AREAS,
DRAWDETAIL_REGIONS, DRAWDETAIL_REGIONS,
DRAWDETAIL_CONTOURS, DRAWDETAIL_CONTOURS,
DRAWDETAIL_MESH, DRAWDETAIL_MESH
}; };
void drawDetail(duDebugDraw* dd, dtTileCache* tc, const int tx, const int ty, int type) void drawDetail(duDebugDraw* dd, dtTileCache* tc, const int tx, const int ty, int type)
@ -667,9 +681,6 @@ void drawObstacles(duDebugDraw* dd, const dtTileCache* tc)
} }
} }
class TempObstacleHilightTool : public SampleTool class TempObstacleHilightTool : public SampleTool
{ {
Sample_TempObstacles* m_sample; Sample_TempObstacles* m_sample;
@ -687,9 +698,7 @@ public:
m_hitPos[0] = m_hitPos[1] = m_hitPos[2] = 0; m_hitPos[0] = m_hitPos[1] = m_hitPos[2] = 0;
} }
virtual ~TempObstacleHilightTool() virtual ~TempObstacleHilightTool();
{
}
virtual int type() { return TOOL_TILE_HIGHLIGHT; } virtual int type() { return TOOL_TILE_HIGHLIGHT; }
@ -764,6 +773,10 @@ public:
} }
}; };
TempObstacleHilightTool::~TempObstacleHilightTool()
{
// Defined out of line to fix the weak v-tables warning
}
class TempObstacleCreateTool : public SampleTool class TempObstacleCreateTool : public SampleTool
{ {
@ -775,9 +788,7 @@ public:
{ {
} }
virtual ~TempObstacleCreateTool() virtual ~TempObstacleCreateTool();
{
}
virtual int type() { return TOOL_TEMP_OBSTACLE; } virtual int type() { return TOOL_TEMP_OBSTACLE; }
@ -819,9 +830,10 @@ public:
virtual void handleRenderOverlay(double* /*proj*/, double* /*model*/, int* /*view*/) { } virtual void handleRenderOverlay(double* /*proj*/, double* /*model*/, int* /*view*/) { }
}; };
TempObstacleCreateTool::~TempObstacleCreateTool()
{
// Defined out of line to fix the weak v-tables warning
}
Sample_TempObstacles::Sample_TempObstacles() : Sample_TempObstacles::Sample_TempObstacles() :
m_keepInterResults(false), m_keepInterResults(false),

View File

@ -87,9 +87,7 @@ public:
m_hitPos[0] = m_hitPos[1] = m_hitPos[2] = 0; m_hitPos[0] = m_hitPos[1] = m_hitPos[2] = 0;
} }
virtual ~NavMeshTileTool() virtual ~NavMeshTileTool();
{
}
virtual int type() { return TOOL_TILE_EDIT; } virtual int type() { return TOOL_TILE_EDIT; }
@ -172,8 +170,10 @@ public:
} }
}; };
NavMeshTileTool::~NavMeshTileTool()
{
// Defined out of line to fix the weak v-tables warning
}
Sample_TileMesh::Sample_TileMesh() : Sample_TileMesh::Sample_TileMesh() :
m_keepInterResults(false), m_keepInterResults(false),

View File

@ -135,7 +135,6 @@ int main(int /*argc*/, char** /*argv*/)
return -1; return -1;
} }
float t = 0.0f;
float timeAcc = 0.0f; float timeAcc = 0.0f;
Uint32 prevFrameTime = SDL_GetTicks(); Uint32 prevFrameTime = SDL_GetTicks();
int mousePos[2] = {0, 0}; int mousePos[2] = {0, 0};
@ -354,8 +353,6 @@ int main(int /*argc*/, char** /*argv*/)
Uint32 time = SDL_GetTicks(); Uint32 time = SDL_GetTicks();
float dt = (time - prevFrameTime) / 1000.0f; float dt = (time - prevFrameTime) / 1000.0f;
prevFrameTime = time; prevFrameTime = time;
t += dt;
// Hit test mesh. // Hit test mesh.
if (processHitTest && geom && sample) if (processHitTest && geom && sample)