mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-26 18:35:20 +00:00
split object base node into two node (one for position, one for everything else)
This commit is contained in:
parent
dececf6c38
commit
22e717161a
@ -135,7 +135,7 @@ void CSVRender::Object::adjustTransform()
|
|||||||
ESM::Position position = getPosition();
|
ESM::Position position = getPosition();
|
||||||
|
|
||||||
// position
|
// position
|
||||||
mBaseNode->setPosition(mForceBaseToZero ? osg::Vec3() : osg::Vec3f(position.pos[0], position.pos[1], position.pos[2]));
|
mRootNode->setPosition(mForceBaseToZero ? osg::Vec3() : osg::Vec3f(position.pos[0], position.pos[1], position.pos[2]));
|
||||||
|
|
||||||
// orientation
|
// orientation
|
||||||
osg::Quat xr (-position.rot[0], osg::Vec3f(1,0,0));
|
osg::Quat xr (-position.rot[0], osg::Vec3f(1,0,0));
|
||||||
@ -161,6 +161,8 @@ CSVRender::Object::Object (CSMWorld::Data& data, osg::Group* parentNode,
|
|||||||
: mData (data), mBaseNode(0), mSelected(false), mParentNode(parentNode), mResourceSystem(data.getResourceSystem().get()), mForceBaseToZero (forceBaseToZero),
|
: mData (data), mBaseNode(0), mSelected(false), mParentNode(parentNode), mResourceSystem(data.getResourceSystem().get()), mForceBaseToZero (forceBaseToZero),
|
||||||
mScaleOverride (1), mOverrideFlags (0)
|
mScaleOverride (1), mOverrideFlags (0)
|
||||||
{
|
{
|
||||||
|
mRootNode = new osg::PositionAttitudeTransform;
|
||||||
|
|
||||||
mBaseNode = new osg::PositionAttitudeTransform;
|
mBaseNode = new osg::PositionAttitudeTransform;
|
||||||
mBaseNode->addCullCallback(new SceneUtil::LightListCallback);
|
mBaseNode->addCullCallback(new SceneUtil::LightListCallback);
|
||||||
|
|
||||||
@ -169,9 +171,11 @@ CSVRender::Object::Object (CSMWorld::Data& data, osg::Group* parentNode,
|
|||||||
|
|
||||||
mBaseNode->setUserData(new ObjectTag(this));
|
mBaseNode->setUserData(new ObjectTag(this));
|
||||||
|
|
||||||
parentNode->addChild(mBaseNode);
|
mRootNode->addChild (mBaseNode);
|
||||||
|
|
||||||
mBaseNode->setNodeMask(Mask_Reference);
|
parentNode->addChild (mRootNode);
|
||||||
|
|
||||||
|
mRootNode->setNodeMask(Mask_Reference);
|
||||||
|
|
||||||
if (referenceable)
|
if (referenceable)
|
||||||
{
|
{
|
||||||
@ -191,20 +195,19 @@ CSVRender::Object::~Object()
|
|||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
mParentNode->removeChild(mBaseNode);
|
mParentNode->removeChild (mRootNode);
|
||||||
mParentNode->removeChild(mOutline);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVRender::Object::setSelected(bool selected)
|
void CSVRender::Object::setSelected(bool selected)
|
||||||
{
|
{
|
||||||
mSelected = selected;
|
mSelected = selected;
|
||||||
|
|
||||||
mParentNode->removeChild(mOutline);
|
mRootNode->removeChild(mOutline);
|
||||||
mParentNode->removeChild(mBaseNode);
|
mRootNode->removeChild(mBaseNode);
|
||||||
if (selected)
|
if (selected)
|
||||||
mParentNode->addChild(mOutline);
|
mRootNode->addChild(mOutline);
|
||||||
else
|
else
|
||||||
mParentNode->addChild(mBaseNode);
|
mRootNode->addChild(mBaseNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSVRender::Object::getSelected() const
|
bool CSVRender::Object::getSelected() const
|
||||||
|
@ -70,6 +70,7 @@ namespace CSVRender
|
|||||||
CSMWorld::Data& mData;
|
CSMWorld::Data& mData;
|
||||||
std::string mReferenceId;
|
std::string mReferenceId;
|
||||||
std::string mReferenceableId;
|
std::string mReferenceableId;
|
||||||
|
osg::ref_ptr<osg::PositionAttitudeTransform> mRootNode;
|
||||||
osg::ref_ptr<osg::PositionAttitudeTransform> mBaseNode;
|
osg::ref_ptr<osg::PositionAttitudeTransform> mBaseNode;
|
||||||
osg::ref_ptr<osgFX::Scribe> mOutline;
|
osg::ref_ptr<osgFX::Scribe> mOutline;
|
||||||
bool mSelected;
|
bool mSelected;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user