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


C++ ObjectManager::setWireframeMode方法代码示例

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


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

示例1: Keyboard

void Keyboard(unsigned char key, int mx, int my)
{
	float LO;
	float HI;
	float x; 
	float z; 
	float y;
	float r, g, b;
	Generic_Object* frag;
	vec3 oldPos;

	float dirX;
	float dirY;
	float dirZ;
	
	float moveSpeed = 10.0f;

	switch(key)
	{
	case 'z':
		camera.position += camera.target * moveSpeed;
		break;
	case 's':
		camera.position -= camera.target * moveSpeed;
		break;
	case 'q':
		camera.position += camera.orientation.Cross(camera.target).Normalized() * moveSpeed;
		break;
	case 'd':
		camera.position -= camera.orientation.Cross(camera.target).Normalized() * moveSpeed;
		break;
	case 'w':
		clearScene = true;
		break;
	case 'x':
		wireframeMode = (wireframeMode?false:true);

		objectManager.setWireframeMode(wireframeMode);
		break;
	case 'y':
		makeExplosion(vec3(0.0f, 0.0f, 0.0f));
		break;
	case 'u':
		makeExplosion(vec3(750.0f, 0.0f, 750.0f));
		break;
	case 'i':
		makeExplosion(vec3(-750.0f, 0.0f, 750.0f));
		break;
	case 'o':
		makeExplosion(vec3(-750.0f, 0.0f, -750.0f));
		break;
	case 'p':
		makeExplosion(vec3(750.0f, 0.0f, -750.0f));
		break;
	case 'v':

		dirX = -2;
		dirY = 4;
		dirZ = -2;


		for(int i = 0; i < 4; ++i)
		{
			for(int j= 0; j < 4; ++j)
			{
				for(int k =0; k < 4; ++k)
				{
					frag = CreateFragments(vec3((float)k * 10.0f-10.f, (float)i * 10.0f + 5.0f + 20.0f, (float)j * 10.0f-10.0f), 10.0f);

					++nbObjects;

					//cout << ++countSphere << " - x: " << k* 5.0f << "   y: " << i* 5.0f + 5.0f<< "   z: " << j* 5.0f << endl;

					LO = -3.0f;
					HI = 3.0f;

					r = LO + static_cast <float> (rand()) /( static_cast <float> (RAND_MAX/(HI-LO)));
					g = LO + static_cast <float> (rand()) /( static_cast <float> (RAND_MAX/(HI-LO)));

					b = LO + static_cast <float> (rand()) /( static_cast <float> (RAND_MAX/(HI-LO)));

					frag->setWireframeMode(false);
					frag->getComponents()->getGravity()->setUseGravity(true);
					frag->getComponents()->getRigidBody()->addRigidBody(RIGID_GENERIC, *frag->getListOfVertices(), *frag->getListOfIndexes(), frag->getCenterOfObject(), true);
					frag->getComponents()->getRigidBody()->setDisplayRigidBody(true);
					frag->getComponents()->getRigidBody()->activateRigidBody(true);
					frag->getComponents()->getGravity()->setBounciness(frag->getMass(), frag->getMass()/5550);
					frag->getComponents()->getGravity()->setResistance(frag->getMass(), frag->getMass() / 1.01f);
					frag->setAlternateFacesAndNormals(true);
					frag->getComponents()->getGravity()->setGravity(9.8f);
					
					switch(j)
					{
					case 0:
						frag->setColor(0.61f, 0.44f, 0.13f, 1.0f);
						break;
					case 1:
						frag->setColor(0.77f, 0.56f, 0.16f, 1.0f);
						break;
					case 2:
//.........这里部分代码省略.........
开发者ID:bibiGN,项目名称:annualproject,代码行数:101,代码来源:main.cpp


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