diff --git a/apps/openmw/mwrender/bulletdebugdraw.cpp b/apps/openmw/mwrender/bulletdebugdraw.cpp index eaf36cf85..d35c3ac5d 100644 --- a/apps/openmw/mwrender/bulletdebugdraw.cpp +++ b/apps/openmw/mwrender/bulletdebugdraw.cpp @@ -4,7 +4,6 @@ #include -#include #include #include @@ -26,13 +25,8 @@ DebugDrawer::DebugDrawer(osg::ref_ptr parentNode, btCollisionWorld * mWorld(world), mDebugOn(true) { - mGeode = new osg::Geode; - mParentNode->addChild(mGeode); - mGeode->setNodeMask(Mask_Debug); createGeometry(); - - mParentNode->addChild(mGeode); } void DebugDrawer::createGeometry() @@ -40,6 +34,7 @@ void DebugDrawer::createGeometry() if (!mGeometry) { mGeometry = new osg::Geometry; + mGeometry->setNodeMask(Mask_Debug); mVertices = new osg::Vec3Array; @@ -50,7 +45,7 @@ void DebugDrawer::createGeometry() mGeometry->setDataVariance(osg::Object::DYNAMIC); mGeometry->addPrimitiveSet(mDrawArrays); - mGeode->addDrawable(mGeometry); + mParentNode->addChild(mGeometry); } } @@ -58,7 +53,7 @@ void DebugDrawer::destroyGeometry() { if (mGeometry) { - mGeode->removeDrawable(mGeometry); + mParentNode->removeChild(mGeometry); mGeometry = NULL; mVertices = NULL; mDrawArrays = NULL; @@ -67,7 +62,7 @@ void DebugDrawer::destroyGeometry() DebugDrawer::~DebugDrawer() { - mParentNode->removeChild(mGeode); + destroyGeometry(); } void DebugDrawer::step() diff --git a/apps/openmw/mwrender/bulletdebugdraw.hpp b/apps/openmw/mwrender/bulletdebugdraw.hpp index 1bccc20bd..30da3aa72 100644 --- a/apps/openmw/mwrender/bulletdebugdraw.hpp +++ b/apps/openmw/mwrender/bulletdebugdraw.hpp @@ -12,7 +12,6 @@ class btCollisionWorld; namespace osg { class Group; - class Geode; class Geometry; } @@ -24,7 +23,6 @@ class DebugDrawer : public btIDebugDraw protected: osg::ref_ptr mParentNode; btCollisionWorld *mWorld; - osg::ref_ptr mGeode; osg::ref_ptr mGeometry; osg::ref_ptr mVertices; osg::ref_ptr mDrawArrays; diff --git a/apps/openmw/mwrender/globalmap.cpp b/apps/openmw/mwrender/globalmap.cpp index b3b6cc3b0..4bc24c594 100644 --- a/apps/openmw/mwrender/globalmap.cpp +++ b/apps/openmw/mwrender/globalmap.cpp @@ -6,7 +6,6 @@ #include #include #include -#include #include #include @@ -296,9 +295,7 @@ namespace MWRender stateset->setTextureAttributeAndModes(0, texture, osg::StateAttribute::ON); stateset->setMode(GL_LIGHTING, osg::StateAttribute::OFF); stateset->setMode(GL_DEPTH_TEST, osg::StateAttribute::OFF); - osg::ref_ptr geode = new osg::Geode; - geode->addDrawable(geom); - camera->addChild(geode); + camera->addChild(geom); } mRoot->addChild(camera); diff --git a/apps/openmw/mwrender/objects.cpp b/apps/openmw/mwrender/objects.cpp index a13ee03ac..e40863622 100644 --- a/apps/openmw/mwrender/objects.cpp +++ b/apps/openmw/mwrender/objects.cpp @@ -3,7 +3,6 @@ #include #include -#include #include #include diff --git a/apps/openmw/mwrender/pathgrid.cpp b/apps/openmw/mwrender/pathgrid.cpp index ae8bda1fb..d79604a91 100644 --- a/apps/openmw/mwrender/pathgrid.cpp +++ b/apps/openmw/mwrender/pathgrid.cpp @@ -4,7 +4,6 @@ #include #include -#include #include #include @@ -213,16 +212,12 @@ void Pathgrid::enableCellPathgrid(const MWWorld::CellStore *store) osg::ref_ptr cellPathGrid = new osg::PositionAttitudeTransform; cellPathGrid->setPosition(cellPathGridPos); - osg::ref_ptr lineGeode = new osg::Geode; osg::ref_ptr lines = createPathgridLines(pathgrid); - lineGeode->addDrawable(lines); - osg::ref_ptr pointGeode = new osg::Geode; osg::ref_ptr points = createPathgridPoints(pathgrid); - pointGeode->addDrawable(points); - cellPathGrid->addChild(lineGeode); - cellPathGrid->addChild(pointGeode); + cellPathGrid->addChild(lines); + cellPathGrid->addChild(points); mPathGridRoot->addChild(cellPathGrid); diff --git a/apps/openmw/mwrender/ripplesimulation.cpp b/apps/openmw/mwrender/ripplesimulation.cpp index f43f1ee5c..85319a632 100644 --- a/apps/openmw/mwrender/ripplesimulation.cpp +++ b/apps/openmw/mwrender/ripplesimulation.cpp @@ -3,7 +3,6 @@ #include #include -#include #include #include #include @@ -85,10 +84,7 @@ namespace MWRender RippleSimulation::RippleSimulation(osg::Group *parent, Resource::ResourceSystem* resourceSystem, const Fallback::Map* fallback) : mParent(parent) { - osg::ref_ptr geode (new osg::Geode); - mParticleSystem = new osgParticle::ParticleSystem; - geode->addDrawable(mParticleSystem); mParticleSystem->setParticleAlignment(osgParticle::ParticleSystem::FIXED); mParticleSystem->setAlignVectorX(osg::Vec3f(1,0,0)); @@ -106,7 +102,7 @@ RippleSimulation::RippleSimulation(osg::Group *parent, Resource::ResourceSystem* mParticleNode = new osg::PositionAttitudeTransform; mParticleNode->addChild(updater); - mParticleNode->addChild(geode); + mParticleNode->addChild(mParticleSystem); mParticleNode->setNodeMask(Mask_Effect); createWaterRippleStateSet(resourceSystem, fallback, mParticleNode); diff --git a/apps/openmw/mwrender/sky.cpp b/apps/openmw/mwrender/sky.cpp index 65a3f8ac2..b74a822f1 100644 --- a/apps/openmw/mwrender/sky.cpp +++ b/apps/openmw/mwrender/sky.cpp @@ -5,7 +5,6 @@ #include #include #include -#include #include #include #include @@ -347,14 +346,6 @@ public: { } - void apply(osg::Geode &geode) - { - for (unsigned int i=0; i geom = createTexturedQuad(numUvSets); - mGeode->addDrawable(geom); + mGeom = createTexturedQuad(numUvSets); mTransform = new osg::PositionAttitudeTransform; mTransform->setScale(osg::Vec3f(450,450,450) * scaleFactor); - mTransform->addChild(mGeode); + mTransform->addChild(mGeom); parentNode->addChild(mTransform); } @@ -460,7 +449,7 @@ public: protected: static const float mDistance; osg::ref_ptr mTransform; - osg::ref_ptr mGeode; + osg::ref_ptr mGeom; }; const float CelestialBody::mDistance = 1000.0f; @@ -479,7 +468,7 @@ public: sunTex->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE); sunTex->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE); - mGeode->getOrCreateStateSet()->setTextureAttributeAndModes(0, sunTex, osg::StateAttribute::ON); + mGeom->getOrCreateStateSet()->setTextureAttributeAndModes(0, sunTex, osg::StateAttribute::ON); osg::ref_ptr queryNode (new osg::Group); // Need to render after the world geometry so we can correctly test for occlusions @@ -553,12 +542,12 @@ private: // Note the debug geometry setDebugDisplay(true) is always DYNAMIC and that can't be changed, not a big deal. oqn->getQueryGeometry()->setDataVariance(osg::Object::STATIC); - osg::ref_ptr queryGeode = osg::clone(mGeode.get(), osg::CopyOp::DEEP_COPY_ALL); - // Disable writing to the color buffer. We are using this geode for visibility tests only. + osg::ref_ptr queryGeom = osg::clone(mGeom.get(), osg::CopyOp::DEEP_COPY_ALL); + // Disable writing to the color buffer. We are using this geometry for visibility tests only. osg::ref_ptr colormask (new osg::ColorMask(0, 0, 0, 0)); - queryGeode->getOrCreateStateSet()->setAttributeAndModes(colormask, osg::StateAttribute::ON); + queryGeom->getOrCreateStateSet()->setAttributeAndModes(colormask, osg::StateAttribute::ON); - oqn->addChild(queryGeode); + oqn->addChild(queryGeom); // Remove the default OFF|PROTECTED setting for texturing. We *want* to enable texturing for alpha testing purposes oqn->getQueryStateSet()->removeTextureMode(0, GL_TEXTURE_2D); @@ -613,12 +602,10 @@ private: mTransform->addChild(transform); - osg::ref_ptr geode (new osg::Geode); - transform->addChild(geode); + osg::ref_ptr geom = createTexturedQuad(); + transform->addChild(geom); - geode->addDrawable(createTexturedQuad()); - - osg::StateSet* stateset = geode->getOrCreateStateSet(); + osg::StateSet* stateset = geom->getOrCreateStateSet(); stateset->setTextureAttributeAndModes(0, tex, osg::StateAttribute::ON); stateset->setMode(GL_DEPTH_TEST, osg::StateAttribute::OFF); @@ -649,11 +636,9 @@ private: camera->setRenderOrder(osg::Camera::NESTED_RENDER); camera->setAllowEventFocus(false); - osg::ref_ptr geode (new osg::Geode); osg::ref_ptr geom = osg::createTexturedQuadGeometry(osg::Vec3f(-1,-1,0), osg::Vec3f(2,0,0), osg::Vec3f(0,2,0)); - geode->addDrawable(geom); - camera->addChild(geode); + camera->addChild(geom); osg::StateSet* stateset = geom->getOrCreateStateSet(); @@ -940,12 +925,12 @@ public: setPhase(MoonState::Phase_Full); setVisible(true); - mGeode->addUpdateCallback(mUpdater); + mGeom->addUpdateCallback(mUpdater); } ~Moon() { - mGeode->removeUpdateCallback(mUpdater); + mGeom->removeUpdateCallback(mUpdater); } virtual void adjustTransparency(const float ratio) @@ -1380,11 +1365,8 @@ void SkyManager::createRain() osg::ref_ptr updater (new osgParticle::ParticleSystemUpdater); updater->addParticleSystem(mRainParticleSystem); - osg::ref_ptr geode (new osg::Geode); - geode->addDrawable(mRainParticleSystem); - mRainNode->addChild(emitter); - mRainNode->addChild(geode); + mRainNode->addChild(mRainParticleSystem); mRainNode->addChild(updater); mRainFader = new RainFader; diff --git a/apps/openmw/mwrender/vismask.hpp b/apps/openmw/mwrender/vismask.hpp index ce13758e3..c70bcc71b 100644 --- a/apps/openmw/mwrender/vismask.hpp +++ b/apps/openmw/mwrender/vismask.hpp @@ -42,7 +42,7 @@ namespace MWRender Mask_Scene = (1<<12), Mask_GUI = (1<<13), - // Set on a Geode + // Set on a ParticleSystem Drawable Mask_ParticleSystem = (1<<14), // Set on cameras within the main scene graph diff --git a/apps/openmw/mwrender/water.cpp b/apps/openmw/mwrender/water.cpp index e2c9db089..2ce4f517c 100644 --- a/apps/openmw/mwrender/water.cpp +++ b/apps/openmw/mwrender/water.cpp @@ -5,7 +5,6 @@ #include #include #include -#include #include #include #include @@ -466,25 +465,22 @@ Water::Water(osg::Group *parent, osg::Group* sceneRoot, Resource::ResourceSystem { mSimulation.reset(new RippleSimulation(parent, resourceSystem, fallback)); - osg::ref_ptr waterGeom = createWaterGeometry(CELL_SIZE*150, 40, 900); - waterGeom->setDrawCallback(new DepthClampCallback); - - mWaterGeode = new osg::Geode; - mWaterGeode->addDrawable(waterGeom); - mWaterGeode->setNodeMask(Mask_Water); + mWaterGeom = createWaterGeometry(CELL_SIZE*150, 40, 900); + mWaterGeom->setDrawCallback(new DepthClampCallback); + mWaterGeom->setNodeMask(Mask_Water); if (ico) - ico->add(mWaterGeode); + ico->add(mWaterGeom); mWaterNode = new osg::PositionAttitudeTransform; - mWaterNode->addChild(mWaterGeode); + mWaterNode->addChild(mWaterGeom); mWaterNode->addCullCallback(new FudgeCallback); // simple water fallback for the local map - osg::ref_ptr geode2 (osg::clone(mWaterGeode.get(), osg::CopyOp::DEEP_COPY_NODES)); - createSimpleWaterStateSet(geode2, mFallback->getFallbackFloat("Water_Map_Alpha")); - geode2->setNodeMask(Mask_SimpleWater); - mWaterNode->addChild(geode2); + osg::ref_ptr geom2 (osg::clone(mWaterGeom.get(), osg::CopyOp::DEEP_COPY_NODES)); + createSimpleWaterStateSet(geom2, mFallback->getFallbackFloat("Water_Map_Alpha")); + geom2->setNodeMask(Mask_SimpleWater); + mWaterNode->addChild(geom2); mSceneRoot->addChild(mWaterNode); @@ -521,10 +517,10 @@ void Water::updateWaterMaterial() mParent->addChild(mRefraction); } - createShaderWaterStateSet(mWaterGeode, mReflection, mRefraction); + createShaderWaterStateSet(mWaterGeom, mReflection, mRefraction); } else - createSimpleWaterStateSet(mWaterGeode, mFallback->getFallbackFloat("Water_World_Alpha")); + createSimpleWaterStateSet(mWaterGeom, mFallback->getFallbackFloat("Water_World_Alpha")); updateVisible(); } diff --git a/apps/openmw/mwrender/water.hpp b/apps/openmw/mwrender/water.hpp index e03728d5f..29e78cf52 100644 --- a/apps/openmw/mwrender/water.hpp +++ b/apps/openmw/mwrender/water.hpp @@ -13,7 +13,7 @@ namespace osg { class Group; class PositionAttitudeTransform; - class Geode; + class Geometry; class Node; } @@ -53,7 +53,7 @@ namespace MWRender osg::ref_ptr mParent; osg::ref_ptr mSceneRoot; osg::ref_ptr mWaterNode; - osg::ref_ptr mWaterGeode; + osg::ref_ptr mWaterGeom; Resource::ResourceSystem* mResourceSystem; const Fallback::Map* mFallback; osg::ref_ptr mIncrementalCompileOperation; diff --git a/components/myguiplatform/myguirendermanager.cpp b/components/myguiplatform/myguirendermanager.cpp index 5d2e3a9ae..0bc7b0ee1 100644 --- a/components/myguiplatform/myguirendermanager.cpp +++ b/components/myguiplatform/myguirendermanager.cpp @@ -6,7 +6,6 @@ #include #include -#include #include #include #include @@ -394,9 +393,6 @@ void RenderManager::initialise() mDrawable = new Drawable(this); - osg::ref_ptr geode = new osg::Geode; - geode->addDrawable(mDrawable.get()); - osg::ref_ptr camera = new osg::Camera(); camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF); camera->setProjectionResizePolicy(osg::Camera::FIXED); @@ -404,8 +400,8 @@ void RenderManager::initialise() camera->setViewMatrix(osg::Matrix::identity()); camera->setRenderOrder(osg::Camera::POST_RENDER); camera->setClearMask(GL_NONE); - geode->setCullingActive(false); - camera->addChild(geode.get()); + mDrawable->setCullingActive(false); + camera->addChild(mDrawable.get()); mGuiRoot = camera; mSceneRoot->addChild(mGuiRoot.get()); diff --git a/components/nifosg/nifloader.cpp b/components/nifosg/nifloader.cpp index a5f9bd950..f935406a6 100644 --- a/components/nifosg/nifloader.cpp +++ b/components/nifosg/nifloader.cpp @@ -2,7 +2,6 @@ #include #include -#include #include #include #include diff --git a/components/sceneutil/attach.cpp b/components/sceneutil/attach.cpp index 1f06e8327..c80b9be36 100644 --- a/components/sceneutil/attach.cpp +++ b/components/sceneutil/attach.cpp @@ -5,7 +5,6 @@ #include #include -#include #include #include #include diff --git a/components/sceneutil/controller.cpp b/components/sceneutil/controller.cpp index 097899911..12c89c87d 100644 --- a/components/sceneutil/controller.cpp +++ b/components/sceneutil/controller.cpp @@ -3,7 +3,6 @@ #include "statesetupdater.hpp" #include -#include #include namespace SceneUtil @@ -85,21 +84,6 @@ namespace SceneUtil traverse(node); } - void ControllerVisitor::apply(osg::Geode &geode) - { - for (unsigned int i=0; igetUpdateCallback(); - - if (Controller* ctrl = dynamic_cast(callback)) - visit(geode, *ctrl); - } - - apply(static_cast(geode)); - } - AssignControllerSourcesVisitor::AssignControllerSourcesVisitor() : ControllerVisitor() { diff --git a/components/sceneutil/controller.hpp b/components/sceneutil/controller.hpp index 7399ecad5..3f1ec874e 100644 --- a/components/sceneutil/controller.hpp +++ b/components/sceneutil/controller.hpp @@ -63,7 +63,6 @@ namespace SceneUtil ControllerVisitor(); virtual void apply(osg::Node& node); - virtual void apply(osg::Geode& geode); virtual void visit(osg::Node& node, Controller& ctrl) = 0; }; diff --git a/components/sceneutil/lightmanager.cpp b/components/sceneutil/lightmanager.cpp index da29647c2..04ff3b603 100644 --- a/components/sceneutil/lightmanager.cpp +++ b/components/sceneutil/lightmanager.cpp @@ -3,7 +3,6 @@ #include #include -#include #include diff --git a/components/sceneutil/visitor.cpp b/components/sceneutil/visitor.cpp index 0a5ad2d00..d147ced7f 100644 --- a/components/sceneutil/visitor.cpp +++ b/components/sceneutil/visitor.cpp @@ -1,7 +1,5 @@ #include "visitor.hpp" -#include - #include #include @@ -19,12 +17,6 @@ namespace SceneUtil traverse(group); } - void DisableFreezeOnCullVisitor::apply(osg::Geode &geode) - { - for (unsigned int i=0; i(&drw)) diff --git a/components/sceneutil/visitor.hpp b/components/sceneutil/visitor.hpp index dcfefe9cd..751339d02 100644 --- a/components/sceneutil/visitor.hpp +++ b/components/sceneutil/visitor.hpp @@ -34,7 +34,6 @@ namespace SceneUtil { } - virtual void apply(osg::Geode &geode); virtual void apply(osg::Drawable& drw); }; diff --git a/components/terrain/terraingrid.cpp b/components/terrain/terraingrid.cpp index abfac4a71..c717a94f6 100644 --- a/components/terrain/terraingrid.cpp +++ b/components/terrain/terraingrid.cpp @@ -17,7 +17,6 @@ #include #include -#include #include #include