Updated ozz-animation to version 0.14.1 @35b2efd4
This commit is contained in:
@@ -31,6 +31,7 @@ add_executable(sample_blend
|
||||
|
||||
target_link_libraries(sample_blend
|
||||
sample_framework)
|
||||
target_copy_shared_libraries(sample_blend)
|
||||
|
||||
set_target_properties(sample_blend
|
||||
PROPERTIES FOLDER "samples")
|
||||
|
||||
+1
-1
@@ -23,6 +23,6 @@ There are two ways to use the sample:
|
||||
|
||||
1. Load animations and skeleton. See "playback" sample for more details.
|
||||
2. Compute each animation time (in order to sync their duration) and samples each of them to get local-space transformations.
|
||||
3. Compute each animation (layer) blend weight and fills ozz::animation::BlendingJob object. BlendingJob object takes as input an array of BlendingJob::Layer representing each layer to blend: weight and local-space transformations (as outputed from the sampling stage). It also takes as input the skeleton bind-pose, which represents the default transformation of each joint. It is used by the blending algorithm as a fall-back when the accumulated layer weight is too small (under a threshold value which is also an input) to be used. The output of the blending job is a set of local-space transformations.
|
||||
3. Compute each animation (layer) blend weight and fills ozz::animation::BlendingJob object. BlendingJob object takes as input an array of BlendingJob::Layer representing each layer to blend: weight and local-space transformations (as outputed from the sampling stage). It also takes as input the skeleton rest-pose, which represents the default transformation of each joint. It is used by the blending algorithm as a fall-back when the accumulated layer weight is too small (under a threshold value which is also an input) to be used. The output of the blending job is a set of local-space transformations.
|
||||
4. Convert local-space transformations to model-space matrices using ozz::animation::LocalToModelJob. It takes as input the skeleton (to know about joint's hierarchy) and local-space transforms. Output is model-space matrices array.
|
||||
5. Model-space matrices array can then be used for rendering (to skin a mesh) or updating the scene graph.
|
||||
+11
-15
@@ -25,26 +25,22 @@
|
||||
// //
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
#include "framework/application.h"
|
||||
#include "framework/imgui.h"
|
||||
#include "framework/renderer.h"
|
||||
#include "framework/utils.h"
|
||||
#include "ozz/animation/runtime/animation.h"
|
||||
#include "ozz/animation/runtime/blending_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/math_ex.h"
|
||||
#include "ozz/base/maths/simd_math.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/renderer.h"
|
||||
#include "framework/utils.h"
|
||||
|
||||
// Skeleton archive can be specified as an option.
|
||||
OZZ_OPTIONS_DECLARE_STRING(skeleton,
|
||||
"Path to the skeleton (ozz archive format).",
|
||||
@@ -97,7 +93,7 @@ class BlendSampleApplication : public ozz::sample::Application {
|
||||
// Setup sampling job.
|
||||
ozz::animation::SamplingJob sampling_job;
|
||||
sampling_job.animation = &sampler.animation;
|
||||
sampling_job.cache = &sampler.cache;
|
||||
sampling_job.context = &sampler.context;
|
||||
sampling_job.ratio = sampler.controller.time_ratio();
|
||||
sampling_job.output = make_span(sampler.locals);
|
||||
|
||||
@@ -123,7 +119,7 @@ class BlendSampleApplication : public ozz::sample::Application {
|
||||
ozz::animation::BlendingJob blend_job;
|
||||
blend_job.threshold = threshold_;
|
||||
blend_job.layers = layers;
|
||||
blend_job.bind_pose = skeleton_.joint_bind_poses();
|
||||
blend_job.rest_pose = skeleton_.joint_rest_poses();
|
||||
blend_job.output = make_span(blended_locals_);
|
||||
|
||||
// Blends.
|
||||
@@ -216,8 +212,8 @@ class BlendSampleApplication : public ozz::sample::Application {
|
||||
// Allocates sampler runtime buffers.
|
||||
sampler.locals.resize(num_soa_joints);
|
||||
|
||||
// Allocates a cache that matches animation requirements.
|
||||
sampler.cache.Resize(num_joints);
|
||||
// Allocates a context that matches animation requirements.
|
||||
sampler.context.Resize(num_joints);
|
||||
}
|
||||
|
||||
// Allocates local space runtime buffers of blended data.
|
||||
@@ -319,14 +315,14 @@ class BlendSampleApplication : 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;
|
||||
} samplers_[kNumLayers]; // kNumLayers animations to blend.
|
||||
|
||||
// Blending job bind pose threshold.
|
||||
// Blending job rest pose threshold.
|
||||
float threshold_;
|
||||
|
||||
// Buffer of local transforms which stores the blending result.
|
||||
|
||||
Reference in New Issue
Block a user