Skip to content

Commit 09a5d75

Browse files
committed
Refactor, improve logging and error handling
1 parent 516284e commit 09a5d75

File tree

20 files changed

+159
-311
lines changed

20 files changed

+159
-311
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: CMake Build
22

33
on:
44
push:
5-
branches: [ main, Navpower ]
5+
branches: [ main ]
66
release:
77
types: [ created ]
88
pull_request:

CMakePresets.json

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,16 @@
22
"version": 2,
33
"configurePresets": [
44
{
5-
"name": "x64-debug",
6-
"displayName": "Windows x64 Debug",
7-
"description": "Sets Ninja generator, compilers, x64 architecture, build and install directory, debug build type",
5+
"name": "base",
6+
"displayName": "Basic config",
7+
"description": "Basic config using Ninja generator",
88
"generator": "Ninja",
99
"binaryDir": "${sourceDir}/build/${presetName}",
1010
"architecture": {
1111
"value": "x64",
1212
"strategy": "external"
1313
},
1414
"cacheVariables": {
15-
"CMAKE_BUILD_TYPE": "Debug",
1615
"CMAKE_INSTALL_PREFIX": "${sourceDir}/build/install/${presetName}",
1716
"CMAKE_TOOLCHAIN_FILE": "${sourceDir}/extern/vcpkg/scripts/buildsystems/vcpkg.cmake"
1817
},
@@ -21,6 +20,20 @@
2120
"hostOS": [ "Windows" ]
2221
}
2322
}
23+
},
24+
{
25+
"name": "x64-debug",
26+
"cacheVariables": {
27+
"CMAKE_BUILD_TYPE": "Debug"
28+
},
29+
"inherits": [ "base" ]
30+
},
31+
{
32+
"name": "x64-release",
33+
"cacheVariables": {
34+
"CMAKE_BUILD_TYPE": "Release"
35+
},
36+
"inherits": [ "base" ]
2437
}
2538
]
2639
}

LICENSE.md

Lines changed: 0 additions & 201 deletions
This file was deleted.

bin/alocgen.dll

-46.5 KB
Binary file not shown.

extern/vcpkg

Submodule vcpkg updated 5424 files

include/NavKit/FileUtil.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include <filesystem>
55

66
namespace FileUtil {
7-
char* openNfdLoadDialog(nfdu8filteritem_t* filters, nfdfiltersize_t filterCount, char* defaultPath = NULL);
8-
char* openNfdSaveDialog(nfdu8filteritem_t* filters, nfdfiltersize_t filterCount, const nfdu8char_t* defaultName, char* defaultPath = NULL);
9-
char* openNfdFolderDialog(char* defaultPath = NULL);
7+
char* openNfdLoadDialog(nfdu8filteritem_t* filters, nfdfiltersize_t filterCount, char* defaultPath = nullptr);
8+
char* openNfdSaveDialog(nfdu8filteritem_t* filters, nfdfiltersize_t filterCount, const nfdu8char_t* defaultName, char* defaultPath = nullptr);
9+
char* openNfdFolderDialog(char* defaultPath = nullptr);
1010
}

include/NavKit/Renderer.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ class Renderer {
2525
void initFrameBuffer(int width, int height);
2626
void drawText(std::string text, Vec3 pos, Vec3 color = { 0.0, 0.0, 0.0 }, double size = 32.0);
2727
bool initWindowAndRenderer();
28-
void closeWindow();
28+
void closeWindow() const;
2929
void initFrameRate(float frameRateValue);
3030
void updateFrameRate();
3131
void handleResize();
3232
void renderFrame();
33-
void finalizeFrame();
34-
void drawBounds();
33+
void finalizeFrame() const;
34+
void drawBounds() const;
3535
void drawAxes();
36-
HitTestResult hitTestRender(int mx, int my);
36+
HitTestResult hitTestRender(int mx, int my) const;
3737

3838
GLuint framebuffer;
3939
GLuint color_rb;

include/NavKit/SceneExtract.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22

33
#include "NavKit.h"
44
#include "PfBoxes.h"
5+
#include <Windows.h>
56

67
class NavKit;
78

89
class SceneExtract {
910
public:
10-
SceneExtract(NavKit* navKit);
11+
SceneExtract(NavKit* navKit, const std::string &pythonScript);
1112
~SceneExtract();
1213

1314
void drawMenu();
@@ -30,6 +31,7 @@ class SceneExtract {
3031
std::string hitmanFolderName;
3132
bool hitmanSet;
3233
std::string outputFolderName;
34+
std::string pythonScript;
3335
bool outputSet;
3436
bool errorExtracting;
3537
std::vector<HANDLE> handles;

include/RecastDemo/SampleInterfaces.h

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@
1919
#ifndef SAMPLEINTERFACES_H
2020
#define SAMPLEINTERFACES_H
2121

22+
#include <deque>
23+
#include <mutex>
24+
2225
#include "DebugDraw.h"
2326
#include "Recast.h"
2427
#include "RecastDump.h"
2528
#include "PerfTimer.h"
26-
#include <vector>
2729
#include <string>
2830

2931
// These are example implementations of various interfaces used in Recast and Detour.
@@ -34,25 +36,26 @@ class BuildContext : public rcContext
3436
TimeVal m_startTime[RC_MAX_TIMERS];
3537
TimeVal m_accTime[RC_MAX_TIMERS];
3638

37-
static const int MAX_MESSAGES = 250;
38-
const char* m_messages[MAX_MESSAGES];
3939
int m_messageCount;
40-
static const int TEXT_POOL_SIZE = 8000;
40+
static const int TEXT_POOL_SIZE = 4000;
4141
char m_textPool[TEXT_POOL_SIZE];
4242
int m_textPoolSize;
43-
std::vector<std::string> m_logBuffer;
4443

4544
public:
4645
BuildContext();
4746

47+
static const int MAX_MESSAGES = 250;
48+
const char* m_messages[MAX_MESSAGES];
49+
std::mutex m_log_mutex;
50+
std::deque<std::string> m_logBuffer;
4851
/// Dumps the log to stdout.
4952
void dumpLog(const char* format, ...);
5053
/// Returns number of log messages.
5154
int getLogCount() const;
5255
/// Returns log message text.
5356
const char* getLogText(const int i) const;
5457

55-
protected:
58+
protected:
5659
/// Virtual functions for custom implementations.
5760
///@{
5861
virtual void doResetLog();

0 commit comments

Comments
 (0)