Get rid of obsolete osg::Geode where it is possible

LTO-timing^2^2
Andrei Kortunov 2 years ago
parent 0b08e5e29a
commit de58c9dff3

@ -1,7 +1,6 @@
#include "cell.hpp"
#include <osg/PositionAttitudeTransform>
#include <osg/Geode>
#include <osg/Group>
#include <components/misc/stringops.hpp>

@ -18,7 +18,6 @@ namespace osg
{
class Group;
class Geometry;
class Geode;
}
namespace CSMWorld

@ -1,14 +1,11 @@
#include "cellarrow.hpp"
#include <osg/Group>
#include <osg/PositionAttitudeTransform>
#include <osg/Geode>
#include <osg/Geometry>
#include <osg/PrimitiveSet>
#include "../../model/prefs/state.hpp"
#include "../../model/prefs/shortcutmanager.hpp"
#include <components/misc/constants.hpp>
@ -159,10 +156,7 @@ void CSVRender::CellArrow::buildShape()
geometry->getOrCreateStateSet()->setMode (GL_LIGHTING, osg::StateAttribute::OFF);
osg::ref_ptr<osg::Geode> geode (new osg::Geode);
geode->addDrawable (geometry);
mBaseNode->addChild (geode);
mBaseNode->addChild (geometry);
}
CSVRender::CellArrow::CellArrow (osg::Group *cellNode, Direction direction,

@ -2,7 +2,6 @@
#include <osg/AutoTransform>
#include <osg/Material>
#include <osg/Geode>
#include <osgText/Text>
#include <components/misc/constants.hpp>
@ -44,9 +43,7 @@ void CSVRender::CellMarker::buildMarker()
markerText->setText(coordinatesText);
// Add text to marker node.
osg::ref_ptr<osg::Geode> geode (new osg::Geode);
geode->addDrawable(markerText);
mMarkerNode->addChild(geode);
mMarkerNode->addChild(markerText);
}
void CSVRender::CellMarker::positionMarker()

@ -1,6 +1,5 @@
#include "cellwater.hpp"
#include <osg/Geode>
#include <osg/Geometry>
#include <osg/Group>
#include <osg/PositionAttitudeTransform>
@ -28,7 +27,7 @@ namespace CSVRender
, mId(id)
, mParentNode(cellNode)
, mWaterTransform(nullptr)
, mWaterNode(nullptr)
, mWaterGroup(nullptr)
, mWaterGeometry(nullptr)
, mDeleted(false)
, mExterior(false)
@ -41,8 +40,8 @@ namespace CSVRender
mWaterTransform->setNodeMask(Mask_Water);
mParentNode->addChild(mWaterTransform);
mWaterNode = new osg::Geode();
mWaterTransform->addChild(mWaterNode);
mWaterGroup = new osg::Group();
mWaterTransform->addChild(mWaterGroup);
int cellIndex = mData.getCells().searchId(mId);
if (cellIndex > -1)
@ -136,7 +135,7 @@ namespace CSVRender
if (mWaterGeometry)
{
mWaterNode->removeDrawable(mWaterGeometry);
mWaterGroup->removeChild(mWaterGeometry);
mWaterGeometry = nullptr;
}
@ -177,6 +176,6 @@ namespace CSVRender
mWaterGeometry->getStateSet()->setTextureAttributeAndModes(0, waterTexture, osg::StateAttribute::ON);
mWaterNode->addDrawable(mWaterGeometry);
mWaterGroup->addChild(mWaterGeometry);
}
}

