@ -118,10 +118,10 @@ int process_faces(const world_t* world, const std::vector<ps1bsp_texture_t>& tex
// Sum all vertices to calculate an average center point
vertexSum = vertexSum + vertexPoint ;
// TODO: face vertex indices will have to be updated to match the tesselator's vertex list
//ps1bsp_facevertex_t faceVertex = { 0 };
//faceVertex.index = vertIndex;
//outFaceVertices.push_back(faceVertex);
// TODO: compute texture color * light at this vertex
ps1bsp_facevertex_t faceVertex = { 0 } ;
faceVertex . index = ( unsigned short ) tesselator . addVertex ( vertexPoint ) ;
outFaceVertices . push_back ( faceVertex ) ;
}
faceBounds [ face ] = bounds ;
@ -132,7 +132,7 @@ int process_faces(const world_t* world, const std::vector<ps1bsp_texture_t>& tex
outFace . numFaceVertices = ( unsigned char ) ( outFaceVertices . size ( ) - outFace . firstFaceVertex ) ;
outFace . center = convertWorldPosition ( vertexSum / face - > ledge_num ) ;
float area = computeFaceArea ( world , face ) ;
float area = computeFaceArea ( world , face ) ; // TODO: divide by number of polygons
outFace . center . pad = ( short ) ( sqrt ( area ) ) ;
outFaces . push_back ( outFace ) ;
}
@ -196,6 +196,8 @@ int process_faces(const world_t* world, const std::vector<ps1bsp_texture_t>& tex
outPolygons . push_back ( outPoly ) ;
}
// TODO: calculate average face lighting * color from texture data
outFace - > numPolygons = ( unsigned char ) ( outPolygons . size ( ) - outFace - > firstPolygon ) ;
}
@ -293,8 +295,8 @@ int process_faces(const world_t* world, const std::vector<ps1bsp_texture_t>& tex
fwrite ( & outHeader , sizeof ( ps1bsp_header_t ) , 1 , fbsp ) ;
fclose ( fbsp ) ;
printf ( " PS1BSP: wrote %d vertices, %d faces, %d face vert s, %d planes, %d nodes, %d leaves, %d leaf faces \n " ,
outVertices . size ( ) , outFaces . size ( ) , outFaceVertice s . size ( ) ,
printf ( " PS1BSP: wrote %d vertices, %d faces, %d polygon s, %d planes, %d nodes, %d leaves, %d leaf faces \n " ,
outVertices . size ( ) , outFaces . size ( ) , outPolygon s . size ( ) ,
outPlanes . size ( ) , outNodes . size ( ) , outLeaves . size ( ) , outLeafFaces . size ( ) ) ;
return 1 ;