-1

I am writing a loader and a renderer of *.bsp Quake 3 files for my 3D engine. I am supporting the format version 46 (0x2e). Everything is rendered well untill I am using very simple maps. The geometry of simple maps renders correctly both under my engine and the renderer that I found in the Internet (at http://www.paulsprojects.net/opengl/q3bsp/q3bsp.html). Here is the screenshot:

enter image description here

I tried rendering more complicated maps (from: http://lvlworld.com/) with my renderer and a renderer that I found to compare the results. And both renderers suffer from a problem that there are holes in the scene (missing triangles here and there). I have no clue what my be causing those problems as I checked the maps and they are all of the same version. Has anybody encountered this problem?

enter image description here

EDIT: Some of the very complicated maps render correctly. It confuses me even more :).

Paweł Jastrzębski
  • 747
  • 1
  • 6
  • 24

1 Answers1

2

The creator of this bsp loader made something wrong. I got fixed it. Simply edit LoadData function, and make all face data ( except meshes and patches ) into one array and render it. Works for me, no more "holes". Here's piece of code:

int currentFace = 0;

for( int i = 0; i < facesCount; i++ ) {
    if( faceData[i].type != SW_POLYGON )
        continue;

    m_pFaces[i].texture = faceData[i].texture;
    m_pFaces[i].lightmapIndex = faceData[i].lightmapIndex;
    m_pFaces[i].firstVertexIndex = faceData[i].firstVertexIndex;
    m_pFaces[i].vertexCount = faceData[i].vertexCount;
    m_pFaces[i].numMeshIndices = faceData[i].numMeshIndices;
    m_pFaces[i].firstMeshIndex = faceData[i].firstMeshIndex;

    f_bspType[i].faceType = SW_FACE; // Custom one.
    f_bspType[i].typeFaceNumber = currentFace;

    currentFace++;
}
neko_code
  • 569
  • 11
  • 21