本文整理汇总了C++中Proxy::setTransformation方法的典型用法代码示例。如果您正苦于以下问题:C++ Proxy::setTransformation方法的具体用法?C++ Proxy::setTransformation怎么用?C++ Proxy::setTransformation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Proxy
的用法示例。
在下文中一共展示了Proxy::setTransformation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testUndo
void UndoTest::testUndo() {
// we maintain 2 World objects, a "undo" World and a "reference" world
//
// we will do some changes on both worlds and then do some changes on
// the "undo" world only. after calling undo, both worlds should be
// synced again.
//
// whenever we start tests, both worlds should be synced.
World undoWorld;
World referenceWorld;
// add simple proxies and never move them
// this tests in particular that a undoStep() call does not change
// things that shouldnt change
undoWorld.addProxy(undoWorld.createProxy(new Box(10, 10, 10)));
referenceWorld.addProxy(referenceWorld.createProxy(new Box(10, 10, 10)));
// add simple proxies, move them before adding, never move them
// afterwards
// this tests in particular that a undoStep() call does not change
// things that shouldnt change
Proxy* staticUndoProxy = undoWorld.createProxy(new Box(10, 10, 10));
Proxy* staticRefereceProxy = referenceWorld.createProxy(new Box(10, 10, 10));
staticUndoProxy->translate(-10, 10, 5);
staticRefereceProxy->translate(-10, 10, 5);
undoWorld.addProxy(staticUndoProxy);
referenceWorld.addProxy(staticRefereceProxy);
// add simple proxies, but move them before adding
Proxy* proxyUndoWorld = undoWorld.createProxy(new Box(10, 10, 10));
Proxy* proxyReferenceWorld = referenceWorld.createProxy(new Box(10, 10, 10));
proxyUndoWorld->translate(-10, 10, 5);
proxyReferenceWorld->translate(-10, 10, 5);
undoWorld.addProxy(proxyUndoWorld);
referenceWorld.addProxy(proxyReferenceWorld);
CPPUNIT_ASSERT_EQUAL(true, checkWorldsAreEqual(&undoWorld, &referenceWorld));
undoWorld.startNextStep();
referenceWorld.startNextStep();
CPPUNIT_ASSERT_EQUAL(true, checkWorldsAreEqual(&undoWorld, &referenceWorld));
// undo simple translations
proxyUndoWorld->translate(100, 100, 100);
undoWorld.undoStep();
CPPUNIT_ASSERT_EQUAL(true, checkWorldsAreEqual(&undoWorld, &referenceWorld));
// undo multiple translations
proxyUndoWorld->translate(100, 100, 100);
proxyUndoWorld->translate(100, 300, 200);
proxyUndoWorld->translate(100, 400, 500);
undoWorld.undoStep();
CPPUNIT_ASSERT_EQUAL(true, checkWorldsAreEqual(&undoWorld, &referenceWorld));
// undo simple rotations
proxyUndoWorld->rotate(45, 1, 0, 0);
undoWorld.undoStep();
CPPUNIT_ASSERT_EQUAL(true, checkWorldsAreEqual(&undoWorld, &referenceWorld));
// undo multiple simple rotations
proxyUndoWorld->rotate(45, 1, 0, 0);
proxyUndoWorld->rotate(15, 1, 0, 0);
proxyUndoWorld->rotate(45, 0, 1, 0);
undoWorld.undoStep();
CPPUNIT_ASSERT_EQUAL(true, checkWorldsAreEqual(&undoWorld, &referenceWorld));
// undo translations and rotations
proxyUndoWorld->translate(100, 100, 100);
proxyUndoWorld->rotate(45, 1, 0, 0);
proxyUndoWorld->translate(100, 1, 100);
proxyUndoWorld->rotate(15, 1, 0, 0);
proxyUndoWorld->translate(100, 20, 100);
proxyUndoWorld->rotate(45, 0, 1, 0);
proxyUndoWorld->translate(100, 100, 400);
undoWorld.undoStep();
CPPUNIT_ASSERT_EQUAL(true, checkWorldsAreEqual(&undoWorld, &referenceWorld));
// undo setTransformation()
Matrix m;
m.translate(100, 0, 0);
proxyUndoWorld->setTransformation(m);
undoWorld.undoStep();
CPPUNIT_ASSERT_EQUAL(true, checkWorldsAreEqual(&undoWorld, &referenceWorld));
// undo multiple setTransformation()
m = Matrix();
m.translate(100, 0, 0);
proxyUndoWorld->setTransformation(m);
m.translate(0, 50, 0);
proxyUndoWorld->setTransformation(m);
undoWorld.undoStep();
CPPUNIT_ASSERT_EQUAL(true, checkWorldsAreEqual(&undoWorld, &referenceWorld));
// undo setProxyType()
proxyUndoWorld->setProxyType(PROXYTYPE_DEFORMABLE);
undoWorld.undoStep();
CPPUNIT_ASSERT_EQUAL(true, checkWorldsAreEqual(&undoWorld, &referenceWorld));
// undo multiple setProxyType()
proxyUndoWorld->setProxyType(PROXYTYPE_DEFORMABLE);
proxyUndoWorld->setProxyType(PROXYTYPE_FIXED);
//.........这里部分代码省略.........