Tools/MeshExtractor: Fixed Doodads and WMOs in the terrain.
Cleaned up a little.
This commit is contained in:
1 parent
279183737c
commit
371dd07037
14 files changed
+67
-149
No files matched your search
@@ -15,9 +15,9 @@ Model::Model( std::string path ) : IsCollidable(false), IsBad(false)
|
||||
Header.OffsetBoundingTriangles > 0 && Header.BoundingRadius > 0.0f)
|
||||
{
|
||||
IsCollidable = true;
|
||||
ReadVertices(Stream);
|
||||
ReadBoundingNormals(Stream);
|
||||
ReadBoundingTriangles(Stream);
|
||||
ReadVertices();
|
||||
ReadBoundingNormals();
|
||||
ReadBoundingTriangles();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,41 +27,41 @@ Model::~Model()
|
||||
fclose(Stream);
|
||||
}
|
||||
|
||||
void Model::ReadVertices( FILE* stream )
|
||||
void Model::ReadVertices()
|
||||
{
|
||||
fseek(stream, Header.OffsetBoundingVertices, SEEK_SET);
|
||||
fseek(Stream, Header.OffsetBoundingVertices, SEEK_SET);
|
||||
Vertices.reserve(Header.CountBoundingVertices);
|
||||
for (uint32 i = 0; i < Header.CountBoundingVertices; ++i)
|
||||
{
|
||||
Vertices.push_back(Vector3::Read(stream));
|
||||
Vertices.push_back(Vector3::Read(Stream));
|
||||
if (Constants::ToWoWCoords)
|
||||
Vertices[i] = Utils::ToWoWCoords(Vertices[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void Model::ReadBoundingTriangles( FILE* stream )
|
||||
void Model::ReadBoundingTriangles()
|
||||
{
|
||||
fseek(stream, Header.OffsetBoundingTriangles, SEEK_SET);
|
||||
fseek(Stream, Header.OffsetBoundingTriangles, SEEK_SET);
|
||||
Triangles.reserve(Header.CountBoundingTriangles / 3);
|
||||
for (uint32 i = 0; i < Header.CountBoundingTriangles / 3; i++)
|
||||
{
|
||||
Triangle<uint16> tri;
|
||||
tri.Type = Constants::TRIANGLE_TYPE_DOODAD;
|
||||
int count = 0;
|
||||
count += fread(&tri.V0, sizeof(uint16), 1, stream);
|
||||
count += fread(&tri.V1, sizeof(uint16), 1, stream);
|
||||
count += fread(&tri.V2, sizeof(uint16), 1, stream);
|
||||
count += fread(&tri.V0, sizeof(uint16), 1, Stream);
|
||||
count += fread(&tri.V1, sizeof(uint16), 1, Stream);
|
||||
count += fread(&tri.V2, sizeof(uint16), 1, Stream);
|
||||
if (count != 3)
|
||||
printf("Model::ReadBoundingTriangles: Error reading data, expected 3, read %d\n", count);
|
||||
Triangles.push_back(tri);
|
||||
}
|
||||
}
|
||||
|
||||
void Model::ReadBoundingNormals( FILE* stream )
|
||||
void Model::ReadBoundingNormals()
|
||||
{
|
||||
fseek(stream, Header.OffsetBoundingNormals, SEEK_SET);
|
||||
fseek(Stream, Header.OffsetBoundingNormals, SEEK_SET);
|
||||
Normals.reserve(Header.CountBoundingNormals);
|
||||
for (uint32 i = 0; i < Header.CountBoundingNormals; i++)
|
||||
Normals.push_back(Vector3::Read(stream));
|
||||
Normals.push_back(Vector3::Read(Stream));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user