Working on graph evaluations. WIP.
This commit is contained in:
@@ -129,23 +129,31 @@ TEST_CASE("BasicGraph", "[AnimGraphResource]") {
|
||||
REQUIRE(anim_sampler_run->m_animation != nullptr);
|
||||
|
||||
WHEN("Emulating Graph Evaluation") {
|
||||
CHECK(graph.m_anim_data_work_buffer.m_available_data.size() == 5);
|
||||
graph.prepareNodeEval(walk_node_index);
|
||||
CHECK(graph.m_anim_data_work_buffer.size() == 0);
|
||||
graph.prepareNodeEval(graph_context, walk_node_index);
|
||||
graph.finishNodeEval(walk_node_index);
|
||||
CHECK(graph.m_anim_data_work_buffer.m_available_data.size() == 4);
|
||||
graph.prepareNodeEval(run_node_index);
|
||||
CHECK(graph.m_anim_data_work_buffer.m_num_allocations == 1);
|
||||
CHECK(graph.m_anim_data_work_buffer.size() == 0);
|
||||
|
||||
graph.prepareNodeEval(graph_context, run_node_index);
|
||||
graph.finishNodeEval(run_node_index);
|
||||
CHECK(graph.m_anim_data_work_buffer.m_available_data.size() == 3);
|
||||
graph.prepareNodeEval(blend_node_index);
|
||||
CHECK(graph.m_anim_data_work_buffer.m_num_allocations == 2);
|
||||
CHECK(graph.m_anim_data_work_buffer.size() == 0);
|
||||
|
||||
graph.prepareNodeEval(graph_context, blend_node_index);
|
||||
CHECK(blend2_instance->i_input0 == anim_sampler_walk->o_output);
|
||||
CHECK(blend2_instance->i_input1 == anim_sampler_run->o_output);
|
||||
CHECK(graph.m_anim_data_work_buffer.m_available_data.size() == 2);
|
||||
CHECK(graph.m_anim_data_work_buffer.m_num_allocations == 3);
|
||||
CHECK(graph.m_anim_data_work_buffer.size() == 0);
|
||||
|
||||
graph.finishNodeEval(blend_node_index);
|
||||
CHECK(anim_sampler_walk->o_output == nullptr);
|
||||
CHECK(anim_sampler_run->o_output == nullptr);
|
||||
CHECK(graph.m_anim_data_work_buffer.m_available_data.size() == 4);
|
||||
CHECK(graph.m_anim_data_work_buffer.m_num_allocations == 3);
|
||||
CHECK(graph.m_anim_data_work_buffer.size() == 2);
|
||||
|
||||
graph.prepareNodeEval(0);
|
||||
// TODO: rethink output node evaluation
|
||||
graph.prepareNodeEval(graph_context, 0);
|
||||
const Socket* graph_output_socket = graph.getOutputSocket("GraphOutput");
|
||||
CHECK(blend2_instance->o_output == (*graph_output_socket->m_reference.ptr_ptr));
|
||||
AnimData* graph_output =
|
||||
@@ -153,8 +161,11 @@ TEST_CASE("BasicGraph", "[AnimGraphResource]") {
|
||||
graph.finishNodeEval(0);
|
||||
CHECK(blend2_instance->o_output == nullptr);
|
||||
CHECK(graph_output == (*graph_output_socket->m_reference.ptr_ptr));
|
||||
CHECK(graph.m_anim_data_work_buffer.m_available_data.size() == 5);
|
||||
CHECK(graph.m_anim_data_work_buffer.m_num_allocations == 3);
|
||||
CHECK(graph.m_anim_data_work_buffer.size() == 3);
|
||||
}
|
||||
|
||||
graph_context.freeAnimations();
|
||||
}
|
||||
|
||||
TEST_CASE("InputAttributeConversion", "[AnimGraphResource]") {
|
||||
@@ -282,7 +293,8 @@ TEST_CASE("ResourceSaveLoadMathGraphInputs", "[AnimGraphResource]") {
|
||||
*graph_float_input = 123.456f;
|
||||
|
||||
AND_WHEN("Evaluating Graph") {
|
||||
AnimGraphContext context = {&anim_graph, nullptr};
|
||||
AnimGraphContext context;
|
||||
context.m_graph = &anim_graph;
|
||||
|
||||
anim_graph.updateTime(0.f);
|
||||
anim_graph.evaluate(context);
|
||||
@@ -299,6 +311,8 @@ TEST_CASE("ResourceSaveLoadMathGraphInputs", "[AnimGraphResource]") {
|
||||
CHECK(vec3_output[1] == *graph_float_input);
|
||||
CHECK(vec3_output[2] == *graph_float_input);
|
||||
}
|
||||
|
||||
context.freeAnimations();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -414,7 +428,8 @@ TEST_CASE("SimpleMathEvaluations", "[AnimGraphResource]") {
|
||||
*graph_float_input = 123.456f;
|
||||
|
||||
AND_WHEN("Evaluating Graph") {
|
||||
AnimGraphContext context = {&anim_graph, nullptr};
|
||||
AnimGraphContext context;
|
||||
context.m_graph = &anim_graph;
|
||||
|
||||
anim_graph.updateTime(0.f);
|
||||
anim_graph.evaluate(context);
|
||||
@@ -442,6 +457,8 @@ TEST_CASE("SimpleMathEvaluations", "[AnimGraphResource]") {
|
||||
CHECK(float1_output == Approx(*graph_float_input * 2.));
|
||||
CHECK(float2_output == Approx(*graph_float_input * 3.));
|
||||
}
|
||||
|
||||
context.freeAnimations();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user