本文整理汇总了C++中ogre::MaterialPtr::setNull方法的典型用法代码示例。如果您正苦于以下问题:C++ MaterialPtr::setNull方法的具体用法?C++ MaterialPtr::setNull怎么用?C++ MaterialPtr::setNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::MaterialPtr
的用法示例。
在下文中一共展示了MaterialPtr::setNull方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cleanupContent
void cleanupContent()
{
// get rid of the shared pointers before shutting down ogre or exceptions occure
std::cout << "Imposto i servizi per gli shader di texture\n";
mActiveFragmentProgram.setNull();
mActiveFragmentParameters.setNull();
mActiveVertexProgram.setNull();
mActiveVertexParameters.setNull();
mActiveMaterial.setNull();
std::cout << "Impostazione terminata\n";
}
示例2: RemoveMaterial
void RemoveMaterial(Ogre::MaterialPtr& material)
{
if (!material.isNull())
{
std::string material_name = material->getName();
material.setNull();
try
{
Ogre::MaterialManager::getSingleton().remove(material_name);
}
catch (Ogre::Exception& e)
{
OgreRenderingModule::LogDebug("Failed to remove Ogre material:" + std::string(e.what()));
}
}
}
示例3: ToOgreMaterial
//.........这里部分代码省略.........
newParamValue.resize(size);
// Find the corresponding property value.
QVariant val = property(paramName.append(" FP").toLatin1());
if (!val.isValid() || val.isNull())
continue;
TypeValuePair typeValuePair = val.toMap();
QString newValueString(typeValuePair.begin().value().toByteArray());
newValueString.trimmed();
// Fill the float vector with new values.
it = newParamValue.begin();
int i = 0, j = 0;
bool ok = true;
while(j != -1 && ok)
{
j = newValueString.indexOf(' ', i);
QString newValue = newValueString.mid(i, j == -1 ? j : j - i);
if (!newValue.isEmpty())
{
*it = *it = newValue.toFloat(&ok);
++it;
}
i = j + 1;
}
// Set the new value.
///\todo use the exact count rather than just 4 values if needed.
if (size == 16)
{
Ogre::Matrix4 matrix(newParamValue[0], newParamValue[1], newParamValue[2], newParamValue[3],
newParamValue[4], newParamValue[5], newParamValue[6], newParamValue[7],
newParamValue[8], newParamValue[9], newParamValue[10], newParamValue[11],
newParamValue[12], newParamValue[13], newParamValue[14], newParamValue[15]);
#if OGRE_VERSION_MINOR <= 6 && OGRE_VERSION_MAJOR <= 1
fragPtr->_writeRawConstant(paramDef.physicalIndex, matrix);
#else
fragPtr->_writeRawConstant(paramDef.physicalIndex, matrix, size);
#endif
}
else
{
Ogre::Vector4 vector(newParamValue[0], newParamValue[1], newParamValue[2], newParamValue[3]);
fragPtr->_writeRawConstant(paramDef.physicalIndex, vector);
}
}
}
}
}
}
Ogre::Pass::TextureUnitStateIterator texIter = pass->getTextureUnitStateIterator();
while(texIter.hasMoreElements())
{
// Texture units
Ogre::TextureUnitState *tu = texIter.getNext();
// Replace the texture name (uuid) with the new one
QString tu_name(tu->getName().c_str());
QVariant val = property(tu_name.append(" TU").toLatin1());
if (!val.isValid() || val.isNull())
continue;
TypeValuePair typeValuePair = val.toMap();
QString newValueString(typeValuePair.begin().value().toByteArray());
newValueString.trimmed();
tu->setTextureName(newValueString.toStdString());
/*
//QString new_texture_name = iter->second;
RexUUID new_name(iter->second);
// If new texture is UUID-based one, make sure the corresponding RexOgreTexture gets created,
// because we may not be able to load it later if load fails now
if (RexUUID::IsValid(new_texture_name))
{
RexUUID imageID(new_texture_name);
if (!imageID.IsNull())
{
image* image = imageList.getImage(imageID);
if (image)
{
image->getOgreTexture();
}
}
}
//tu->setTextureName(iter->second);
*/
}
}
}
return matPtrClone;
}
matPtrClone.setNull();
return matPtrClone;
}
示例4: SetData
//.........这里部分代码省略.........
}
else
{
// Write line to the modified copy
if (!skip_until_next)
output << line << std::endl;
if (brace_level <= skip_brace_level)
skip_until_next = false;
}
}
}
std::string output_str = output.str();
Ogre::DataStreamPtr modified_data = Ogre::DataStreamPtr(new Ogre::MemoryDataStream((u8 *)(&output_str[0]), output_str.size()));
matmgr.parseScript(modified_data, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
Ogre::MaterialPtr tempmat;
tempmat = matmgr.getByName(tempname);
if (tempmat.isNull())
{
OgreRenderingModule::LogWarning(std::string("Failed to create an Ogre material from material asset ") +
source->GetId());
return false;
}
if(!tempmat->getNumTechniques())
{
OgreRenderingModule::LogWarning("Failed to create an Ogre material from material asset " +
source->GetId());
return false;
}
ogre_material_ = tempmat->clone(id_);
tempmat.setNull();
matmgr.remove(tempname);
if (ogre_material_.isNull())
{
OgreRenderingModule::LogWarning("Failed to create an Ogre material from material asset " +
source->GetId());
return false;
}
// Now go through all the texturenames and restore \ back to / and @ to :
Ogre::Material::TechniqueIterator iter = ogre_material_->getTechniqueIterator();
while (iter.hasMoreElements())
{
Ogre::Technique *tech = iter.getNext();
Ogre::Technique::PassIterator passIter = tech->getPassIterator();
while (passIter.hasMoreElements())
{
Ogre::Pass *pass = passIter.getNext();
Ogre::Pass::TextureUnitStateIterator texIter = pass->getTextureUnitStateIterator();
while (texIter.hasMoreElements())
{
Ogre::TextureUnitState *texUnit = texIter.getNext();
std::string texname = texUnit->getTextureName();
if (texname.find('\\') != std::string::npos)
{
ReplaceCharInplace(texname, '\\', '/');
ReplaceCharInplace(texname, '@', ':');
texUnit->setTextureName(texname);
}
}
}
}