|
|
@ -111,11 +111,11 @@ int process_faces(const world_t* world, const TextureList& textures) |
|
|
outFace.firstFaceVertex = (unsigned short)outFaceVertices.size(); |
|
|
outFace.firstFaceVertex = (unsigned short)outFaceVertices.size(); |
|
|
outFace.textureId = (unsigned char)texinfo->texture_id; |
|
|
outFace.textureId = (unsigned char)texinfo->texture_id; |
|
|
|
|
|
|
|
|
Matrix4x4 textureTrsf = tesselator.buildTextureSpaceTransform(texinfo, miptex, plane); |
|
|
|
|
|
|
|
|
FaceBound bounds; |
|
|
|
|
|
bounds.textureTransform = tesselator.buildTextureSpaceTransform(texinfo, miptex, plane); |
|
|
|
|
|
|
|
|
// Traverse the list of face edges to collect all of the face's vertices
|
|
|
// Traverse the list of face edges to collect all of the face's vertices
|
|
|
Vec3 vertexSum; |
|
|
Vec3 vertexSum; |
|
|
FaceBound bounds; |
|
|
|
|
|
for (int edgeListIdx = 0; edgeListIdx < face->ledge_num; ++edgeListIdx) |
|
|
for (int edgeListIdx = 0; edgeListIdx < face->ledge_num; ++edgeListIdx) |
|
|
{ |
|
|
{ |
|
|
int edgeIdx = world->edgeList[face->ledge_id + edgeListIdx]; |
|
|
int edgeIdx = world->edgeList[face->ledge_id + edgeListIdx]; |
|
|
@ -133,7 +133,7 @@ int process_faces(const world_t* world, const TextureList& textures) |
|
|
else |
|
|
else |
|
|
bounds.worldBounds.includePoint(vertexPoint); |
|
|
bounds.worldBounds.includePoint(vertexPoint); |
|
|
|
|
|
|
|
|
Vec3 texturePoint = textureTrsf.TransformPoint(vertexPoint); |
|
|
|
|
|
|
|
|
Vec3 texturePoint = bounds.textureTransform.TransformPoint(vertexPoint); |
|
|
bounds.addTexturePoint(texturePoint.x, texturePoint.y); |
|
|
bounds.addTexturePoint(texturePoint.x, texturePoint.y); |
|
|
|
|
|
|
|
|
// Sum all vertices to calculate an average center point
|
|
|
// Sum all vertices to calculate an average center point
|
|
|
|