@ -12,7 +12,6 @@
namespace osg
{
class Geode;
class Geometry;
class Group;
class PositionAttitudeTransform;
@ -60,7 +59,7 @@ namespace CSVRender
osg::Group* mParentNode;
osg::ref_ptr<osg::PositionAttitudeTransform> mWaterTransform;
osg::ref_ptr<osg::Geode> mWaterNode;
osg::ref_ptr<osg::Group> mWaterGroup;
osg::ref_ptr<osg::Geometry> mWaterGeometry;
bool mDeleted;

@ -2,7 +2,6 @@
#include <stdexcept>
#include <string>
#include <iostream>
#include <osg/Depth>
#include <osg/Group>
@ -10,17 +9,13 @@
#include <osg/ShapeDrawable>
#include <osg/Shape>
#include <osg/Geode>
#include <osg/Geometry>
#include <osg/PrimitiveSet>
#include <osgFX/Scribe>
#include "../../model/world/data.hpp"
#include "../../model/world/ref.hpp"
#include "../../model/world/refidcollection.hpp"
#include "../../model/world/commands.hpp"
#include "../../model/world/universalid.hpp"
#include "../../model/world/commandmacro.hpp"
#include "../../model/world/cellcoordinates.hpp"
#include "../../model/prefs/state.hpp"
@ -43,15 +38,15 @@ const float CSVRender::Object::MarkerHeadLength = 50;
namespace
{
osg::ref_ptr<osg::Geode> createErrorCube()
osg::ref_ptr<osg::Group> createErrorCube()
{
osg::ref_ptr<osg::Box> shape(new osg::Box(osg::Vec3f(0,0,0), 50.f));
osg::ref_ptr<osg::ShapeDrawable> shapedrawable(new osg::ShapeDrawable);
shapedrawable->setShape(shape);
osg::ref_ptr<osg::Geode> geode (new osg::Geode);
geode->addDrawable(shapedrawable);
return geode;
osg::ref_ptr<osg::Group> group (new osg::Group);
group->addChild(shapedrawable);
return group;
}
}
@ -296,10 +291,10 @@ osg::ref_ptr<osg::Node> CSVRender::Object::makeMoveOrScaleMarker (int axis)
setupCommonMarkerState(geometry);
osg::ref_ptr<osg::Geode> geode (new osg::Geode);
geode->addDrawable (geometry);
osg::ref_ptr<osg::Group> group (new osg::Group);
group->addChild(geometry);
return geode;
return group;
}
osg::ref_ptr<osg::Node> CSVRender::Object::makeRotateMarker (int axis)
@ -382,10 +377,10 @@ osg::ref_ptr<osg::Node> CSVRender::Object::makeRotateMarker (int axis)
setupCommonMarkerState(geometry);
osg::ref_ptr<osg::Geode> geode = new osg::Geode();
geode->addDrawable (geometry);
osg::ref_ptr<osg::Group> group = new osg::Group();
group->addChild(geometry);
return geode;
return group;
}
void CSVRender::Object::setupCommonMarkerState(osg::ref_ptr<osg::Geometry> geometry)

@ -20,7 +20,6 @@ namespace osg
class PositionAttitudeTransform;
class Group;
class Node;
class Geode;
}
namespace osgFX

@ -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()

@ -15,7 +15,6 @@
namespace osg
{
class Geode;
class Geometry;
class Group;
class PositionAttitudeTransform;
@ -107,7 +106,7 @@ namespace CSVRender
osg::Group* mParent;
osg::ref_ptr<osg::PositionAttitudeTransform> mBaseNode;
osg::ref_ptr<osg::Geode> mPathgridGeode;
osg::ref_ptr<osg::Group> mPathgridGroup;
osg::ref_ptr<osg::Geometry> mPathgridGeometry;
osg::ref_ptr<osg::Geometry> mSelectedGeometry;
osg::ref_ptr<osg::Geometry> mDragGeometry;

@ -9,10 +9,10 @@ namespace Misc
"osg::Group {"
" UniqueID 1 "
" Children 5 {"
" osg::Geode {"
" osg::Group {"
" UniqueID 2 "
" Name \"Error\" "
" Drawables 1 {"
" Children 1 {"
" osg::Geometry {"
" UniqueID 3 "
" DataVariance STATIC "
@ -245,10 +245,10 @@ namespace Misc
" }"
" }"
" }"
" osg::Geode {"
" osg::Group {"
" UniqueID 12 "
" Name \"Error\" "
" Drawables 1 {"
" Children 1 {"
" osg::Geometry {"
" UniqueID 13 "
" DataVariance STATIC "
@ -476,10 +476,10 @@ namespace Misc
" }"
" }"
" }"
" osg::Geode {"
" osg::Group {"
" UniqueID 20 "
" Name \"Error\" "
" Drawables 1 {"
" Children 1 {"
" osg::Geometry {"
" UniqueID 21 "
" DataVariance STATIC "
@ -852,10 +852,10 @@ namespace Misc
" }"
" }"
" }"
" osg::Geode {"
" osg::Group {"
" UniqueID 30 "
" Name \"Error\" "
" Drawables 1 {"
" Children 1 {"
" osg::Geometry {"
" UniqueID 31 "
" DataVariance STATIC "
@ -1221,10 +1221,10 @@ namespace Misc
" }"
" }"
" }"
" osg::Geode {"
" osg::Group {"
" UniqueID 38 "
" Name \"Cube\" "
" Drawables 1 {"
" Children 1 {"
" osg::Geometry {"
" UniqueID 39 "
" DataVariance STATIC "

@ -210,7 +210,7 @@ class CollectLowestTransformsVisitor : public BaseOptimizerVisitor
traverse(node);
}
void apply(osg::Geometry& geode) override
void apply(osg::Geometry& geometry) override
{
}
@ -1615,9 +1615,6 @@ bool Optimizer::MergeGeometryVisitor::mergeGroup(osg::Group& group)
}
// geode.dirtyBound();
return false;
}

