User:Yukimono/Toolchain/OWM

From owdev
Jump to: navigation, search

Checking for versions

tag = (uint)major + 0xFFFF + minor

Version Tags

Version Tag
1.0 0x10000
1.1 0x10001

Common Structures

string

info

 byte str_size1
 if str_size1 > 128:
   byte str_size2
   str_size1 = (str_size1 % 128) + (str_size2 * 128)
 char* str[str_size1]

vec2

 float x
 float y

vec3

 float x
 float y
 float z

quat

 float x
 float y
 float z
 float w

OWMDL

 ushort major
 ushort minor
 string mtl
 string name
 ushort bone_count
 uint mesh_count
 uint empty_count
 bone* bones[bone_count]
 mesh* meshes[mesh_count]
 empty* empty[empty_count]
 empty_a* empty_binds[empty_count]  // added in version 1.1
 int cloth_count  // added in version 1.3, NOTE: THIS IS ALWAYS 0 FOR NOW, IT DOESN'T WORK AS WELL AS I HAD HOPED
 cloth* cloths[cloth_count] // added in version 1.3
 refpose_bone* refpose_bones[bone_count] // added in version 1.4
 uint guid // added in version 1.5


cloth

 string name
 int mesh_count
 cloth_mesh* meshes[mesh_count]
 

cloth_mesh

 uint index
 int connection_vert_count
 string mesh_name
 int* connection_verts[connection_vert_count]

refpose_bone

 string name
 short parent
 vec3 pos
 vec3 scale
 vec3 rot


bone

 string name
 short parent
 vec3 pos
 vec3 scale
 quat rot

mesh

 string name
 ulong material_key
 byte uv_count
 uint vertex_count
 uint index_count
 vertex* vertices[vertex_count]
 index* indices[index_count]

vertex

 vec3 position
 vec3 normal
 vec2* uv[uv_count]
 byte bone_weight_count
 ushort* bone_indices[bone_weight_count]
 float* bone_weights[bone_weight_count]

index

 byte point_count
 uint* points[point_count]

empty

 string name
 vec3 pos
 quat rot

empty_a

 string bone_name

OWMTL

Common

RealTextureType

All of these names are rubbish. e.g. HairNormal is sometimes used for eyes.

 enum RealTextureType : uint {
     DiffuseAO = 2903569922,  // Alpha channel is AO, hex value = 0xAD10F602
     DiffuseOpacity = 1239794147, // hex value = 0x49E5C1E3
     DiffuseBlack = 3989656707,  // bad name, use this as fac for own diffuse bdsf hex value = 0xEDCD5483
     Normal = 378934698, //hex value = 0x169615AA
     HairNormal = 562391268, // why? hex value = 0x218568E4
     CorneaNormal = 562391268, // maybe not hex value = 0x218568E4
     Tertiary = 548341454,  // Metal (R) + Highlight (G) + Detail (B) hex value = 0x20AF06CE
     Opacity = 1482859648, //hex value = 0x5862A480
     MaterialMask = 1557393490, // ? hex value = 0x5CD3F052
     SubsurfaceScattering = 3004687613, //hex value = 0xB317E4FD
     Emission = 3166598269, // hex value = 0xBCBE747D
     Emission2 = 1523270506, //hex value = 0x5ACB436A
     HairTangent = 2337956496, //hex value = 0x8B5A6290
     HairSpecular = 1117188170, //hex value = 0x4296F04A
     HairAO = 3761386704, //hex value = 0xE03234D0
     SomeKindOfGradient = 1140682086 //hex value = 0x43FD6D66
   }

v2

 struct owmat {
   ushort major;
   ushort minor;
   long count;
   OWMatType type;
 
   string* mat_files[count];  // if type == ModelLook
   
   owmat_material material;  // if type == Material, pass in count
 }
 struct owmat_material {
   uint shader;
   int id_count;
   ulong* ids[id_count];
   owmat_material_tex* textures[count];  // use count from parent
 }
 struct owmat_material_tex {
   string file;
   RealTextureType type;
 }
 enum OWMatType : uint {
   Material = 0,
   ModelLook = 1
 }

v1

 ushort major
 ushort minor
 ulong material_count
 material* materials[material_count]

material

 ulong key
 uint texture_count
 texture* textures[texture_count] # extension 1.1

TEXTURE_TYPE

 enum TEXTURE_TYPE : byte {
   DIFFUSE = 0,
   NORMAL = 1,
   SHADER = 2
 }

texture

 string path
 TEXTURE_TYPE type
 RealTextureType realType # extension 1.2


ASCII Version

