PROCB

From Mod Wiki

Jump to: navigation, search

Contents

Simple Types


These are all stored as little-endian




  • bool = 1 byte
  • unsigned char = 1 byte
  • int = 4 bytes
  • float = 4 bytes

Compound types


  • vec3 = float x, float y, float z
  • bounds = vec3 mins, vec3 maxs
  • string = int length, char[ length ]


File Structure

 chunk id;
 chunk data;
 ...
 chunk id;
 chunk data;

Chunks needed for loading geometry data


Material Table

 material chunk {
   string id = "materials";
   int numMaterials;
   string array[ numMaterials ];
 }

Model Chunk

 model chunk {
   string id = "model";
   int chunkLength;
   string name;
   
   int numSurfaces;
   int numAreas;
   int array[ numAreas ];
   
   for each of numSurfaces {
       int materialIndex;
       bool hasVertexColor;
       bounds surfaceBounds;
       
       int numVerts;
       int numIndices;
       int __privateCount;
       
       for each of numVerts {
           int numVertexElements;  // should always be 12
           float vertex[ numVertexElements ];
           
           int numColorElements;   // should always be 4
           unsigned char color[ numColorElements ];
           // if hasVertexColor is true, use the color read above; otherwise the color is "255 255 255 255"
           
           // vertex[ 0 ] - x
           // vertex[ 1 ] - y
           // vertex[ 2 ] - z
   
           // vertex[ 3 ] - s
           // vertex[ 4 ] - t
   
           // vertex[ 5 ] - normal x
           // vertex[ 6 ] - normal y
           // vertex[ 7 ] - normal z
           
           // vertex[ 8 ] - tangent x
           // vertex[ 9 ] - tangent y
           // vertex[ 10 ] - tangent z     
           // vertex[ 11 ] - bitangent sign
       }
       for each of numIndices {
           int index;
       }
       
       for each of __privateCount {
           float __private[ 6 ];
           int __private;
           int __private;
           int __private;
           int __private;      
       }
   }  
 }
 all_other_chunks {
   string id;
   int chunkLength;
   <skip ahead by chunklength to get to the next chunk>
 }
Personal tools