1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-12-12 22:43:07 +00:00

Yes sir clang

This commit is contained in:
Sam Hellawell 2024-04-17 08:19:49 +01:00
parent 2653b76db9
commit d09f32d9e4

View file

@ -1,7 +1,7 @@
#include <components/sceneutil/osgacontroller.hpp> #include <components/sceneutil/osgacontroller.hpp>
#include <osgAnimation/Channel>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <osgAnimation/Channel>
#include <filesystem> #include <filesystem>
#include <fstream> #include <fstream>
@ -36,7 +36,7 @@ namespace
std::vector<EmulatedAnimation> emulatedAnimations; std::vector<EmulatedAnimation> emulatedAnimations;
emulatedAnimations.push_back({ 0.0f, 1.0f, "test1" }); // should sample this emulatedAnimations.push_back({ 0.0f, 1.0f, "test1" }); // should sample this
emulatedAnimations.push_back({ 1.1f, 2.0f, "test2" }); // should ignore this emulatedAnimations.push_back({ 1.1f, 2.0f, "test2" }); // should ignore this
OsgAnimationController controller; OsgAnimationController controller;
controller.setEmulatedAnimations(emulatedAnimations); controller.setEmulatedAnimations(emulatedAnimations);
@ -46,7 +46,8 @@ namespace
endTransform.setTrans(1.0f, 1.0f, 1.0f); endTransform.setTrans(1.0f, 1.0f, 1.0f);
controller.addMergedAnimationTrack(createMergedAnimationTrack("test1", startTransform, endTransform)); controller.addMergedAnimationTrack(createMergedAnimationTrack("test1", startTransform, endTransform));
endTransform2.setTrans(2.0f, 2.0f, 2.0f); endTransform2.setTrans(2.0f, 2.0f, 2.0f);
controller.addMergedAnimationTrack(createMergedAnimationTrack("test2", endTransform, endTransform2, 0.1f, 0.9f)); controller.addMergedAnimationTrack(
createMergedAnimationTrack("test2", endTransform, endTransform2, 0.1f, 0.9f));
// should be halfway between 0,0,0 and 1,1,1 // should be halfway between 0,0,0 and 1,1,1
osg::Vec3f translation = controller.getTranslation(0.5f); osg::Vec3f translation = controller.getTranslation(0.5f);
@ -109,7 +110,7 @@ namespace
std::vector<EmulatedAnimation> emulatedAnimations; std::vector<EmulatedAnimation> emulatedAnimations;
emulatedAnimations.push_back({ 0.0f, 1.0f, "test1" }); // should sample this emulatedAnimations.push_back({ 0.0f, 1.0f, "test1" }); // should sample this
emulatedAnimations.push_back({ 1.1f, 2.0f, "test2" }); // should ignore this emulatedAnimations.push_back({ 1.1f, 2.0f, "test2" }); // should ignore this
OsgAnimationController controller; OsgAnimationController controller;
controller.setEmulatedAnimations(emulatedAnimations); controller.setEmulatedAnimations(emulatedAnimations);
@ -119,7 +120,8 @@ namespace
controller.addMergedAnimationTrack(createMergedAnimationTrack("test1", startTransform, endTransform)); controller.addMergedAnimationTrack(createMergedAnimationTrack("test1", startTransform, endTransform));
osg::Matrixf endTransform2 = osg::Matrixf::identity(); osg::Matrixf endTransform2 = osg::Matrixf::identity();
endTransform2.setTrans(2.0f, 2.0f, 2.0f); endTransform2.setTrans(2.0f, 2.0f, 2.0f);
controller.addMergedAnimationTrack(createMergedAnimationTrack("test2", endTransform, endTransform2, 0.1f, 0.9f)); controller.addMergedAnimationTrack(
createMergedAnimationTrack("test2", endTransform, endTransform2, 0.1f, 0.9f));
EXPECT_EQ(controller.getTransformForNode(0.0f, ROOT_BONE_NAME), startTransform); // start of test1 EXPECT_EQ(controller.getTransformForNode(0.0f, ROOT_BONE_NAME), startTransform); // start of test1
EXPECT_EQ(controller.getTransformForNode(1.0f, ROOT_BONE_NAME), endTransform); // end of test1 EXPECT_EQ(controller.getTransformForNode(1.0f, ROOT_BONE_NAME), endTransform); // end of test1