@ -284,10 +284,10 @@ class Optimizer
FlattenStaticTransformsVisitor(Optimizer* optimizer=0):
BaseOptimizerVisitor(optimizer, FLATTEN_STATIC_TRANSFORMS) {}
void apply(osg::Node& geode) override;
void apply(osg::Geometry& drawable) override;
void apply(osg::Node& node) override;
void apply(osg::Geometry& geometry) override;
void apply(osg::Drawable& drawable) override;
void apply(osg::Billboard& geode) override;
void apply(osg::Billboard& billboard) override;
void apply(osg::Transform& transform) override final;
void apply(osg::MatrixTransform& transform) override;

@ -65,10 +65,10 @@ osg::ref_ptr<osg::Group> CellBorder::createBorderGeometry(float x, float y, floa
border->addPrimitiveSet(new osg::DrawArrays(GL_LINE_STRIP,0,vertices->size()));
osg::ref_ptr<osg::Group> borderGeode = new osg::Group;
borderGeode->addChild(border.get());
osg::ref_ptr<osg::Group> borderGroup = new osg::Group;
borderGroup->addChild(border.get());
osg::StateSet *stateSet = borderGeode->getOrCreateStateSet();
osg::StateSet *stateSet = borderGroup->getOrCreateStateSet();
osg::ref_ptr<osg::Material> material (new osg::Material);
material->setColorMode(osg::Material::AMBIENT_AND_DIFFUSE);
stateSet->setAttribute(material);
@ -77,18 +77,18 @@ osg::ref_ptr<osg::Group> CellBorder::createBorderGeometry(float x, float y, floa
polygonmode->setMode(osg::PolygonMode::FRONT_AND_BACK, osg::PolygonMode::LINE);
stateSet->setAttributeAndModes(polygonmode,osg::StateAttribute::ON);
sceneManager->recreateShaders(borderGeode, "debug");
borderGeode->setNodeMask(mask);
sceneManager->recreateShaders(borderGroup, "debug");
borderGroup->setNodeMask(mask);
return borderGeode;
return borderGroup;
}
void CellBorder::createCellBorderGeometry(int x, int y)
{
auto borderGeode = createBorderGeometry(x, y, 1.f, mWorld->getStorage(), mSceneManager, mBorderMask);
mRoot->addChild(borderGeode);
auto borderGroup = createBorderGeometry(x, y, 1.f, mWorld->getStorage(), mSceneManager, mBorderMask);
mRoot->addChild(borderGroup);
mCellBorderNodes[std::make_pair(x,y)] = borderGeode;
mCellBorderNodes[std::make_pair(x,y)] = borderGroup;
}
void CellBorder::destroyCellBorderGeometry(int x, int y)

Loading…
Cancel
Save