Walking animation working on desktop and web

- Skeleton texture is clamp to edge because it's an NPOT on webgl 1
main
parent 4137372292
commit e7ac3ee43c

@ -135,7 +135,7 @@ for o in D.objects:
for strip in track.strips: for strip in track.strips:
anims.append(strip.action) anims.append(strip.action)
print(f"Writing {len(anims)} animations") print(f"Writing {len(anims)} animations")
assert(len(anims) == 1) assert len(anims) == 1, f"Expected the number of animations, {len(anims)}, to be 1, but it isn't"
for animation in anims: for animation in anims:
armature.animation_data.action = animation armature.animation_data.action = animation
startFrame = int(animation.frame_range.x) startFrame = int(animation.frame_range.x)

BIN
art/art.blend (Stored with Git LFS)

Binary file not shown.

@ -1093,6 +1093,12 @@ Armature load_armature(MD_Arena *arena, MD_String8 binary_file, MD_String8 armat
.pixel_format = SG_PIXELFORMAT_RGBA8, .pixel_format = SG_PIXELFORMAT_RGBA8,
.min_filter = SG_FILTER_NEAREST, .min_filter = SG_FILTER_NEAREST,
.mag_filter = SG_FILTER_NEAREST, .mag_filter = SG_FILTER_NEAREST,
// for webgl NPOT texures https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Tutorial/Using_textures_in_WebGL
.wrap_u = SG_WRAP_CLAMP_TO_EDGE,
.wrap_v = SG_WRAP_CLAMP_TO_EDGE,
.wrap_w = SG_WRAP_CLAMP_TO_EDGE,
.usage = SG_USAGE_STREAM, .usage = SG_USAGE_STREAM,
}); });
@ -1104,13 +1110,14 @@ Armature load_armature(MD_Arena *arena, MD_String8 binary_file, MD_String8 armat
{ {
for(int c = 0; c < 4; c++) for(int c = 0; c < 4; c++)
{ {
const float eps = 0.0001f;
if(r == c) if(r == c)
{ {
assert(should_be_identity.Elements[c][r] == 1.0f); assert(fabsf(should_be_identity.Elements[c][r] - 1.0f) < eps);
} }
else else
{ {
assert(should_be_identity.Elements[c][r] == 0.0f); assert(fabsf(should_be_identity.Elements[c][r] - 0.0f) < eps);
} }
} }
} }
@ -3075,8 +3082,8 @@ void init(void)
mesh_player = load_mesh(persistent_arena, binary_file, MD_S8Lit("Player.bin")); mesh_player = load_mesh(persistent_arena, binary_file, MD_S8Lit("Player.bin"));
binary_file = MD_LoadEntireFile(frame_arena, MD_S8Lit("assets/exported_3d/Armature.bin")); binary_file = MD_LoadEntireFile(frame_arena, MD_S8Lit("assets/exported_3d/WalkingArmature.bin"));
armature = load_armature(persistent_arena, binary_file, MD_S8Lit("Armature.bin")); armature = load_armature(persistent_arena, binary_file, MD_S8Lit("WalkingArmature.bin"));
@ -4883,27 +4890,6 @@ void frame(void)
Vec3 z = MulM4V3(cur->matrix_local, V3(0,0,cur->length)); Vec3 z = MulM4V3(cur->matrix_local, V3(0,0,cur->length));
Vec3 dot = MulM4V3(cur->matrix_local, V3(cur->length,0,cur->length)); Vec3 dot = MulM4V3(cur->matrix_local, V3(cur->length,0,cur->length));
Vec3 should_be_zero = MulM4V3(cur->inverse_model_space_pos, from);
assert(should_be_zero.x == 0.0);
assert(should_be_zero.y == 0.0);
assert(should_be_zero.z == 0.0);
if(cur->parent == 0)
{
// do some testing on the bone with no parent
Vec3 should_be_zero = MulM4V3(transform_to_mat(cur_pose_bone->parent_space_pose), V3(0,0,0));
// there is another bone, that's not at (0,0,0) in model space on the model
// for debugging purposes right now
assert(should_be_zero.y == 0.0);
/*
assert(should_be_zero.x == 0.0);
assert(should_be_zero.z == 0.0);
*/
}
// from, x, y, and z are like vertex points. They are model-space // from, x, y, and z are like vertex points. They are model-space
// points *around* the bones they should be influenced by. Now we // points *around* the bones they should be influenced by. Now we
// need to transform them according to how much the pose bones // need to transform them according to how much the pose bones

@ -12,7 +12,7 @@
#define ARROW_SPEED 200.0f #define ARROW_SPEED 200.0f
#define SECONDS_PER_ARROW 1.3f #define SECONDS_PER_ARROW 1.3f
#define ARENA_SIZE (1024*1024) #define ARENA_SIZE (1024*1024*10)
#define BIG_ARENA_SIZE (ARENA_SIZE * 8) #define BIG_ARENA_SIZE (ARENA_SIZE * 8)
#ifdef DEVTOOLS #ifdef DEVTOOLS

Loading…
Cancel
Save