Advertisement
liquidspark

Blam.h

Apr 24th, 2019
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 5.75 KB | None | 0 0
  1. #pragma once
  2. #include "stdint.h"
  3. typedef struct
  4. {
  5.     uint8_t val[32];
  6. } string;
  7. typedef int8_t char_integer;
  8. typedef int16_t short_integer;
  9. typedef int32_t long_integer;
  10. typedef float angle;
  11. typedef uint32_t tag;
  12. //typedef enum enum;
  13. typedef uint32_t long_flags;
  14. typedef uint16_t word_flags;
  15. typedef uint8_t byte_flags;
  16. typedef struct
  17. {
  18.     int16_t x, y;
  19. } point_2d;
  20. typedef struct
  21. {
  22.     int16_t top, left, bottom, right;
  23. } rectangle_2d;
  24. typedef struct
  25. {
  26.     uint8_t red, green, blue;
  27. } rgb_color;
  28. typedef struct
  29. {
  30.     uint8_t alpha, red, green, blue;
  31. } argb_color;
  32. typedef float real;
  33. typedef float real_fraction;
  34. typedef struct
  35. {
  36.     float x, y;
  37. } real_point_2d;
  38. typedef struct
  39. {
  40.     float x, y, z;
  41. } real_point_3d;
  42. typedef struct
  43. {
  44.     float i, j;
  45. } real_vector_2d;
  46. typedef struct
  47. {
  48.     float i, j, k;
  49. } real_vector_3d;
  50. typedef struct
  51. {
  52.     float i, j, k, w;
  53. } real_quaternion;
  54. typedef struct
  55. {
  56.     float yaw, pitch;
  57. } real_euler_angles_2d;
  58. typedef struct
  59. {
  60.     float yaw, pitch, roll;
  61. } real_euler_angles_3d;
  62. typedef struct
  63. {
  64.     float i, j, d;
  65. } real_plane_2d;
  66. typedef struct
  67. {
  68.     float i, j, k, d;
  69. } real_plane_3d;
  70. typedef struct
  71. {
  72.     float red, green, blue;
  73. } real_rgb_color;
  74. typedef struct
  75. {
  76.     float alpha, red, green, blue;
  77. } real_argb_color;
  78. typedef struct
  79. {
  80.     float hue, saturation, value;
  81. } real_hsv_color;
  82. typedef struct
  83. {
  84.     float alpha, hue, saturation, value;
  85. } real_ahsv_color;
  86. typedef struct
  87. {
  88.     int16_t from, to;
  89. } short_integer_bounds;
  90. typedef struct
  91. {
  92.     float left, right;
  93. } angle_bounds;
  94. typedef struct
  95. {
  96.     float from, to;
  97. } real_bounds;
  98. typedef struct
  99. {
  100.     float from, to;
  101. } fraction_bounds;
  102. typedef struct
  103. {
  104.     tag tag_class;
  105.     uint32_t path_address;
  106.     uint32_t path_length;
  107.     struct id { int16_t pos, neg; };
  108.     char* path;
  109. } tag_reference;
  110. typedef struct
  111. {
  112.     //const char* name;
  113.     //const uint32_t max_chunks;
  114.     //const uint32_t chunk_size;
  115.     uint32_t chunk_count;
  116.     uint32_t address;
  117.     uint32_t definition_address; // little endian
  118. } block; // this approach is silly
  119. typedef int16_t short_block_index;
  120. typedef int32_t long_block_index;
  121. typedef struct
  122. {
  123.     uint32_t length;
  124.     uint8_t pad[4];
  125.     uint32_t offset;
  126.     uint32_t address;   // pointer
  127.     uint32_t definition_address;
  128. } data;
  129. // array_start
  130. // array_end
  131. typedef uint8_t pad;
  132. // skip
  133. // explanation
  134. // custom
  135. // terminator_X
  136.  
  137. typedef struct
  138. {
  139.     pad p1[36];
  140.     tag tag_class;
  141.     uint32_t crc32;
  142.     int32_t header_length;
  143.     pad p2[8];
  144.     int16_t tag_version;
  145.     int16_t engine_version;
  146.     tag engine_class;
  147. } tag_header;
  148.  
  149. typedef struct
  150. {
  151.     char_integer region_index;
  152.     char_integer permutation_index;
  153.     char_integer node_index;
  154.     pad p1[1];
  155.     real_point_3d translation;
  156.     real_quaternion rotation;
  157. } model_marker_instance_block;
  158.  
  159. typedef struct
  160. {
  161.     string name;
  162.     short_integer magic_identifier;
  163.     pad p1[2];
  164.     pad p2[16];
  165.     block instances;
  166. } model_markers_block;
  167.  
  168. typedef struct
  169. {
  170.     string name;
  171.     short_block_index next_sibling_node_index;
  172.     short_block_index first_child_node_index;
  173.     short_block_index parent_node_index;
  174.     pad p1[2];
  175.     real_point_3d default_translation;
  176.     real_quaternion default_rotation;
  177.     real node_distance_from_parent;
  178.     pad p2[32];
  179.     pad p3[52];
  180. } model_node_block;
  181.  
  182. typedef struct
  183. {
  184.     string name;
  185.     short_block_index node_index;
  186.     pad p1[2];
  187.     real_quaternion rotation;
  188.     real_point_3d translation;
  189.     pad p2[16];
  190. } model_region_permutation_marker_block;
  191.  
  192. typedef struct
  193. {
  194.     string name;
  195.     long_flags flags;
  196.     pad p1[28];
  197.     short_block_index super_low;
  198.     short_block_index low;
  199.     short_block_index medium;
  200.     short_block_index high;
  201.     short_block_index super_high;
  202.     pad p2[2];
  203.     block markers;
  204. } model_region_permutation_block;
  205.  
  206. typedef struct
  207. {
  208.     string name;
  209.     pad p1[32];
  210.     block permutations;
  211. } model_region_block;
  212.  
  213. typedef struct
  214. {
  215.     real_point_3d position;
  216.     real_vector_3d normal;
  217.     real_vector_3d binormal;
  218.     real_vector_3d tangent;
  219.     real_point_2d texture_coords;
  220.     short_integer node0_index;
  221.     short_integer node1_index;
  222.     real node0_weight;
  223.     real node1_weight;
  224. } model_vertex_uncompressed_block;
  225.  
  226. typedef struct
  227. {
  228.     real_point_3d position;
  229.     long_integer normal;
  230.     long_integer binormal;
  231.     long_integer tangent;
  232.     short_integer texture_coordinate_u;
  233.     short_integer texture_coordinate_v;
  234.     char_integer node0_index;
  235.     char_integer node1_index;
  236.     short_integer node0_weight;
  237. } model_vertex_compressed_block;
  238.  
  239. typedef struct
  240. {
  241.     short_integer vertex0_index;
  242.     short_integer vertex1_index;
  243.     short_integer vertex2_index;
  244. } model_triangle_block;
  245.  
  246. typedef struct
  247. {
  248.     long_flags flags;
  249.     short_block_index shader_index;
  250.     char_integer prev_filthy_part_index;
  251.     char_integer next_filthy_part_index;
  252.     short_integer centroid_primary_node;
  253.     short_integer centroid_secondary_node;
  254.     real_fraction centroid_primary_weight;
  255.     real_fraction centroid_secondary_weight;
  256.     real_point_3d centroid;
  257.     block uncompressed_vertices;
  258.     block compressed_vertices;
  259.     block triangles;
  260.     pad p1[20];
  261.     pad p2[16];
  262. } model_geometry_part_block;
  263.  
  264. typedef struct
  265. {
  266.     long_flags flags;
  267.     pad p1[32];
  268.     block parts;
  269. } model_geometry_block;
  270.  
  271. typedef struct
  272. {
  273.     tag_reference shader;
  274.     short_integer permutation;
  275.     pad p1[2];
  276.     pad p2[12];
  277. } model_shader_reference_block;
  278.  
  279. typedef struct
  280. {
  281.     long_flags flags;
  282.     long_integer node_list_checksum;
  283.     real super_high_detail_cutoff;
  284.     real high_detail_cutoff;
  285.     real medium_detail_cutoff;
  286.     real low_detail_cutoff;
  287.     real super_low_detail_cutoff;
  288.     short_integer super_high_detail_node_count;
  289.     short_integer high_detail_node_count;
  290.     short_integer medium_detail_node_count;
  291.     short_integer low_detail_node_count;
  292.     short_integer super_low_detail_node_count;
  293.     pad p1[2];
  294.     pad p2[8];
  295.     real base_map_u_scale;
  296.     real base_map_v_scale;
  297.     pad p3[116];
  298.     block markers;
  299.     block nodes;
  300.     block regions;
  301.     block geometries;
  302.     block shaders;
  303. } model;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement