File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change 44#include " build.h"
55#include " ../recast/InputGeom.h"
66#include " ../recast/MeshLoaderObj.h"
7+ #include < string.h>
78
89// #define DEBUG
9- #define OUTPUT_STRING
1010
1111rcConfig m_cfg;
1212class rcContext *m_ctx = new rcContext;
@@ -27,6 +27,7 @@ rcContourSet *m_cset;
2727rcPolyMesh *m_pmesh; // Navigation mesh 数据
2828rcPolyMeshDetail *m_dmesh; // Navigation mesh detail 数据
2929
30+ static char obj[262144 ];
3031
3132int load (const char *str) {
3233 if (!m_geom->load (m_ctx, str)) {
@@ -420,7 +421,6 @@ char *build(
420421 // See duDebugDrawPolyMesh or dtCreateNavMeshData as examples how to access the data.
421422
422423
423- char obj[262144 ];
424424 char *p_obj = obj;
425425
426426 do {
@@ -455,6 +455,7 @@ char *build(
455455 }
456456 }
457457 } while (0 );
458+ *p_obj = ' \0 ' ;
458459
459460#ifdef DEBUG
460461 float m_totalBuildTimeMs = m_ctx->getAccumulatedTime (RC_TIMER_TOTAL) / 1000 .0f ;
@@ -478,8 +479,8 @@ int exportAsObj(const char *path) {
478479 return 1 ;
479480 }
480481
481- char obj [262144 ];
482- char *p_obj = obj ;
482+ char buf [262144 ];
483+ char *p_obj = buf ;
483484
484485 const float cs = m_pmesh->cs ;
485486 const float ch = m_pmesh->ch ;
@@ -513,7 +514,7 @@ int exportAsObj(const char *path) {
513514 p_obj += sprintf (p_obj, " \n " );
514515 }
515516
516- fputs (obj , fp);
517+ fputs (buf , fp);
517518 fclose (fp);
518519 fp = NULL ;
519520
You can’t perform that action at this time.
0 commit comments