本文整理汇总了C++中technique::PassIterator::getNext方法的典型用法代码示例。如果您正苦于以下问题:C++ PassIterator::getNext方法的具体用法?C++ PassIterator::getNext怎么用?C++ PassIterator::getNext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类technique::PassIterator
的用法示例。
在下文中一共展示了PassIterator::getNext方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: instancedMaterialName
String OgreSample13App::buildInstancedMaterial(const String &originalMaterialName)
{
if (StringUtil::endsWith(originalMaterialName,"/instanced"))
{
return originalMaterialName;
}
MaterialPtr originalMaterial = MaterialManager::getSingleton().getByName(originalMaterialName);
const String instancedMaterialName(originalMaterial.isNull() ? "Instancing" : originalMaterialName + "/Instanced");
MaterialPtr instancedMaterial = MaterialManager::getSingleton().getByName(instancedMaterialName);
if (instancedMaterial.isNull())
{
instancedMaterial = originalMaterial->clone(instancedMaterialName);
instancedMaterial->load();
Technique::PassIterator pIt = instancedMaterial->getBestTechnique()->getPassIterator();
while(pIt.hasMoreElements())
{
Pass * const p = pIt.getNext();
p->setVertexProgram("Instancing",false);
p->setShadowCasterVertexProgram("InstancingShadowCaster");
}
}
instancedMaterial->load();
return instancedMaterialName;
}
示例2: execute
virtual void execute(SceneManager *sm, RenderSystem *rs)
{
// Fire listener
instance->_fireNotifyMaterialRender(pass_id, mat);
Rectangle2D * mRectangle=static_cast<Rectangle2D *>(CompositorManager::getSingleton()._getTexturedRectangle2D());
if (mQuadCornerModified)
{
// insure positions are using peculiar render system offsets
RenderSystem* rs = Root::getSingleton().getRenderSystem();
Viewport* vp = rs->_getViewport();
Real hOffset = rs->getHorizontalTexelOffset() / (0.5 * vp->getActualWidth());
Real vOffset = rs->getVerticalTexelOffset() / (0.5 * vp->getActualHeight());
mRectangle->setCorners(mQuadLeft + hOffset, mQuadTop - vOffset, mQuadRight + hOffset, mQuadBottom - vOffset);
}
// Queue passes from mat
Technique::PassIterator i = technique->getPassIterator();
while(i.hasMoreElements())
{
sm->_injectRenderWithPass(
i.getNext(),
mRectangle,
false // don't allow replacement of shadow passes
);
}
}
示例3: ChangeClr
void CarModel::ChangeClr()
{
int i = iColor;
float c_h = pSet->gui.car_hue[i], c_s = pSet->gui.car_sat[i],
c_v = pSet->gui.car_val[i], gloss = pSet->gui.car_gloss[i], refl = pSet->gui.car_refl[i];
color.setHSB(1-c_h, c_s, c_v); //set, mini pos clr
MaterialPtr mtr = MaterialManager::getSingleton().getByName(sMtr[Mtr_CarBody]);
if (!mtr.isNull())
{ Material::TechniqueIterator techIt = mtr->getTechniqueIterator();
while (techIt.hasMoreElements())
{ Technique* tech = techIt.getNext();
Technique::PassIterator passIt = tech->getPassIterator();
while (passIt.hasMoreElements())
{ Pass* pass = passIt.getNext();
if (pass->hasFragmentProgram())
{
GpuProgramParametersSharedPtr params = pass->getFragmentProgramParameters();
params->setNamedConstant("carColour", color);
params->setNamedConstant("glossiness", 1 - gloss);
params->setNamedConstant("reflectiveness", refl);
} } } }
if (pNickTxt)
pNickTxt->setTextColour(MyGUI::Colour(color.r,color.g,color.b));
// opp list text and mini pos colors - auto in hud update
}
示例4: setShadowsEnabled
void MaterialFactory::setShadowsEnabled(bool bEnable)
{
for (std::vector<MaterialDefinition*>::iterator it=mDefinitions.begin();
it!=mDefinitions.end(); ++it)
{
MaterialPtr mat = MaterialManager::getSingleton().getByName( (*it)->getName() );
if (mat.isNull()) continue;
Material::TechniqueIterator techIt = mat->getTechniqueIterator();
while (techIt.hasMoreElements())
{
Technique* tech = techIt.getNext();
Technique::PassIterator passIt = tech->getPassIterator();
while (passIt.hasMoreElements())
{
Pass* pass = passIt.getNext();
if (pass->hasFragmentProgram())
{
if ( pass->getFragmentProgramParameters()->_findNamedConstantDefinition("enableShadows", false))
pass->getFragmentProgramParameters()->setNamedConstant("enableShadows", Real(bEnable));
}
}
}
}
}
示例5: addTransparentRenderable
//-----------------------------------------------------------------------
void RenderPriorityGroup::addTransparentRenderable(Technique* pTech, Renderable* rend)
{
Technique::PassIterator pi = pTech->getPassIterator();
while (pi.hasMoreElements())
{
// Insert into transparent list
mTransparents.addRenderable(pi.getNext(), rend);
}
}
示例6: setSceneBlending
void MaterialInstance::setSceneBlending (SceneBlendType sbt) {
mSBT = sbt;
if (!mCopyMat.isNull ()) {
Material::TechniqueIterator techniqueIt = mCopyMat->getTechniqueIterator ();
while (techniqueIt.hasMoreElements ()) {
Technique *t = techniqueIt.getNext ();
Technique::PassIterator passIt = t->getPassIterator ();
while (passIt.hasMoreElements ()) {
passIt.getNext ()->setSceneBlending (mSBT);
}
}
}
}
示例7: execute
virtual void execute(SceneManager *sm, RenderSystem *rs)
{
// Fire listener
instance->_fireNotifyMaterialRender(pass_id, mat);
// Queue passes from mat
Technique::PassIterator i = technique->getPassIterator();
while(i.hasMoreElements())
{
sm->_injectRenderWithPass(
i.getNext(),
CompositorManager::getSingleton()._getTexturedRectangle2D(),
false // don't allow replacement of shadow passes
);
}
}
示例8: UpdateLightMap
//-------------------------------------------------------------------------------------------------------
// utility
//-------------------------------------------------------------------------------------------------------
void CarModel::UpdateLightMap()
{
MaterialPtr mtr;
for (int i=0; i < NumMaterials; ++i)
{
mtr = MaterialManager::getSingleton().getByName(sMtr[i]);
if (!mtr.isNull())
{ Material::TechniqueIterator techIt = mtr->getTechniqueIterator();
while (techIt.hasMoreElements())
{ Technique* tech = techIt.getNext();
Technique::PassIterator passIt = tech->getPassIterator();
while (passIt.hasMoreElements())
{ Pass* pass = passIt.getNext();
if (pass->hasFragmentProgram())
{
GpuProgramParametersSharedPtr params = pass->getFragmentProgramParameters();
params->setIgnoreMissingParams(true); // don't throw exception if material doesnt use lightmap
params->setNamedConstant("enableTerrainLightMap", bLightMapEnabled ? 1.f : 0.f);
} } } } }
}
示例9: UpdateBraking
void CarModel::UpdateBraking()
{
if (brakes)
brakes->setVisible(bBraking && mbVisible);
std::string texName = sDirname + (bBraking ? "_body00_brake.png" : "_body00_add.png");
MaterialPtr mtr = MaterialManager::getSingleton().getByName(sMtr[Mtr_CarBody]);
if (!mtr.isNull())
{ Material::TechniqueIterator techIt = mtr->getTechniqueIterator();
while (techIt.hasMoreElements())
{ Technique* tech = techIt.getNext();
Technique::PassIterator passIt = tech->getPassIterator();
while (passIt.hasMoreElements())
{ Pass* pass = passIt.getNext();
Pass::TextureUnitStateIterator tusIt = pass->getTextureUnitStateIterator();
while (tusIt.hasMoreElements())
{
TextureUnitState* tus = tusIt.getNext();
if (tus->getName() == "diffuseMap")
{ tus->setTextureName( texName ); return; }
} } } }
}
示例10: addSolidRenderable
//-----------------------------------------------------------------------
void RenderPriorityGroup::addSolidRenderable(Technique* pTech,
Renderable* rend, bool addToNoShadow)
{
Technique::PassIterator pi = pTech->getPassIterator();
QueuedRenderableCollection* collection;
if (addToNoShadow)
{
collection = &mSolidsNoShadowReceive;
}
else
{
collection = &mSolidsBasic;
}
while (pi.hasMoreElements())
{
// Insert into solid list
Pass* p = pi.getNext();
collection->addRenderable(p, rend);
}
}
示例11: update
void MaterialFactory::update()
{
for (std::vector<std::string>::const_iterator it = timeMtrs.begin();
it != timeMtrs.end(); ++it)
{
MaterialPtr mtr = MaterialManager::getSingleton().getByName( (*it) );
if (!mtr.isNull())
{ Material::TechniqueIterator techIt = mtr->getTechniqueIterator();
while (techIt.hasMoreElements())
{ Technique* tech = techIt.getNext();
Technique::PassIterator passIt = tech->getPassIterator();
while (passIt.hasMoreElements())
{ Pass* pass = passIt.getNext();
// time
if (pass->hasFragmentProgram() && pass->getFragmentProgramParameters()->_findNamedConstantDefinition("time", false))
pass->getFragmentProgramParameters()->setNamedConstantFromTime( "time", 1 );
}
}
}
}
}
示例12: isPotentialOccluder
bool OcclusionQuery::isPotentialOccluder(Ogre::SceneNode* node)
{
bool result = false;
for (unsigned int i=0; i < node->numAttachedObjects(); ++i)
{
MovableObject* ob = node->getAttachedObject(i);
std::string type = ob->getMovableType();
if (type == "Entity")
{
Entity* ent = static_cast<Entity*>(ob);
for (unsigned int j=0; j < ent->getNumSubEntities(); ++j)
{
// if any sub entity has a material with depth write off,
// consider the object as not an occluder
MaterialPtr mat = ent->getSubEntity(j)->getMaterial();
Material::TechniqueIterator techIt = mat->getTechniqueIterator();
while (techIt.hasMoreElements())
{
Technique* tech = techIt.getNext();
Technique::PassIterator passIt = tech->getPassIterator();
while (passIt.hasMoreElements())
{
Pass* pass = passIt.getNext();
if (pass->getDepthWriteEnabled() == false)
return false;
else
result = true;
}
}
}
}
}
return result;
}
示例13: renderStaticGeometry
//-----------------------------------------------------------------------
void BspSceneManager::renderStaticGeometry(void)
{
// Check we should be rendering
if (!isRenderQueueToBeProcessed(mWorldGeometryRenderQueue))
return;
// Cache vertex/face data first
vector<StaticFaceGroup*>::type::const_iterator faceGrpi;
static RenderOperation patchOp;
// no world transform required
mDestRenderSystem->_setWorldMatrix(Matrix4::IDENTITY);
// Set view / proj
setViewMatrix(mCachedViewMatrix);
mDestRenderSystem->_setProjectionMatrix(mCameraInProgress->getProjectionMatrixRS());
// For each material in turn, cache rendering data & render
MaterialFaceGroupMap::const_iterator mati;
for (mati = mMatFaceGroupMap.begin(); mati != mMatFaceGroupMap.end(); ++mati)
{
// Get Material
Material* thisMaterial = mati->first;
// Empty existing cache
mRenderOp.indexData->indexCount = 0;
// lock index buffer ready to receive data
unsigned int* pIdx = static_cast<unsigned int*>(
mRenderOp.indexData->indexBuffer->lock(HardwareBuffer::HBL_DISCARD));
for (faceGrpi = mati->second.begin(); faceGrpi != mati->second.end(); ++faceGrpi)
{
// Cache each
unsigned int numelems = cacheGeometry(pIdx, *faceGrpi);
mRenderOp.indexData->indexCount += numelems;
pIdx += numelems;
}
// Unlock the buffer
mRenderOp.indexData->indexBuffer->unlock();
// Skip if no faces to process (we're not doing flare types yet)
if (mRenderOp.indexData->indexCount == 0)
continue;
Technique::PassIterator pit = thisMaterial->getTechnique(0)->getPassIterator();
while (pit.hasMoreElements())
{
_setPass(pit.getNext());
mDestRenderSystem->_render(mRenderOp);
}
} // for each material
/*
if (mShowNodeAABs)
{
mDestRenderSystem->_render(mAABGeometry);
}
*/
}
示例14: collectPasses
void CompositorInstance::collectPasses(TargetOperation &finalState, CompositionTargetPass *target)
{
/// Here, passes are converted into render target operations
Pass *targetpass;
Technique *srctech;
MaterialPtr mat, srcmat;
CompositionTargetPass::PassIterator it = target->getPassIterator();
while(it.hasMoreElements())
{
CompositionPass *pass = it.getNext();
switch(pass->getType())
{
case CompositionPass::PT_CLEAR:
queueRenderSystemOp(finalState, new RSClearOperation(
pass->getClearBuffers(),
pass->getClearColour(),
pass->getClearDepth(),
pass->getClearStencil()
));
break;
case CompositionPass::PT_STENCIL:
queueRenderSystemOp(finalState, new RSStencilOperation(
pass->getStencilCheck(),pass->getStencilFunc(), pass->getStencilRefValue(),
pass->getStencilMask(), pass->getStencilFailOp(), pass->getStencilDepthFailOp(),
pass->getStencilPassOp(), pass->getStencilTwoSidedOperation()
));
break;
case CompositionPass::PT_RENDERSCENE:
if(pass->getFirstRenderQueue() < finalState.currentQueueGroupID)
{
/// Mismatch -- warn user
/// XXX We could support repeating the last queue, with some effort
LogManager::getSingleton().logMessage("Warning in compilation of Compositor "
+mCompositor->getName()+": Attempt to render queue "+
StringConverter::toString(pass->getFirstRenderQueue())+" before "+
StringConverter::toString(finalState.currentQueueGroupID));
}
/// Add render queues
for(int x=pass->getFirstRenderQueue(); x<=pass->getLastRenderQueue(); ++x)
{
assert(x>=0);
finalState.renderQueues.set(x);
}
finalState.currentQueueGroupID = pass->getLastRenderQueue()+1;
finalState.findVisibleObjects = true;
finalState.materialScheme = target->getMaterialScheme();
break;
case CompositionPass::PT_RENDERQUAD:
srcmat = pass->getMaterial();
if(srcmat.isNull())
{
/// No material -- warn user
LogManager::getSingleton().logMessage("Warning in compilation of Compositor "
+mCompositor->getName()+": No material defined for composition pass");
break;
}
srcmat->compile();
if(srcmat->getNumSupportedTechniques()==0)
{
/// No supported techniques -- warn user
LogManager::getSingleton().logMessage("Warning in compilation of Compositor "
+mCompositor->getName()+": material "+srcmat->getName()+" has no supported techniques");
break;
}
srctech = srcmat->getBestTechnique(0);
/// Create local material
MaterialPtr mat = createLocalMaterial();
/// Copy and adapt passes from source material
Technique::PassIterator i = srctech->getPassIterator();
while(i.hasMoreElements())
{
Pass *srcpass = i.getNext();
/// Create new target pass
targetpass = mat->getTechnique(0)->createPass();
(*targetpass) = (*srcpass);
/// Set up inputs
for(size_t x=0; x<pass->getNumInputs(); ++x)
{
String inp = pass->getInput(x);
if(!inp.empty())
{
if(x < targetpass->getNumTextureUnitStates())
{
targetpass->getTextureUnitState((ushort)x)->setTextureName(getSourceForTex(inp));
}
else
{
/// Texture unit not there
LogManager::getSingleton().logMessage("Warning in compilation of Compositor "
+mCompositor->getName()+": material "+srcmat->getName()+" texture unit "
+StringConverter::toString(x)+" out of bounds");
}
}
}
}
queueRenderSystemOp(finalState, new RSQuadOperation(this,pass->getIdentifier(),mat));
break;
}
//.........这里部分代码省略.........
示例15: generate
//.........这里部分代码省略.........
bool exists = false;
shaderMap::iterator sit;
for (sit = mShaderCache.begin();
sit != mShaderCache.end(); ++sit)
{
if ( sit->second->isEqual( shaderProps ) )
{
exists = true;
break;
}
}
if (!exists)
generator->mShaderCached = false;
else
{
generator->mShaderCached = true;
generator->mVertexProgram = sit->first.first;
generator->mFragmentProgram = sit->first.second;
}
generator->mDef = (*it);
generator->mShader = shaderProps;
generator->generate();
// insert into cache
#ifdef USE_CACHE
if (!exists)
{
if (!generator->mVertexProgram.isNull() && !generator->mFragmentProgram.isNull())
mShaderCache[ std::make_pair(generator->mVertexProgram, generator->mFragmentProgram) ] = shaderProps;
else
delete shaderProps;
}
else
delete shaderProps;
#else
delete shaderProps;
#endif
}
bSettingsChanged = false;
ti.update(); /// time
float dt = ti.dt * 1000.f;
LogO(String("::: Time MaterialFactory: ") + toStr(dt) + " ms");
// recreate cloned car materials
#ifndef ROAD_EDITOR
pApp->recreateCarMtr();
#endif
}
else
{
LogO("[MaterialFactory] settings not changed, using old materials");
}
// update params
for (std::vector<MaterialDefinition*>::iterator it=mDefinitions.begin();
it!=mDefinitions.end(); ++it)
{
MaterialPtr mat = MaterialManager::getSingleton().getByName( (*it)->getName() );
setShaderParams(mat);
}
#ifdef USE_CUSTOM_TERRAIN_MATERIAL
// update terrain params
if (!mTerrain) return;
MaterialPtr terrainMat = mTerrain->_getMaterial();
if (!terrainMat.isNull())
{
Material::TechniqueIterator techIt = terrainMat->getTechniqueIterator();
while (techIt.hasMoreElements())
{
Technique* tech = techIt.getNext();
Technique::PassIterator passIt = tech->getPassIterator();
while (passIt.hasMoreElements())
{
Pass* pass = passIt.getNext();
if (!pass->hasFragmentProgram()
|| !pass->getFragmentProgramParameters()->_findNamedConstantDefinition("fadeStart_farDist", false)) continue;
float fadeDist;
if (mSceneMgr->getShadowFarDistance() != 0)
fadeDist = getShadowsFadeDistance()/mSceneMgr->getShadowFarDistance();
else
fadeDist = 0.f;
pass->getFragmentProgramParameters()->setNamedConstant("fadeStart_farDist", Vector3(
fadeDist,
mSceneMgr->getShadowFarDistance(),
float(getShadowsFade())
));
}
}
}
#endif
}