本文整理汇总了C++中ogre::ResourcePtr::getPointer方法的典型用法代码示例。如果您正苦于以下问题:C++ ResourcePtr::getPointer方法的具体用法?C++ ResourcePtr::getPointer怎么用?C++ ResourcePtr::getPointer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::ResourcePtr
的用法示例。
在下文中一共展示了ResourcePtr::getPointer方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GameState
IntroState::IntroState(Engine* p_engine) :
GameState(p_engine),
m_totalMilliseconds(std::time_t(2000)),
m_elapsedMilliseconds(0)
{
std::clog << "Entering intro state..." << std::endl;
// do one input state capture just to hide the mouse cursor
InputSystem* inputSystem = m_engine->getInputSystem();
inputSystem->capture();
// get the material by name
std::clog << "Loading fade overlay material..." << std::endl;
Ogre::ResourcePtr resptr = Ogre::MaterialManager::getSingleton().
getByName("Materials/FadeOverlay");
Ogre::Material* material = dynamic_cast<Ogre::Material*>(resptr.getPointer());
Ogre::Technique* tech = material->getTechnique(0);
Ogre::Pass* pass = tech->getPass(0);
m_textureUnitState = pass->getTextureUnitState(0);
// get the overlay
std::clog << "Loading fade overlay..." << std::endl;
m_fadeOverlay = Ogre::OverlayManager::getSingleton().getByName("Overlays/FadeOverlay");
m_alpha = 1.0;
m_fadeOverlay->show();
}
示例2:
SoundTrackPtr::SoundTrackPtr(const Ogre::ResourcePtr &resourcePtr)
{
Log *errorLog = OGF::LogFactory::getSingletonPtr()->get(OGF::LOG_ERR);
if (resourcePtr.isNull()) {
return;
}
OGRE_LOCK_MUTEX(*resourcePtr.OGRE_AUTO_MUTEX_NAME)
OGRE_COPY_AUTO_SHARED_MUTEX(resourcePtr.OGRE_AUTO_MUTEX_NAME)
pRep = static_cast<SoundTrack *>(resourcePtr.getPointer());
pUseCount = resourcePtr.useCountPointer();
useFreeMethod = resourcePtr.freeMethod();
// Incremento del contador de referencias.
if (pUseCount)
++(*pUseCount);
}
示例3:
Fader::Fader(const char *OverlayName, const char *MaterialName, FaderCallback *instance)
{
_fadeop = FADE_NONE;
_alpha = 0.0;
_inst = instance;
// Get the material by name
Ogre::ResourcePtr resptr = Ogre::MaterialManager::getSingleton().getByName(MaterialName);
Ogre::Material * mat = dynamic_cast<Ogre::Material*>(resptr.getPointer());
Ogre::Technique *tech = mat->getTechnique(0); // Get the technique
Ogre::Pass *pass = tech->getPass(0); // Get the pass
_tex_unit = pass->getTextureUnitState(0); // Get the texture_unit state
// Get the _overlay
_overlay = Ogre::OverlayManager::getSingleton().getByName(OverlayName);
_overlay->hide();
}
示例4: createScene
void GameState::createScene()
{
// CREATE 3D SCENE
m_bQuit = false;
_highScoreEntryDialog = nullptr;
_gameTime = 0.0f;
_physicsTime = 0.0f;
_playerScore = 0.0f;
_pauseState = PAUSE_STATE_NONE;
_pulsePower = 0.0f;
_pulseTime = 0.0f;
_gameOverTime = 0.0f;
_energyDrainFactor = 1.0f;
_vibrationStrength = 0.0f;
// BULLET SETUP
// Build the broadphase
_btBroadphase = new (alignedMalloc<btDbvtBroadphase>()) btDbvtBroadphase();
// Set up the collision configuration and dispatcher
_btCollisionConfiguration = new (alignedMalloc<btDefaultCollisionConfiguration>()) btDefaultCollisionConfiguration();
_btDispatcher = new (alignedMalloc<btCollisionDispatcher>()) btCollisionDispatcher(_btCollisionConfiguration);
// The actual physics solver
_btSolver = new (alignedMalloc<btSequentialImpulseConstraintSolver>()) btSequentialImpulseConstraintSolver;
// The world.
_btDynamicsWorld = new (alignedMalloc<btDiscreteDynamicsWorld>()) btDiscreteDynamicsWorld(_btDispatcher,_btBroadphase,_btSolver,_btCollisionConfiguration);
_btDynamicsWorld->setGravity(btVector3(0,-10,0));
_btGroundShape = new (alignedMalloc<btStaticPlaneShape>()) btStaticPlaneShape(btVector3(0,1,0),1);
_btGroundMotionState = new (alignedMalloc<btDefaultMotionState>()) btDefaultMotionState(btTransform(btQuaternion(0,0,0,1),btVector3(0,-1,0)));
btRigidBody::btRigidBodyConstructionInfo groundRigidBodyCI(0,_btGroundMotionState,_btGroundShape,btVector3(0,0,0));
_btGroundRigidBody = new (alignedMalloc<btRigidBody>()) btRigidBody(groundRigidBodyCI);
assert((int)_btGroundRigidBody % 16 == 0);
_btGroundRigidBody->setRestitution(1.0f);
_btGroundRigidBody->setActivationState(DISABLE_DEACTIVATION);
_btDynamicsWorld->addRigidBody(_btGroundRigidBody,COL_STATIC,COL_ALL);
// CREATE ACTORS
_playerBase = new LagomPlayerBase(this);
boost::shared_ptr<LagomPlayerBase> playerBase(_playerBase);
RegisterActor(playerBase);
// Effects stuff
_particleManager = new LagomParticleManager(m_pSceneMgr,_btDynamicsWorld,1000,0.5f);
_billboardManager = new BillboardManager(m_pSceneMgr,m_pCamera);
//need a HUD too!
Gorilla::Silverback* silverback = Gorilla::Silverback::getSingletonPtr();
_gScreen[0] = silverback->createScreen(Lagom::getSingleton().m_pViewport, "LargeFont");
_gScreen[1] = silverback->createScreen(Lagom::getSingleton().m_pViewport, "MediumFont");
_gScreen[2] = silverback->createScreen(Lagom::getSingleton().m_pViewport, "SmallFont");
_gTutorialScreen = silverback->createScreen(Lagom::getSingleton().m_pViewport, "dejavu");
_gLayer[0] = _gScreen[0]->createLayer(12);
_gLayer[1] = _gScreen[1]->createLayer(13);
_gLayer[2] = _gScreen[2]->createLayer(15);
_gTutorialLayer = _gTutorialScreen->createLayer(18);
int x,y,w,h;
Lagom::getSingleton().m_pViewport->getActualDimensions(x,y,w,h);
_gDisplays[0]._gText = _gLayer[1]->createCaption(24,w/2,h, "");
_gDisplays[1]._gText = _gLayer[0]->createCaption(48,w/2,h, "");
_gDisplays[2]._gText = _gLayer[1]->createCaption(24,w/2,h, "");
for(auto it = _gDisplays.begin(); it< _gDisplays.end(); ++it)
{
it->_text = "";
it->_displayPingTime = 0.0f;
it->_displayVisibleTime = 0.0f;
it->_gText->align(Gorilla::TextAlign_Centre);
}
_gDisplays[0]._gText->vertical_align(Gorilla::VerticalAlign_Top);
_gDisplays[0]._gText->top(0+5);
_gDisplays[1]._gText->vertical_align(Gorilla::VerticalAlign_Middle);
_gDisplays[1]._gText->top(h/2);
_gDisplays[2]._gText->vertical_align(Gorilla::VerticalAlign_Bottom);
_gDisplays[2]._gText->top(h-5);
_gameTime= 0.0f;
_displayTime = 0.0f;
_inputTime = 0.0;
//set up fader
Ogre::ResourcePtr resptr = Ogre::MaterialManager::getSingleton().getByName("fadeToBlackMaterial");
Ogre::Material * mat = dynamic_cast<Ogre::Material*>(resptr.getPointer());
Ogre::Technique *tech = mat->getTechnique(0); // Get the technique
//.........这里部分代码省略.........