本文整理汇总了C++中ogre::Technique::getPassIterator方法的典型用法代码示例。如果您正苦于以下问题:C++ Technique::getPassIterator方法的具体用法?C++ Technique::getPassIterator怎么用?C++ Technique::getPassIterator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::Technique
的用法示例。
在下文中一共展示了Technique::getPassIterator方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: destroyMaterial
/**
* Destroy / unload the memory of a material
* @param mat MaterialName
*/
void GUIHelper::destroyMaterial(const Ogre::String &matName)
{
Ogre::MaterialPtr mat = Ogre::MaterialManager::getSingleton().getByName(matName);
if(mat.isNull()) return;
Ogre::Material::TechniqueIterator tit = mat->getTechniqueIterator();
while(tit.hasMoreElements()){
Ogre::Technique *t = tit.peekNext();
ASSERT(t);
Ogre::Technique::PassIterator pit = t->getPassIterator();
while(pit.hasMoreElements()){
Ogre::Pass *pass = pit.peekNext();
ASSERT(pass);
Ogre::Pass::TextureUnitStateIterator tuit =
pass->getTextureUnitStateIterator();
while(tuit.hasMoreElements()){
Ogre::TextureUnitState *tus = tuit.peekNext();
ASSERT(tus);
const Ogre::String &textName = tus->getTextureName();
Ogre::TextureManager::getSingleton().unload(textName);
Ogre::TextureManager::getSingleton().remove(textName);
tuit.moveNext();
}
pit.moveNext();
}
tit.moveNext();
}
Ogre::MaterialManager::getSingleton().unload(matName);
Ogre::MaterialManager::getSingleton().remove(matName);
}
示例2: SetSelfIllumination
void EC_WidgetCanvas::SetSelfIllumination(bool illuminating)
{
if (material_name_.empty())
return;
Ogre::ColourValue emissiveColor;
if (illuminating)
emissiveColor = Ogre::ColourValue(1.0f, 1.0f, 1.0f, 1.0f);
else
emissiveColor = Ogre::ColourValue(0.0f, 0.0f, 0.0f, 0.0f);
Ogre::MaterialPtr material = Ogre::MaterialManager::getSingleton().getByName(material_name_);
if (!material.isNull())
{
Ogre::Material::TechniqueIterator iter = material->getTechniqueIterator();
while(iter.hasMoreElements())
{
Ogre::Technique *tech = iter.getNext();
if (!tech)
continue;
Ogre::Technique::PassIterator passIter = tech->getPassIterator();
while(passIter.hasMoreElements())
{
Ogre::Pass *pass = passIter.getNext();
if (pass)
pass->setSelfIllumination(emissiveColor);
}
}
}
}
示例3: ReplaceTextureOnMaterial
void ReplaceTextureOnMaterial(Ogre::MaterialPtr material, const std::string& original_name, const std::string& texture_name)
{
if (material.isNull())
return;
Ogre::TextureManager &tm = Ogre::TextureManager::getSingleton();
Ogre::TexturePtr tex = tm.getByName(texture_name);
Ogre::Material::TechniqueIterator iter = material->getTechniqueIterator();
while(iter.hasMoreElements())
{
Ogre::Technique *tech = iter.getNext();
assert(tech);
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();
if (texUnit->getTextureName() == original_name)
{
if (tex.get())
texUnit->setTextureName(texture_name);
else
texUnit->setTextureName("TextureMissing.png");
}
}
}
}
}
示例4: Animation
CreatureAnimation::CreatureAnimation(const MWWorld::Ptr& ptr, OEngine::Render::OgreRenderer& _rend): Animation(_rend)
{
mInsert = ptr.getRefData().getBaseNode();
MWWorld::LiveCellRef<ESM::Creature> *ref = ptr.get<ESM::Creature>();
assert (ref->base != NULL);
if(!ref->base->model.empty())
{
const std::string &mesh = "meshes\\" + ref->base->model;
std::string meshNumbered = mesh + getUniqueID(mesh) + ">|";
NifOgre::NIFLoader::load(meshNumbered);
mBase = mRend.getScene()->createEntity(meshNumbered);
mBase->setVisibilityFlags(RV_Actors);
bool transparent = false;
for (unsigned int i=0; i < mBase->getNumSubEntities(); ++i)
{
Ogre::MaterialPtr mat = mBase->getSubEntity(i)->getMaterial();
Ogre::Material::TechniqueIterator techIt = mat->getTechniqueIterator();
while (techIt.hasMoreElements())
{
Ogre::Technique* tech = techIt.getNext();
Ogre::Technique::PassIterator passIt = tech->getPassIterator();
while (passIt.hasMoreElements())
{
Ogre::Pass* pass = passIt.getNext();
if (pass->getDepthWriteEnabled() == false)
transparent = true;
}
}
}
mBase->setRenderQueueGroup(transparent ? RQG_Alpha : RQG_Main);
std::string meshZero = mesh + "0000>|";
if((mTransformations = (NIFLoader::getSingletonPtr())->getAnim(meshZero)))
{
for(std::size_t init = 0; init < mTransformations->size(); init++)
{
mRindexI.push_back(0);
mTindexI.push_back(0);
}
mStopTime = mTransformations->begin()->getStopTime();
mStartTime = mTransformations->begin()->getStartTime();
mShapes = (NIFLoader::getSingletonPtr())->getShapes(meshZero);
}
mTextmappings = NIFLoader::getSingletonPtr()->getTextIndices(meshZero);
mInsert->attachObject(mBase);
}
}
示例5: Animation
CreatureAnimation::CreatureAnimation(const MWWorld::Ptr& ptr): Animation()
{
mInsert = ptr.getRefData().getBaseNode();
MWWorld::LiveCellRef<ESM::Creature> *ref = ptr.get<ESM::Creature>();
assert (ref->mBase != NULL);
if(!ref->mBase->mModel.empty())
{
std::string mesh = "meshes\\" + ref->mBase->mModel;
mEntityList = NifOgre::NIFLoader::createEntities(mInsert, &mTextKeys, mesh);
for(size_t i = 0; i < mEntityList.mEntities.size(); i++)
{
Ogre::Entity *ent = mEntityList.mEntities[i];
ent->setVisibilityFlags(RV_Actors);
bool transparent = false;
for (unsigned int j=0; j < ent->getNumSubEntities() && !transparent; ++j)
{
Ogre::MaterialPtr mat = ent->getSubEntity(j)->getMaterial();
Ogre::Material::TechniqueIterator techIt = mat->getTechniqueIterator();
while (techIt.hasMoreElements() && !transparent)
{
Ogre::Technique* tech = techIt.getNext();
Ogre::Technique::PassIterator passIt = tech->getPassIterator();
while (passIt.hasMoreElements() && !transparent)
{
Ogre::Pass* pass = passIt.getNext();
if (pass->getDepthWriteEnabled() == false)
transparent = true;
}
}
}
ent->setRenderQueueGroup(transparent ? RQG_Alpha : RQG_Main);
}
if(mEntityList.mSkelBase)
{
Ogre::AnimationStateSet *aset = mEntityList.mSkelBase->getAllAnimationStates();
Ogre::AnimationStateIterator as = aset->getAnimationStateIterator();
while(as.hasMoreElements())
{
Ogre::AnimationState *state = as.getNext();
state->setEnabled(true);
state->setLoop(false);
}
}
}
}
示例6: while
void
Terrain::_applyFogMode(const Ogre::MaterialPtr& material, Ogre::FogMode oldFogMode, Ogre::FogMode newFogMode) const
{
if (oldFogMode == newFogMode)
return;
if (mData->mSupportedFogReplacements.empty())
return;
Ogre::String newProgramName;
Ogre::Material::TechniqueIterator ti = material->getTechniqueIterator();
while (ti.hasMoreElements())
{
Ogre::Technique* technique = ti.getNext();
Ogre::Technique::PassIterator pi = technique->getPassIterator();
while (pi.hasMoreElements())
{
Ogre::Pass* pass = pi.getNext();
if (pass->hasVertexProgram() &&
_checkFogProgramName(pass->getVertexProgram(), oldFogMode, newFogMode, newProgramName))
{
pass->setVertexProgram(newProgramName);
}
if (pass->hasFragmentProgram() &&
_checkFogProgramName(pass->getFragmentProgram(), oldFogMode, newFogMode, newProgramName))
{
pass->setFragmentProgram(newProgramName);
}
if (pass->hasShadowCasterVertexProgram() &&
_checkFogProgramName(pass->getShadowCasterVertexProgram(), oldFogMode, newFogMode, newProgramName))
{
pass->setShadowCasterVertexProgram(newProgramName);
}
if (pass->hasShadowReceiverVertexProgram() &&
_checkFogProgramName(pass->getShadowReceiverVertexProgram(), oldFogMode, newFogMode, newProgramName))
{
pass->setShadowReceiverVertexProgram(newProgramName);
}
if (pass->hasShadowReceiverFragmentProgram() &&
_checkFogProgramName(pass->getShadowReceiverFragmentProgram(), oldFogMode, newFogMode, newProgramName))
{
pass->setShadowReceiverFragmentProgram(newProgramName);
}
}
}
}
示例7: findFogPassesByName
void GroundFog::findFogPassesByName (const Ogre::String& passName) {
Ogre::MaterialManager *matManager = Ogre::MaterialManager::getSingletonPtr();
Ogre::MaterialManager::ResourceMapIterator matIt = matManager->getResourceIterator();
while (matIt.hasMoreElements()) {
Ogre::MaterialPtr mat = matIt.getNext();
Ogre::Material::TechniqueIterator techIt = mat->getTechniqueIterator();
while (techIt.hasMoreElements()) {
Ogre::Technique *tech = techIt.getNext();
Ogre::Technique::PassIterator passIt = tech->getPassIterator();
while (passIt.hasMoreElements()) {
Ogre::Pass *pass = passIt.getNext();
if (pass->getName() == passName) {
mPasses.insert(pass);
}
}
}
}
forceUpdate();
}
示例8: GetTextureNamesFromMaterial
void GetTextureNamesFromMaterial(Ogre::MaterialPtr material, StringVector& textures)
{
textures.clear();
if (material.isNull())
return;
// Use a set internally to avoid duplicates
std::set<std::string> textures_set;
Ogre::Material::TechniqueIterator iter = material->getTechniqueIterator();
while(iter.hasMoreElements())
{
Ogre::Technique *tech = iter.getNext();
assert(tech);
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();
const std::string& texname = texUnit->getTextureName();
if (!texname.empty())
textures_set.insert(texname);
}
}
}
std::set<std::string>::iterator i = textures_set.begin();
while (i != textures_set.end())
{
textures.push_back(*i);
++i;
}
}
示例9: Animation
ActivatorAnimation::ActivatorAnimation(const MWWorld::Ptr &ptr)
: Animation(ptr)
{
MWWorld::LiveCellRef<ESM::Activator> *ref = mPtr.get<ESM::Activator>();
assert (ref->mBase != NULL);
if(!ref->mBase->mModel.empty())
{
std::string mesh = "meshes\\" + ref->mBase->mModel;
createEntityList(mPtr.getRefData().getBaseNode(), mesh);
for(size_t i = 0;i < mEntityList.mEntities.size();i++)
{
Ogre::Entity *ent = mEntityList.mEntities[i];
bool transparent = false;
for (unsigned int j=0;j < ent->getNumSubEntities() && !transparent; ++j)
{
Ogre::MaterialPtr mat = ent->getSubEntity(j)->getMaterial();
Ogre::Material::TechniqueIterator techIt = mat->getTechniqueIterator();
while (techIt.hasMoreElements() && !transparent)
{
Ogre::Technique* tech = techIt.getNext();
Ogre::Technique::PassIterator passIt = tech->getPassIterator();
while (passIt.hasMoreElements() && !transparent)
{
Ogre::Pass* pass = passIt.getNext();
if (pass->getDepthWriteEnabled() == false)
transparent = true;
}
}
}
ent->setVisibilityFlags(RV_Misc);
ent->setRenderQueueGroup(transparent ? RQG_Alpha : RQG_Main);
}
setAnimationSource(mesh);
}
}
示例10: unloadTheMesh
// unload all about this mesh. The mesh itself and the textures.
// BETWEEN FRAME OPERATION
void VisCalcFrustDist::unloadTheMesh(Ogre::MeshPtr meshP) {
if (m_shouldCullTextures) {
Ogre::Mesh::SubMeshIterator smi = meshP->getSubMeshIterator();
while (smi.hasMoreElements()) {
Ogre::SubMesh* oneSubMesh = smi.getNext();
Ogre::String subMeshMaterialName = oneSubMesh->getMaterialName();
Ogre::MaterialPtr subMeshMaterial = (Ogre::MaterialPtr)Ogre::MaterialManager::getSingleton().getByName(subMeshMaterialName);
if (!subMeshMaterial.isNull()) {
Ogre::Material::TechniqueIterator techIter = subMeshMaterial->getTechniqueIterator();
while (techIter.hasMoreElements()) {
Ogre::Technique* oneTech = techIter.getNext();
Ogre::Technique::PassIterator passIter = oneTech->getPassIterator();
while (passIter.hasMoreElements()) {
Ogre::Pass* onePass = passIter.getNext();
Ogre::Pass::TextureUnitStateIterator tusIter = onePass->getTextureUnitStateIterator();
while (tusIter.hasMoreElements()) {
Ogre::TextureUnitState* oneTus = tusIter.getNext();
Ogre::String texName = oneTus->getTextureName();
Ogre::TexturePtr texP = (Ogre::TexturePtr)Ogre::TextureManager::getSingleton().getByName(texName);
if (!texP.isNull()) {
// if (texP.useCount() <= 1) {
texP->unload();
LG::IncStat(LG::StatCullTexturesUnloaded);
// LG::Log("unloadTheMesh: unloading texture %s", texName.c_str());
// }
}
}
}
}
}
}
}
if (m_shouldCullMeshes) {
LG::OLMeshTracker::Instance()->MakeUnLoaded(meshP->getName(), Ogre::String(), NULL);
LG::IncStat(LG::StatCullMeshesUnloaded);
// LG::Log("unloadTheMesh: unloading mesh %s", mshName.c_str());
}
}
示例11: findFogPassesByName
void GroundFog::findFogPassesByName (const Ogre::String& passName) {
Ogre::MaterialManager *matManager = Ogre::MaterialManager::getSingletonPtr();
Ogre::MaterialManager::ResourceMapIterator matIt = matManager->getResourceIterator();
while (matIt.hasMoreElements()) {
#if (OGRE_VERSION < ((1 << 16) | (9 << 8) | 0))
Ogre::MaterialPtr mat = matIt.getNext();
#else
Ogre::MaterialPtr mat = matIt.getNext().staticCast<Ogre::Material>();
#endif
Ogre::Material::TechniqueIterator techIt = mat->getTechniqueIterator();
while (techIt.hasMoreElements()) {
Ogre::Technique *tech = techIt.getNext();
Ogre::Technique::PassIterator passIt = tech->getPassIterator();
while (passIt.hasMoreElements()) {
Ogre::Pass *pass = passIt.getNext();
if (pass->getName() == passName) {
mPasses.insert(pass);
}
}
}
}
forceUpdate();
}
示例12: SetData
//.........这里部分代码省略.........
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);
}
}
}
}
//workaround: if receives shadows, check the amount of shadowmaps. If only 1 specified, add 2 more to support 3 shadowmaps
if(ogre_material_->getReceiveShadows() && shadowquality_ == Shadows_High && ogre_material_->getNumTechniques() > 0)
{
Ogre::Technique *tech = ogre_material_->getTechnique(0);
if(tech)
{
Ogre::Technique::PassIterator passiterator = tech->getPassIterator();
while(passiterator.hasMoreElements())
{
Ogre::Pass* pass = passiterator.getNext();
Ogre::Pass::TextureUnitStateIterator texiterator = pass->getTextureUnitStateIterator();
int shadowmaps = 0;
while(texiterator.hasMoreElements())
{
示例13: insertMesh
void Objects::insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh)
{
Ogre::SceneNode* insert = ptr.getRefData().getBaseNode();
assert(insert);
Ogre::AxisAlignedBox bounds = Ogre::AxisAlignedBox::BOX_NULL;
NifOgre::EntityList entities = NifOgre::NIFLoader::createEntities(insert, NULL, mesh);
for(size_t i = 0;i < entities.mEntities.size();i++)
{
const Ogre::AxisAlignedBox &tmp = entities.mEntities[i]->getBoundingBox();
bounds.merge(Ogre::AxisAlignedBox(insert->_getDerivedPosition() + tmp.getMinimum(),
insert->_getDerivedPosition() + tmp.getMaximum())
);
}
Ogre::Vector3 extents = bounds.getSize();
extents *= insert->getScale();
float size = std::max(std::max(extents.x, extents.y), extents.z);
bool small = (size < Settings::Manager::getInt("small object size", "Viewing distance")) && Settings::Manager::getBool("limit small object distance", "Viewing distance");
// do not fade out doors. that will cause holes and look stupid
if (ptr.getTypeName().find("Door") != std::string::npos)
small = false;
if (mBounds.find(ptr.getCell()) == mBounds.end())
mBounds[ptr.getCell()] = Ogre::AxisAlignedBox::BOX_NULL;
mBounds[ptr.getCell()].merge(bounds);
bool transparent = false;
for(size_t i = 0;i < entities.mEntities.size();i++)
{
Ogre::Entity *ent = entities.mEntities[i];
for (unsigned int i=0; i<ent->getNumSubEntities(); ++i)
{
Ogre::MaterialPtr mat = ent->getSubEntity(i)->getMaterial();
Ogre::Material::TechniqueIterator techIt = mat->getTechniqueIterator();
while (techIt.hasMoreElements())
{
Ogre::Technique* tech = techIt.getNext();
Ogre::Technique::PassIterator passIt = tech->getPassIterator();
while (passIt.hasMoreElements())
{
Ogre::Pass* pass = passIt.getNext();
if (pass->getDepthWriteEnabled() == false)
transparent = true;
}
}
}
}
if(!mIsStatic || !Settings::Manager::getBool("use static geometry", "Objects") || transparent)
{
for(size_t i = 0;i < entities.mEntities.size();i++)
{
Ogre::Entity *ent = entities.mEntities[i];
ent->setRenderingDistance(small ? Settings::Manager::getInt("small object distance", "Viewing distance") : 0);
ent->setVisibilityFlags(mIsStatic ? (small ? RV_StaticsSmall : RV_Statics) : RV_Misc);
ent->setRenderQueueGroup(transparent ? RQG_Alpha : RQG_Main);
}
}
else
{
Ogre::StaticGeometry* sg = 0;
if (small)
{
if( mStaticGeometrySmall.find(ptr.getCell()) == mStaticGeometrySmall.end())
{
uniqueID = uniqueID +1;
sg = mRenderer.getScene()->createStaticGeometry( "sg" + Ogre::StringConverter::toString(uniqueID));
mStaticGeometrySmall[ptr.getCell()] = sg;
sg->setRenderingDistance(Settings::Manager::getInt("small object distance", "Viewing distance"));
}
else
sg = mStaticGeometrySmall[ptr.getCell()];
}
else
{
if( mStaticGeometry.find(ptr.getCell()) == mStaticGeometry.end())
{
uniqueID = uniqueID +1;
sg = mRenderer.getScene()->createStaticGeometry( "sg" + Ogre::StringConverter::toString(uniqueID));
mStaticGeometry[ptr.getCell()] = sg;
}
else
sg = mStaticGeometry[ptr.getCell()];
}
// This specifies the size of a single batch region.
// If it is set too high:
// - there will be problems choosing the correct lights
// - the culling will be more inefficient
// If it is set too low:
// - there will be too many batches.
sg->setRegionDimensions(Ogre::Vector3(2500,2500,2500));
//.........这里部分代码省略.........
示例14: Animation
NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, Ogre::SceneNode* node, MWWorld::InventoryStore& _inv, int visibilityFlags)
: Animation(), mStateID(-1), mInv(_inv), timeToChange(0), mVisibilityFlags(visibilityFlags),
robe(mInv.end()), helmet(mInv.end()), shirt(mInv.end()),
cuirass(mInv.end()), greaves(mInv.end()),
leftpauldron(mInv.end()), rightpauldron(mInv.end()),
boots(mInv.end()),
leftglove(mInv.end()), rightglove(mInv.end()), skirtiter(mInv.end()),
pants(mInv.end())
{
MWWorld::LiveCellRef<ESM::NPC> *ref = ptr.get<ESM::NPC>();
for (int init = 0; init < 27; init++)
{
mPartslots[init] = -1; //each slot is empty
mPartPriorities[init] = 0;
}
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
const ESM::Race *race = store.races.find(ref->base->mRace);
std::string hairID = ref->base->mHair;
std::string headID = ref->base->mHead;
headModel = "meshes\\" + store.bodyParts.find(headID)->mModel;
hairModel = "meshes\\" + store.bodyParts.find(hairID)->mModel;
npcName = ref->base->mName;
isFemale = !!(ref->base->mFlags&ESM::NPC::Female);
isBeast = !!(race->mData.mFlags&ESM::Race::Beast);
bodyRaceID = "b_n_"+ref->base->mRace;
std::transform(bodyRaceID.begin(), bodyRaceID.end(), bodyRaceID.begin(), ::tolower);
mInsert = node;
assert(mInsert);
std::string smodel = (!isBeast ? "meshes\\base_anim.nif" : "meshes\\base_animkna.nif");
mEntityList = NifOgre::NIFLoader::createEntities(mInsert, &mTextKeys, smodel);
for(size_t i = 0;i < mEntityList.mEntities.size();i++)
{
Ogre::Entity *base = mEntityList.mEntities[i];
base->getUserObjectBindings ().setUserAny (Ogre::Any(-1));
base->setVisibilityFlags(mVisibilityFlags);
bool transparent = false;
for(unsigned int j=0;j < base->getNumSubEntities();++j)
{
Ogre::MaterialPtr mat = base->getSubEntity(j)->getMaterial();
Ogre::Material::TechniqueIterator techIt = mat->getTechniqueIterator();
while (techIt.hasMoreElements())
{
Ogre::Technique* tech = techIt.getNext();
Ogre::Technique::PassIterator passIt = tech->getPassIterator();
while (passIt.hasMoreElements())
{
Ogre::Pass* pass = passIt.getNext();
if (pass->getDepthWriteEnabled() == false)
transparent = true;
}
}
}
base->setRenderQueueGroup(transparent ? RQG_Alpha : RQG_Main);
}
if(mEntityList.mSkelBase)
{
Ogre::AnimationStateSet *aset = mEntityList.mSkelBase->getAllAnimationStates();
Ogre::AnimationStateIterator as = aset->getAnimationStateIterator();
while(as.hasMoreElements())
{
Ogre::AnimationState *state = as.getNext();
state->setEnabled(true);
state->setLoop(false);
}
}
float scale = race->mData.mHeight.mMale;
if (isFemale) {
scale = race->mData.mHeight.mFemale;
}
mInsert->scale(scale, scale, scale);
updateParts();
}
示例15: poll
//.........这里部分代码省略.........
}
}
}
}
}
}
mState = LS_MATERIAL_PREPARING;
return poll(timeFrame);
} else if (mState == LS_MATERIAL_PREPARING) {
if (areAllTicketsProcessed()) {
mState = LS_MATERIAL_PREPARED;
return poll(timeFrame);
}
} else if (mState == LS_MATERIAL_PREPARED) {
for (SubModelDefinitionsStore::const_iterator I_subModels = mModel.getDefinition()->getSubModelDefinitions().begin(); I_subModels != mModel.getDefinition()->getSubModelDefinitions().end(); ++I_subModels) {
Ogre::MeshPtr meshPtr = static_cast<Ogre::MeshPtr> (Ogre::MeshManager::getSingleton().getByName((*I_subModels)->getMeshName()));
Ogre::Mesh::SubMeshIterator subMeshI = meshPtr->getSubMeshIterator();
while (subMeshI.hasMoreElements()) {
Ogre::SubMesh* submesh(subMeshI.getNext());
Ogre::MaterialPtr materialPtr = static_cast<Ogre::MaterialPtr> (Ogre::MaterialManager::getSingleton().getByName(submesh->getMaterialName()));
if (!materialPtr.isNull() && !materialPtr->isLoaded()) {
#if OGRE_THREAD_SUPPORT == 1
Ogre::BackgroundProcessTicket ticket = Ogre::ResourceBackgroundQueue::getSingleton().load(Ogre::MaterialManager::getSingleton().getResourceType(), materialPtr->getName(), Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, false, 0, 0, createListener());
if (ticket) {
// materialPtr->setBackgroundLoaded(true);
addTicket(ticket);
}
#else
Ogre::Material::TechniqueIterator techIter = materialPtr->getSupportedTechniqueIterator();
while (techIter.hasMoreElements()) {
Ogre::Technique* tech = techIter.getNext();
Ogre::Technique::PassIterator passIter = tech->getPassIterator();
while (passIter.hasMoreElements()) {
Ogre::Pass* pass = passIter.getNext();
Ogre::Pass::TextureUnitStateIterator tusIter = pass->getTextureUnitStateIterator();
while (tusIter.hasMoreElements()) {
Ogre::TextureUnitState* tus = tusIter.getNext();
unsigned int frames = tus->getNumFrames();
for (unsigned int i = 0; i < frames; ++i) {
if (!timeFrame.isTimeLeft()) {
return false;
}
//This will automatically load the texture.
// S_LOG_VERBOSE("Loading texture " << tus->getTextureName());
Ogre::TexturePtr texturePtr = tus->_getTexturePtr(i);
}
}
}
}
if (!timeFrame.isTimeLeft()) {
return false;
}
// S_LOG_VERBOSE("Loading material " << materialPtr->getName());
materialPtr->load();
#endif
}
}
for (PartDefinitionsStore::const_iterator I_parts = (*I_subModels)->getPartDefinitions().begin(); I_parts != (*I_subModels)->getPartDefinitions().end(); ++I_parts) {
if ((*I_parts)->getSubEntityDefinitions().size() > 0) {
for (SubEntityDefinitionsStore::const_iterator I_subEntities = (*I_parts)->getSubEntityDefinitions().begin(); I_subEntities != (*I_parts)->getSubEntityDefinitions().end(); ++I_subEntities) {
const std::string& materialName = (*I_subEntities)->getMaterialName();
if (materialName != "") {
Ogre::MaterialPtr materialPtr = static_cast<Ogre::MaterialPtr> (Ogre::MaterialManager::getSingleton().getByName(materialName));