diff options
-rw-r--r-- | level.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -270,11 +270,19 @@ LEVEL *LoadLevel(char *filename) { } } } + v = VectorCross( VectorSub(level->rooms[i].walls[j].vertices[1], level->rooms[i].walls[j].vertices[0]), VectorSub(level->rooms[i].walls[j].vertices[2], level->rooms[i].walls[j].vertices[0]) ); - if(VectorLengthSq(v)) level->rooms[i].walls[j].normal = VectorNormalize(v); + if(VectorLengthSq(v) > 0.0) { + level->rooms[i].walls[j].normal = VectorNormalize(v); + + for(k = 0; k < 3; k++) { + if(VectorLengthSq(level->rooms[i].walls[j].normals[k]) == 0.0) + level->rooms[i].walls[j].normals[k] = level->rooms[i].walls[j].normal; + } + } j++; } |