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


C++ ContentManager::loadTexture方法代码示例

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


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

示例1: loadContent

void Scene::loadContent(ContentManager & contentManager)
{
	/**Model * solidBox = new Model();
	contentManager.loadModel().loadAssimpScene(std::string("content/box.obj"),*solidBox);

	Entity box1 (glm::vec3(10.0,0.0,-50.0),glm::vec3(1.0,1.0,1.0),glm::vec4(0.0,0.0,0.0,0.0));
	Entity box2 (glm::vec3(10.0,0.0,-40.0),glm::vec3(1.0,1.0,1.0),glm::vec4(0.0,0.0,0.0,0.0));
	Entity box3 (glm::vec3(0.0,0.0,-40.0),glm::vec3(1.0,1.0,1.0),glm::vec4(0.0,0.0,0.0,0.0));
	Entity box4 (glm::vec3(0.0,0.0,-50.0),glm::vec3(1.0,1.0,1.0),glm::vec4(0.0,0.0,0.0,0.0));
	solidBox->addEntity(box1);
	solidBox->addEntity(box2);
	solidBox->addEntity(box3);
	solidBox->addEntity(box4);
	
	GLuint difTex = contentManager.loadTexture().loadRAWRGBTexture("content/fieldstone-c.raw",512,512);
	GLuint normTex = contentManager.loadTexture().loadRAWRGBTexture("content/fieldstone-n.raw",512,512);
	solidBox->setDiffuseTexID(difTex);
	solidBox->setNormalTexID(normTex);

	solidBox->setCurrentMaterial(Material::materialId("lambert5SG"));
	Material mat = solidBox->getMaterial("lambert5SG");
	mat.setOpacity(1.0);
	mat.setDiffuseColor(glm::vec3(0.5,0.5,0.5));
	mat.setSpecularColor(glm::vec3(0.5,0.5,0.5));
	solidBox->updateMaterial(mat);

	modelVector.push_back(solidBox);**/

	Model * transparentBox = new Model();
	contentManager.loadModel().loadAssimpScene(std::string("content/box.obj"),*transparentBox);

	for(unsigned int i = 0; i < 20; i += 10)
	{
		for(unsigned int j = 0; j < 20; j += 10)
		{
			Entity box (glm::vec3(i,0.0,j),glm::vec3(1.0,1.0,1.0),glm::vec4(0.0,0.0,0.0,0.0));
			transparentBox->addEntity(box);
		}
	}
	/**Entity box5 (glm::vec3(10.0,0.0,-30.0),glm::vec3(1.0,1.0,1.0),glm::vec4(0.0,0.0,0.0,0.0));
	Entity box6 (glm::vec3(10.0,0.0,-20.0),glm::vec3(1.0,1.0,1.0),glm::vec4(0.0,0.0,0.0,0.0));
	Entity box7 (glm::vec3(0.0,0.0,-20.0),glm::vec3(1.0,1.0,1.0),glm::vec4(0.0,0.0,0.0,0.0));
	Entity box8 (glm::vec3(0.0,0.0,-30.0),glm::vec3(1.0,1.0,1.0),glm::vec4(0.0,0.0,0.0,0.0));
	transparentBox->addEntity(box5);
	transparentBox->addEntity(box6);
	transparentBox->addEntity(box7);
	transparentBox->addEntity(box8);**/
	
	GLuint difTexO = contentManager.loadTexture().loadRAWRGBTexture("content/fieldstone-c.raw",512,512);
	GLuint normTexO = contentManager.loadTexture().loadRAWRGBTexture("content/fieldstone-n.raw",512,512);
	transparentBox->setDiffuseTexID(difTexO);
	transparentBox->setNormalTexID(normTexO);

	transparentBox->setCurrentMaterial(Material::materialId("lambert5SG"));
	Material matO = transparentBox->getMaterial("lambert5SG");
	matO.setOpacity(0.5);
	matO.setDiffuseColor(glm::vec3(0.5,0.5,0.5));
	matO.setAmbientColor(glm::vec3(0.1,0.1,0.1));
	matO.setSpecularColor(glm::vec3(0.5,0.5,0.5));
	transparentBox->updateMaterial(matO);

	modelVector.push_back(transparentBox);

	// Lights
	Light * pointLight1 = new Light(glm::vec3(-10,0,0),glm::vec3(1.0,1.0,1.0),30.0);
	Light * pointLight2 = new Light(glm::vec3(-10,0,0),glm::vec3(1.0,1.0,1.0),15.0);
	Light * pointLight3 = new Light(glm::vec3(0,0,-10),glm::vec3(1.0,1.0,1.0),15.0);

	lightVector.push_back(pointLight1);
	lightVector.push_back(pointLight2);
	lightVector.push_back(pointLight3);
}
开发者ID:CrizMobius,项目名称:Deferred-Shader,代码行数:72,代码来源:Scene.cpp


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