patterns: Added a few voxel model patterns (#74)

* patterns: added a few voxel model patterns

* patterns: updated qbcl

according to https://gist.github.com/tostc/7f049207a2e5a7ccb714499702b5e2fd

* readme: added new voxel format petterns to the readme

* tests: added vxl test file

* ccvxl: updated two fields
This commit is contained in:
Martin Gerhardy
2023-01-13 20:19:06 +01:00
committed by GitHub
parent 5ea7141cb7
commit 8ab2ff4ab1
6 changed files with 196 additions and 0 deletions

View File

@@ -65,6 +65,10 @@ Hex patterns, include patterns and magic files for the use with the ImHex Hex Ed
| CHM | | [`patterns/chm.hexpat`](patterns/chm.hexpat) | Windows HtmlHelp Data (ITSF / CHM) |
| DMG | | [`patterns/dmg.hexpat`](patterns/dmg.hexpat) | Apple Disk Image Trailer (DMG) |
| XBEH | `audio/x-xbox-executable` | [`patterns/xbeh.hexpat`](patterns/xbeh.hexpat) | Xbox executable |
| QBCL | | [`patterns/qbcl.hexpat`](patterns/qbcl.hexpat) | Qubicle voxel scene project file |
| CCHVA | | [`patterns/cchva.hexpat`](patterns/cchva.hexpat) | Command and Conquer Voxel Animation |
| CCVXL | | [`patterns/ccvxl.hexpat`](patterns/ccvxl.hexpat) | Command and Conquer Voxel Model |
| CCPAL | | [`patterns/ccpal.hexpat`](patterns/ccpal.hexpat) | Command and Conquer Voxel Palette |
### Scripts

30
patterns/cchva.hexpat Normal file
View File

@@ -0,0 +1,30 @@
// Command and conquer voxel animation format
struct vec4_s {
float x [[color("FF0000")]];
float y [[color("00FF00")]];
float z [[color("0000FF")]];
float w [[color("FFFF00")]];
};
struct mat3x4_s {
vec4_s row[3];
};
struct name_s {
char buffer[16] [[color("EECCCC")]];
};
struct hva_s {
name_s name;
u32 numFrames;
u32 numNodes;
name_s nodeNames[numNodes];
};
struct frame_s {
mat3x4_s mat[hva.numNodes];
};
hva_s hva @0x00;
frame_s frames[hva.numFrames] @sizeof(hva);

13
patterns/ccpal.hexpat Normal file
View File

@@ -0,0 +1,13 @@
// Command and conquer palette format
struct Color {
u8 r;
u8 g;
u8 b;
};
struct Palette {
Color colors[256];
};
Palette pal @0x00;

69
patterns/ccvxl.hexpat Normal file
View File

@@ -0,0 +1,69 @@
// Command and Conquer voxel model format
struct vec4_s {
float x [[color("FF0000")]];
float y [[color("00FF00")]];
float z [[color("0000FF")]];
float w [[color("FFFF00")]];
};
struct vec3_s {
float x [[color("FF0000")]];
float y [[color("00FF00")]];
float z [[color("0000FF")]];
};
struct mat3x4_s {
vec4_s row[3];
};
struct name_s {
char buffer[16] [[color("EECCCC")]];
};
struct color_s {
u8 r;
u8 g;
u8 b;
};
struct vxl_limb_header_s {
name_s name;
s32 limb_number;
u32 _reserved1;
u32 _reserved2;
};
struct vxl_limb_tailer_s {
u32 span_start_offset;
u32 span_end_offset;
u32 span_data_offset;
float scale;
mat3x4_s matrix;
vec3_s min_bounds;
vec3_s max_bounds;
u8 xsize;
u8 ysize;
u8 zsize;
u8 normal_type;
};
struct vxl_s {
name_s name;
u32 palette_count;
u32 limb_count;
u32 tailer_count;
u32 body_size;
u8 remap_start_index;
u8 remap_end_index;
color_s internal_palette[256];
vxl_limb_header_s _headers[limb_count];
u8 body[body_size];
vxl_limb_tailer_s _tailers[limb_count];
};
struct frame_s {
mat3x4_s mat[hva.numNodes];
};
vxl_s vxl @0x00;

80
patterns/qbcl.hexpat Normal file
View File

@@ -0,0 +1,80 @@
// Qubicle QBCL format
struct String {
u32 len;
char string[len];
};
struct Matrix {
u32 sizex;
u32 sizey;
u32 sizez;
s32 tx;
s32 ty;
s32 tz;
float pivotx;
float pivoty;
float pivotz;
u32 compressedDataSize;
u8 zip[compressedDataSize];
};
// Rotation matrix according to wikipedia
// https://en.wikipedia.org/wiki/Rotation_matrix#Basic_rotations
struct Matrices {
float row1[3];
float row2[3];
float row3[3];
};
using Node;
struct Model {
Matrices rotation;
u32 childCount;
Node nodes[childCount];
};
struct Compound {
Matrix matrix;
u32 childCount;
Node nodes[childCount];
};
struct Node {
u32 type;
u32 unknown;
String name;
u8 visible;
u8 unknown2;
u8 locked;
if (type == 0) {
Matrix matrix;
} else if (type == 1) {
Model model;
} else if (type == 2) {
Compound compound;
}
};
struct Header {
u32 magic;
u32 version;
u32 fileversion;
u32 thumbwidth;
u32 thumbheight;
char bgra[thumbwidth * thumbheight * 4];
String title;
String desc;
String metadata;
String author;
String company;
String website;
String copyright;
// Maybe change and creation time?
double time1;
double time2;
Node node;
};
Header hdr @0x00;

Binary file not shown.