ImHex-Patterns icon indicating copy to clipboard operation
ImHex-Patterns copied to clipboard

Build engine patterns

Open mgerhardy opened this issue 2 years ago • 1 comments

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

mgerhardy avatar Sep 27 '23 14:09 mgerhardy

Have you considered opening a PR with your patterns?

C3pa avatar Jul 11 '24 17:07 C3pa