mirror of
https://github.com/ZDoom/ZDRay.git
synced 2025-01-24 16:51:08 +00:00
- remove some old broken debug code
This commit is contained in:
parent
8f564c9210
commit
79d0b257e1
3 changed files with 0 additions and 115 deletions
|
@ -1028,46 +1028,8 @@ void LightmapBuilder::AddLightmapLump(FWadWriter &wadFile)
|
|||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
// Apply compression predictor
|
||||
uint8_t *texBytes = lumpFile.BufferAt() - texDataSize;
|
||||
for (int i = texDataSize - 1; i > 0; i--)
|
||||
{
|
||||
texBytes[i] -= texBytes[i - 1];
|
||||
}
|
||||
#endif
|
||||
|
||||
// Compress and store in lump
|
||||
ZLibOut zout(wadFile);
|
||||
wadFile.StartWritingLump("LIGHTMAP");
|
||||
zout.Write(buffer.data(), lumpFile.BufferAt() - lumpFile.Buffer());
|
||||
}
|
||||
|
||||
/*
|
||||
void LightmapBuilder::WriteTexturesToTGA()
|
||||
{
|
||||
BinFile file;
|
||||
|
||||
for (unsigned int i = 0; i < textures.size(); i++)
|
||||
{
|
||||
file.Create(Va("lightmap_%02d.tga", i));
|
||||
file.Write16(0);
|
||||
file.Write16(2);
|
||||
file.Write16(0);
|
||||
file.Write16(0);
|
||||
file.Write16(0);
|
||||
file.Write16(0);
|
||||
file.Write16(textureWidth);
|
||||
file.Write16(textureHeight);
|
||||
file.Write16(24);
|
||||
|
||||
for (int j = 0; j < (textureWidth * textureHeight) * 3; j += 3)
|
||||
{
|
||||
file.Write8(textures[i][j + 2]);
|
||||
file.Write8(textures[i][j + 1]);
|
||||
file.Write8(textures[i][j + 0]);
|
||||
}
|
||||
file.Close();
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -422,78 +422,3 @@ bool LevelMesh::IsDegenerate(const Vec3 &v0, const Vec3 &v1, const Vec3 &v2)
|
|||
float crosslengthsqr = crossx * crossx + crossy * crossy + crossz * crossz;
|
||||
return crosslengthsqr <= 1.e-6f;
|
||||
}
|
||||
|
||||
void LevelMesh::WriteMeshToOBJ()
|
||||
{
|
||||
FILE *f = fopen("mesh.obj", "w");
|
||||
|
||||
std::map<int, std::vector<Surface*>> sortedSurfs;
|
||||
|
||||
for (unsigned int i = 0; i < surfaces.size(); i++)
|
||||
sortedSurfs[surfaces[i]->lightmapNum].push_back(surfaces[i].get());
|
||||
|
||||
for (const auto &it : sortedSurfs)
|
||||
{
|
||||
for (const auto &s : it.second)
|
||||
{
|
||||
for (int j = 0; j < s->numVerts; j++)
|
||||
{
|
||||
fprintf(f, "v %f %f %f\n", s->verts[j].x, s->verts[j].z + 100.0f, s->verts[j].y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto &it : sortedSurfs)
|
||||
{
|
||||
for (const auto &s : it.second)
|
||||
{
|
||||
for (int j = 0; j < s->numVerts; j++)
|
||||
{
|
||||
fprintf(f, "vt %f %f\n", s->lightmapCoords[j * 2], s->lightmapCoords[j * 2 + 1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int voffset = 1;
|
||||
for (const auto &it : sortedSurfs)
|
||||
{
|
||||
int lightmapNum = it.first;
|
||||
|
||||
if (lightmapNum != -1)
|
||||
fprintf(f, "usemtl lightmap_%02d\n", lightmapNum);
|
||||
else
|
||||
fprintf(f, "usemtl black\n");
|
||||
|
||||
for (const auto &s : it.second)
|
||||
{
|
||||
switch (s->type)
|
||||
{
|
||||
case ST_FLOOR:
|
||||
for (int j = 2; j < s->numVerts; j++)
|
||||
{
|
||||
fprintf(f, "f %d/%d %d/%d %d/%d\n", voffset + j, voffset + j, voffset + j - 1, voffset + j - 1, voffset, voffset);
|
||||
}
|
||||
break;
|
||||
case ST_CEILING:
|
||||
for (int j = 2; j < s->numVerts; j++)
|
||||
{
|
||||
fprintf(f, "f %d/%d %d/%d %d/%d\n", voffset, voffset, voffset + j - 1, voffset + j - 1, voffset + j, voffset + j);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
for (int j = 2; j < s->numVerts; j++)
|
||||
{
|
||||
if (j % 2 == 0)
|
||||
fprintf(f, "f %d/%d %d/%d %d/%d\n", voffset + j - 2, voffset + j - 2, voffset + j - 1, voffset + j - 1, voffset + j, voffset + j);
|
||||
else
|
||||
fprintf(f, "f %d/%d %d/%d %d/%d\n", voffset + j, voffset + j, voffset + j - 1, voffset + j - 1, voffset + j - 2, voffset + j - 2);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
voffset += s->numVerts;
|
||||
}
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
}
|
||||
|
|
|
@ -88,8 +88,6 @@ public:
|
|||
LevelTraceHit Trace(const Vec3 &startVec, const Vec3 &endVec);
|
||||
bool TraceAnyHit(const Vec3 &startVec, const Vec3 &endVec);
|
||||
|
||||
void WriteMeshToOBJ();
|
||||
|
||||
std::vector<std::unique_ptr<Surface>> surfaces;
|
||||
|
||||
TArray<Vec3> MeshVertices;
|
||||
|
|
Loading…
Reference in a new issue