diff options
author | omniscient <17525998+omnisci3nce@users.noreply.github.com> | 2024-08-13 22:13:29 +1000 |
---|---|---|
committer | omniscient <17525998+omnisci3nce@users.noreply.github.com> | 2024-08-13 22:13:29 +1000 |
commit | d4df846c97a7fd216748806abdb729a11a0ce2ec (patch) | |
tree | c466b49a356904842f7fb5b7df7c43adfa1b91d7 /examples | |
parent | 567d384b698151e287e31140709c93f1b92e6db4 (diff) |
go
Diffstat (limited to 'examples')
-rw-r--r-- | examples/game_demo/game_demo.c | 8 | ||||
-rw-r--r-- | examples/skinned_animation/ex_skinned_animation.c | 23 |
2 files changed, 22 insertions, 9 deletions
diff --git a/examples/game_demo/game_demo.c b/examples/game_demo/game_demo.c index 65b31ba..919e306 100644 --- a/examples/game_demo/game_demo.c +++ b/examples/game_demo/game_demo.c @@ -107,10 +107,10 @@ int main() { // Shadow_Run(entities, entity_count); // Quat rot = quat_from_axis_angle(VEC3_X, HALF_PI, true); - // Immdraw_Sphere(transform_create(VEC3_ZERO, quat_ident(), vec3(1.0, 3.0, 1.0)), - // vec4(1.0, 0.0, 0.0, 1.0), true); - // Immdraw_Cuboid(transform_create(vec3(4.0, 0.0, 0.0), quat_ident(), vec3(3.0, 0.5, 3.0)), - // vec4(1.0, 0.0, 0.0, 1.0), true); + Immdraw_Sphere(transform_create(VEC3_ZERO, quat_ident(), vec3(1.0, 3.0, 1.0)), + vec4(1.0, 0.0, 0.0, 1.0), true); + Immdraw_Cuboid(transform_create(vec3(4.0, 0.0, 0.0), quat_ident(), vec3(3.0, 0.5, 3.0)), + vec4(1.0, 0.0, 0.0, 1.0), true); Immdraw_Bbox(transform_create(vec3(0.0, 0.0, 0.0), quat_ident(), vec3(2.0, 2.0, 2.0)), vec4(0.0, 1.0, 0.0, 1.0), true); diff --git a/examples/skinned_animation/ex_skinned_animation.c b/examples/skinned_animation/ex_skinned_animation.c index 7a44160..f7db62e 100644 --- a/examples/skinned_animation/ex_skinned_animation.c +++ b/examples/skinned_animation/ex_skinned_animation.c @@ -1,6 +1,7 @@ #include <assert.h> #include <glfw3.h> +#include "animation.h" #include "camera.h" #include "core.h" #include "loaders.h" @@ -39,9 +40,9 @@ int main() { // scene our_scene = make_default_scene(); - Vec3 cam_pos = vec3_create(0, 5, -8); - Camera camera = - Camera_Create(cam_pos, vec3_normalise(vec3_negate(cam_pos)), VEC3_Y, deg_to_rad(45.0)); + Vec3 cam_pos = vec3_create(0, 1.2, 4); + Camera cam = Camera_Create(cam_pos, VEC3_NEG_Z, VEC3_Y, deg_to_rad(45.0)); + SetCamera(cam); // Main loop const f32 camera_lateral_speed = 0.2; @@ -71,10 +72,22 @@ int main() { // Transform tf = transform_create(VEC3_ZERO, quat_ident(), 1.0); // TODO: Drawing should still just use the PBR pipeline - ModelExtractRenderEnts(rend_ents, handle, mat4_translation(vec3(0, -1, 0)), 0); + Mesh* m = Mesh_Get(simple_skin->meshes[0]); + RenderEnt render_ents[1] = { + (RenderEnt ){ .mesh = simple_skin->meshes[0], + .material = m->material, + .animation_clip = simple_skin->animations->data[0], + .is_playing = true, + .t = 0.0, + .affine = mat4_ident(), + .flags = 0 } + }; + // ModelExtractRenderEnts(rend_ents, handle, mat4_translation(vec3(0, 0, 0)), 0); // draw_skinned_model(&core->renderer, &game.camera, simple_skin, tf, &our_scene); - Render_RenderEntities(rend_ents->data, rend_ents->len); + Render_RenderEntities(render_ents, 1); + + // Animation_VisualiseJoints(&m->armature); RenderEnt_darray_clear(rend_ents); |