Note this is not implemented anywhere, it exists in concept only.

 owmtlii						    // header, must start with this, no exceptions.
 
 base 10					 	    // base, all numeric values after this must be this base
 version 1 2						    // major, minor
 
 enum TT.DIFFUSE 0					    // string value, dec value
 enum DiffuseAO 2903569922				    //
 
 import enum-base.owmtlii				    // path
 
 materials 2						    // count
 
 material 1234567890 0 2				    // key, index, tex count 
 material 1234567890 1 0				    //
 
 texture-enum 0 TT.DIFFUSE DiffuseAO C:/Output/Texture.dds  // material index, texture type enum, real texture type enum, path
 texture 0 1 378934698 C:/Output/Normal.dds		    // material index, texture type dec, real texture type dec, path

OWMAP

 ushort major
 ushort minor
 string name
 uint object_count
 uint detail_count
 uint light_count // extension 1.1
 object* objects[object_count]
 detail* details[detail_count]
 light* lights[light_count] // extension 1.1

object

 string model_file
 uint entity_count
 entity* entities[entity_count]

entity

 string material_file
 uint record_count
 record* records[record_count]

record

 vec3 pos
 vec3 scale
 quat rot

detail

 string model_file
 string material_file
 vec3 pos
 vec3 scale
 quat rot

light

 vec3 pos
 quat rot
 uint light_type       // The type of light: 1 = Spot Light, 2 = Point Light, 0 = Directional?
 float field_of_view   // Cone angle, in degrees. Set to -1.0 for Point Lights
 vec3 color

This is followed by additional, currently unknown data. This data might get truncated in future revisions.

 uint unknown1[2]
 byte unknown2[4]
 uint unknown3[2]
 vec3 unknownPos1
 quat unknownQuat1
 vec3 unknownPos2
 quat unknownQuat2
 vec3 unknownPos3
 quat unknownQuat3
 float unknown4[2]
 uint unknown5
 short unknown6[2]
 uint unknown7[2]

OWDELTA

This is the file format produced by OverTool "delta" mode.

V1

 uint header; //  0x444C5441 DLTA/ATLD
 string buildName;
 uint count;
 int records[count];

V2

 uint header; //  0x444C5442 DLTB/BTLD
 string buildName;
 uint count;
 DeltaRecord records[count];

DeltaRecord

 int size;
 char hash[16];

OWEFFECT

 string identifier;  // "oweffect"
 short major;
 short minor;
 uint guid;
 float length; // seconds
 int dmce_count;
 int cece_count
 int nece_count;
 int rpce_count;
 int fece_count;
 int osce_count;
 int svce_count;  // ver 1.1+
 dmce_info* dmces[dmce_count];
 cece_info* ceces[cece_count];
 nece_info* neces[nece_count];  // ver 1.1+
 rpce_info* rpces[rpce_count];
 svce_info* svces[svce_count];  // ver 1.2+

time_info

 bool use_time;
 float start_time;
 float end_time;
 string attachment;

svce_info

 time_info time;
 uint guid;
 int line_count;
 svce_line* lines[line_count];

svce_line

 int sound_count;
 svce_sound* sounds[sound_count];

svce_sound

 string file;

rpce_info

 time_info time;
 ulong model;
 ulong material;
 string model_file;

nece_info

 time_info time;
 ulong guid;
 uint variable_index;
 string entity_file;

dmce_info

 time_info time;
 ulong animation;
 ulong material;
 ulong model;
 string model_path  // .owmdl
 string animation_path  // .owanim  "null" = no anim

cece_info

 time_info time;
 cece_action action;
 ulong animation;
 ulong entity_variable;
 uint entity_variable_index;
 string animation_math; // "null" = no anim

cece_action

 enum cece_action : byte {  // todo: maybe u16/i16
   Show = 1,  // Animation is 0, todo: this is not right
   PlayAnim = 4
 }

OWANIM

OWAnimType

 enum OWAnimType {
   Unknown = -1,
   Data = 0,
   Reference = 1,
   Reset = 2  // unused
 }

Header

 string identifier; // "owanim"
 short major;
 short minor;
 uint guid_index;
 float fps;
 OWAnimType type;
 anim_data data; // if type == OWAnimType.Data
 anim_reference reference; // if type == OWAnimType.Reference
 

anim_data

 string seanim_path;
 string model_path;
 OWEFFECT effect;

anim reference

 string file

OWENTITY

 string identifier; // owentity
 short major;
 short minor;
 string thisName;
 string model;
 uint entityGUID;
 uint modelGUID;
 int childCount;
 childEntity* children[childCount];

childEntity

 string name;
 ulong hardpoint;  // 03C
 ulong variable;  // 01C
 uint hardpointIndex;
 uint variableIndex; 
 string hardpointName;