當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。