Repository navigation
GEO
The GEO file contains geometry and animations organized as a scene graph. Similar to the GLTF file format.
Header | geofileHeader
Transformations | vector<geofileTransformation>
Scene Nodes | vector<geofileTreeNode>
Empty Space | Fill to next 16 bytes
Meshes | vector<geofileMesh>
├── Mesh header | geofileMeshHeader
├── Surfaces | vector<geofileSurface>
├── Vertices | vector<vec3>
├── Tangent | vector<vec3> - Optional: If new is set, used for normal mapping|
├── Bitangent | vector<vec3> - Optional: If new is set, used for normal mapping|
├── UV | vector<vec2> (Texture coordinates)
├── Empty Space | Fill to next 16 bytes
└── Textures | vector<geofileTexture>
├── Texture header | vector<geofileTextureHeader>
├── Colortable | vector<rgba> - Used deepening on texture format
└── Data | vector<char> - Texture binary data
The file starts with a header:
struct geofileHeader
{
int unk1;
int number_of_nodes; // Total number of scene nodes
int unk3;
int number_of_transformations; // Total number of transformations
int number_of_keyframes; // Total number of keframes
int offset_to_first_model; // Offset to first model (geometry) data
int number_of_models; // Total number of models (geometry)
int unk6;
}The header is followed by a list of transformations (geofileHeader.number_of_transformations):
struct geofileTransformation
{
glm::vec3 position; // (xyz-float) All values are multiplied by 10.
float unk7;
glm::vec3 rotation; // (xyz-float) Euler angles YXZ in degree. All values are multiplied by 10.
float unk8;
glm::vec3 scale; // (xyz-float) All values are multiplied by 100.
float unk9;
float unk10, unk11, unk12, unk13;
}I use OpenGl so my axes are different, here are my conversion functions:
glm::vec3 fromDisaPosition(const glm::vec3& position) { return glm::vec3(-position.x, -position.y, position.z) / 10.0f; }
glm::quat fromDisaRotation(const glm::vec3& rotation){
const glm::vec3 eulerRotation = glm::radians(glm::vec3(
-rotation.z / 10.0f,
-rotation.y / 10.0f,
rotation.x / 10.0f
));
return glm::quat(glm::eulerAngleYXZ(
eulerRotation.y, eulerRotation.z, eulerRotation.x
));
}
glm::vec3 fromDisaScale(const glm::vec3& scale) { return scale / 100.0f; }
Next are the keyframes (geofileHeader.number_of_keyframes):
struct geofileKeyframe{
unsigned short value;
unsigned short time;
};
What exactly they do must be discovered.
Next are the nodes of the scene tree (geofileHeader.number_of_nodes):
struct geofileTreeNode
{
short parent_index; // The index of the parent node. 0 is root, so 1 is first entry
short transformations_start_index;
short number_of_transformations; // Must be at least 1.
short model_index; // If -1, then node is a pure transformation node.
short transformation_mode; // 2 or 3 is a Billboard, rest ist normal?
short keyframe_start_index; // Is 0, if node is not animated
short number_of_keyframes; // Is 0, if node is not animated
}The nodes are connected in a parent-child hierarchy.
transformation_mode must be more researched, but if it is 2 or 3 then node seams to be a billboard (always faces the camera).
How the animation system fully works is not complitly discovered. But it looks like it interpolates the transformations, from 0 to max keyframe time. The keyframe value parameters seams to be used as an alpha value.
Buffer data (geometry and texture) starts at the given offset inside the header.
Each Model consists out of a header, surface data, triangle data, uv data and textures:
struct geofileModelHeader
{
unsigned short number_of_triangles; // Each trianlge has 3 vertices
unsigned short isNew; // is a model that is used in new maps with high res textures.
int unk9; //no idea what this is, the number seams to be kinda randome
int number_of_surfaces;
int number_of_textures;
int start_offset_texture; // Offset starts from the model header location
int end_offset_model; // Offset starts from the model header location
int size_of_triangles;
int unk12; //Probably spacer so header is 32 byte big
}If isNew bigger 0 then model also has tangets and bitangets for normal mapping. They are added after the UV maps and there size is the same as number_of_triangles.
The model header is followed by a surface list (geofileModelHeader.number_of_surfaces):
struct geofileSurface{
unsigned char unk1a, unk1b, unk1c, unk1d; //somekind of blend mode or alpha values?
unsigned short texture_index; // Can be 0, then this surface has no texture. (Default texture is Black?)
unsigned short lenght; // Number of vertices inside surface (start is the sum of previous lenghts)
int unk4, unk5; //somekind of texture effects?
}First are the vertices. Whose total size is model.header.number_of_triangles * 3 * sizeof(glm::vec3).
Second are the UV values. They are a bit strange as they are only present for used vertices, so their total size is not as you would expect: model.header.number_of_triangles * 2 * sizeof(glm::vec2) but rather the sum of surface lengths: sumLength * 2 * sizeof(glm::vec2). (Must be checked)
The texures start at the given offset inside model header.
Each texture begins with a header:
struct geofileTextureHeader{
unsigned short total_size; // the total byte size of the texture
unsigned short unk0;
unsigned short width, height, colortable_quantity;
unsigned char powerWidth, powerHeight; // The power of
unsigned int unk4;
}Next follows the colortable filled with ARGB(8888). Afterwards, the indeces to the colortable.
If colortable is smaller 16 then each index has 4 bits else 8 bit:
int pixelDataSize = texture.header.width * texture.header.height; // base size
if (texture.header.colortableSize <= 16) pixelDataSize /= 2.0; // with 16 colors you only need 4 bit (half byte)