本文整理汇总了C++中Proxy::addChild方法的典型用法代码示例。如果您正苦于以下问题:C++ Proxy::addChild方法的具体用法?C++ Proxy::addChild怎么用?C++ Proxy::addChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Proxy
的用法示例。
在下文中一共展示了Proxy::addChild方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testUndo
//.........这里部分代码省略.........
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);
undoWorld.undoStep();
CPPUNIT_ASSERT_EQUAL(true, checkWorldsAreEqual(&undoWorld, &referenceWorld));
////////////////////////////////////////////////////////////////
// build up a simple hierarchy with static + non-static children
////////////////////////////////////////////////////////////////
Proxy* staticChildUndoWorld = undoWorld.createProxy(new Box(10, 10, 10));
Proxy* staticChildReferenceWorld = referenceWorld.createProxy(new Box(10, 10, 10));
staticChildUndoWorld->translate(40, 10, 10);
staticChildReferenceWorld->translate(40, 10, 10);
proxyUndoWorld->addChild(staticChildUndoWorld);
proxyReferenceWorld->addChild(staticChildReferenceWorld);
Proxy* childUndoWorld = undoWorld.createProxy(new Box(10, 10, 10));
Proxy* childReferenceWorld = referenceWorld.createProxy(new Box(10, 10, 10));
childUndoWorld->translate(0, 0, 10);
childReferenceWorld->translate(0, 0, 10);
childUndoWorld->rotate(100, 0, 0, 1);
childReferenceWorld->rotate(100, 0, 0, 1);
proxyUndoWorld->addChild(childUndoWorld);
proxyReferenceWorld->addChild(childReferenceWorld);
Proxy* staticGrandChildUndoWorld = undoWorld.createProxy(new Box(10, 10, 10));
Proxy* staticGrandChildReferenceWorld = referenceWorld.createProxy(new Box(10, 10, 10));
staticGrandChildUndoWorld->translate(20, 10, 10);
staticGrandChildReferenceWorld->translate(20, 10, 10);
childUndoWorld->addChild(staticGrandChildUndoWorld);
childReferenceWorld->addChild(staticGrandChildReferenceWorld);
////////////////////////////////////
// build up a simple hierarchy (end)
////////////////////////////////////
// sanity check
CPPUNIT_ASSERT_EQUAL(true, checkWorldsAreEqual(&undoWorld, &referenceWorld));
// adding child proxies should not have any influence on undo, i.e. undo
// should be a noop here.
undoWorld.undoStep();
CPPUNIT_ASSERT_EQUAL(true, checkWorldsAreEqual(&undoWorld, &referenceWorld));
Proxy* dummyUndoProxy = undoWorld.createProxy(new Box(10, 10, 10));
Proxy* dummyReferenceProxy = referenceWorld.createProxy(new Box(10, 10, 10));
undoWorld.addProxy(dummyUndoProxy);