mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Improve Recast & Detour and NavMesh generation
* Add missing dtQueryFilter field (some flag used in the engine but not sure yet what it does). * Set tile->polysEnd and tile->offMeshConsEnd to end of polys and offMeshCons array pointer (if ever needed). * Set camera perspective to 75 (previous 50). * Improve theme. * Lowered the climb height for all hulls (this improves NavMesh generation around low obstacles, previously it would create a poly connecting the ground on the side with the surface of the object around where it connects with the ground, causing AI to take this route instead and kind of 'glitch' onto the surface).
This commit is contained in:
parent
58e0d96e22
commit
112a530d5a
@ -178,16 +178,16 @@ void Sample::resetCommonSettings()
|
||||
m_partitionType = SAMPLE_PARTITION_WATERSHED;
|
||||
m_reachabilityTableCount = 4;
|
||||
}
|
||||
hulldef hulls[5] = {
|
||||
{"small",8,72*0.5,70,512.0f},
|
||||
{"med_short",20,72*0.5,75,512.0f},
|
||||
{"medium",48,150*0.5,77,512.0f},
|
||||
{"large",60,235*0.5,80,960.0f},
|
||||
{"extra_large",88,235*0.5,80,960.0f},
|
||||
const hulldef hulls[5] = {
|
||||
{ "small", 8, 72 * 0.5, 45, 512.0f },
|
||||
{ "med_short", 20, 72 * 0.5, 50, 512.0f },
|
||||
{ "medium", 48, 150 * 0.5, 55, 512.0f },
|
||||
{ "large", 60, 235 * 0.5, 60, 960.0f },
|
||||
{ "extra_large", 88, 235 * 0.5, 65, 960.0f },
|
||||
};
|
||||
void Sample::handleCommonSettings()
|
||||
{
|
||||
for (auto& h : hulls)
|
||||
for (const hulldef& h : hulls)
|
||||
{
|
||||
if (imguiButton(h.name))
|
||||
{
|
||||
@ -246,7 +246,7 @@ void Sample::handleCommonSettings()
|
||||
imguiLabel("Polygonization");
|
||||
imguiSlider("Max Edge Length", &m_edgeMaxLen, 0.0f, 50.0f, 1.0f);
|
||||
imguiSlider("Max Edge Error", &m_edgeMaxError, 0.1f, 3.0f, 0.1f);
|
||||
imguiSlider("Verts Per Poly", &m_vertsPerPoly, 3.0f, 12.0f, 1.0f,false);
|
||||
imguiSlider("Verts Per Poly", &m_vertsPerPoly, 3.0f, 12.0f, 1.0f);
|
||||
|
||||
imguiSeparator();
|
||||
imguiLabel("Detail Mesh");
|
||||
|
@ -32,7 +32,7 @@ struct hulldef
|
||||
float tile_size;
|
||||
//TODO: voxel size, tile size
|
||||
};
|
||||
extern hulldef hulls[5];
|
||||
extern const hulldef hulls[5];
|
||||
|
||||
/// Tool types.
|
||||
enum SampleToolType
|
||||
|
@ -443,7 +443,7 @@ int not_main(int argc, char** argv)
|
||||
}
|
||||
}
|
||||
// Fog.
|
||||
float fogColor[4] = { 0.32f, 0.31f, 0.30f, 1.0f };
|
||||
float fogColor[4] = { 0.30f, 0.31f, 0.32f, 1.0f };
|
||||
glEnable(GL_FOG);
|
||||
glFogi(GL_FOG_MODE, GL_LINEAR);
|
||||
glFogf(GL_FOG_START, camr * 0.1f);
|
||||
@ -708,7 +708,7 @@ int not_main(int argc, char** argv)
|
||||
glGetIntegerv(GL_VIEWPORT, viewport);
|
||||
|
||||
// Clear the screen
|
||||
glClearColor(0.3f, 0.3f, 0.32f, 1.0f);
|
||||
glClearColor(0.20f, 0.21f, 0.22f, 1.0f);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
@ -718,7 +718,7 @@ int not_main(int argc, char** argv)
|
||||
// Compute the projection matrix.
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
gluPerspective(50.0f, (float)width/(float)height, 1.0f, camr);
|
||||
gluPerspective(75.0f, (float)width/(float)height, 1.0f, camr);
|
||||
GLdouble projectionMatrix[16];
|
||||
glGetDoublev(GL_PROJECTION_MATRIX, projectionMatrix);
|
||||
|
||||
@ -727,7 +727,7 @@ int not_main(int argc, char** argv)
|
||||
glLoadIdentity();
|
||||
glRotatef(cameraEulers[0], 1, 0, 0);
|
||||
glRotatef(cameraEulers[1], 0, 1, 0);
|
||||
float mXZY_to_XYZ[16] =
|
||||
const float mXZY_to_XYZ[16] =
|
||||
{
|
||||
1,0,0,0,
|
||||
0,0,-1,0, //tbh not sure why this is needed, the tri flips again? something is very stupid...
|
||||
|
@ -37,6 +37,7 @@ class dtQueryFilter
|
||||
float m_areaCost[DT_MAX_AREAS]; ///< Cost per area type. (Used by default implementation.)
|
||||
unsigned short m_includeFlags; ///< Flags for polygons that can be visited. (Used by default implementation.)
|
||||
unsigned short m_excludeFlags; ///< Flags for polygons that should not be visted. (Used by default implementation.)
|
||||
unsigned short m_unknownFlags; ///< Unknown.
|
||||
|
||||
public:
|
||||
dtQueryFilter();
|
||||
|
@ -1017,6 +1017,8 @@ dtStatus dtNavMesh::addTile(unsigned char* data, int dataSize, int flags,
|
||||
|
||||
// Init tile.
|
||||
tile->header = header;
|
||||
tile->polysEnd = &tile->polys[polysSize];
|
||||
tile->offMeshConsEnd = &tile->offMeshCons[offMeshLinksSize];
|
||||
tile->data = data;
|
||||
tile->dataSize = dataSize;
|
||||
tile->flags = flags;
|
||||
|
Loading…
x
Reference in New Issue
Block a user