当前位置: 首页>>代码示例>>C++>>正文


C++ ModelFactory::createBoxMesh方法代码示例

本文整理汇总了C++中ModelFactory::createBoxMesh方法的典型用法代码示例。如果您正苦于以下问题:C++ ModelFactory::createBoxMesh方法的具体用法?C++ ModelFactory::createBoxMesh怎么用?C++ ModelFactory::createBoxMesh使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ModelFactory的用法示例。


在下文中一共展示了ModelFactory::createBoxMesh方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CreatePrismRectangle

void CreatePrismRectangle(SimpleTree& _rRoot, const Matrix44& _rTransformation)
{
	Entity* pPrismRectangle = new Entity();
	ModelFactory* pFactory = ModelFactory::getInstance();

	SimpleTree* pRootNode = new SimpleTree;
	pRootNode->setTransformation(_rTransformation);
	_rRoot.addChild(pRootNode);

	//Model* pSquare = pFactory->createSquareMesh(5.0f, Vector4(1.0f, 1.0f, 0.0f, 1.0f), true);
	Model* pSquare = pFactory->createBoxMesh(5.0f, 5.0f, 0.1f, Vector4(1.0f, 1.0f, 0.0f, 1.0f), true);
	pSquare->setMaterial(CreatePrismRectangleModelMaterial());
	pPrismRectangle->addComponent(pSquare);
	pSquare->setEntity(pPrismRectangle);

	SimpleTree* pSquareNode = new SimpleTree;
	//getTranslation3(pSquareNode->getTransformation()).Y() = 5.0f;
	getTranslation3(pSquareNode->getTransformation()).Y() = 4.9f;
	pSquareNode->setModel(pSquare);
	pRootNode->addChild(pSquareNode);

	Body* pSquareBody = PhysicsFactory::getInstance()->createBody(CreateObstacleBodyMaterial(), pSquare,
		pSquareNode->getAbsoluteTransformation(), false);
	//static_cast<BulletBody*>(pSquareBody)->setNode(pSquareNode);
	static_cast<PhysXBody*>(pSquareBody)->setNode(pSquareNode);
	pPrismRectangle->addComponent(pSquareBody);
	pSquareBody->setEntity(pPrismRectangle);

	Model* pPrism0 = pFactory->createPrismMesh(5.0f, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
	pPrism0->setMaterial(CreatePrismRectangleModelMaterial());
	pPrismRectangle->addComponent(pPrism0);
	pPrism0->setEntity(pPrismRectangle);

	SimpleTree* pPrism0Node = new SimpleTree;
	rotate(pPrism0Node->getTransformation(), Math::PI, Vector4(0.0f, 1.0f, 0.0f, 1.0f));
	getTranslation3(pPrism0Node->getTransformation()).Z() = 10.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);
	pPrismRectangle->addComponent(pPrism0Body);
	pPrism0Body->setEntity(pPrismRectangle);

	Model* pPrism1 = pFactory->createPrismMesh(5.0f, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
	pPrism1->setMaterial(CreatePrismRectangleModelMaterial());
	pPrismRectangle->addComponent(pPrism1);
	pPrism1->setEntity(pPrismRectangle);

	SimpleTree* pPrism1Node = new SimpleTree;
	getTranslation3(pPrism1Node->getTransformation()).Z() = -10.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);
	pPrismRectangle->addComponent(pPrism1Body);
	pPrism1Body->setEntity(pPrismRectangle);

	GazEngine::addEntity(pPrismRectangle);
}
开发者ID:roosen5,项目名称:media-design-school,代码行数:65,代码来源:Scene.cpp


注:本文中的ModelFactory::createBoxMesh方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。