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