本文整理汇总了C++中IScene::getMaterialNames方法的典型用法代码示例。如果您正苦于以下问题:C++ IScene::getMaterialNames方法的具体用法?C++ IScene::getMaterialNames怎么用?C++ IScene::getMaterialNames使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IScene
的用法示例。
在下文中一共展示了IScene::getMaterialNames方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
PassOptix::optixInit() {
glGetError();
// Can these be removed due to texture count?
o_TexLib.addTexture(1);
o_Context["tex0"]->set(o_TexLib.getTexture(1));
std::set<std::string> *materialNames = new std::set<std::string>;
std::vector<std::string>::iterator scenesIter;
scenesIter = m_SceneVector.begin();
for ( ; scenesIter != m_SceneVector.end(); ++scenesIter) {
IScene *aScene = RENDERMANAGER->getScene (*scenesIter);
aScene->compile();
// Adding Materials to optix lib
aScene->getMaterialNames(materialNames);
std::set<std::string>::iterator matIter;
matIter = materialNames->begin();
for( ; matIter != materialNames->end(); ++matIter) {
o_MatLib.addMaterial(m_MaterialMap[*matIter]);
}
materialNames->clear();
std::vector<SceneObject *> objs = aScene->getAllObjects();
std::vector<nau::scene::SceneObject*>::iterator objsIter;
objsIter = objs.begin();
for ( ; objsIter != objs.end(); ++objsIter) {
o_GeomLib.addSceneObject(*objsIter, m_MaterialMap);
// o_GeomLib.addSceneObject((*objsIter)->getId(), m_MaterialMap);
}
}
o_GeomLib.buildGeometryGroup();
o_Context["top_object"]->set(o_GeomLib.getGeometryGroup());
o_MatLib.applyMissPrograms();
std::map<std::string, std::string>::iterator iter;
iter = o_InputBuffers.begin();
for ( ; iter != o_InputBuffers.end(); ++iter) {
try {
unsigned int id = RESOURCEMANAGER->getTexture(iter->second)->getPropi(ITexture::ID);
if (RESOURCEMANAGER->getTexture(iter->second)->getPrope(ITexture::DIMENSION) == GL_TEXTURE_2D) {
optix::TextureSampler rtWorldSpaceTexture = o_Context->createTextureSamplerFromGLImage(id, RT_TARGET_GL_TEXTURE_2D);
rtWorldSpaceTexture->setWrapMode(0, RT_WRAP_CLAMP_TO_EDGE);
rtWorldSpaceTexture->setWrapMode(1, RT_WRAP_CLAMP_TO_EDGE);
rtWorldSpaceTexture->setIndexingMode(RT_TEXTURE_INDEX_ARRAY_INDEX);
rtWorldSpaceTexture->setReadMode(RT_TEXTURE_READ_ELEMENT_TYPE);
rtWorldSpaceTexture->setMaxAnisotropy(1.0f);
rtWorldSpaceTexture->setFilteringModes(RT_FILTER_NEAREST, RT_FILTER_NEAREST, RT_FILTER_NONE);
o_Context[iter->first]->setTextureSampler(rtWorldSpaceTexture);
}
}
catch(optix::Exception& e) {
NAU_THROW("Optix Error: Input Buffer preparation in pass %s [%s]", m_Name.c_str(), e.getErrorString().c_str());
}
}
std::map<std::string, databuffer>::iterator iter2;
iter2 = o_OutputDataBuffer.begin();
ITexture *texID;
for ( ; iter2 != o_OutputDataBuffer.end() ; ++iter2) {
texID = RESOURCEMANAGER->getTexture(iter2->second.texName);
// int format = texID->getPrope(ITexture::FORMAT);
int tex = texID->getPropi(ITexture::ID);
unsigned int pbo;
glGenBuffers(1, &pbo);
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pbo);
// need to allow different types
glBufferData(GL_PIXEL_UNPACK_BUFFER, texID->getPropi(ITexture::WIDTH)*texID->getPropi(ITexture::HEIGHT)*texID->getPropi(ITexture::ELEMENT_SIZE), 0, GL_STREAM_READ);
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
optix::Buffer ob = o_Context->createBufferFromGLBO(RT_BUFFER_OUTPUT, pbo);
ob->setSize(texID->getPropi(ITexture::WIDTH), texID->getPropi(ITexture::HEIGHT));
// same here (types)
ob->setFormat(getOptixFormat(texID));
o_Context[iter2->first]->setBuffer(ob);
o_OutputDataBuffer[iter2->first].pbo = pbo;
//
}
#if (TEST == 2)
try {
unsigned int id = RESOURCEMANAGER->getTexture("Deferred Render Targets::pos")->getId();
optix::ITextureSampler rtWorldSpaceTexture = o_Context->createTextureSamplerFromGLImage(id, RT_TARGET_GL_TEXTURE_2D);
rtWorldSpaceTexture->setWrapMode(0, RT_WRAP_CLAMP_TO_EDGE);
rtWorldSpaceTexture->setWrapMode(1, RT_WRAP_CLAMP_TO_EDGE);
//.........这里部分代码省略.........