Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

range loop refactoring #2845

Merged
merged 1 commit into from
May 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 28 additions & 43 deletions OgreMain/src/OgreTechnique.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ namespace Ogre {
}
}



//Check compilation errors for all program types.
for (int t = 0; t < 6; t++)
Expand Down Expand Up @@ -229,7 +229,7 @@ namespace Ogre {
<< std::endl;
return false;
}

}
}

Expand Down Expand Up @@ -286,22 +286,13 @@ namespace Ogre {
//-----------------------------------------------------------------------------
Pass* Technique::getPass(const String& name) const
{
Passes::const_iterator i = mPasses.begin();
Passes::const_iterator iend = mPasses.end();
Pass* foundPass = 0;

// iterate through techniques to find a match
while (i != iend)
{
if ( (*i)->getName() == name )
{
foundPass = (*i);
break;
}
++i;
for (Pass *p : mPasses) {
if (p->getName() == name )
return p;
}

return foundPass;
return (Pass *)0;
}
//-----------------------------------------------------------------------------
void Technique::removePass(unsigned short index)
Expand Down Expand Up @@ -550,7 +541,7 @@ namespace Ogre {
for (auto *p : mPasses)
{
p->_unload();
}
}
}
//-----------------------------------------------------------------------------
bool Technique::isLoaded(void) const
Expand Down Expand Up @@ -758,11 +749,9 @@ namespace Ogre {
{
// Alpha rejection passes must retain their transparency, so
// we allow the texture units, but override the colour functions
Pass::TextureUnitStates::const_iterator it;
for(it = newPass->getTextureUnitStates().begin(); it != newPass->getTextureUnitStates().end(); ++it)
for(auto *s : newPass->getTextureUnitStates())
{
TextureUnitState* tus = *it;
tus->setColourOperationEx(LBX_SOURCE1, LBS_CURRENT);
s->setColourOperationEx(LBX_SOURCE1, LBS_CURRENT);
}
}
else
Expand Down Expand Up @@ -844,11 +833,9 @@ namespace Ogre {
{
// Alpha rejection passes must retain their transparency, so
// we allow the texture units, but override the colour functions
Pass::TextureUnitStates::const_iterator it;
for(it = newPass->getTextureUnitStates().begin(); it != newPass->getTextureUnitStates().end(); ++it)
for(auto *s : newPass->getTextureUnitStates())
{
TextureUnitState* tus = *it;
tus->setColourOperationEx(LBX_SOURCE1, LBS_CURRENT);
s->setColourOperationEx(LBX_SOURCE1, LBS_CURRENT);
}
}
else
Expand Down Expand Up @@ -981,13 +968,13 @@ namespace Ogre {
return mParent->getGroup();
}
//-----------------------------------------------------------------------
Ogre::MaterialPtr Technique::getShadowCasterMaterial() const
{
return mShadowCasterMaterial;
Ogre::MaterialPtr Technique::getShadowCasterMaterial() const
{
return mShadowCasterMaterial;
}
//-----------------------------------------------------------------------
void Technique::setShadowCasterMaterial(Ogre::MaterialPtr val)
{
void Technique::setShadowCasterMaterial(Ogre::MaterialPtr val)
{
if (!val)
{
mShadowCasterMaterial.reset();
Expand All @@ -997,39 +984,39 @@ namespace Ogre {
{
// shadow caster material should never receive shadows
val->setReceiveShadows(false); // should we warn if this is not set?
mShadowCasterMaterial = val;
mShadowCasterMaterial = val;
mShadowCasterMaterialName = val->getName();
}
}
//-----------------------------------------------------------------------
void Technique::setShadowCasterMaterial(const Ogre::String &name)
{
void Technique::setShadowCasterMaterial(const Ogre::String &name)
{
setShadowCasterMaterial(MaterialManager::getSingleton().getByName(name));
// remember the name, even if it is not created yet
mShadowCasterMaterialName = name;
}
//-----------------------------------------------------------------------
Ogre::MaterialPtr Technique::getShadowReceiverMaterial() const
{
return mShadowReceiverMaterial;
Ogre::MaterialPtr Technique::getShadowReceiverMaterial() const
{
return mShadowReceiverMaterial;
}
//-----------------------------------------------------------------------
void Technique::setShadowReceiverMaterial(Ogre::MaterialPtr val)
{
void Technique::setShadowReceiverMaterial(Ogre::MaterialPtr val)
{
if (!val)
{
mShadowReceiverMaterial.reset();
mShadowReceiverMaterialName.clear();
}
else
{
mShadowReceiverMaterial = val;
mShadowReceiverMaterial = val;
mShadowReceiverMaterialName = val->getName();
}
}
//-----------------------------------------------------------------------
void Technique::setShadowReceiverMaterial(const Ogre::String &name)
{
void Technique::setShadowReceiverMaterial(const Ogre::String &name)
{
mShadowReceiverMaterialName = name;
mShadowReceiverMaterial = MaterialManager::getSingleton().getByName(name);
}
Expand Down Expand Up @@ -1062,7 +1049,7 @@ namespace Ogre {
return GPUVendorRuleIterator(mGPUVendorRules.begin(), mGPUVendorRules.end());
}
//---------------------------------------------------------------------
void Technique::addGPUDeviceNameRule(const String& devicePattern,
void Technique::addGPUDeviceNameRule(const String& devicePattern,
Technique::IncludeOrExclude includeOrExclude, bool caseSensitive)
{
addGPUDeviceNameRule(GPUDeviceNameRule(devicePattern, includeOrExclude, caseSensitive));
Expand Down Expand Up @@ -1091,6 +1078,4 @@ namespace Ogre {
return GPUDeviceNameRuleIterator(mGPUDeviceNameRules.begin(), mGPUDeviceNameRules.end());
}
//---------------------------------------------------------------------


}