trackgen: remove empty objects from models
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@9479 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: 3aa936cc73f0e42c17738f71639fa03cc94abde0 Former-commit-id: b15cfc67ba81a3f547f8831f37ec2f0e1321eb27
This commit is contained in:
parent
92012b0dae
commit
a619a69a9a
4 changed files with 23 additions and 1 deletions
|
@ -1054,6 +1054,20 @@ void Ac3d::Object::splitByMaterial()
|
|||
}
|
||||
}
|
||||
|
||||
void Ac3d::Object::removeEmptyObjects()
|
||||
{
|
||||
auto kid = kids.begin();
|
||||
while (kid != kids.end())
|
||||
{
|
||||
if (kid->type == "poly" && (kid->vertices.empty() || kid->surfaces.empty()))
|
||||
kid = kids.erase(kid);
|
||||
else if (kid->type == "group" && kid->kids.empty())
|
||||
kid = kids.erase(kid);
|
||||
else
|
||||
++kid;
|
||||
}
|
||||
}
|
||||
|
||||
void Ac3d::Object::splitByUV()
|
||||
{
|
||||
if (type == "poly")
|
||||
|
@ -1759,6 +1773,11 @@ void Ac3d::splitByUV()
|
|||
root.splitByUV();
|
||||
}
|
||||
|
||||
void Ac3d::removeEmptyObjects()
|
||||
{
|
||||
root.removeEmptyObjects();
|
||||
}
|
||||
|
||||
void Ac3d::getPolys(Object *object, std::vector<Ac3d::Object *> &polys)
|
||||
{
|
||||
if (object->type == "poly")
|
||||
|
|
|
@ -353,6 +353,7 @@ struct Ac3d
|
|||
void splitBySURF();
|
||||
void splitByMaterial();
|
||||
void splitByUV();
|
||||
void removeEmptyObjects();
|
||||
void removeSurfacesNotSURF(unsigned int SURF);
|
||||
void removeSurfacesNotMaterial(int material);
|
||||
void removeUnusedVertices();
|
||||
|
@ -385,6 +386,7 @@ struct Ac3d
|
|||
void splitBySURF();
|
||||
void splitByMaterial();
|
||||
void splitByUV();
|
||||
void removeEmptyObjects();
|
||||
void merge(const Ac3d &ac3d, bool mergeMaterials);
|
||||
double getTerrainHeight(double x, double y) const;
|
||||
double getTerrainAngle(double x, double y) const;
|
||||
|
|
|
@ -104,7 +104,7 @@ public:
|
|||
|
||||
//! Constructor.
|
||||
Application::Application()
|
||||
: GfApplication("TrackGen", "1.7.0.9", "Terrain generator for tracks")
|
||||
: GfApplication("TrackGen", "1.7.0.10", "Terrain generator for tracks")
|
||||
, HeightSteps(30)
|
||||
, Bump(false)
|
||||
, Raceline(false)
|
||||
|
|
|
@ -133,6 +133,7 @@ InitObjects(tTrack *track, void *TrackHandle)
|
|||
curObj->ac3d.readFile(curObj->fileName);
|
||||
curObj->ac3d.generateTriangles(); // convert quads to triangles
|
||||
curObj->ac3d.flattenGeometry();
|
||||
curObj->ac3d.removeEmptyObjects();
|
||||
curObj->ac3d.flipAxes(true); // convert to track coordinate system
|
||||
}
|
||||
catch (const Ac3d::Exception &e)
|
||||
|
|
Loading…
Reference in a new issue