Loading age @ efee155f Compare 75bf250b to efee155f Original line number Diff line number Diff line Subproject commit 75bf250bc17fbdd064c5e6df182055c27a3ee9da Subproject commit efee155f0875e07d5d763900b7a3d8a62c086beb src/maker/src/gui.cpp +10 −10 Original line number Diff line number Diff line Loading @@ -290,11 +290,11 @@ void render() { edited_player->set_paused(paused); edited_player->set_reversed(reversed); static bool blend_button = false; auto blended = anim::animation_system()->find_player<anim::BlendedPlayer>("blended.player"); static bool blend_button = true; auto blended = anim::animation_system()->find_player<anim::BlendedPlayer>("test_anim.player"); if (ImGui::Button("Blend")) { blend_button = !blend_button; blended->blend(anim::animation_system()->find_animation((blend_button) ? "wave.anim" : "swing.anim"), 0.5f); blended->blend(anim::animation_system()->find_animation((blend_button) ? "test_anim.anim" : "second_test.anim"), 0.5f); } ImGui::SameLine(); Loading Loading @@ -348,19 +348,19 @@ void render() { ImGui::RadioButton("constant", &interpolationIdx, static_cast<int>(anim::InterpolationType::CONSTANT)); ImGui::SameLine(); ImGui::RadioButton("linear", &interpolationIdx, static_cast<int>(anim::InterpolationType::LINEAR)); ImGui::SameLine(); ImGui::RadioButton("bezier", &interpolationIdx, static_cast<int>(anim::InterpolationType::BEZIER)); ImGui::SameLine(); ImGui::RadioButton("ease", &interpolationIdx, static_cast<int>(anim::InterpolationType::EASING)); //ImGui::SameLine(); ImGui::RadioButton("ease", &interpolationIdx, static_cast<int>(anim::InterpolationType::EASING)); ImGui::SameLine(); // ImGui::PushItemWidth(100); ImGui::PushItemWidth(100); // ImGuiSliderFlags slider_flags = ImGuiSliderFlags_Logarithmic; // ImGui::DragFloat("easing", &easingFactor, 0.02f, -10.f, 10.f, nullptr, slider_flags); // ImGui::SameLine(); // static auto partial_blender = anim::animation_system()->players()->locate<anim::PartialBlendPlayer>({"partial_blender.player"}); static auto partial_blender = anim::animation_system()->players()->locate<anim::PartialBlendPlayer>({"partial_blender.player"}); // float blend_alpha = partial_blender->alpha(); // ImGui::DragFloat("blend", &blend_alpha, 0.002f, 0.f, 1.f, nullptr); // partial_blender->set_alpha(blend_alpha); // ImGui::PopItemWidth(); float blend_alpha = partial_blender->alpha(); ImGui::DragFloat("blend", &blend_alpha, 0.002f, 0.f, 1.f, nullptr); partial_blender->set_alpha(blend_alpha); ImGui::PopItemWidth(); prev_animation = edited_animation_index; Loading src/maker/src/presenter.cpp +108 −14 Original line number Diff line number Diff line Loading @@ -158,7 +158,8 @@ void main() { my_frame2->move_origin_z(5); auto* cube_object = gfx::object_system()->objects()->locate<com::Folder>({"game", "gltf_box__gltf_box_Cube.0010"}); auto* my_new_frame_link = gfx::object_system()->push_frame_back(cube_object, my_frame2); auto* orig_instance = dynamic_cast<com::Folder*>(cube_object->locate<com::Link>({"skeletons", "link.link"})->target()); auto* orig_instance = dynamic_cast<com::Folder*>(cube_object->locate<com::Link>({"skeletons", "link.link"})->target())/* ->folder() */; print_tree(com::Folder::root(), std::cout); auto* instance = orig_instance->folder()->copy_back(orig_instance, orig_instance->name() + "2"); cube_object->find<com::Folder>("skeletons")->push_back<com::Link>(my_new_frame_link->name(), instance); Loading @@ -175,12 +176,11 @@ void main() { auto catwalk_material = gfx::material_system()->insert_material("gltf_catwalk_material", lit_skinning_shader, { "maker" }); catwalk_material->set_uniform("color", vec3{ 0.0f, 0.75f, 1.f }); // utils::import_gltf(root(), "models/stand.gltf", "gltf_human", human_material, vec3{2, 4, 0}); // utils::import_gltf(root(), "models/dance.gltf", "gltf_dance", nullptr, vec3{-5, 4, 0}); // utils::import_gltf(root(), "models/catwalk.gltf", "gltf_catwalk", nullptr, vec3{8, 4, 0}); // utils::import_gltf(root(), "models/gunplay.gltf", "gltf_gunplay", nullptr); // utils::import_gltf(root(), "models/walk_and_gun.gltf", "gltf_walk_and_gun", walk_material, vec3{-2, 4, 0}/* , identity<quat>(), "gltf_human" */); // utils::import_gltf(instances, "models/stand.gltf", "gltf_human", human_material, vec3{2, 4, 0}); // utils::import_gltf(instances, "models/dance.gltf", "gltf_dance", nullptr, vec3{-5, 4, 0}); // utils::import_gltf(instances, "models/catwalk.gltf", "gltf_catwalk", nullptr, vec3{8, 4, 0}); // utils::import_gltf(instances, "models/gunplay.gltf", "gltf_gunplay", nullptr); // utils::import_gltf(instances, "models/walk_and_gun.gltf", "gltf_walk_and_gun", walk_material, vec3{-2, 4, 0}/* , identity<quat>(), "gltf_human" */); // --- END HUMAN --- Loading Loading @@ -479,6 +479,16 @@ void main() { } ); test_anim->add_track( "left_pos_y", com::Folder::root()->locate<com::Frame>({ "anim", "instances", "gltf_box", "Armature", "Bone.Root", "Bone.L", "frame"}), "set_origin_y", anim::Keyframes<scalar>{ {0, 0.f, -2.f}, {5, 0.f, -2.f}, } ); auto original_rotation = com::Folder::root()->locate<com::Frame>({ "anim", "instances", "gltf_box", "Armature", "Bone.Root", "Bone.R", "frame"})->rotation(); test_anim->add_track( Loading @@ -493,18 +503,102 @@ void main() { } ); auto second_test = anim::animation_system()->insert_animation_with_player("second_test"); auto second_test = anim::animation_system()->insert_animation("second_test"); // second_test->add_track( // "second_instance", // com::Folder::root()->locate<com::Frame>({ "anim", "instances", "gltf_box", "Armature", "Bone.Root", "Bone.R", "frame"}), // "set_origin", // anim::Keyframes<vec3>{ // {0, {3, -1, 0}}, // {1, {3, 1, 0}}, // {2, {3, -1, 0}} // } // ); second_test->add_track( "left_pos", com::Folder::root()->locate<com::Frame>({ "anim", "instances", "gltf_box", "Armature", "Bone.Root", "Bone.L", "frame"}), "set_origin_x", anim::Keyframes<scalar>{ {0, 0.f, -2.f}, {1.5, -2, -2}, {5, 0.f, -2.f}, } ); second_test->add_track( "left_pos_y", com::Folder::root()->locate<com::Frame>({ "anim", "instances", "gltf_box", "Armature", "Bone.Root", "Bone.L", "frame"}), "set_origin_y", anim::Keyframes<scalar>{ {0, 0.f, -2.f}, {2.5, 2.f, -2.f}, {5, 0.f, -2.f}, } ); second_test->add_track( "second_instance", "bone_1_rot", com::Folder::root()->locate<com::Frame>({ "anim", "instances", "gltf_box", "Armature", "Bone.Root", "Bone.R", "frame"}), "set_rotation", anim::Keyframes<quat>{ {0, original_rotation * quat(vec3(0, 0, 0))}, {1.3, original_rotation * quat(vec3(0, 0, 1.57))}, {3.7, original_rotation * quat(vec3(0, 0, -1.57))}, {5, original_rotation * quat(vec3(0, 0, 0))}, } ); auto partial_blend_a = anim::animation_system()->insert_animation_with_player("partial_blend_a"); partial_blend_a->add_track( "left_pos", com::Folder::root()->locate<com::Frame>({ "anim", "instances", "gltf_box", "Armature2", "Bone.Root", "Bone.L", "frame"}), "set_origin_x", anim::Keyframes<scalar>{ {0, 0.f, -2.f}, {2.5, -2.f, -2.f}, {5, 0.f, -2.f}, } ); partial_blend_a->add_track( "left_pos_y", com::Folder::root()->locate<com::Frame>({ "anim", "instances", "gltf_box", "Armature2", "Bone.Root", "Bone.L", "frame"}), "set_origin_y", anim::Keyframes<scalar>{ {0, 0.f, -2.f}, {5, 0.f, -2.f}, } ); partial_blend_a->add_track( "bone_1_rot", com::Folder::root()->locate<com::Frame>({ "anim", "instances", "gltf_box", "Armature2", "Bone.Root", "Bone.R", "frame"}), "set_origin", anim::Keyframes<vec3>{ {0, {3, -1, 0}}, {1, {3, 1, 0}}, {2, {3, -1, 0}} "set_rotation", anim::Keyframes<quat>{ {0, original_rotation * quat(vec3(0, 0, 0))}, {1.3, original_rotation * quat(vec3(1.57, 0, 0))}, {3.7, original_rotation * quat(vec3(-1.57, 0, 0))}, {5, original_rotation * quat(vec3(0, 0, 0))}, } ); auto partial_blend_b = anim::animation_system()->insert_animation_with_player("partial_blend_b"); partial_blend_b->add_track( "left_pos_y", com::Folder::root()->locate<com::Frame>({ "anim", "instances", "gltf_box", "Armature2", "Bone.Root", "Bone.L", "frame"}), "set_origin_y", anim::Keyframes<scalar>{ {0, 0.f, -2.f}, {2.5, 2.f, -2.f}, {5, 0.f, -2.f}, } ); anim::NameWeightMap weight_map = { { "left_pos_y.track", 1.0_s }, }; auto my_partial_blender = anim::animation_system()->players() ->push_back<anim::PartialBlendPlayer>("partial_blender.player", partial_blend_a, partial_blend_b, weight_map); // --- END skeleton --- // --- BEGIN human --- Loading Loading
age @ efee155f Compare 75bf250b to efee155f Original line number Diff line number Diff line Subproject commit 75bf250bc17fbdd064c5e6df182055c27a3ee9da Subproject commit efee155f0875e07d5d763900b7a3d8a62c086beb
src/maker/src/gui.cpp +10 −10 Original line number Diff line number Diff line Loading @@ -290,11 +290,11 @@ void render() { edited_player->set_paused(paused); edited_player->set_reversed(reversed); static bool blend_button = false; auto blended = anim::animation_system()->find_player<anim::BlendedPlayer>("blended.player"); static bool blend_button = true; auto blended = anim::animation_system()->find_player<anim::BlendedPlayer>("test_anim.player"); if (ImGui::Button("Blend")) { blend_button = !blend_button; blended->blend(anim::animation_system()->find_animation((blend_button) ? "wave.anim" : "swing.anim"), 0.5f); blended->blend(anim::animation_system()->find_animation((blend_button) ? "test_anim.anim" : "second_test.anim"), 0.5f); } ImGui::SameLine(); Loading Loading @@ -348,19 +348,19 @@ void render() { ImGui::RadioButton("constant", &interpolationIdx, static_cast<int>(anim::InterpolationType::CONSTANT)); ImGui::SameLine(); ImGui::RadioButton("linear", &interpolationIdx, static_cast<int>(anim::InterpolationType::LINEAR)); ImGui::SameLine(); ImGui::RadioButton("bezier", &interpolationIdx, static_cast<int>(anim::InterpolationType::BEZIER)); ImGui::SameLine(); ImGui::RadioButton("ease", &interpolationIdx, static_cast<int>(anim::InterpolationType::EASING)); //ImGui::SameLine(); ImGui::RadioButton("ease", &interpolationIdx, static_cast<int>(anim::InterpolationType::EASING)); ImGui::SameLine(); // ImGui::PushItemWidth(100); ImGui::PushItemWidth(100); // ImGuiSliderFlags slider_flags = ImGuiSliderFlags_Logarithmic; // ImGui::DragFloat("easing", &easingFactor, 0.02f, -10.f, 10.f, nullptr, slider_flags); // ImGui::SameLine(); // static auto partial_blender = anim::animation_system()->players()->locate<anim::PartialBlendPlayer>({"partial_blender.player"}); static auto partial_blender = anim::animation_system()->players()->locate<anim::PartialBlendPlayer>({"partial_blender.player"}); // float blend_alpha = partial_blender->alpha(); // ImGui::DragFloat("blend", &blend_alpha, 0.002f, 0.f, 1.f, nullptr); // partial_blender->set_alpha(blend_alpha); // ImGui::PopItemWidth(); float blend_alpha = partial_blender->alpha(); ImGui::DragFloat("blend", &blend_alpha, 0.002f, 0.f, 1.f, nullptr); partial_blender->set_alpha(blend_alpha); ImGui::PopItemWidth(); prev_animation = edited_animation_index; Loading
src/maker/src/presenter.cpp +108 −14 Original line number Diff line number Diff line Loading @@ -158,7 +158,8 @@ void main() { my_frame2->move_origin_z(5); auto* cube_object = gfx::object_system()->objects()->locate<com::Folder>({"game", "gltf_box__gltf_box_Cube.0010"}); auto* my_new_frame_link = gfx::object_system()->push_frame_back(cube_object, my_frame2); auto* orig_instance = dynamic_cast<com::Folder*>(cube_object->locate<com::Link>({"skeletons", "link.link"})->target()); auto* orig_instance = dynamic_cast<com::Folder*>(cube_object->locate<com::Link>({"skeletons", "link.link"})->target())/* ->folder() */; print_tree(com::Folder::root(), std::cout); auto* instance = orig_instance->folder()->copy_back(orig_instance, orig_instance->name() + "2"); cube_object->find<com::Folder>("skeletons")->push_back<com::Link>(my_new_frame_link->name(), instance); Loading @@ -175,12 +176,11 @@ void main() { auto catwalk_material = gfx::material_system()->insert_material("gltf_catwalk_material", lit_skinning_shader, { "maker" }); catwalk_material->set_uniform("color", vec3{ 0.0f, 0.75f, 1.f }); // utils::import_gltf(root(), "models/stand.gltf", "gltf_human", human_material, vec3{2, 4, 0}); // utils::import_gltf(root(), "models/dance.gltf", "gltf_dance", nullptr, vec3{-5, 4, 0}); // utils::import_gltf(root(), "models/catwalk.gltf", "gltf_catwalk", nullptr, vec3{8, 4, 0}); // utils::import_gltf(root(), "models/gunplay.gltf", "gltf_gunplay", nullptr); // utils::import_gltf(root(), "models/walk_and_gun.gltf", "gltf_walk_and_gun", walk_material, vec3{-2, 4, 0}/* , identity<quat>(), "gltf_human" */); // utils::import_gltf(instances, "models/stand.gltf", "gltf_human", human_material, vec3{2, 4, 0}); // utils::import_gltf(instances, "models/dance.gltf", "gltf_dance", nullptr, vec3{-5, 4, 0}); // utils::import_gltf(instances, "models/catwalk.gltf", "gltf_catwalk", nullptr, vec3{8, 4, 0}); // utils::import_gltf(instances, "models/gunplay.gltf", "gltf_gunplay", nullptr); // utils::import_gltf(instances, "models/walk_and_gun.gltf", "gltf_walk_and_gun", walk_material, vec3{-2, 4, 0}/* , identity<quat>(), "gltf_human" */); // --- END HUMAN --- Loading Loading @@ -479,6 +479,16 @@ void main() { } ); test_anim->add_track( "left_pos_y", com::Folder::root()->locate<com::Frame>({ "anim", "instances", "gltf_box", "Armature", "Bone.Root", "Bone.L", "frame"}), "set_origin_y", anim::Keyframes<scalar>{ {0, 0.f, -2.f}, {5, 0.f, -2.f}, } ); auto original_rotation = com::Folder::root()->locate<com::Frame>({ "anim", "instances", "gltf_box", "Armature", "Bone.Root", "Bone.R", "frame"})->rotation(); test_anim->add_track( Loading @@ -493,18 +503,102 @@ void main() { } ); auto second_test = anim::animation_system()->insert_animation_with_player("second_test"); auto second_test = anim::animation_system()->insert_animation("second_test"); // second_test->add_track( // "second_instance", // com::Folder::root()->locate<com::Frame>({ "anim", "instances", "gltf_box", "Armature", "Bone.Root", "Bone.R", "frame"}), // "set_origin", // anim::Keyframes<vec3>{ // {0, {3, -1, 0}}, // {1, {3, 1, 0}}, // {2, {3, -1, 0}} // } // ); second_test->add_track( "left_pos", com::Folder::root()->locate<com::Frame>({ "anim", "instances", "gltf_box", "Armature", "Bone.Root", "Bone.L", "frame"}), "set_origin_x", anim::Keyframes<scalar>{ {0, 0.f, -2.f}, {1.5, -2, -2}, {5, 0.f, -2.f}, } ); second_test->add_track( "left_pos_y", com::Folder::root()->locate<com::Frame>({ "anim", "instances", "gltf_box", "Armature", "Bone.Root", "Bone.L", "frame"}), "set_origin_y", anim::Keyframes<scalar>{ {0, 0.f, -2.f}, {2.5, 2.f, -2.f}, {5, 0.f, -2.f}, } ); second_test->add_track( "second_instance", "bone_1_rot", com::Folder::root()->locate<com::Frame>({ "anim", "instances", "gltf_box", "Armature", "Bone.Root", "Bone.R", "frame"}), "set_rotation", anim::Keyframes<quat>{ {0, original_rotation * quat(vec3(0, 0, 0))}, {1.3, original_rotation * quat(vec3(0, 0, 1.57))}, {3.7, original_rotation * quat(vec3(0, 0, -1.57))}, {5, original_rotation * quat(vec3(0, 0, 0))}, } ); auto partial_blend_a = anim::animation_system()->insert_animation_with_player("partial_blend_a"); partial_blend_a->add_track( "left_pos", com::Folder::root()->locate<com::Frame>({ "anim", "instances", "gltf_box", "Armature2", "Bone.Root", "Bone.L", "frame"}), "set_origin_x", anim::Keyframes<scalar>{ {0, 0.f, -2.f}, {2.5, -2.f, -2.f}, {5, 0.f, -2.f}, } ); partial_blend_a->add_track( "left_pos_y", com::Folder::root()->locate<com::Frame>({ "anim", "instances", "gltf_box", "Armature2", "Bone.Root", "Bone.L", "frame"}), "set_origin_y", anim::Keyframes<scalar>{ {0, 0.f, -2.f}, {5, 0.f, -2.f}, } ); partial_blend_a->add_track( "bone_1_rot", com::Folder::root()->locate<com::Frame>({ "anim", "instances", "gltf_box", "Armature2", "Bone.Root", "Bone.R", "frame"}), "set_origin", anim::Keyframes<vec3>{ {0, {3, -1, 0}}, {1, {3, 1, 0}}, {2, {3, -1, 0}} "set_rotation", anim::Keyframes<quat>{ {0, original_rotation * quat(vec3(0, 0, 0))}, {1.3, original_rotation * quat(vec3(1.57, 0, 0))}, {3.7, original_rotation * quat(vec3(-1.57, 0, 0))}, {5, original_rotation * quat(vec3(0, 0, 0))}, } ); auto partial_blend_b = anim::animation_system()->insert_animation_with_player("partial_blend_b"); partial_blend_b->add_track( "left_pos_y", com::Folder::root()->locate<com::Frame>({ "anim", "instances", "gltf_box", "Armature2", "Bone.Root", "Bone.L", "frame"}), "set_origin_y", anim::Keyframes<scalar>{ {0, 0.f, -2.f}, {2.5, 2.f, -2.f}, {5, 0.f, -2.f}, } ); anim::NameWeightMap weight_map = { { "left_pos_y.track", 1.0_s }, }; auto my_partial_blender = anim::animation_system()->players() ->push_back<anim::PartialBlendPlayer>("partial_blender.player", partial_blend_a, partial_blend_b, weight_map); // --- END skeleton --- // --- BEGIN human --- Loading