void scaleAndTestMount(TestModel& model, Model::ModelMount& mount, const Ogre::Node* node) { WFMath::AxisBox<3> axisBox(WFMath::Point<3>(0, 0, 0), WFMath::Point<3>(10.0f, 10.0f, 10.0f)); model.manualObject->setBoundingBox(Ogre::AxisAlignedBox(Ogre::Vector3(0, 0, 0), Ogre::Vector3(5.0f, 5.0f, 5.0f))); mount.rescale(&axisBox); CPPUNIT_ASSERT(equals(node->getScale(), Ogre::Vector3(2.0f, 2.0f, 2.0f))); model.manualObject->setBoundingBox(Ogre::AxisAlignedBox(Ogre::Vector3(0, 0, 0), Ogre::Vector3(20.0f, 20.0f, 20.0f))); mount.rescale(&axisBox); CPPUNIT_ASSERT(equals(node->getScale(), Ogre::Vector3(0.5f, 0.5f, 0.5f))); model.manualObject->setBoundingBox(Ogre::AxisAlignedBox(Ogre::Vector3(10.0f, 10.0f, 10.0f), Ogre::Vector3(20.0f, 20.0f, 20.0f))); mount.rescale(&axisBox); CPPUNIT_ASSERT(equals(node->getScale(), Ogre::Vector3(1.0f, 1.0f, 1.0f))); model.manualObject->setBoundingBox(Ogre::AxisAlignedBox(Ogre::Vector3(0, 10.0f, 15.0f), Ogre::Vector3(20.0f, 20.0f, 20.0f))); mount.rescale(&axisBox); CPPUNIT_ASSERT(equals(node->getScale(), Ogre::Vector3(2.0f, 1.0f, 0.5f))); }
void scaleAndTestMount(TestModel& model, Model::ModelMount& mount, const Ogre::Node& node) { WFMath::AxisBox<3> axisBox(WFMath::Point<3>(0, 0, 0), WFMath::Point<3>(10, 10, 10)); model.bbox = Ogre::AxisAlignedBox(Ogre::Vector3(0, 0, 0), Ogre::Vector3(5, 5, 5)); mount.rescale(&axisBox); CPPUNIT_ASSERT(node.getScale() == Ogre::Vector3(2, 2, 2)); model.bbox = Ogre::AxisAlignedBox(Ogre::Vector3(0, 0, 0), Ogre::Vector3(20, 20, 20)); mount.rescale(&axisBox); CPPUNIT_ASSERT(node.getScale() == Ogre::Vector3(0.5, 0.5, 0.5)); model.bbox = Ogre::AxisAlignedBox(Ogre::Vector3(10, 10, 10), Ogre::Vector3(20, 20, 20)); mount.rescale(&axisBox); CPPUNIT_ASSERT(node.getScale() == Ogre::Vector3(1, 1, 1)); model.bbox = Ogre::AxisAlignedBox(Ogre::Vector3(0, 10, 15), Ogre::Vector3(20, 20, 20)); mount.rescale(&axisBox); CPPUNIT_ASSERT(node.getScale() == Ogre::Vector3(2, 1, 0.5)); }