|
|
|
@ -58,6 +58,9 @@ int process_faces(const world_t* world, const TextureList& textures) |
|
|
|
outHeader.version = 1; |
|
|
|
fwrite(&outHeader, sizeof(ps1bsp_header_t), 1, fbsp); |
|
|
|
|
|
|
|
std::vector<ps1bsp_worldspawn_t> outWorldSpawns; |
|
|
|
ps1bsp_worldspawn_t outWorldSpawn = { 0 }; |
|
|
|
|
|
|
|
Tesselator tesselator(world); |
|
|
|
|
|
|
|
// Convert faces defined by edges into faces defined by vertex indices
|
|
|
|
@ -181,7 +184,7 @@ int process_faces(const world_t* world, const TextureList& textures) |
|
|
|
int col[3], maxCol = 0; |
|
|
|
for (int i = 0; i < 3; ++i) |
|
|
|
{ |
|
|
|
col[i] = texture.dominantColor.channel[i] * light / 255; |
|
|
|
col[i] = texture.averageColor.channel[i] * light / 255; |
|
|
|
if (col[i] > maxCol) |
|
|
|
maxCol = col[i]; |
|
|
|
} |
|
|
|
@ -205,6 +208,9 @@ int process_faces(const world_t* world, const TextureList& textures) |
|
|
|
// Sky surfaces do not need to be tesselated
|
|
|
|
if (outFace->flags & SURF_DRAWSKY) |
|
|
|
{ |
|
|
|
outWorldSpawn.skyColor[0] = texture.averageColor.rgb.r << 1; |
|
|
|
outWorldSpawn.skyColor[1] = texture.averageColor.rgb.g << 1; |
|
|
|
outWorldSpawn.skyColor[2] = texture.averageColor.rgb.b << 1; |
|
|
|
outFace->firstPolygon = 0; |
|
|
|
outFace->numPolygons = 0; |
|
|
|
continue; |
|
|
|
@ -346,7 +352,10 @@ int process_faces(const world_t* world, const TextureList& textures) |
|
|
|
std::vector<unsigned short> outLeafFaces(world->faceList, world->faceList + world->faceListLength); |
|
|
|
std::vector<unsigned char> outVisData(world->visList, world->visList + world->visListLength); |
|
|
|
|
|
|
|
outWorldSpawns.push_back(outWorldSpawn); |
|
|
|
|
|
|
|
// Write collected data to file and update header info
|
|
|
|
writeMapData(outWorldSpawns, outHeader.worldSpawn, fbsp); |
|
|
|
writeMapData(outTextures, outHeader.textures, fbsp); |
|
|
|
writeMapData(outVertices, outHeader.vertices, fbsp); |
|
|
|
writeMapData(outPolygons, outHeader.polygons, fbsp); |
|
|
|
|