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


C++ ModelLoader::removeAsset方法代码示例

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


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

示例1: main


//.........这里部分代码省略.........
	float second = t->getMilli();
	float lastTime = second;

	while (win->isOpen())
	{
		second = t->getMilli();
		deltaTime = second - lastTime;
		lastTime = second;
		if (glfwGetKey(GLFW_KEY_ESC))
			break;
		if (glfwGetKey(GLFW_KEY_SPACE))
			mdlanictrl2.setActiveAnimation("jump");
		if (glfwGetKey('W'))
			mdlanictrl2.setActiveAnimation("begin_walk");
		if (glfwGetKey('S'))
			mdlanictrl2.setActiveAnimation("idle");
		if (glfwGetKey('F'))
			mdlanictrl.setActiveAnimation("die");
		if (glfwGetKey('G'))
			mdlanictrl2.setActiveAnimation("die");
		if (glfwGetKey('A'))
			mdlm2 = glm::rotate(mdlm2, -0.3f, glm::vec3(0.0f, 1.0f, 0.0f));
		if (glfwGetKey('D'))
			mdlm2 = glm::rotate(mdlm2, 0.3f, glm::vec3(0.0f, 1.0f, 0.0f));
		if( glfwGetKey(GLFW_KEY_LSHIFT) || glfwGetKey(GLFW_KEY_RSHIFT))
			speed = 1.0f;
		else speed = 0.1f;
		if (glfwGetKey('I'))
			cam_pos += glm::cross(cam->getUpVector(),cam->getRightVector()) * speed * deltaTime;
		if (glfwGetKey('K'))
			cam_pos -= glm::cross(cam->getUpVector(),cam->getRightVector()) * speed * deltaTime;
		if (glfwGetKey('J'))
			cam_pos -= cam->getRightVector() * speed * deltaTime;
		if (glfwGetKey('L'))
			cam_pos += cam->getRightVector() * speed * deltaTime;
		if (glfwGetKey('O'))
			cam_pos += cam->getUpVector() * speed * deltaTime;
		if (glfwGetKey('P'))
			cam_pos -= cam->getUpVector() * speed * deltaTime;
		if(glfwGetKey(GLFW_KEY_LEFT))
			cam_orient = glm::rotate(cam_orient,speed * deltaTime,glm::vec3(0.0f,1.0f,0.0f));
		if(glfwGetKey(GLFW_KEY_RIGHT))
			cam_orient =glm::rotate(cam_orient,-speed * deltaTime,glm::vec3(0.0f,1.0f,0.0f));
		if(glfwGetKey(GLFW_KEY_UP))
			cam_orient = glm::rotate(cam_orient,speed * deltaTime,glm::vec3(1.0f,0.0f,0.0f));
		if(glfwGetKey(GLFW_KEY_DOWN))
			cam_orient = glm::rotate(cam_orient,-speed * deltaTime,glm::vec3(1.0f,0.0f,0.0f));
		cam_pos.y = terr->getHeightAt(cam_pos.x,cam_pos.z) + 5;
		cam->setPosition(cam_pos);
		cam->setOrientation(cam_orient);
		mdlanictrl.update(deltaTime);
		mdlanictrl2.update(deltaTime);
		grctx->clearDisplay();
		grctx->setShader(sh);

		grctx->setProjectionMatrix(cam->getLens());
		grctx->setViewMatrix(cam->getView());
		grctx->setModelMatrix(&mdlm);
		for (int i = 0; i < mdl->getNumMeshes(); i++)
		{
			grctx->setMesh(mdl->getMesh(i));
			grctx->setMaterial(mdl->getMaterial(mdl->getMesh(i)->getMaterialId()));
			grctx->setBoneTransformation(mdlanictrl.getBoneTransformation(), mdlanictrl.getNumBones());

			grctx->draw();
		}

		grctx->setModelMatrix(&mdlm2);
		for (int i = 0; i < mdl2->getNumMeshes(); i++)
		{
			grctx->setMesh(mdl2->getMesh(i));
			grctx->setMaterial(mdl2->getMaterial(mdl2->getMesh(i)->getMaterialId()));
			grctx->setBoneTransformation(mdlanictrl2.getBoneTransformation(), mdlanictrl2.getNumBones());
			grctx->draw();
		}

		grctx->setShader(tsh);
		grctx->setProjectionMatrix(cam->getLens());
		grctx->setViewMatrix(cam->getView());
		terr->selectNodes(cam);

		grctx->swapBuffers();
		frames++;
	}
	t->end();

	delete sh;

	mmgr->removeAsset("Resources/Models/dwarf1.ms3d");
	mmgr->removeAsset("Resources/Models/ant01.ms3d");
	std::cout << "TpF: " << t->getLastMilli() / frames << " mspf was " << frames
			<< " Frames in " << t->getLastMilli() << "ms or "
			<< frames / t->getLastSecond() << "fps" << std::endl;
	delete mmgr;
	delete tmgr;
	delete t;
	delete GSystem;

	return 0;
}
开发者ID:Cracky,项目名称:XiyaGE,代码行数:101,代码来源:main.cpp


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