WerWolv / ImHex-Patterns

Hex patterns, include patterns and magic files for the use with the ImHex Hex Editor
https://github.com/WerWolv/ImHex
GNU General Public License v2.0
637 stars 168 forks source link

Build engine patterns #171

Open mgerhardy opened 11 months ago

mgerhardy commented 11 months ago

KV6 Voxel model format

#include <std/array.pat>

struct color {
  u8 b;
  u8 g;
  u8 r;
};

bitfield VisMask {
  left : 1;
  right : 1;
  front : 1;
  back : 1;
  up : 1;
  down : 1;  
  upadding : 2;
};

struct kv6 {
    color col;
    u8 always128;
    u8 z;
    u8 always0;
    VisMask visMask;
    u8 direction;
};

struct Header {
    u32 magic;
    u32 width;
    u32 depth;
    u32 height;
    float pivot_x;
    float pivot_y;
    float pivot_z;
    u32 voxels;
    kv6 data[voxels];
    u32 xoffsets[width];
    std::Array<u16, depth * width> xyoffsets;
   // u32 palMagic; // optional if there is still space left in the file
   // color colors[256];
};

Header hdr @0x00;

KFA File (KV6 Animation) kfa.hexpat

struct point3d {
    float x;
    float y;
    float z;
};

struct hingetype {
    s32 parenthinge;
    point3d childPoint;
    point3d parentPoint;
    point3d childAxisRotationVector;
    point3d parentAxisRotationVector;
    s16 vmin;
    s16 vmax;
    s8 htype;
    s8 filler[7];
};

struct seqtyp {
    s32 timeMillis;
    s32 frm;
};

struct Header {
    u32 magic;
    u32 stringlen;
    u8 filename[stringlen];
    u32 numhinge;
    hingetype hinge[numhinge];
    u32 numfrm;
    // These are the hinge angles. 0 is 0 degrees, 16384 is 90 degrees, -16384 is -90 degrees
    s16 frmval[numfrm * numhinge]; //[numfrm][numhinge]
    u32 seqnum;
    seqtyp seq[seqnum];
};

Header hdr @0x00;

example files: https://github.com/Ericson2314/Voxlap/blob/no-asm/share/voxdata.zip

C3pa commented 1 month ago

Have you considered opening a PR with your patterns?