mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
Removed RigTests
This commit is contained in:
parent
470aa53454
commit
cb1d453f10
2 changed files with 0 additions and 152 deletions
|
@ -1,97 +0,0 @@
|
|||
//
|
||||
// RigTests.cpp
|
||||
// tests/rig/src
|
||||
//
|
||||
// Created by Howard Stearns on 6/16/15
|
||||
// Copyright 2015 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
/* FIXME/TBD:
|
||||
|
||||
The following lower level functionality might be separated out into a separate class, covered by a separate test case class:
|
||||
- With no input, initial pose is standing, arms at side
|
||||
- Some single animation produces correct results at a given keyframe time.
|
||||
- Some single animation produces correct results at a given interpolated time.
|
||||
- Blend between two animations, started at separate times, produces correct result at a given interpolated time.
|
||||
- Head orientation can be overridden to produce change that doesn't come from the playing animation.
|
||||
- Hand position/orientation can be overridden to produce change that doesn't come from the playing animation.
|
||||
- Hand position/orientation can be overrridden to produce elbow change that doesn't come from the playing animation.
|
||||
- Respect scaling? (e.g., so that MyAvatar.increase/decreaseSize can alter rig, such that anti-scating and footfalls-on-stairs works)
|
||||
|
||||
Higher level functionality:
|
||||
- start/stopAnimation adds the animation to that which is playing, blending/fading as needed.
|
||||
- thrust causes walk role animation to be used.
|
||||
- turning causes turn role animation to be used. (two tests, correctly symmetric left & right)
|
||||
- walk/turn do not skate (footfalls match over-ground velocity)
|
||||
- (Later?) walk up stairs / hills have proper footfall for terrain
|
||||
- absence of above causes return to idle role animation to be used
|
||||
- (later?) The lower-level head/hand placements respect previous state. E.g., actual hand movement can be slower than requested.
|
||||
- (later) The lower-level head/hand placements can move whole skeleton. E.g., turning head past a limit may turn whole body. Reaching up can move shoulders and hips.
|
||||
|
||||
Backward-compatability operations. We should think of this behavior as deprecated:
|
||||
- clearJointData return to standing. TBD: presumably with idle and all other animations NOT playing, until explicitly reenabled with a new TBD method?
|
||||
- setJointData applies the given data. Same TBD.
|
||||
These can be defined true or false, but the tests document the behavior and tells us if something's changed:
|
||||
- An external change to the original skeleton IS/ISN'T seen by the rig.
|
||||
- An external change to the original skeleton's head orientation IS/ISN'T seen by the rig.
|
||||
- An external change to the original skeleton's hand orientiation IS/ISN'T seen by the rig.
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "FBXReader.h"
|
||||
#include "OBJReader.h"
|
||||
|
||||
#include <Rig.h>
|
||||
#include "RigTests.h"
|
||||
|
||||
static void reportJoint(const Rig& rig, int index) { // Handy for debugging
|
||||
std::cout << "\n";
|
||||
std::cout << index << " " << rig.getAnimSkeleton()->getJointName(index).toUtf8().data() << "\n";
|
||||
glm::vec3 pos;
|
||||
rig.getJointPosition(index, pos);
|
||||
glm::quat rot;
|
||||
rig.getJointRotation(index, rot);
|
||||
std::cout << " pos:" << pos << "\n";
|
||||
std::cout << " rot:" << safeEulerAngles(rot) << "\n";
|
||||
std::cout << "\n";
|
||||
}
|
||||
static void reportByName(const Rig& rig, const QString& name) {
|
||||
int jointIndex = rig.indexOfJoint(name);
|
||||
reportJoint(rig, jointIndex);
|
||||
}
|
||||
static void reportAll(const Rig& rig) {
|
||||
for (int i = 0; i < rig.getJointStateCount(); i++) {
|
||||
reportJoint(rig, i);
|
||||
}
|
||||
}
|
||||
static void reportSome(const Rig& rig) {
|
||||
QString names[] = {"Head", "Neck", "RightShoulder", "RightArm", "RightForeArm", "RightHand", "Spine2", "Spine1", "Spine", "Hips", "RightUpLeg", "RightLeg", "RightFoot", "RightToeBase", "RightToe_End"};
|
||||
for (auto name : names) {
|
||||
reportByName(rig, name);
|
||||
}
|
||||
}
|
||||
|
||||
QTEST_MAIN(RigTests)
|
||||
|
||||
void RigTests::initTestCase() {
|
||||
|
||||
// TODO: include this fbx in the test case assets, we are not testing networking here.
|
||||
QString fileName("/Users/howardstearns/howardHiFi/Zack.fbx");
|
||||
|
||||
QFile file(fileName);
|
||||
QCOMPARE(file.open(QIODevice::ReadOnly), true);
|
||||
FBXGeometry* geometry = readFBX(file.readAll(), QVariantHash());
|
||||
|
||||
QVERIFY((bool)geometry);
|
||||
|
||||
_rig.initJointStates(*geometry, glm::mat4());
|
||||
std::cout << "Rig is ready " << geometry->joints.count() << " joints " << std::endl;
|
||||
reportAll(_rig);
|
||||
}
|
||||
|
||||
void RigTests::initialPoseArmsDown() {
|
||||
reportSome(_rig);
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
//
|
||||
// RigTests.h
|
||||
// tests/rig/src
|
||||
//
|
||||
// Created by Howard Stearns on 6/16/15
|
||||
// Copyright 2015 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#ifndef hifi_RigTests_h
|
||||
#define hifi_RigTests_h
|
||||
|
||||
#include <QtTest/QtTest>
|
||||
#include <Rig.h>
|
||||
|
||||
//#include "../QTestExtensions.h"
|
||||
|
||||
|
||||
// The QTest terminology is not consistent with itself or with industry:
|
||||
// The whole directory, and the rig-tests target, doesn't seem to be a QTest concept, an corresponds roughly to a toplevel suite of suites.
|
||||
// The directory can contain any number of classes like this one. (Don't forget to wipe your build dir, and rerun cmake when you add one.):
|
||||
// QTest doc (http://doc.qt.io/qt-5/qtest-overview.html) calls this a "test case".
|
||||
// The output of QTest's 'ctest' runner calls this a "test" when run in the whole directory (e.g., when reporting success/failure counts).
|
||||
// The test case (like this class) can contain any number of test slots:
|
||||
// QTest doc calls these "test functions"
|
||||
// When you run a single test case executable (e.g., "rig-RigTests"), the (unlabeled) count includes these test functions and also the before method, which is auto generated as initTestCase.
|
||||
|
||||
// To build and run via make:
|
||||
// make help | grep tests # shows all test targets, including all-tests and rig-tests.
|
||||
// make all-tests # will compile and then die as soon as any test case dies, even if its not in your directory
|
||||
// make rig-tests # will compile and run `ctest .` in the tests/rig directory, running all the test cases found there.
|
||||
// Alas, only summary output is shown on stdout. The real results, including any stdout that your code does, is in tests/rig/Testing/Temporary/LastTest.log, or...
|
||||
// tests/rig/rig-RigTests (or the executable corresponding to any test case you define here) will run just that case and give output directly.
|
||||
//
|
||||
// To build and run via Xcode:
|
||||
// On some machines, xcode can't find cmake on the path it uses. I did, effectively: sudo ln -s `which cmake` /usr/bin
|
||||
// Note the above make instructions.
|
||||
// all-tests, rig-tests, and rig-RigTests are all targets:
|
||||
// The first two of these show no output at all, but if there's a failure you can see it by clicking on the red failure in the "issue navigator" (or by externally viewing the .log above).
|
||||
// The last (or any other individual test case executable) does show output in the Xcode output display.
|
||||
|
||||
class RigTests : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
void initTestCase();
|
||||
void initialPoseArmsDown();
|
||||
|
||||
private:
|
||||
Rig _rig;
|
||||
};
|
||||
|
||||
#endif // hifi_RigTests_h
|
Loading…
Reference in a new issue