Added license info to some files.
Added mem info for last processed tile view. Fixed memleak in tiled navmesh demo.
This commit is contained in:
parent
aa7357d897
commit
2eab83c0e3
File diff suppressed because it is too large
Load Diff
@ -278,13 +278,13 @@
|
|||||||
<key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
|
<key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
|
||||||
<array>
|
<array>
|
||||||
<array>
|
<array>
|
||||||
<integer>33</integer>
|
<integer>30</integer>
|
||||||
<integer>1</integer>
|
<integer>1</integer>
|
||||||
<integer>0</integer>
|
<integer>0</integer>
|
||||||
</array>
|
</array>
|
||||||
</array>
|
</array>
|
||||||
<key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key>
|
<key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key>
|
||||||
<string>{{0, 22}, {282, 660}}</string>
|
<string>{{0, 73}, {282, 660}}</string>
|
||||||
</dict>
|
</dict>
|
||||||
<key>PBXTopSmartGroupGIDs</key>
|
<key>PBXTopSmartGroupGIDs</key>
|
||||||
<array/>
|
<array/>
|
||||||
@ -331,7 +331,7 @@
|
|||||||
<key>_historyCapacity</key>
|
<key>_historyCapacity</key>
|
||||||
<integer>0</integer>
|
<integer>0</integer>
|
||||||
<key>bookmark</key>
|
<key>bookmark</key>
|
||||||
<string>6B024BD01005DFAB00CF7107</string>
|
<string>6B024BF61006079300CF7107</string>
|
||||||
<key>history</key>
|
<key>history</key>
|
||||||
<array>
|
<array>
|
||||||
<string>6BB87E0B0F9DE8A300E33F12</string>
|
<string>6BB87E0B0F9DE8A300E33F12</string>
|
||||||
@ -363,27 +363,27 @@
|
|||||||
<string>6B2AEDA00FFBA507005BE9CC</string>
|
<string>6B2AEDA00FFBA507005BE9CC</string>
|
||||||
<string>6B092B4F0FFCA0A20088D3A5</string>
|
<string>6B092B4F0FFCA0A20088D3A5</string>
|
||||||
<string>6B092B500FFCA0A20088D3A5</string>
|
<string>6B092B500FFCA0A20088D3A5</string>
|
||||||
<string>6B092BAB0FFCEC1A0088D3A5</string>
|
|
||||||
<string>6B092BB50FFCEC1A0088D3A5</string>
|
<string>6B092BB50FFCEC1A0088D3A5</string>
|
||||||
<string>6B092BB70FFCEC1A0088D3A5</string>
|
<string>6B092BB70FFCEC1A0088D3A5</string>
|
||||||
<string>6B092C5F0FFCFF790088D3A5</string>
|
<string>6B092C5F0FFCFF790088D3A5</string>
|
||||||
<string>6B092CC10FFE40160088D3A5</string>
|
<string>6B092CC10FFE40160088D3A5</string>
|
||||||
<string>6B092CC30FFE40160088D3A5</string>
|
|
||||||
<string>6B02497E1003751300CF7107</string>
|
<string>6B02497E1003751300CF7107</string>
|
||||||
<string>6B0249821003751300CF7107</string>
|
<string>6B0249821003751300CF7107</string>
|
||||||
<string>6B02499F1003766D00CF7107</string>
|
<string>6B02499F1003766D00CF7107</string>
|
||||||
<string>6B0249BE1003793900CF7107</string>
|
<string>6B0249BE1003793900CF7107</string>
|
||||||
<string>6B024ACD1004AC8D00CF7107</string>
|
|
||||||
<string>6B024ACE1004AC8D00CF7107</string>
|
<string>6B024ACE1004AC8D00CF7107</string>
|
||||||
<string>6B024B391004CCCC00CF7107</string>
|
<string>6B024B391004CCCC00CF7107</string>
|
||||||
<string>6B024BA81005DC3A00CF7107</string>
|
<string>6B024BA81005DC3A00CF7107</string>
|
||||||
<string>6B024BB71005DF5700CF7107</string>
|
|
||||||
<string>6B024BB81005DF5700CF7107</string>
|
<string>6B024BB81005DF5700CF7107</string>
|
||||||
<string>6B024BB91005DF5700CF7107</string>
|
<string>6B024BB91005DF5700CF7107</string>
|
||||||
<string>6B024BC91005DFAB00CF7107</string>
|
|
||||||
<string>6B024BCA1005DFAB00CF7107</string>
|
<string>6B024BCA1005DFAB00CF7107</string>
|
||||||
<string>6B024BCB1005DFAB00CF7107</string>
|
<string>6B024BD31006059C00CF7107</string>
|
||||||
<string>6B024BCC1005DFAB00CF7107</string>
|
<string>6B024BD41006059C00CF7107</string>
|
||||||
|
<string>6B024BD51006059C00CF7107</string>
|
||||||
|
<string>6B024BD61006059C00CF7107</string>
|
||||||
|
<string>6B024BD71006059C00CF7107</string>
|
||||||
|
<string>6B024BEB1006064C00CF7107</string>
|
||||||
|
<string>6B024BF41006073700CF7107</string>
|
||||||
</array>
|
</array>
|
||||||
<key>prevStack</key>
|
<key>prevStack</key>
|
||||||
<array>
|
<array>
|
||||||
@ -516,6 +516,15 @@
|
|||||||
<string>6B024BCD1005DFAB00CF7107</string>
|
<string>6B024BCD1005DFAB00CF7107</string>
|
||||||
<string>6B024BCE1005DFAB00CF7107</string>
|
<string>6B024BCE1005DFAB00CF7107</string>
|
||||||
<string>6B024BCF1005DFAB00CF7107</string>
|
<string>6B024BCF1005DFAB00CF7107</string>
|
||||||
|
<string>6B024BDA1006059C00CF7107</string>
|
||||||
|
<string>6B024BDB1006059C00CF7107</string>
|
||||||
|
<string>6B024BDC1006059C00CF7107</string>
|
||||||
|
<string>6B024BDD1006059C00CF7107</string>
|
||||||
|
<string>6B024BDE1006059C00CF7107</string>
|
||||||
|
<string>6B024BDF1006059C00CF7107</string>
|
||||||
|
<string>6B024BE01006059C00CF7107</string>
|
||||||
|
<string>6B024BED1006064C00CF7107</string>
|
||||||
|
<string>6B024BEE1006064C00CF7107</string>
|
||||||
</array>
|
</array>
|
||||||
</dict>
|
</dict>
|
||||||
<key>SplitCount</key>
|
<key>SplitCount</key>
|
||||||
|
@ -1,3 +1,21 @@
|
|||||||
|
//
|
||||||
|
// Copyright (c) 2009 Mikko Mononen memon@inside.org
|
||||||
|
//
|
||||||
|
// This software is provided 'as-is', without any express or implied
|
||||||
|
// warranty. In no event will the authors be held liable for any damages
|
||||||
|
// arising from the use of this software.
|
||||||
|
// Permission is granted to anyone to use this software for any purpose,
|
||||||
|
// including commercial applications, and to alter it and redistribute it
|
||||||
|
// freely, subject to the following restrictions:
|
||||||
|
// 1. The origin of this software must not be misrepresented; you must not
|
||||||
|
// claim that you wrote the original software. If you use this software
|
||||||
|
// in a product, an acknowledgment in the product documentation would be
|
||||||
|
// appreciated but is not required.
|
||||||
|
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
// misrepresented as being the original software.
|
||||||
|
// 3. This notice may not be removed or altered from any source distribution.
|
||||||
|
//
|
||||||
|
|
||||||
#ifndef RECASTBUILDERTILEDMESH_H
|
#ifndef RECASTBUILDERTILEDMESH_H
|
||||||
#define RECASTBUILDERTILEDMESH_H
|
#define RECASTBUILDERTILEDMESH_H
|
||||||
|
|
||||||
@ -34,6 +52,7 @@ protected:
|
|||||||
float m_tileBmin[3];
|
float m_tileBmin[3];
|
||||||
float m_tileBmax[3];
|
float m_tileBmax[3];
|
||||||
float m_tileBuildTime;
|
float m_tileBuildTime;
|
||||||
|
float m_tileMemUsage;
|
||||||
int m_tileTriCount;
|
int m_tileTriCount;
|
||||||
|
|
||||||
enum ToolMode
|
enum ToolMode
|
||||||
|
@ -1,3 +1,21 @@
|
|||||||
|
//
|
||||||
|
// Copyright (c) 2009 Mikko Mononen memon@inside.org
|
||||||
|
//
|
||||||
|
// This software is provided 'as-is', without any express or implied
|
||||||
|
// warranty. In no event will the authors be held liable for any damages
|
||||||
|
// arising from the use of this software.
|
||||||
|
// Permission is granted to anyone to use this software for any purpose,
|
||||||
|
// including commercial applications, and to alter it and redistribute it
|
||||||
|
// freely, subject to the following restrictions:
|
||||||
|
// 1. The origin of this software must not be misrepresented; you must not
|
||||||
|
// claim that you wrote the original software. If you use this software
|
||||||
|
// in a product, an acknowledgment in the product documentation would be
|
||||||
|
// appreciated but is not required.
|
||||||
|
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
// misrepresented as being the original software.
|
||||||
|
// 3. This notice may not be removed or altered from any source distribution.
|
||||||
|
//
|
||||||
|
|
||||||
#define _USE_MATH_DEFINES
|
#define _USE_MATH_DEFINES
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -26,6 +44,7 @@ BuilderTiledMesh::BuilderTiledMesh() :
|
|||||||
m_chunkyMesh(0),
|
m_chunkyMesh(0),
|
||||||
m_keepInterResults(true),
|
m_keepInterResults(true),
|
||||||
m_tileBuildTime(0),
|
m_tileBuildTime(0),
|
||||||
|
m_tileMemUsage(0),
|
||||||
m_triflags(0),
|
m_triflags(0),
|
||||||
m_solid(0),
|
m_solid(0),
|
||||||
m_chf(0),
|
m_chf(0),
|
||||||
@ -470,7 +489,7 @@ void BuilderTiledMesh::handleRenderOverlay(class GLFont* font, double* proj, dou
|
|||||||
model, proj, view, &x, &y, &z))
|
model, proj, view, &x, &y, &z))
|
||||||
{
|
{
|
||||||
char text[32];
|
char text[32];
|
||||||
snprintf(text,32,"%.3f ms %d Tris", m_tileBuildTime, m_tileTriCount);
|
snprintf(text,32,"%.3fms / %dTris / %.1fkB", m_tileBuildTime, m_tileTriCount, m_tileMemUsage);
|
||||||
const float len = font->getTextLength(text);
|
const float len = font->getTextLength(text);
|
||||||
font->drawText((float)x - len/2, (float)y-font->getLineHeight(), text, GLFont::RGBA(0,0,0,220));
|
font->drawText((float)x - len/2, (float)y-font->getLineHeight(), text, GLFont::RGBA(0,0,0,220));
|
||||||
}
|
}
|
||||||
@ -523,16 +542,26 @@ void BuilderTiledMesh::setToolEndPos(const float* p)
|
|||||||
bool BuilderTiledMesh::handleBuild()
|
bool BuilderTiledMesh::handleBuild()
|
||||||
{
|
{
|
||||||
if (!m_verts || !m_tris)
|
if (!m_verts || !m_tris)
|
||||||
|
{
|
||||||
|
printf("No verts or tris\n");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
delete m_navMesh;
|
delete m_navMesh;
|
||||||
m_navMesh = new dtTiledNavMesh;
|
m_navMesh = new dtTiledNavMesh;
|
||||||
if (!m_navMesh)
|
if (!m_navMesh)
|
||||||
|
{
|
||||||
|
printf("Could not allocate navmehs\n");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
if (!m_navMesh->init(m_bmin, m_tileSize*m_cellSize, m_agentMaxClimb*m_cellHeight))
|
if (!m_navMesh->init(m_bmin, m_tileSize*m_cellSize, m_agentMaxClimb*m_cellHeight))
|
||||||
|
{
|
||||||
|
printf("Could not init navmesh\n");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Build chunky mesh.
|
// Build chunky mesh.
|
||||||
|
delete m_chunkyMesh;
|
||||||
m_chunkyMesh = new rcChunkyTriMesh;
|
m_chunkyMesh = new rcChunkyTriMesh;
|
||||||
if (!m_chunkyMesh)
|
if (!m_chunkyMesh)
|
||||||
{
|
{
|
||||||
@ -546,7 +575,6 @@ bool BuilderTiledMesh::handleBuild()
|
|||||||
rcGetLog()->log(RC_LOG_ERROR, "buildTiledNavigation: Could not build chunky mesh.");
|
rcGetLog()->log(RC_LOG_ERROR, "buildTiledNavigation: Could not build chunky mesh.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -805,7 +833,6 @@ unsigned char* BuilderTiledMesh::buildTileMesh(const float* bmin, const float* b
|
|||||||
|
|
||||||
unsigned char* navData = 0;
|
unsigned char* navData = 0;
|
||||||
int navDataSize = 0;
|
int navDataSize = 0;
|
||||||
|
|
||||||
if (m_cfg.maxVertsPerPoly == DT_TILE_VERTS_PER_POLYGON)
|
if (m_cfg.maxVertsPerPoly == DT_TILE_VERTS_PER_POLYGON)
|
||||||
{
|
{
|
||||||
// Remove padding from the polymesh data.
|
// Remove padding from the polymesh data.
|
||||||
@ -825,6 +852,7 @@ unsigned char* BuilderTiledMesh::buildTileMesh(const float* bmin, const float* b
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
m_tileMemUsage = navDataSize/1024.0f;
|
||||||
|
|
||||||
rcTimeVal totEndTime = rcGetPerformanceTimer();
|
rcTimeVal totEndTime = rcGetPerformanceTimer();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user