本文整理汇总了C++中technique::PassIterator类的典型用法代码示例。如果您正苦于以下问题:C++ PassIterator类的具体用法?C++ PassIterator怎么用?C++ PassIterator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PassIterator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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
}
示例2: 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));
}
}
}
}
}
示例3: 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;
}
示例4: 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
);
}
}
示例5: setColor
void MaterialInstance::setColor(float red, float green, float blue, float alpha)
{
if (mCopyMat.isNull ()) {
createCopyMaterial ();
}
unsigned short i = 0, j;
ColourValue sc, dc; // Source colur, destination colour
Material::TechniqueIterator techniqueIt = mCopyMat->getTechniqueIterator ();
while (techniqueIt.hasMoreElements ())
{
Technique *t = techniqueIt.getNext ();
Technique::PassIterator passIt = t->getPassIterator ();
j = 0;
while (passIt.hasMoreElements ())
{
sc = mOriginalMat->getTechnique (i)->getPass (j)->getDiffuse ();
dc = sc;
dc.a = alpha;
dc.r = red;
dc.g = green;
dc.b = blue;
passIt.peekNext ()->setAmbient (mOriginalMat->getTechnique (i)->getPass (j)->getAmbient ());
passIt.peekNext ()->setDiffuse (dc);
passIt.moveNext ();
++j;
}
++i;
}
}
示例6: ChangeOriginalMaterial
void MaterialInstance::ChangeOriginalMaterial()
{
if (mCopyMat.isNull ()) {
createCopyMaterial ();
}
unsigned short i = 0, j;
ColourValue sc, dc; // Source colur, destination colour
Material::TechniqueIterator techniqueIt = mCopyMat->getTechniqueIterator ();
while (techniqueIt.hasMoreElements ())
{
Technique *t = techniqueIt.getNext ();
Technique::PassIterator passIt = t->getPassIterator ();
j = 0;
while (passIt.hasMoreElements ())
{
sc = mOriginalMat->getTechnique (i)->getPass (j)->getDiffuse ();
passIt.peekNext ()->setAmbient (mOriginalMat->getTechnique (i)->getPass (j)->getAmbient ());
passIt.peekNext ()->setDiffuse (sc);
passIt.moveNext ();
++j;
}
++i;
}
}
示例7: 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);
}
}
示例8: 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);
}
}
}
}
示例9: 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
);
}
}
示例10: 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);
} } } } }
}
示例11: createCopyMaterial
void MaterialInstance::createCopyMaterial () {
String name;
// Avoid name collision
do {
name = mOriginalMat->getName () + StringConverter::toString (Math::UnitRandom ());
} while (MaterialManager::getSingleton ().resourceExists (name));
mCopyMat = mOriginalMat->clone (name);
Material::TechniqueIterator techniqueIt = mCopyMat->getTechniqueIterator ();
while (techniqueIt.hasMoreElements ()) {
Technique *t = techniqueIt.getNext ();
Technique::PassIterator passIt = t->getPassIterator ();
while (passIt.hasMoreElements ()) {
passIt.peekNext ()->setDepthWriteEnabled (false);
passIt.peekNext ()->setSceneBlending (mSBT);
passIt.moveNext ();
}
}
}
示例12: subEntityAction
//===========================================================================
// MaterialPassAction
//===========================================================================
void IMaterialPassAction::subEntityAction( SubEntityMaterial* subEntity ) const
{
if( !subEntity->getMaterial().isNull() )
{
unsigned short i = 0 ;
for( Material::TechniqueIterator techniqueIt = subEntity->getMaterial()->getTechniqueIterator() ;
techniqueIt.hasMoreElements() ;
techniqueIt.moveNext(), ++i )
{
Technique* techniqueScr = subEntity->getMaterial()->getTechnique( i ) ;
unsigned short j = 0;
for( Technique::PassIterator passIt = techniqueIt.peekNext()->getPassIterator ();
passIt.hasMoreElements() ;
passIt.moveNext(), ++j )
{
passAction( subEntity, passIt.peekNext(), techniqueScr->getPass( j ) ) ;
}
}
}
}
示例13: 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);
}
}
示例14: 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 );
}
}
}
}
}
示例15: 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; }
} } } }
}