Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build engine patterns #171

Open
mgerhardy opened this issue Sep 27, 2023 · 1 comment
Open

Build engine patterns #171

mgerhardy opened this issue Sep 27, 2023 · 1 comment

Comments

@mgerhardy
Copy link
Contributor

mgerhardy commented Sep 27, 2023

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
Copy link
Contributor

C3pa commented Jul 11, 2024

Have you considered opening a PR with your patterns?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants