Skip to content

Commit

Permalink
std::string in objmeshgroup::load
Browse files Browse the repository at this point in the history
  • Loading branch information
no-lex committed Dec 31, 2024
1 parent 92f7808 commit 56c49d8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/engine/model/obj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ bool obj::objmeshgroup::load(const char *filename, float smooth)
std::vector<tcvert> tcverts;
std::vector<tri> tris;

string meshname = "";
std::string meshname = "";
vertmesh *curmesh = nullptr;
while(file->getline(buf, sizeof(buf)))
{
Expand Down Expand Up @@ -130,13 +130,13 @@ bool obj::objmeshgroup::load(const char *filename, float smooth)
{
c++;
}
char *name = c;
const char *name = c;
size_t namelen = std::strlen(name);
while(namelen > 0 && std::isspace(name[namelen-1]))
{
namelen--;
}
copystring(meshname, name, std::min(namelen+1, sizeof(meshname)));
meshname = std::string(name, namelen+1);
if(curmesh)
{
flushmesh(*curmesh, verts, tcverts, tris, attrib[2], smooth);
Expand All @@ -149,7 +149,7 @@ bool obj::objmeshgroup::load(const char *filename, float smooth)
if(!curmesh)
{
//startmesh
vertmesh &m = *new vertmesh(meshname[0] ? std::string(meshname) : "", this);
vertmesh &m = *new vertmesh(meshname[0] ? meshname : "", this);
meshes.push_back(&m);
curmesh = &m;
verthash.clear();
Expand Down

0 comments on commit 56c49d8

Please sign in to comment.