View Single Post
  #4  
Old 09-15-2004, 03:28 PM
daeken_bb
Discordant
 
Join Date: Mar 2003
Location: Chambersburg, PA
Posts: 469
Default

Well, I just got zone geometry rendering perfectly, albiet without textures (it's figured out, just not coded as of yet)

It was very, very simple.

Code:
struct Header {
  char magic[4]; // Constant at EQGT
  uint32 version; // Constant at 2.
  uint32 list_length; // This is the total length of the material list that follows
  uint32 object_count; // This is the number of materials in the list (NOT the number of elements)
  uint32 vertex_count; // Number of vertices
  uint32 poly_count; // Polygon count
};
After the header comes a list of materials and their properties.
Each element is a null-terminated name followed by a null-terminated value.
If the name starts with 'e_' it is a property of the previous material named, otherwise it's naming a new material and its associated base texture. If the base texture named starts with e_, leave the base texture empty and treat this name as its own variable. In the case of having no base texture, simply use the first e_ entry value as the texture, but make sure you also set the e_ entry in your material data.

Now comes the one portion of the file that I have yet to figure out. My theory is that it is a BSP or octree, but I have yet to test it. To skip it, seek to 3 + (vertex_count * 32) + (poly_count * 20) bytes before the end of the file. I'll work on figuring this out when I get a chance, but my knowledge of BSPs and octrees is so limited its not even funny.

Next comes the vertices. You should decode these and store them in a zero-indexed array.

Code:
struct Vertex {
  float x, y, z; // Vertex location
  float i, j, k; // Normals?
  float u, v; // Tex coords, clamped to [0,1]
};
After that comes the triangles. The v0, v1, and v2 fields index the vertex array. The group field indexes the object type list if greater than or equal to zero, else it means the object is invisible I _think_.

Code:
struct Triangle {
  unsigned long v0, v1, v2; // These are vertex indices
  signed long group; // Texture/material group id.
  unsigned long flags; // This seems to flag if you can walk through the polygon or not.
};
Then after that is simply 3 null bytes, then the end of the file.


Enjoy
__________________
Keep me unemployed and working on OpenEQ, PM me about donating

Check out my deviantART page at http://daeken.deviantart.com/
Reply With Quote