本文整理汇总了C++中ModelFactory::createCubeMesh方法的典型用法代码示例。如果您正苦于以下问题:C++ ModelFactory::createCubeMesh方法的具体用法?C++ ModelFactory::createCubeMesh怎么用?C++ ModelFactory::createCubeMesh使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModelFactory
的用法示例。
在下文中一共展示了ModelFactory::createCubeMesh方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreatePrismRectangleCube
void CreatePrismRectangleCube(SimpleTree& _rRoot, const Matrix44& _rTransformation)
{
Entity* pPrismRectangleCube = new Entity();
ModelFactory* pFactory = ModelFactory::getInstance();
SimpleTree* pRootNode = new SimpleTree;
pRootNode->setTransformation(_rTransformation);
_rRoot.addChild(pRootNode);
Model* pCube = pFactory->createCubeMesh(5.0f, Vector4(0.0f, 1.0f, 0.0f, 1.0f));
pCube->setMaterial(CreatePrismRectangleCubeModelMaterial());
pPrismRectangleCube->addComponent(pCube);
pCube->setEntity(pPrismRectangleCube);
SimpleTree* pCubeNode = new SimpleTree;
pCubeNode->setModel(pCube);
pRootNode->addChild(pCubeNode);
Body* pCubeBody = PhysicsFactory::getInstance()->createBody(CreateObstacleBodyMaterial(), pCube,
pCubeNode->getAbsoluteTransformation(), false);
//static_cast<BulletBody*>(pCubeBody)->setNode(pCubeNode);
static_cast<PhysXBody*>(pCubeBody)->setNode(pCubeNode);
pPrismRectangleCube->addComponent(pCubeBody);
pCubeBody->setEntity(pPrismRectangleCube);
//Model* pSquare0 = pFactory->createSquareMesh(5.0f, Vector4(1.0f, 1.0f, 0.0f, 1.0f), true);
Model* pSquare0 = pFactory->createBoxMesh(5.0f, 5.0f, 0.1f, Vector4(1.0f, 1.0f, 0.0f, 1.0f), true);
pSquare0->setMaterial(CreatePrismRectangleCubeModelMaterial());
pPrismRectangleCube->addComponent(pSquare0);
pSquare0->setEntity(pPrismRectangleCube);
SimpleTree* pSquare0Node = new SimpleTree;
//getTranslation3(pSquare0Node->getTransformation()).Y() = 5.0f;
getTranslation3(pSquare0Node->getTransformation()).Y() = 4.9f;
getTranslation3(pSquare0Node->getTransformation()).Z() = 10.0f;
pSquare0Node->setModel(pSquare0);
pRootNode->addChild(pSquare0Node);
Body* pSquare0Body = PhysicsFactory::getInstance()->createBody(CreateObstacleBodyMaterial(), pSquare0,
pSquare0Node->getAbsoluteTransformation(), false);
//static_cast<BulletBody*>(pSquare0Body)->setNode(pSquare0Node);
static_cast<PhysXBody*>(pSquare0Body)->setNode(pSquare0Node);
pPrismRectangleCube->addComponent(pSquare0Body);
pSquare0Body->setEntity(pPrismRectangleCube);
Model* pPrism0 = pFactory->createPrismMesh(5.0f, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
pPrism0->setMaterial(CreatePrismRectangleCubeModelMaterial());
pPrismRectangleCube->addComponent(pPrism0);
pPrism0->setEntity(pPrismRectangleCube);
SimpleTree* pPrism0Node = new SimpleTree;
rotate(pPrism0Node->getTransformation(), Math::PI, Vector4(0.0f, 1.0f, 0.0f, 1.0f));
getTranslation3(pPrism0Node->getTransformation()).Z() = 20.0f;
pPrism0Node->setModel(pPrism0);
pRootNode->addChild(pPrism0Node);
Body* pPrism0Body = PhysicsFactory::getInstance()->createBody(CreateObstacleBodyMaterial(), pPrism0,
pPrism0Node->getAbsoluteTransformation(), false);
//static_cast<BulletBody*>(pPrism0Body)->setNode(pPrism0Node);
static_cast<PhysXBody*>(pPrism0Body)->setNode(pPrism0Node);
pPrismRectangleCube->addComponent(pPrism0Body);
pPrism0Body->setEntity(pPrismRectangleCube);
//Model* pSquare1 = pFactory->createSquareMesh(5.0f, Vector4(1.0f, 1.0f, 0.0f, 1.0f), true);
Model* pSquare1 = pFactory->createBoxMesh(5.0f, 5.0f, 0.1f, Vector4(1.0f, 1.0f, 0.0f, 1.0f), true);
pSquare1->setMaterial(CreatePrismRectangleCubeModelMaterial());
pPrismRectangleCube->addComponent(pSquare1);
pSquare1->setEntity(pPrismRectangleCube);
SimpleTree* pSquare1Node = new SimpleTree;
//getTranslation3(pSquare1Node->getTransformation()).Y() = 5.0f;
getTranslation3(pSquare1Node->getTransformation()).Y() = 4.9f;
getTranslation3(pSquare1Node->getTransformation()).Z() = -10.0f;
pSquare1Node->setModel(pSquare1);
pRootNode->addChild(pSquare1Node);
Body* pSquare1Body = PhysicsFactory::getInstance()->createBody(CreateObstacleBodyMaterial(), pSquare1,
pSquare1Node->getAbsoluteTransformation(), false);
//static_cast<BulletBody*>(pSquare1Body)->setNode(pSquare1Node);
static_cast<PhysXBody*>(pSquare1Body)->setNode(pSquare1Node);
pPrismRectangleCube->addComponent(pSquare1Body);
pSquare1Body->setEntity(pPrismRectangleCube);
Model* pPrism1 = pFactory->createPrismMesh(5.0f, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
pPrism1->setMaterial(CreatePrismRectangleCubeModelMaterial());
pPrismRectangleCube->addComponent(pPrism1);
pPrism1->setEntity(pPrismRectangleCube);
SimpleTree* pPrism1Node = new SimpleTree;
getTranslation3(pPrism1Node->getTransformation()).Z() = -20.0f;
pPrism1Node->setModel(pPrism1);
pRootNode->addChild(pPrism1Node);
Body* pPrism1Body = PhysicsFactory::getInstance()->createBody(CreateObstacleBodyMaterial(), pPrism1,
pPrism1Node->getAbsoluteTransformation(), false);
//static_cast<BulletBody*>(pPrism1Body)->setNode(pPrism1Node);
static_cast<PhysXBody*>(pPrism1Body)->setNode(pPrism1Node);
pPrismRectangleCube->addComponent(pPrism1Body);
pPrism1Body->setEntity(pPrismRectangleCube);
//.........这里部分代码省略.........