本文整理汇总了C++中ogre::MaterialPtr::getGroup方法的典型用法代码示例。如果您正苦于以下问题:C++ MaterialPtr::getGroup方法的具体用法?C++ MaterialPtr::getGroup怎么用?C++ MaterialPtr::getGroup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::MaterialPtr
的用法示例。
在下文中一共展示了MaterialPtr::getGroup方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createOrRetrieveHaloMaterial
gkString createOrRetrieveHaloMaterial(const gkString& baseMatName)
{
gkString matName = DEFAULT_HALO_MAT;
try
{
gkString haloMatName = baseMatName + ".halo";
Ogre::MaterialManager& mmgr = Ogre::MaterialManager::getSingleton();
if (mmgr.resourceExists(haloMatName))
matName = haloMatName;
else
{
Ogre::MaterialPtr baseMat = mmgr.getByName(baseMatName);
if (!baseMat.isNull())
{
Ogre::MaterialPtr mat = mmgr.create(haloMatName, baseMat->getGroup());
baseMat->copyDetailsTo(mat);
Ogre::Pass *pass = mat->getTechnique(0)->getPass(0);
pass->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA);
pass->setAlphaRejectSettings(Ogre::CMPF_GREATER_EQUAL, 150);
pass->setDepthWriteEnabled(false);
Ogre::TextureUnitState* tu = pass->createTextureUnitState(HALO_IMAGE_NAME);
matName = haloMatName;
}
}
}
catch(Ogre::Exception& e)
{
gkLogMessage("gkParticleManager: " << e.getDescription());
}
return matName;
}
示例2: Initial
//.........这里部分代码省略.........
FLOAT fCamera_MaxDistance = g_pVaribleSys->GetAs_Float("Camera_MaxDistance", &bHave);
if(bHave) CCamera_Scene::MAX_DISTANCE = fCamera_MaxDistance;
FLOAT fCamera_Pitch = g_pVaribleSys->GetAs_Float("Camera_Pitch", &bHave);
if(bHave) CCamera_Scene::STATIC_PITCH = -fCamera_Pitch*TDU_PI/180.0f;
}
m_pCamera_CharView = new CCamera_CharSel(m_pRenderSystem->getCamera());
m_pCamera_Scene = new CCamera_Scene(m_pRenderSystem->getCamera());
m_pCamera_Scene->SetDistance(CCamera_Scene::MAX_DISTANCE);
m_pCamera_Current = m_pCamera_CharView;
//--------------------------------------------
//初始化PostFilter系统
m_pPostFilterManager = m_pRenderSystem->getPostFilterManager();
//注册所有全局渲染器
WX::registerAllPostFilterFactories(m_pPostFilterManager);
m_pPostFilterManager->createPostFilter("Floodlighting", m_pRenderSystem->getViewport());
// m_pPostFilterManager->createPostFilter("Bloom", m_pRenderSystem->getViewport());
// m_pPostFilterManager->createPostFilter("HeatVision", m_pRenderSystem->getViewport());
m_pPostFilterManager->createPostFilter("Fade", m_pRenderSystem->getViewport());
//--------------------------------------------
//设置特效系统的声音播放函数
WX::LogicModel::SetPlaySoundFuncton((OnPlaySound)(g_pSoundSystem->GetPlaySoundFunc()));
WX::LogicModel::SetStopSoundFunction((OnStopSound)(g_pSoundSystem->GetStopSoundFunc()));
WX::LogicModel::SetGetHeightInWorldListener((GetHeightInWorld)(g_pWorldSystem->GetTerrainHeightFunc()));
// 初始化 fake obeject manager
m_pFakeObjectManager = new CFakeObjectManager;
m_pFakeObjectManager->Initial();
// WX::Effect::setDefaultIterativeInterval(0.01f);
Ogre::ParticleSystem::setDefaultIterationInterval(0.033f);
//系统设置接口挂接变量控制系统
g_pEventSys->RegisterEventHandle("VARIABLE_CHANGED",_OnVariableChangedEvent);
//恢复上次颜色设置
g_pEventSys->PushEvent(
GE_VARIABLE_CHANGED,
sz32BitTexturesVar,
g_pVaribleSys->GetAs_String(sz32BitTexturesVar).c_str());
}
catch(const Ogre::Exception& e)
{
BOOL rethrow = TRUE;
if (e.getNumber() == Ogre::Exception::ERR_DUPLICATE_ITEM)
{
if (e.getSource() == "ResourceManager::add")
{
if (Ogre::StringUtil::endsWith(listener._scriptName, ".material", TRUE))
{
char materialName[256];
if (sscanf(e.getDescription().c_str(), "Resource with the name %255s already exists.", materialName) == 1)
{
Ogre::MaterialPtr material = Ogre::MaterialManager::getSingleton().getByName(materialName);
if (!material.isNull())
{
char message[1024];
Ogre::StringVectorPtr currentNames = WX::findResourceFilenames(listener._groupName, listener._scriptName);
const Ogre::String& currentName = currentNames.isNull() || currentNames->empty() ? listener._scriptName : currentNames->front();
if (material->getOrigin().empty())
{
_snprintf(message, 1024,
("Predefined material \"%s\" duplicated in file \"%s\", the application will exit."),
material->getName().c_str(), currentName.c_str());
}
else
{
Ogre::StringVectorPtr originNames = WX::findResourceFilenames(material->getGroup(), material->getOrigin());
const Ogre::String& originName = originNames.isNull() || originNames->empty() ? material->getOrigin() : originNames->front();
if (currentName == originName)
{
_snprintf(message, 1024,
("The material \"%s\" occuring in the file \"%s\" more than once, the application will exit."),
material->getName().c_str(), currentName.c_str());
}
else
{
_snprintf(message, 1024,
("Duplicate material \"%s\" in files \"%s\" and \"%s\", the application will exit."),
material->getName().c_str(), currentName.c_str(), originName.c_str());
}
}
TDThrow("Ogre::%s", message);
}
}
}
}
}
throw;
}
}
示例3: Initial
//.........这里部分代码省略.........
m_pPostFilterManager->createPostFilter("Bloom", m_pFairySystem->getViewport());
m_pPostFilterManager->createPostFilter("HeatVision", m_pFairySystem->getViewport());
m_pPostFilterManager->createPostFilter("Fade", m_pFairySystem->getViewport());
m_pPostFilterManager->createPostFilter("MotionBlur", m_pFairySystem->getViewport());
//--------------------------------------------
// 设置特效系统的声音播放函数
Fairy::LogicModel::SetPlaySoundFuncton((OnPlaySound)(g_pSoundSystem->GetPlaySoundFunc()));
Fairy::LogicModel::SetStopSoundFunction((OnStopSound)(g_pSoundSystem->GetStopSoundFunc()));
Fairy::BulletSystem::SetPlaySoundFuncton((OnPlaySound)(g_pSoundSystem->GetPlaySoundFunc()));
Fairy::BulletSystem::SetStopSoundFunction((OnStopSound)(g_pSoundSystem->GetStopSoundFunc()));
Fairy::LogicModel::SetGetHeightInWorldListener((GetHeightInWorld)(g_pWorldSystem->GetTerrainHeightFunc()));
// 初始化 fake obeject manager
m_pFakeObjectManager = new CFakeObjectEntityManager;
m_pFakeObjectManager->Initial();
// Fairy::Effect::setDefaultIterativeInterval(0.01f);
Ogre::ParticleSystem::setDefaultIterationInterval(0.033f);
// 系统设置接口挂接变量控制系统
g_pEventSys->RegisterEventHandle("VARIABLE_CHANGED",_OnVariableChangedEvent);
// 恢复上次颜色设置
g_pEventSys->PushEvent(GE_VARIABLE_CHANGED, sz32BitTexturesVar, g_pVaribleSys->GetAs_String(sz32BitTexturesVar).c_str());
// Ogre::TextureManager::getSingleton().setDefaultNumMipmaps( 1 );
// 加载人物阴影配置
BOOL bHave;
INT nHumanLightmap = g_pVaribleSys->GetAs_Float(szShadowTechniqueVar, &bHave );
if( bHave )
Scene_SetShadowTechnique( (BOOL)nHumanLightmap );
// 加载全局泛光配置
INT nFullScreenLight = g_pVaribleSys->GetAs_Float( szPostFilterEnabledVar, &bHave );
if( bHave )
Scene_SetPostFilterEnabled( (BOOL)nFullScreenLight );
//初始化小地图探灯功能
m_pMapLight = new CUIMapLight;
m_pMapLight->Initial();
}
catch(const Ogre::Exception& e)
{
BOOL rethrow = TRUE;
if (e.getNumber() == Ogre::Exception::ERR_DUPLICATE_ITEM)
{
if (e.getSource() == "ResourceManager::add")
{
if (Ogre::StringUtil::endsWith(listener._scriptName, ".material", TRUE))
{
char materialName[256];
if (sscanf(e.getDescription().c_str(), "Resource with the name %255s already exists.", materialName) == 1)
{
Ogre::MaterialPtr material = Ogre::MaterialManager::getSingleton().getByName(materialName);
if (!material.isNull())
{
char message[1024];
Ogre::StringVectorPtr currentNames = Fairy::findResourceFilenames(listener._groupName, listener._scriptName);
const Ogre::String& currentName = currentNames.isNull() || currentNames->empty() ? listener._scriptName : currentNames->front();
if (material->getOrigin().empty())
{
_snprintf(message, 1024,
("Predefined material \"%s\" duplicated in file \"%s\", the application will exit."),
material->getName().c_str(), currentName.c_str());
}
else
{
Ogre::StringVectorPtr originNames = Fairy::findResourceFilenames(material->getGroup(), material->getOrigin());
const Ogre::String& originName = originNames.isNull() || originNames->empty() ? material->getOrigin() : originNames->front();
if (currentName == originName)
{
_snprintf(message, 1024,
("The material \"%s\" occuring in the file \"%s\" more than once, the application will exit."),
material->getName().c_str(), currentName.c_str());
}
else
{
_snprintf(message, 1024,
("Duplicate material \"%s\" in files \"%s\" and \"%s\", the application will exit."),
material->getName().c_str(), currentName.c_str(), originName.c_str());
}
}
KLThrow("Ogre::%s", message);
}
}
}
}
}
throw;
}
}
示例4: update
void LIRenAttachmentEntity::update (float secs)
{
/* Check if background loading has finished. */
if (loaded)
return;
lisys_assert (entity == NULL);
/* Wait for the mesh to load. */
if (!mesh->isLoaded ())
{
if (loading_mesh)
return;
loading_mesh = true;
#ifdef LIREN_BACKGROUND_LOADING
Ogre::ResourceBackgroundQueue::getSingleton ().load (
"Mesh", mesh->getName (), mesh->getGroup ());
#else
mesh->load ();
#endif
return;
}
/* Start loading dependencies. */
if (!loading_deps)
{
loading_deps = true;
for (size_t i = 0 ; i < mesh->getNumSubMeshes () ; i++)
{
Ogre::SubMesh* sub = mesh->getSubMesh (i);
if (sub->isMatInitialised ())
{
Ogre::MaterialManager& mgr = Ogre::MaterialManager::getSingleton ();
Ogre::MaterialPtr material = mgr.getByName (sub->getMaterialName (), mesh->getGroup ());
if (!material.isNull ())
{
resources.push_back (material);
#ifdef LIREN_BACKGROUND_LOADING
Ogre::ResourceBackgroundQueue::getSingleton ().load (
"Material", material->getName (), material->getGroup ());
#else
material->load (true);
#endif
}
}
}
return;
}
// Wait for the dependencies to load.
for (size_t i = 0 ; i < resources.size () ; i++)
{
Ogre::ResourcePtr& resource = resources[i];
if (!resource->isLoaded ())
return;
}
// Create the entity.
Ogre::String e_name = render->id.next ();
entity = render->scene_manager->createEntity (e_name, mesh->getName (), LIREN_RESOURCES_TEMPORARY);
object->node->attachObject (entity);
// Create the skeleton and its pose buffer.
if (create_skeleton ())
{
LIRenModelData* model = get_model ();
lisys_assert (pose_buffer == NULL);
if (model != NULL)
{
pose_buffer = limdl_pose_buffer_new_copy (model->rest_pose_buffer);
lisys_assert (pose_buffer != NULL);
lisys_assert (pose_buffer->bones.count == entity->getSkeleton ()->getNumBones ());
}
}
// Set the entity flags.
entity->setCastShadows (object->get_shadow_casting ());
// Trigger queued texture replacements.
//
// This needs to be done before showing the entity in order to avoid
// the textures flickering for a few frames.
for (size_t i = 0 ; i < queued_texture_replaces.size () ; ++i)
{
LIRenTextureReplace& repl = queued_texture_replaces[i];
replace_texture_now (repl.name, repl.texture);
}
queued_texture_replaces.clear();
// Set entity visibility.
//
// If a visible entity is added to a hidden scene node, the entity is
// still rendered. Hence, newly added entities needs to be explicitly
// hidden or Ogre will render our invisible objects. */
entity->setVisible (object->get_visible ());
// Apply queued settings.
update_settings ();
// Clear the now useless dependency list.
resources.clear ();
//.........这里部分代码省略.........