本文整理汇总了C++中mwworld::CellStore类的典型用法代码示例。如果您正苦于以下问题:C++ CellStore类的具体用法?C++ CellStore怎么用?C++ CellStore使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CellStore类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: configureFog
void RenderingManager::configureFog(const MWWorld::CellStore &mCell)
{
Ogre::ColourValue color;
color.setAsABGR (mCell.getCell()->mAmbi.mFog);
configureFog (mCell.getCell()->mAmbi.mFogDensity, color);
}
示例2: getNearbyDoor
MWWorld::Ptr getNearbyDoor(const MWWorld::Ptr& actor, float minSqr, bool closed)
{
MWWorld::CellStore *cell = actor.getCell();
if(cell->getCell()->isExterior())
return MWWorld::Ptr(); // check interior cells only
// Check all the doors in this cell
MWWorld::CellRefList<ESM::Door>& doors = cell->get<ESM::Door>();
MWWorld::CellRefList<ESM::Door>::List& refList = doors.mList;
MWWorld::CellRefList<ESM::Door>::List::iterator it = refList.begin();
Ogre::Vector3 pos(actor.getRefData().getPosition().pos);
/// TODO: How to check whether the actor is facing a door? Below code is for
/// the player, perhaps it can be adapted.
//MWWorld::Ptr ptr = MWBase::Environment::get().getWorld()->getFacedObject();
//if(!ptr.isEmpty())
//std::cout << "faced door " << ptr.getClass().getName(ptr) << std::endl;
/// TODO: The in-game observation of rot[2] value seems to be the
/// opposite of the code in World::activateDoor() ::confused::
for (; it != refList.end(); ++it)
{
MWWorld::LiveCellRef<ESM::Door>& ref = *it;
if(pos.squaredDistance(Ogre::Vector3(ref.mData.getPosition().pos)) < minSqr)
if((closed && ref.mData.getLocalRotation().rot[2] == 0) ||
(!closed && ref.mData.getLocalRotation().rot[2] >= 1))
{
return MWWorld::Ptr(&ref, actor.getCell()); // found, stop searching
}
}
return MWWorld::Ptr(); // none found
}
示例3: execute
virtual void execute (Interpreter::Runtime& runtime)
{
MWWorld::CellStore *cell = MWBase::Environment::get().getWorld()->getPlayerPtr().getCell();
if (cell->getCell()->hasWater())
runtime.push (cell->getWaterLevel());
else
runtime.push (-std::numeric_limits<float>().max());
}
示例4: execute
virtual void execute (Interpreter::Runtime& runtime)
{
if (!MWMechanics::getPlayer().isInCell())
{
runtime.push(0.f);
return;
}
MWWorld::CellStore *cell = MWMechanics::getPlayer().getCell();
if (cell->getCell()->hasWater())
runtime.push (cell->getWaterLevel());
else
runtime.push (-std::numeric_limits<float>::max());
}
示例5: execute
virtual void execute (Interpreter::Runtime& runtime)
{
if (!MWMechanics::getPlayer().isInCell())
{
runtime.push(0.f);
return;
}
MWWorld::CellStore *cell = MWMechanics::getPlayer().getCell();
if (cell->isExterior())
runtime.push(0.f); // vanilla oddity, return 0 even though water is actually at -1
else if (cell->getCell()->hasWater())
runtime.push (cell->getWaterLevel());
else
runtime.push (-std::numeric_limits<float>::max());
}
示例6: Ptr
const MWWorld::Ptr getNearbyDoor(const MWWorld::Ptr& actor, float minDist)
{
MWWorld::CellStore *cell = actor.getCell();
// Check all the doors in this cell
const MWWorld::CellRefList<ESM::Door>& doors = cell->getReadOnlyDoors();
const MWWorld::CellRefList<ESM::Door>::List& refList = doors.mList;
MWWorld::CellRefList<ESM::Door>::List::const_iterator it = refList.begin();
osg::Vec3f pos(actor.getRefData().getPosition().asVec3());
pos.z() = 0;
osg::Vec3f actorDir = (actor.getRefData().getBaseNode()->getAttitude() * osg::Vec3f(0,1,0));
for (; it != refList.end(); ++it)
{
const MWWorld::LiveCellRef<ESM::Door>& ref = *it;
osg::Vec3f doorPos(ref.mData.getPosition().asVec3());
// FIXME: cast
const MWWorld::Ptr doorPtr = MWWorld::Ptr(&const_cast<MWWorld::LiveCellRef<ESM::Door> &>(ref), actor.getCell());
int doorState = doorPtr.getClass().getDoorState(doorPtr);
float doorRot = ref.mData.getPosition().rot[2] - doorPtr.getCellRef().getPosition().rot[2];
if (doorState != 0 || doorRot != 0)
continue; // the door is already opened/opening
doorPos.z() = 0;
float angle = std::acos(actorDir * (doorPos - pos) / (actorDir.length() * (doorPos - pos).length()));
// Allow 60 degrees angle between actor and door
if (angle < -osg::PI / 3 || angle > osg::PI / 3)
continue;
// Door is not close enough
if ((pos - doorPos).length2() > minDist*minDist)
continue;
return doorPtr; // found, stop searching
}
return MWWorld::Ptr(); // none found
}
示例7: configureAmbient
void RenderingManager::configureAmbient(MWWorld::CellStore &mCell)
{
if (mCell.getCell()->mData.mFlags & ESM::Cell::Interior)
mAmbientColor.setAsABGR (mCell.getCell()->mAmbi.mAmbient);
setAmbientMode();
// Create a "sun" that shines light downwards. It doesn't look
// completely right, but leave it for now.
if(!mSun)
{
mSun = mRendering.getScene()->createLight();
mSun->setType(Ogre::Light::LT_DIRECTIONAL);
}
if (mCell.getCell()->mData.mFlags & ESM::Cell::Interior)
{
Ogre::ColourValue colour;
colour.setAsABGR (mCell.getCell()->mAmbi.mSunlight);
mSun->setDiffuseColour (colour);
mSun->setDirection(0,-1,0);
}
}
示例8: copyToCellImpl
MWWorld::Ptr Light::copyToCellImpl(const MWWorld::ConstPtr &ptr, MWWorld::CellStore &cell) const
{
const MWWorld::LiveCellRef<ESM::Light> *ref = ptr.get<ESM::Light>();
return MWWorld::Ptr(cell.insert(ref), &cell);
}