Renamed AnimData to Pose.
This commit is contained in:
@@ -15,9 +15,9 @@ bool AnimGraphBlendTree::Init(AnimGraphContext& context) {
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < m_animdata_blocks.size(); i++) {
|
||||
for (size_t i = 0; i < m_pose_blocks.size(); i++) {
|
||||
int num_soa_joints = context.m_skeleton->num_soa_joints();
|
||||
m_animdata_blocks[i]->m_local_matrices.resize(num_soa_joints);
|
||||
m_pose_blocks[i]->m_local_matrices.resize(num_soa_joints);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -13,8 +13,6 @@
|
||||
// AnimGraph (Runtime)
|
||||
//
|
||||
struct AnimGraphBlendTree : public AnimNode {
|
||||
AnimData m_local_transforms;
|
||||
|
||||
std::vector<AnimNode*> m_nodes;
|
||||
std::vector<AnimNode*> m_eval_ordered_nodes;
|
||||
std::vector<std::vector<AnimGraphConnection> > m_node_input_connections;
|
||||
@@ -30,7 +28,7 @@ struct AnimGraphBlendTree : public AnimNode {
|
||||
return m_node_input_connections[0];
|
||||
}
|
||||
|
||||
std::vector<AnimData*> m_animdata_blocks;
|
||||
std::vector<Pose*> m_pose_blocks;
|
||||
NodeDescriptorBase* m_node_descriptor = nullptr;
|
||||
char* m_input_buffer = nullptr;
|
||||
char* m_output_buffer = nullptr;
|
||||
@@ -67,10 +65,10 @@ struct AnimGraphBlendTree : public AnimNode {
|
||||
void PropagateTimeToNodeInputs(const AnimNode* node);
|
||||
|
||||
void dealloc() {
|
||||
for (size_t i = 0; i < m_animdata_blocks.size(); i++) {
|
||||
m_animdata_blocks[i]->m_local_matrices.vector::~vector();
|
||||
for (size_t i = 0; i < m_pose_blocks.size(); i++) {
|
||||
m_pose_blocks[i]->m_local_matrices.vector::~vector();
|
||||
}
|
||||
m_animdata_blocks.clear();
|
||||
m_pose_blocks.clear();
|
||||
|
||||
m_node_input_connections.clear();
|
||||
m_node_output_connections.clear();
|
||||
|
||||
@@ -25,26 +25,26 @@
|
||||
struct AnimGraph;
|
||||
struct AnimNode;
|
||||
|
||||
struct AnimData {
|
||||
struct Pose {
|
||||
ozz::vector<ozz::math::SoaTransform> m_local_matrices;
|
||||
};
|
||||
|
||||
struct AnimDataRef {
|
||||
AnimData* ptr = nullptr;
|
||||
Pose* ptr = nullptr;
|
||||
};
|
||||
|
||||
struct AnimDataAllocator {
|
||||
struct AnimDataList {
|
||||
AnimData* m_anim_data = nullptr;
|
||||
AnimDataList* next = nullptr;
|
||||
struct PoseList {
|
||||
Pose* m_anim_data = nullptr;
|
||||
PoseList* next = nullptr;
|
||||
};
|
||||
|
||||
std::list<AnimData*> m_anim_data_list;
|
||||
std::list<Pose*> m_anim_data_list;
|
||||
size_t m_num_allocations = 0;
|
||||
|
||||
~AnimDataAllocator() {
|
||||
while (!m_anim_data_list.empty()) {
|
||||
AnimData* front = m_anim_data_list.front();
|
||||
Pose* front = m_anim_data_list.front();
|
||||
#ifdef ANIM_DATA_ALLOCATOR_DEBUG
|
||||
std::cout << "about to delete with size "
|
||||
<< front->m_anim_data->m_local_matrices.size()
|
||||
@@ -55,9 +55,9 @@ struct AnimDataAllocator {
|
||||
}
|
||||
}
|
||||
|
||||
AnimData* allocate(ozz::animation::Skeleton* skeleton) {
|
||||
Pose* allocate(ozz::animation::Skeleton* skeleton) {
|
||||
if (m_anim_data_list.empty()) {
|
||||
AnimData* result = new AnimData();
|
||||
Pose* result = new Pose();
|
||||
result->m_local_matrices.resize(skeleton->num_soa_joints());
|
||||
#ifdef ANIM_DATA_ALLOCATOR_DEBUG
|
||||
std::cout << "Allocated with size " << result->m_local_matrices.size()
|
||||
@@ -67,7 +67,7 @@ struct AnimDataAllocator {
|
||||
return result;
|
||||
}
|
||||
|
||||
AnimData* result = m_anim_data_list.front();
|
||||
Pose* result = m_anim_data_list.front();
|
||||
m_anim_data_list.pop_front();
|
||||
|
||||
#ifdef ANIM_DATA_ALLOCATOR_DEBUG
|
||||
@@ -78,7 +78,7 @@ struct AnimDataAllocator {
|
||||
return result;
|
||||
}
|
||||
|
||||
void free(AnimData* anim_data) {
|
||||
void free(Pose* anim_data) {
|
||||
#ifdef ANIM_DATA_ALLOCATOR_DEBUG
|
||||
std::cout << "Storing buffer with size "
|
||||
<< anim_data->m_local_matrices.size() << " " << anim_data
|
||||
@@ -238,7 +238,7 @@ SocketType GetSocketType() {
|
||||
return SocketType::SocketTypeBool;
|
||||
}
|
||||
|
||||
if constexpr (std::is_same<T, AnimData>::value) {
|
||||
if constexpr (std::is_same<T, Pose>::value) {
|
||||
return SocketType::SocketTypeAnimation;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,9 +18,9 @@ struct AnimNode;
|
||||
// Blend2Node
|
||||
//
|
||||
struct Blend2Node : public AnimNode {
|
||||
AnimData* i_input0 = nullptr;
|
||||
AnimData* i_input1 = nullptr;
|
||||
AnimData* o_output = nullptr;
|
||||
Pose* i_input0 = nullptr;
|
||||
Pose* i_input1 = nullptr;
|
||||
Pose* o_output = nullptr;
|
||||
float* i_blend_weight = nullptr;
|
||||
bool m_sync_blend = false;
|
||||
|
||||
@@ -77,8 +77,8 @@ struct NodeDescriptor<Blend2Node> : public NodeDescriptorBase {
|
||||
// SpeedScaleNode
|
||||
//
|
||||
struct SpeedScaleNode : public AnimNode {
|
||||
AnimData* i_input = nullptr;
|
||||
AnimData* o_output = nullptr;
|
||||
Pose* i_input = nullptr;
|
||||
Pose* o_output = nullptr;
|
||||
float* i_speed_scale = nullptr;
|
||||
|
||||
void UpdateTime(float time_last, float time_now) override {
|
||||
@@ -114,7 +114,7 @@ struct NodeDescriptor<SpeedScaleNode> : public NodeDescriptorBase {
|
||||
// AnimSamplerNode
|
||||
//
|
||||
struct AnimSamplerNode : public AnimNode {
|
||||
AnimData* o_output = nullptr;
|
||||
Pose* o_output = nullptr;
|
||||
std::string m_filename;
|
||||
ozz::animation::SamplingJob::Context m_sampling_context;
|
||||
ozz::animation::Animation* m_animation = nullptr;
|
||||
@@ -144,8 +144,8 @@ struct NodeDescriptor<AnimSamplerNode> : public NodeDescriptorBase {
|
||||
// LockTranslationNode
|
||||
//
|
||||
struct LockTranslationNode : public AnimNode {
|
||||
AnimData* i_input = nullptr;
|
||||
AnimData* o_output = nullptr;
|
||||
Pose* i_input = nullptr;
|
||||
Pose* o_output = nullptr;
|
||||
int m_locked_bone_index = 0;
|
||||
bool m_lock_x = false;
|
||||
bool m_lock_y = false;
|
||||
|
||||
@@ -86,7 +86,7 @@ Socket sJsonToSocket(const json& json_data) {
|
||||
}
|
||||
} else if (type_string == "Animation") {
|
||||
result.m_type = SocketType::SocketTypeAnimation;
|
||||
result.m_type_size = sizeof(AnimData);
|
||||
result.m_type_size = sizeof(Pose);
|
||||
} else if (type_string == "Int") {
|
||||
result.m_type = SocketType::SocketTypeInt;
|
||||
result.m_type_size = sizeof(int);
|
||||
@@ -1242,9 +1242,8 @@ void BlendTreeResource::CreateBlendTreeConnectionInstances(
|
||||
&instance.m_connection_data_storage[socket_data_offset];
|
||||
|
||||
if (source_socket->m_type == SocketType::SocketTypeAnimation) {
|
||||
instance.m_animdata_blocks.push_back(
|
||||
(AnimData*)(&instance
|
||||
.m_connection_data_storage[socket_data_offset]));
|
||||
instance.m_pose_blocks.push_back(
|
||||
(Pose*)(&instance.m_connection_data_storage[socket_data_offset]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -75,8 +75,7 @@ struct BlendTreeResource : AnimGraphResource {
|
||||
m_virtual_socket_accessor = VirtualAnimNodeDescriptorFactory("BlendTree");
|
||||
|
||||
InitGraphConnectors();
|
||||
RegisterBlendTreeOutputSocket<AnimData>(
|
||||
AnimGraphResource::DefaultAnimOutput);
|
||||
RegisterBlendTreeOutputSocket<Pose>(AnimGraphResource::DefaultAnimOutput);
|
||||
}
|
||||
~BlendTreeResource() { ClearAllNodes(); }
|
||||
|
||||
|
||||
+1
-1
@@ -491,7 +491,7 @@ int main() {
|
||||
|
||||
AnimGraphBlendTree anim_graph;
|
||||
AnimGraphContext anim_graph_context;
|
||||
AnimData anim_graph_output;
|
||||
Pose anim_graph_output;
|
||||
anim_graph_output.m_local_matrices.resize(
|
||||
skinned_mesh.m_skeleton.num_soa_joints());
|
||||
AnimGraphEditorClear();
|
||||
|
||||
Reference in New Issue
Block a user