コード例 #1
0
ファイル: debugging.cpp プロジェクト: Adrian-Revk/openmw
void Debugging::enableCellPathgrid(MWWorld::Ptr::CellStore *store)
{
    const ESM::Pathgrid *pathgrid =
        MWBase::Environment::get().getWorld()->getStore().get<ESM::Pathgrid>().search(*store->mCell);
    if (!pathgrid) return;

    Vector3 cellPathGridPos(0, 0, 0);
    if (store->mCell->isExterior())
    {
        cellPathGridPos.x = store->mCell->mData.mX * ESM::Land::REAL_SIZE;
        cellPathGridPos.y = store->mCell->mData.mY * ESM::Land::REAL_SIZE;
    }
    SceneNode *cellPathGrid = mPathGridRoot->createChildSceneNode(cellPathGridPos);
    cellPathGrid->attachObject(createPathgridLines(pathgrid));
    cellPathGrid->attachObject(createPathgridPoints(pathgrid));

    if (store->mCell->isExterior())
    {
        mExteriorPathgridNodes[std::make_pair(store->mCell->getGridX(), store->mCell->getGridY())] = cellPathGrid;
    }
    else
    {
        assert(mInteriorPathgridNode == NULL);
        mInteriorPathgridNode = cellPathGrid;
    }
}
コード例 #2
0
void Pathgrid::enableCellPathgrid(const MWWorld::CellStore *store)
{
    MWBase::World* world = MWBase::Environment::get().getWorld();
    const ESM::Pathgrid *pathgrid =
        world->getStore().get<ESM::Pathgrid>().search(*store->getCell());
    if (!pathgrid) return;

    osg::Vec3f cellPathGridPos(0, 0, 0);
    if (store->getCell()->isExterior())
    {
        cellPathGridPos.x() = static_cast<float>(store->getCell()->mData.mX * ESM::Land::REAL_SIZE);
        cellPathGridPos.y() = static_cast<float>(store->getCell()->mData.mY * ESM::Land::REAL_SIZE);
    }

    osg::ref_ptr<osg::PositionAttitudeTransform> cellPathGrid = new osg::PositionAttitudeTransform;
    cellPathGrid->setPosition(cellPathGridPos);

    osg::ref_ptr<osg::Geode> lineGeode = new osg::Geode;
    osg::ref_ptr<osg::Geometry> lines = createPathgridLines(pathgrid);
    lineGeode->addDrawable(lines);

    osg::ref_ptr<osg::Geode> pointGeode = new osg::Geode;
    osg::ref_ptr<osg::Geometry> points = createPathgridPoints(pathgrid);
    pointGeode->addDrawable(points);

    cellPathGrid->addChild(lineGeode);
    cellPathGrid->addChild(pointGeode);

    mPathGridRoot->addChild(cellPathGrid);

    if (store->getCell()->isExterior())
    {
        mExteriorPathgridNodes[std::make_pair(store->getCell()->getGridX(), store->getCell()->getGridY())] = cellPathGrid;
    }
    else
    {
        assert(mInteriorPathgridNode == NULL);
        mInteriorPathgridNode = cellPathGrid;
    }
}