|
|
|
@ -3,7 +3,6 @@
|
|
|
|
|
#include <algorithm>
|
|
|
|
|
|
|
|
|
|
#include <osg/Array>
|
|
|
|
|
#include <osg/Geode>
|
|
|
|
|
#include <osg/Geometry>
|
|
|
|
|
#include <osg/Group>
|
|
|
|
|
#include <osg/PositionAttitudeTransform>
|
|
|
|
@ -11,7 +10,6 @@
|
|
|
|
|
|
|
|
|
|
#include <components/sceneutil/pathgridutil.hpp>
|
|
|
|
|
|
|
|
|
|
#include "../../model/world/cell.hpp"
|
|
|
|
|
#include "../../model/world/commands.hpp"
|
|
|
|
|
#include "../../model/world/commandmacro.hpp"
|
|
|
|
|
#include "../../model/world/data.hpp"
|
|
|
|
@ -77,8 +75,8 @@ namespace CSVRender
|
|
|
|
|
mBaseNode->setNodeMask(Mask_Pathgrid);
|
|
|
|
|
mParent->addChild(mBaseNode);
|
|
|
|
|
|
|
|
|
|
mPathgridGeode = new osg::Geode();
|
|
|
|
|
mBaseNode->addChild(mPathgridGeode);
|
|
|
|
|
mPathgridGroup = new osg::Group();
|
|
|
|
|
mBaseNode->addChild(mPathgridGroup);
|
|
|
|
|
|
|
|
|
|
recreateGeometry();
|
|
|
|
|
|
|
|
|
@ -222,7 +220,7 @@ namespace CSVRender
|
|
|
|
|
mUseOffset = false;
|
|
|
|
|
mMoveOffset.set(0, 0, 0);
|
|
|
|
|
|
|
|
|
|
mPathgridGeode->removeDrawable(mDragGeometry);
|
|
|
|
|
mPathgridGroup->removeChild(mDragGeometry);
|
|
|
|
|
mDragGeometry = nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -524,7 +522,7 @@ namespace CSVRender
|
|
|
|
|
|
|
|
|
|
removePathgridGeometry();
|
|
|
|
|
mPathgridGeometry = SceneUtil::createPathgridGeometry(*source);
|
|
|
|
|
mPathgridGeode->addDrawable(mPathgridGeometry);
|
|
|
|
|
mPathgridGroup->addChild(mPathgridGeometry);
|
|
|
|
|
|
|
|
|
|
createSelectedGeometry(*source);
|
|
|
|
|
}
|
|
|
|
@ -553,14 +551,14 @@ namespace CSVRender
|
|
|
|
|
removeSelectedGeometry();
|
|
|
|
|
|
|
|
|
|
mSelectedGeometry = SceneUtil::createPathgridSelectedWireframe(source, mSelected);
|
|
|
|
|
mPathgridGeode->addDrawable(mSelectedGeometry);
|
|
|
|
|
mPathgridGroup->addChild(mSelectedGeometry);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Pathgrid::removePathgridGeometry()
|
|
|
|
|
{
|
|
|
|
|
if (mPathgridGeometry)
|
|
|
|
|
{
|
|
|
|
|
mPathgridGeode->removeDrawable(mPathgridGeometry);
|
|
|
|
|
mPathgridGroup->removeChild(mPathgridGeometry);
|
|
|
|
|
mPathgridGeometry = nullptr;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -569,7 +567,7 @@ namespace CSVRender
|
|
|
|
|
{
|
|
|
|
|
if (mSelectedGeometry)
|
|
|
|
|
{
|
|
|
|
|
mPathgridGeode->removeDrawable(mSelectedGeometry);
|
|
|
|
|
mPathgridGroup->removeChild(mSelectedGeometry);
|
|
|
|
|
mSelectedGeometry = nullptr;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -577,7 +575,7 @@ namespace CSVRender
|
|
|
|
|
void Pathgrid::createDragGeometry(const osg::Vec3f& start, const osg::Vec3f& end, bool valid)
|
|
|
|
|
{
|
|
|
|
|
if (mDragGeometry)
|
|
|
|
|
mPathgridGeode->removeDrawable(mDragGeometry);
|
|
|
|
|
mPathgridGroup->removeChild(mDragGeometry);
|
|
|
|
|
|
|
|
|
|
mDragGeometry = new osg::Geometry();
|
|
|
|
|
|
|
|
|
@ -605,7 +603,7 @@ namespace CSVRender
|
|
|
|
|
mDragGeometry->addPrimitiveSet(indices);
|
|
|
|
|
mDragGeometry->getOrCreateStateSet()->setMode(GL_LIGHTING, osg::StateAttribute::OFF);
|
|
|
|
|
|
|
|
|
|
mPathgridGeode->addDrawable(mDragGeometry);
|
|
|
|
|
mPathgridGroup->addChild(mDragGeometry);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const CSMWorld::Pathgrid* Pathgrid::getPathgridSource()
|
|
|
|
|