Skip to content

CEMtool Data Structure

zocker-160 edited this page Apr 22, 2020 · 2 revisions

CEMtool Python Data Structure

this is for developers, who want to use my CEM library for converting CEM file formats

the CEM file gets converted into 5 parts:

  • header
  • indices
  • materials
  • tag_points
  • frames

header

saved as dictionary with following entrys:

header{ 
"cem_version",     # uint32
"faces",        # uint32
"vertices",        # uint32
"tag_points",    # uint32
"materials",    # uint32
"frames",        # uint32
"child_models",    # uint32
"lod_levels",    # uint32
"name_length",    # uint32
"name",            # string
"center",        # tuple with 3 values for each axis (xVal, yVal, zVal) as f32
}

indices

saved as list:

indices[lod_level][0: number_faces]     # uint32
indices[lod_level][1: values_faces][face][0: xVal, 1: yVal, 2: zVal]

lod_level: index of the LOD level limited by header["lod_levels"] (type: uint32)

number_faces: number of faces in this lod_level (type: uint32)

face: index of the face limited by header["faces"] (type: uint32)

materials

saved as list:

materials[material_index]{
"material_name_length",        # uint32
"material_name",            # string
"texture_index",            # uint32
"triangle_selections",        # list of tuples (offset, length) as uint32 for each LOD level
"vertex_offset",             # uint32
"vertex_count",                # uint32
"texture_name_length",         # uint32
"texture_name"                 # string
}

tag_points

list of all tag_point names with length = header["tag_points"]

frames

saved as list:

frames[frame_index]{ 
"radius",                # f32
"vertices",                # list of vertex dictionarys (**)
"tag_points",            # list of tuples (xVal, yVal, zVal)
"transform_matrix",        # list of 4 lists with 4 values each (4x4 matrix)
"lower_bound",            # tuple with (xVal, yVal, zVal)
"upper_bound"            # tuple with (xVal, yVal, zVal)
}

vertex (**)

saved as dictionary:

vertex{
"point",         # tuple with (xVal, yVal, zVal)
"normal",         # tuple with (xVal, yVal, zVal)
"texture"        # tuple with (xVal, yVal)
}

example getting one vertex value: frames[frame_index]["vertices"][vertex_index]["point"/"normal"/"texture"][0: xVal, 1: yVal, 2:zVal]

Clone this wiki locally