本文整理汇总了C++中ContentManager::loadModel方法的典型用法代码示例。如果您正苦于以下问题:C++ ContentManager::loadModel方法的具体用法?C++ ContentManager::loadModel怎么用?C++ ContentManager::loadModel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContentManager
的用法示例。
在下文中一共展示了ContentManager::loadModel方法的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);
}