Updated ozz-animation to version 0.14.1 @35b2efd4
This commit is contained in:
@@ -29,6 +29,7 @@ add_executable(sample_foot_ik
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/media/floor.ozz")
|
||||
target_link_libraries(sample_foot_ik
|
||||
sample_framework)
|
||||
target_copy_shared_libraries(sample_foot_ik)
|
||||
|
||||
set_target_properties(sample_foot_ik
|
||||
PROPERTIES FOLDER "samples")
|
||||
|
||||
+17
-23
@@ -25,34 +25,28 @@
|
||||
// //
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
#include <limits>
|
||||
|
||||
#include "framework/application.h"
|
||||
#include "framework/imgui.h"
|
||||
#include "framework/mesh.h"
|
||||
#include "framework/renderer.h"
|
||||
#include "framework/utils.h"
|
||||
#include "ozz/animation/runtime/animation.h"
|
||||
#include "ozz/animation/runtime/ik_aim_job.h"
|
||||
#include "ozz/animation/runtime/ik_two_bone_job.h"
|
||||
#include "ozz/animation/runtime/local_to_model_job.h"
|
||||
#include "ozz/animation/runtime/sampling_job.h"
|
||||
#include "ozz/animation/runtime/skeleton.h"
|
||||
|
||||
#include "ozz/base/log.h"
|
||||
|
||||
#include "ozz/base/maths/box.h"
|
||||
#include "ozz/base/maths/math_ex.h"
|
||||
#include "ozz/base/maths/simd_math.h"
|
||||
#include "ozz/base/maths/simd_quaternion.h"
|
||||
#include "ozz/base/maths/soa_transform.h"
|
||||
#include "ozz/base/maths/vec_float.h"
|
||||
|
||||
#include "ozz/options/options.h"
|
||||
|
||||
#include "framework/application.h"
|
||||
#include "framework/imgui.h"
|
||||
#include "framework/mesh.h"
|
||||
#include "framework/utils.h"
|
||||
|
||||
#include "framework/renderer.h"
|
||||
#include "framework/utils.h"
|
||||
|
||||
#include <limits>
|
||||
|
||||
// Skeleton archive can be specified as an option.
|
||||
OZZ_OPTIONS_DECLARE_STRING(skeleton,
|
||||
"Path to the skeleton (ozz archive format).",
|
||||
@@ -107,7 +101,7 @@ class FootIKSampleApplication : public ozz::sample::Application {
|
||||
FootIKSampleApplication()
|
||||
: pelvis_offset_(0.f, 0.f, 0.f),
|
||||
root_translation_(2.17f, 2.f, -2.06f),
|
||||
root_yaw_(2.f),
|
||||
root_yaw_(-2.f),
|
||||
foot_heigh_(.12f),
|
||||
weight_(1.f),
|
||||
soften_(1.f),
|
||||
@@ -186,7 +180,7 @@ class FootIKSampleApplication : public ozz::sample::Application {
|
||||
// Samples optimized animation at t = animation_time.
|
||||
ozz::animation::SamplingJob sampling_job;
|
||||
sampling_job.animation = &animation_;
|
||||
sampling_job.cache = &cache_;
|
||||
sampling_job.context = &context_;
|
||||
sampling_job.ratio = controller_.time_ratio();
|
||||
sampling_job.output = make_span(locals_);
|
||||
if (!sampling_job.Run()) {
|
||||
@@ -481,8 +475,8 @@ class FootIKSampleApplication : public ozz::sample::Application {
|
||||
}
|
||||
} else {
|
||||
// Renders skeleton only.
|
||||
success &= _renderer->DrawPosture(skeleton_, make_span(models_),
|
||||
offsetted_root);
|
||||
success &=
|
||||
_renderer->DrawPosture(skeleton_, make_span(models_), offsetted_root);
|
||||
}
|
||||
|
||||
// Showing joints
|
||||
@@ -557,8 +551,8 @@ class FootIKSampleApplication : public ozz::sample::Application {
|
||||
const int num_joints = skeleton_.num_joints();
|
||||
models_.resize(num_joints);
|
||||
|
||||
// Allocates a cache that matches animation requirements.
|
||||
cache_.Resize(num_joints);
|
||||
// Allocates a context that matches animation requirements.
|
||||
context_.Resize(num_joints);
|
||||
|
||||
// Finds left and right joints.
|
||||
if (!SetupLeg(skeleton_, kLeftJointNames, &legs_setup_[kLeft]) ||
|
||||
@@ -597,7 +591,7 @@ class FootIKSampleApplication : public ozz::sample::Application {
|
||||
bool SetupLeg(const ozz::animation::Skeleton& _skeleton,
|
||||
const char* _joint_names[3], LegSetup* _leg) {
|
||||
int found = 0;
|
||||
int joints[3] = {0, 0, 0};
|
||||
int joints[3] = {0};
|
||||
for (int i = 0; i < _skeleton.num_joints() && found != 3; i++) {
|
||||
const char* joint_name = _skeleton.joint_names()[i];
|
||||
if (std::strcmp(joint_name, _joint_names[found]) == 0) {
|
||||
@@ -742,8 +736,8 @@ class FootIKSampleApplication : public ozz::sample::Application {
|
||||
// Runtime animation.
|
||||
ozz::animation::Animation animation_;
|
||||
|
||||
// Sampling cache.
|
||||
ozz::animation::SamplingCache cache_;
|
||||
// Sampling context.
|
||||
ozz::animation::SamplingJob::Context context_;
|
||||
|
||||
// Buffer of local transforms as sampled from animation_.
|
||||
ozz::vector<ozz::math::SoaTransform> locals_;
|
||||
@@ -752,7 +746,7 @@ class FootIKSampleApplication : public ozz::sample::Application {
|
||||
ozz::vector<ozz::math::Float4x4> models_;
|
||||
|
||||
// Buffer of skinning matrices, result of the joint multiplication of the
|
||||
// inverse bind pose with the model space matrix.
|
||||
// inverse rest pose with the model space matrix.
|
||||
ozz::vector<ozz::math::Float4x4> skinning_matrices_;
|
||||
|
||||
// The mesh used by the sample.
|
||||
|
||||
Reference in New Issue
Block a user