Original Post
Hi all. I just debugged my engine (rendering was really weird) and found out interesting thing. I am trying to load Quake 3 map (official one) and if I print the position of vertices, sometimes it shows insane values:
Vertex 0 | X: 2552.000000 Y: 24.000000 Z: -2436.000000
Vertex 1 | X: 2.937500 Y: 0.480469 Z: 0.937500
Vertex 2 | X: 0.003906 Y: -1.000000 Z: -0.000000
Vertex 3 | X: 0.000000 Y: 2552.000000 Z: 208876590168752002862353036063671320576.000000
Vertex 4 | X: 2436.000000 Y: 2.937500 Z: -88.000000
Vertex 5 | X: -0.937500 Y: 0.066406 Z: -0.449219
Vertex 6 | X: 0.000000 Y: 0.000000 Z: 1.000000
Vertex 7 | X: -208876590168752002862353036063671320576.000000 Y: 2496.000000 Z: -2496.000000
Vertex 8 | X: 88.000000 Y: -0.937500 Z: -2.937500
Vertex 9 | X: 0.441406 Y: 0.000000 Z: -0.003906
Vertex 10 | X: 1.000000 Y: -217045371201441920428938639413616836608.000000 Z: -0.000000
Position like about 2^38 is really insane. i absolutely don't understand it. Here is relevant part of loading code:
numVerts = gLump[LUMPS_VERTICES].length / sizeof(sVertex);
newentity->Geometry->Vertices = new sVertex[numVerts];
newentity->Geometry->numVertices = numVerts;
fseek(f, gLump[LUMPS_VERTICES].offset, SEEK_SET);
for(i = 0; i < numVerts; i++) {
fread(&newentity->Geometry->Vertices, 1, sizeof(sVertex), f);
float temp = newentity->Geometry->Vertices.position[1];
newentity->Geometry->Vertices.position[1] = newentity->Geometry->Vertices.position[2];
newentity->Geometry->Vertices.position[2] = -temp;
newentity->Geometry->Vertices.texCoord[1] *= -1;
}
Does anyone know the reason of these values? I would really appreciate your help. Thanks in advance. bori [Edited by - bori on January 25, 2008 8:23:37 AM]