|
|
@ -815,6 +815,7 @@ typedef struct Bone
|
|
|
|
{
|
|
|
|
{
|
|
|
|
struct Bone *next;
|
|
|
|
struct Bone *next;
|
|
|
|
Mat4 matrix_local;
|
|
|
|
Mat4 matrix_local;
|
|
|
|
|
|
|
|
float length;
|
|
|
|
} Bone;
|
|
|
|
} Bone;
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
typedef struct
|
|
|
@ -929,7 +930,7 @@ Bone *load_armature(MD_Arena *arena, MD_String8 binary_file, MD_String8 armature
|
|
|
|
BlenderMat b;
|
|
|
|
BlenderMat b;
|
|
|
|
ser_BlenderMat(&ser, &b);
|
|
|
|
ser_BlenderMat(&ser, &b);
|
|
|
|
next_bone->matrix_local = blender_to_handmade_mat(b);
|
|
|
|
next_bone->matrix_local = blender_to_handmade_mat(b);
|
|
|
|
|
|
|
|
ser_float(&ser, &next_bone->length);
|
|
|
|
MD_StackPush(to_return, next_bone);
|
|
|
|
MD_StackPush(to_return, next_bone);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
assert(!ser.cur_error.failed);
|
|
|
|
assert(!ser.cur_error.failed);
|
|
|
@ -2530,6 +2531,7 @@ void audio_stream_callback(float *buffer, int num_frames, int num_channels)
|
|
|
|
#define RED ((Color) { 1.0f, 0.0f, 0.0f, 1.0f })
|
|
|
|
#define RED ((Color) { 1.0f, 0.0f, 0.0f, 1.0f })
|
|
|
|
#define PINK ((Color) { 1.0f, 0.0f, 1.0f, 1.0f })
|
|
|
|
#define PINK ((Color) { 1.0f, 0.0f, 1.0f, 1.0f })
|
|
|
|
#define BLUE ((Color) { 0.0f, 0.0f, 1.0f, 1.0f })
|
|
|
|
#define BLUE ((Color) { 0.0f, 0.0f, 1.0f, 1.0f })
|
|
|
|
|
|
|
|
#define LIGHTBLUE ((Color) { 0.2f, 0.2f, 0.8f, 1.0f })
|
|
|
|
#define GREEN ((Color) { 0.0f, 1.0f, 0.0f, 1.0f })
|
|
|
|
#define GREEN ((Color) { 0.0f, 1.0f, 0.0f, 1.0f })
|
|
|
|
#define BROWN (colhex(0x4d3d25))
|
|
|
|
#define BROWN (colhex(0x4d3d25))
|
|
|
|
|
|
|
|
|
|
|
@ -3364,7 +3366,7 @@ void dbgsquare(Vec2 at)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
#ifdef DEVTOOLS
|
|
|
|
#ifdef DEVTOOLS
|
|
|
|
if (!show_devtools) return;
|
|
|
|
if (!show_devtools) return;
|
|
|
|
colorquad(quad_centered(at, V2(3.0, 3.0)), debug_color);
|
|
|
|
colorquad(quad_centered(at, V2(10.0, 10.0)), debug_color);
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
(void)at;
|
|
|
|
(void)at;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
@ -3483,6 +3485,12 @@ void colorquadplane(Quad q, Color col)
|
|
|
|
colorquad(warped, col);
|
|
|
|
colorquad(warped, col);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void dbgsquare3d(Vec3 point)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Vec2 in_screen = threedee_to_screenspace(point);
|
|
|
|
|
|
|
|
dbgsquare(in_screen);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void dbgplanesquare(Vec2 at)
|
|
|
|
void dbgplanesquare(Vec2 at)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(!show_devtools) return;
|
|
|
|
if(!show_devtools) return;
|
|
|
@ -4477,17 +4485,16 @@ void frame(void)
|
|
|
|
for(Bone *cur = bones; cur; cur = cur->next)
|
|
|
|
for(Bone *cur = bones; cur; cur = cur->next)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Vec3 offset = V3(5, 0, 5);
|
|
|
|
Vec3 offset = V3(5, 0, 5);
|
|
|
|
if(cur->next)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Vec3 from = MulM4V3(cur->matrix_local, V3(0,0,0));
|
|
|
|
Vec3 from = MulM4V3(cur->matrix_local, V3(0,0,0));
|
|
|
|
Vec3 to = MulM4V3(cur->next->matrix_local, V3(0,0,0));
|
|
|
|
Vec3 to = MulM4V3(cur->matrix_local, V3(0,cur->length,0));
|
|
|
|
|
|
|
|
|
|
|
|
from = AddV3(from, offset);
|
|
|
|
from = AddV3(from, offset);
|
|
|
|
to = AddV3(to, offset);
|
|
|
|
to = AddV3(to, offset);
|
|
|
|
|
|
|
|
dbgcol(LIGHTBLUE)
|
|
|
|
|
|
|
|
dbgsquare3d(to);
|
|
|
|
dbgcol(BLUE)
|
|
|
|
dbgcol(BLUE)
|
|
|
|
dbg3dline(from, to);
|
|
|
|
dbg3dline(from, to);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for(PlacedMesh *cur = level_threedee.placed_mesh_list; cur; cur = cur->next)
|
|
|
|
for(PlacedMesh *cur = level_threedee.placed_mesh_list; cur; cur = cur->next)
|
|
|
|