Simple time propagation works.

This commit is contained in:
Martin Felis
2022-02-22 22:03:26 +01:00
parent 87eb2ab7df
commit af5d27db85
3 changed files with 158 additions and 37 deletions
+45 -6
View File
@@ -247,6 +247,9 @@ TEST_CASE("GraphInputOutputConnectivity", "[AnimGraphResource]") {
graph_input_node.m_socket_accessor->RegisterOutput<float>(
"GraphFloatInput",
nullptr);
graph_input_node.m_socket_accessor->RegisterOutput<float>(
"SpeedScaleInput",
nullptr);
graph_input_node.m_socket_accessor->RegisterOutput<AnimData>(
"GraphAnimInput0",
nullptr);
@@ -372,6 +375,12 @@ TEST_CASE("GraphInputOutputConnectivity", "[AnimGraphResource]") {
blend2_node_resource,
"Weight"));
REQUIRE(graph_resource.connectSockets(
graph_resource.getGraphInputNode(),
"SpeedScaleInput",
speed_scale_node_resource,
"SpeedScale"));
REQUIRE(graph_resource.connectSockets(
graph_resource.getGraphInputNode(),
"GraphAnimInput0",
@@ -440,14 +449,14 @@ TEST_CASE("GraphInputOutputConnectivity", "[AnimGraphResource]") {
// check ordering
//
REQUIRE(
anim_graph.getAnimNodeOrderIndex(blend2_node)
< anim_graph.getAnimNodeOrderIndex(sampler_node));
anim_graph.getNodeEvalOrderIndex(blend2_node)
< anim_graph.getNodeEvalOrderIndex(sampler_node));
REQUIRE(
anim_graph.getAnimNodeOrderIndex(blend2_node)
< anim_graph.getAnimNodeOrderIndex(speed_scale_node));
anim_graph.getNodeEvalOrderIndex(blend2_node)
< anim_graph.getNodeEvalOrderIndex(speed_scale_node));
REQUIRE(
anim_graph.getAnimNodeOrderIndex(speed_scale_node)
< anim_graph.getAnimNodeOrderIndex(sampler_node));
anim_graph.getNodeEvalOrderIndex(speed_scale_node)
< anim_graph.getNodeEvalOrderIndex(sampler_node));
}
WHEN("Instantiating graph") {
@@ -491,6 +500,36 @@ TEST_CASE("GraphInputOutputConnectivity", "[AnimGraphResource]") {
REQUIRE(anim_graph.CheckIsNodeActive(sampler_node) == true);
}
}
WHEN("Updating time with dt = 0.3f and speed scale = 1.0f") {
float* speed_scale_input =
reinterpret_cast<float*>(anim_graph.GetInput("SpeedScaleInput"));
*blend_weight_input = 0.1;
*speed_scale_input = 1.0f;
anim_graph.MarkActiveNodes();
anim_graph.UpdateTime(0.3f);
THEN ("Anim sampler node time now must be 0.3f") {
REQUIRE(sampler_node->m_time_now == Approx(0.3f));
}
}
WHEN("Updating time with dt = 0.3f and speed scale = 1.3f") {
float* speed_scale_input =
reinterpret_cast<float*>(anim_graph.GetInput("SpeedScaleInput"));
*blend_weight_input = 0.1;
*speed_scale_input = 1.3f;
anim_graph.MarkActiveNodes();
anim_graph.UpdateTime(0.3f);
THEN ("Anim sampler node time now must be 0.39f") {
REQUIRE(sampler_node->m_time_now == Approx(0.39f));
}
}
}
}
}