mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-25 16:43:33 +00:00
Don't use Geodes
This commit is contained in:
parent
137dde7cf8
commit
f898bf493f
@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
#include <BulletCollision/CollisionDispatch/btCollisionWorld.h>
|
#include <BulletCollision/CollisionDispatch/btCollisionWorld.h>
|
||||||
|
|
||||||
#include <osg/Geode>
|
|
||||||
#include <osg/Geometry>
|
#include <osg/Geometry>
|
||||||
#include <osg/Group>
|
#include <osg/Group>
|
||||||
|
|
||||||
@ -26,13 +25,8 @@ DebugDrawer::DebugDrawer(osg::ref_ptr<osg::Group> parentNode, btCollisionWorld *
|
|||||||
mWorld(world),
|
mWorld(world),
|
||||||
mDebugOn(true)
|
mDebugOn(true)
|
||||||
{
|
{
|
||||||
mGeode = new osg::Geode;
|
|
||||||
mParentNode->addChild(mGeode);
|
|
||||||
mGeode->setNodeMask(Mask_Debug);
|
|
||||||
|
|
||||||
createGeometry();
|
createGeometry();
|
||||||
|
|
||||||
mParentNode->addChild(mGeode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebugDrawer::createGeometry()
|
void DebugDrawer::createGeometry()
|
||||||
@ -40,6 +34,7 @@ void DebugDrawer::createGeometry()
|
|||||||
if (!mGeometry)
|
if (!mGeometry)
|
||||||
{
|
{
|
||||||
mGeometry = new osg::Geometry;
|
mGeometry = new osg::Geometry;
|
||||||
|
mGeometry->setNodeMask(Mask_Debug);
|
||||||
|
|
||||||
mVertices = new osg::Vec3Array;
|
mVertices = new osg::Vec3Array;
|
||||||
|
|
||||||
@ -50,7 +45,7 @@ void DebugDrawer::createGeometry()
|
|||||||
mGeometry->setDataVariance(osg::Object::DYNAMIC);
|
mGeometry->setDataVariance(osg::Object::DYNAMIC);
|
||||||
mGeometry->addPrimitiveSet(mDrawArrays);
|
mGeometry->addPrimitiveSet(mDrawArrays);
|
||||||
|
|
||||||
mGeode->addDrawable(mGeometry);
|
mParentNode->addChild(mGeometry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,7 +53,7 @@ void DebugDrawer::destroyGeometry()
|
|||||||
{
|
{
|
||||||
if (mGeometry)
|
if (mGeometry)
|
||||||
{
|
{
|
||||||
mGeode->removeDrawable(mGeometry);
|
mParentNode->removeChild(mGeometry);
|
||||||
mGeometry = NULL;
|
mGeometry = NULL;
|
||||||
mVertices = NULL;
|
mVertices = NULL;
|
||||||
mDrawArrays = NULL;
|
mDrawArrays = NULL;
|
||||||
@ -67,7 +62,7 @@ void DebugDrawer::destroyGeometry()
|
|||||||
|
|
||||||
DebugDrawer::~DebugDrawer()
|
DebugDrawer::~DebugDrawer()
|
||||||
{
|
{
|
||||||
mParentNode->removeChild(mGeode);
|
destroyGeometry();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebugDrawer::step()
|
void DebugDrawer::step()
|
||||||
|
@ -12,7 +12,6 @@ class btCollisionWorld;
|
|||||||
namespace osg
|
namespace osg
|
||||||
{
|
{
|
||||||
class Group;
|
class Group;
|
||||||
class Geode;
|
|
||||||
class Geometry;
|
class Geometry;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24,7 +23,6 @@ class DebugDrawer : public btIDebugDraw
|
|||||||
protected:
|
protected:
|
||||||
osg::ref_ptr<osg::Group> mParentNode;
|
osg::ref_ptr<osg::Group> mParentNode;
|
||||||
btCollisionWorld *mWorld;
|
btCollisionWorld *mWorld;
|
||||||
osg::ref_ptr<osg::Geode> mGeode;
|
|
||||||
osg::ref_ptr<osg::Geometry> mGeometry;
|
osg::ref_ptr<osg::Geometry> mGeometry;
|
||||||
osg::ref_ptr<osg::Vec3Array> mVertices;
|
osg::ref_ptr<osg::Vec3Array> mVertices;
|
||||||
osg::ref_ptr<osg::DrawArrays> mDrawArrays;
|
osg::ref_ptr<osg::DrawArrays> mDrawArrays;
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
#include <osg/Texture2D>
|
#include <osg/Texture2D>
|
||||||
#include <osg/Group>
|
#include <osg/Group>
|
||||||
#include <osg/Geometry>
|
#include <osg/Geometry>
|
||||||
#include <osg/Geode>
|
|
||||||
#include <osg/Depth>
|
#include <osg/Depth>
|
||||||
|
|
||||||
#include <osgDB/WriteFile>
|
#include <osgDB/WriteFile>
|
||||||
@ -296,9 +295,7 @@ namespace MWRender
|
|||||||
stateset->setTextureAttributeAndModes(0, texture, osg::StateAttribute::ON);
|
stateset->setTextureAttributeAndModes(0, texture, osg::StateAttribute::ON);
|
||||||
stateset->setMode(GL_LIGHTING, osg::StateAttribute::OFF);
|
stateset->setMode(GL_LIGHTING, osg::StateAttribute::OFF);
|
||||||
stateset->setMode(GL_DEPTH_TEST, osg::StateAttribute::OFF);
|
stateset->setMode(GL_DEPTH_TEST, osg::StateAttribute::OFF);
|
||||||
osg::ref_ptr<osg::Geode> geode = new osg::Geode;
|
camera->addChild(geom);
|
||||||
geode->addDrawable(geom);
|
|
||||||
camera->addChild(geode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mRoot->addChild(camera);
|
mRoot->addChild(camera);
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
#include <osg/Group>
|
#include <osg/Group>
|
||||||
#include <osg/Geode>
|
|
||||||
#include <osg/UserDataContainer>
|
#include <osg/UserDataContainer>
|
||||||
|
|
||||||
#include <osgParticle/ParticleSystem>
|
#include <osgParticle/ParticleSystem>
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
#include <osg/Geometry>
|
#include <osg/Geometry>
|
||||||
#include <osg/PositionAttitudeTransform>
|
#include <osg/PositionAttitudeTransform>
|
||||||
#include <osg/Geode>
|
|
||||||
#include <osg/Group>
|
#include <osg/Group>
|
||||||
|
|
||||||
#include <components/esm/loadstat.hpp>
|
#include <components/esm/loadstat.hpp>
|
||||||
@ -213,16 +212,12 @@ void Pathgrid::enableCellPathgrid(const MWWorld::CellStore *store)
|
|||||||
osg::ref_ptr<osg::PositionAttitudeTransform> cellPathGrid = new osg::PositionAttitudeTransform;
|
osg::ref_ptr<osg::PositionAttitudeTransform> cellPathGrid = new osg::PositionAttitudeTransform;
|
||||||
cellPathGrid->setPosition(cellPathGridPos);
|
cellPathGrid->setPosition(cellPathGridPos);
|
||||||
|
|
||||||
osg::ref_ptr<osg::Geode> lineGeode = new osg::Geode;
|
|
||||||
osg::ref_ptr<osg::Geometry> lines = createPathgridLines(pathgrid);
|
osg::ref_ptr<osg::Geometry> lines = createPathgridLines(pathgrid);
|
||||||
lineGeode->addDrawable(lines);
|
|
||||||
|
|
||||||
osg::ref_ptr<osg::Geode> pointGeode = new osg::Geode;
|
|
||||||
osg::ref_ptr<osg::Geometry> points = createPathgridPoints(pathgrid);
|
osg::ref_ptr<osg::Geometry> points = createPathgridPoints(pathgrid);
|
||||||
pointGeode->addDrawable(points);
|
|
||||||
|
|
||||||
cellPathGrid->addChild(lineGeode);
|
cellPathGrid->addChild(lines);
|
||||||
cellPathGrid->addChild(pointGeode);
|
cellPathGrid->addChild(points);
|
||||||
|
|
||||||
mPathGridRoot->addChild(cellPathGrid);
|
mPathGridRoot->addChild(cellPathGrid);
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
|
||||||
#include <osg/PolygonOffset>
|
#include <osg/PolygonOffset>
|
||||||
#include <osg/Geode>
|
|
||||||
#include <osg/Texture2D>
|
#include <osg/Texture2D>
|
||||||
#include <osg/Material>
|
#include <osg/Material>
|
||||||
#include <osg/Depth>
|
#include <osg/Depth>
|
||||||
@ -85,10 +84,7 @@ namespace MWRender
|
|||||||
RippleSimulation::RippleSimulation(osg::Group *parent, Resource::ResourceSystem* resourceSystem, const Fallback::Map* fallback)
|
RippleSimulation::RippleSimulation(osg::Group *parent, Resource::ResourceSystem* resourceSystem, const Fallback::Map* fallback)
|
||||||
: mParent(parent)
|
: mParent(parent)
|
||||||
{
|
{
|
||||||
osg::ref_ptr<osg::Geode> geode (new osg::Geode);
|
|
||||||
|
|
||||||
mParticleSystem = new osgParticle::ParticleSystem;
|
mParticleSystem = new osgParticle::ParticleSystem;
|
||||||
geode->addDrawable(mParticleSystem);
|
|
||||||
|
|
||||||
mParticleSystem->setParticleAlignment(osgParticle::ParticleSystem::FIXED);
|
mParticleSystem->setParticleAlignment(osgParticle::ParticleSystem::FIXED);
|
||||||
mParticleSystem->setAlignVectorX(osg::Vec3f(1,0,0));
|
mParticleSystem->setAlignVectorX(osg::Vec3f(1,0,0));
|
||||||
@ -106,7 +102,7 @@ RippleSimulation::RippleSimulation(osg::Group *parent, Resource::ResourceSystem*
|
|||||||
|
|
||||||
mParticleNode = new osg::PositionAttitudeTransform;
|
mParticleNode = new osg::PositionAttitudeTransform;
|
||||||
mParticleNode->addChild(updater);
|
mParticleNode->addChild(updater);
|
||||||
mParticleNode->addChild(geode);
|
mParticleNode->addChild(mParticleSystem);
|
||||||
mParticleNode->setNodeMask(Mask_Effect);
|
mParticleNode->setNodeMask(Mask_Effect);
|
||||||
|
|
||||||
createWaterRippleStateSet(resourceSystem, fallback, mParticleNode);
|
createWaterRippleStateSet(resourceSystem, fallback, mParticleNode);
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
#include <osg/ClipPlane>
|
#include <osg/ClipPlane>
|
||||||
#include <osg/Fog>
|
#include <osg/Fog>
|
||||||
#include <osg/Transform>
|
#include <osg/Transform>
|
||||||
#include <osg/Geode>
|
|
||||||
#include <osg/Depth>
|
#include <osg/Depth>
|
||||||
#include <osg/Geometry>
|
#include <osg/Geometry>
|
||||||
#include <osg/Material>
|
#include <osg/Material>
|
||||||
@ -347,14 +346,6 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void apply(osg::Geode &geode)
|
|
||||||
{
|
|
||||||
for (unsigned int i=0; i<geode.getNumDrawables(); ++i)
|
|
||||||
{
|
|
||||||
osg::Drawable* drw = geode.getDrawable(i);
|
|
||||||
apply(*drw);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void apply(osg::Drawable& drw)
|
void apply(osg::Drawable& drw)
|
||||||
{
|
{
|
||||||
osg::Geometry* geom = drw.asGeometry();
|
osg::Geometry* geom = drw.asGeometry();
|
||||||
@ -438,12 +429,10 @@ class CelestialBody
|
|||||||
public:
|
public:
|
||||||
CelestialBody(osg::Group* parentNode, float scaleFactor, int numUvSets)
|
CelestialBody(osg::Group* parentNode, float scaleFactor, int numUvSets)
|
||||||
{
|
{
|
||||||
mGeode = new osg::Geode;
|
mGeom = createTexturedQuad(numUvSets);
|
||||||
osg::ref_ptr<osg::Geometry> geom = createTexturedQuad(numUvSets);
|
|
||||||
mGeode->addDrawable(geom);
|
|
||||||
mTransform = new osg::PositionAttitudeTransform;
|
mTransform = new osg::PositionAttitudeTransform;
|
||||||
mTransform->setScale(osg::Vec3f(450,450,450) * scaleFactor);
|
mTransform->setScale(osg::Vec3f(450,450,450) * scaleFactor);
|
||||||
mTransform->addChild(mGeode);
|
mTransform->addChild(mGeom);
|
||||||
|
|
||||||
parentNode->addChild(mTransform);
|
parentNode->addChild(mTransform);
|
||||||
}
|
}
|
||||||
@ -460,7 +449,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
static const float mDistance;
|
static const float mDistance;
|
||||||
osg::ref_ptr<osg::PositionAttitudeTransform> mTransform;
|
osg::ref_ptr<osg::PositionAttitudeTransform> mTransform;
|
||||||
osg::ref_ptr<osg::Geode> mGeode;
|
osg::ref_ptr<osg::Geometry> mGeom;
|
||||||
};
|
};
|
||||||
|
|
||||||
const float CelestialBody::mDistance = 1000.0f;
|
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_S, osg::Texture::CLAMP_TO_EDGE);
|
||||||
sunTex->setWrap(osg::Texture::WRAP_T, 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<osg::Group> queryNode (new osg::Group);
|
osg::ref_ptr<osg::Group> queryNode (new osg::Group);
|
||||||
// Need to render after the world geometry so we can correctly test for occlusions
|
// 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.
|
// 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);
|
oqn->getQueryGeometry()->setDataVariance(osg::Object::STATIC);
|
||||||
|
|
||||||
osg::ref_ptr<osg::Geode> queryGeode = osg::clone(mGeode.get(), osg::CopyOp::DEEP_COPY_ALL);
|
osg::ref_ptr<osg::Geometry> queryGeom = osg::clone(mGeom.get(), osg::CopyOp::DEEP_COPY_ALL);
|
||||||
// Disable writing to the color buffer. We are using this geode for visibility tests only.
|
// Disable writing to the color buffer. We are using this geometry for visibility tests only.
|
||||||
osg::ref_ptr<osg::ColorMask> colormask (new osg::ColorMask(0, 0, 0, 0));
|
osg::ref_ptr<osg::ColorMask> 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
|
// Remove the default OFF|PROTECTED setting for texturing. We *want* to enable texturing for alpha testing purposes
|
||||||
oqn->getQueryStateSet()->removeTextureMode(0, GL_TEXTURE_2D);
|
oqn->getQueryStateSet()->removeTextureMode(0, GL_TEXTURE_2D);
|
||||||
@ -613,12 +602,10 @@ private:
|
|||||||
|
|
||||||
mTransform->addChild(transform);
|
mTransform->addChild(transform);
|
||||||
|
|
||||||
osg::ref_ptr<osg::Geode> geode (new osg::Geode);
|
osg::ref_ptr<osg::Geometry> geom = createTexturedQuad();
|
||||||
transform->addChild(geode);
|
transform->addChild(geom);
|
||||||
|
|
||||||
geode->addDrawable(createTexturedQuad());
|
osg::StateSet* stateset = geom->getOrCreateStateSet();
|
||||||
|
|
||||||
osg::StateSet* stateset = geode->getOrCreateStateSet();
|
|
||||||
|
|
||||||
stateset->setTextureAttributeAndModes(0, tex, osg::StateAttribute::ON);
|
stateset->setTextureAttributeAndModes(0, tex, osg::StateAttribute::ON);
|
||||||
stateset->setMode(GL_DEPTH_TEST, osg::StateAttribute::OFF);
|
stateset->setMode(GL_DEPTH_TEST, osg::StateAttribute::OFF);
|
||||||
@ -649,11 +636,9 @@ private:
|
|||||||
camera->setRenderOrder(osg::Camera::NESTED_RENDER);
|
camera->setRenderOrder(osg::Camera::NESTED_RENDER);
|
||||||
camera->setAllowEventFocus(false);
|
camera->setAllowEventFocus(false);
|
||||||
|
|
||||||
osg::ref_ptr<osg::Geode> geode (new osg::Geode);
|
|
||||||
osg::ref_ptr<osg::Geometry> geom = osg::createTexturedQuadGeometry(osg::Vec3f(-1,-1,0), osg::Vec3f(2,0,0), osg::Vec3f(0,2,0));
|
osg::ref_ptr<osg::Geometry> 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();
|
osg::StateSet* stateset = geom->getOrCreateStateSet();
|
||||||
|
|
||||||
@ -940,12 +925,12 @@ public:
|
|||||||
setPhase(MoonState::Phase_Full);
|
setPhase(MoonState::Phase_Full);
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
|
|
||||||
mGeode->addUpdateCallback(mUpdater);
|
mGeom->addUpdateCallback(mUpdater);
|
||||||
}
|
}
|
||||||
|
|
||||||
~Moon()
|
~Moon()
|
||||||
{
|
{
|
||||||
mGeode->removeUpdateCallback(mUpdater);
|
mGeom->removeUpdateCallback(mUpdater);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void adjustTransparency(const float ratio)
|
virtual void adjustTransparency(const float ratio)
|
||||||
@ -1380,11 +1365,8 @@ void SkyManager::createRain()
|
|||||||
osg::ref_ptr<osgParticle::ParticleSystemUpdater> updater (new osgParticle::ParticleSystemUpdater);
|
osg::ref_ptr<osgParticle::ParticleSystemUpdater> updater (new osgParticle::ParticleSystemUpdater);
|
||||||
updater->addParticleSystem(mRainParticleSystem);
|
updater->addParticleSystem(mRainParticleSystem);
|
||||||
|
|
||||||
osg::ref_ptr<osg::Geode> geode (new osg::Geode);
|
|
||||||
geode->addDrawable(mRainParticleSystem);
|
|
||||||
|
|
||||||
mRainNode->addChild(emitter);
|
mRainNode->addChild(emitter);
|
||||||
mRainNode->addChild(geode);
|
mRainNode->addChild(mRainParticleSystem);
|
||||||
mRainNode->addChild(updater);
|
mRainNode->addChild(updater);
|
||||||
|
|
||||||
mRainFader = new RainFader;
|
mRainFader = new RainFader;
|
||||||
|
@ -42,7 +42,7 @@ namespace MWRender
|
|||||||
Mask_Scene = (1<<12),
|
Mask_Scene = (1<<12),
|
||||||
Mask_GUI = (1<<13),
|
Mask_GUI = (1<<13),
|
||||||
|
|
||||||
// Set on a Geode
|
// Set on a ParticleSystem Drawable
|
||||||
Mask_ParticleSystem = (1<<14),
|
Mask_ParticleSystem = (1<<14),
|
||||||
|
|
||||||
// Set on cameras within the main scene graph
|
// Set on cameras within the main scene graph
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
#include <osg/Fog>
|
#include <osg/Fog>
|
||||||
#include <osg/Depth>
|
#include <osg/Depth>
|
||||||
#include <osg/Group>
|
#include <osg/Group>
|
||||||
#include <osg/Geode>
|
|
||||||
#include <osg/Geometry>
|
#include <osg/Geometry>
|
||||||
#include <osg/Material>
|
#include <osg/Material>
|
||||||
#include <osg/PositionAttitudeTransform>
|
#include <osg/PositionAttitudeTransform>
|
||||||
@ -466,25 +465,22 @@ Water::Water(osg::Group *parent, osg::Group* sceneRoot, Resource::ResourceSystem
|
|||||||
{
|
{
|
||||||
mSimulation.reset(new RippleSimulation(parent, resourceSystem, fallback));
|
mSimulation.reset(new RippleSimulation(parent, resourceSystem, fallback));
|
||||||
|
|
||||||
osg::ref_ptr<osg::Geometry> waterGeom = createWaterGeometry(CELL_SIZE*150, 40, 900);
|
mWaterGeom = createWaterGeometry(CELL_SIZE*150, 40, 900);
|
||||||
waterGeom->setDrawCallback(new DepthClampCallback);
|
mWaterGeom->setDrawCallback(new DepthClampCallback);
|
||||||
|
mWaterGeom->setNodeMask(Mask_Water);
|
||||||
mWaterGeode = new osg::Geode;
|
|
||||||
mWaterGeode->addDrawable(waterGeom);
|
|
||||||
mWaterGeode->setNodeMask(Mask_Water);
|
|
||||||
|
|
||||||
if (ico)
|
if (ico)
|
||||||
ico->add(mWaterGeode);
|
ico->add(mWaterGeom);
|
||||||
|
|
||||||
mWaterNode = new osg::PositionAttitudeTransform;
|
mWaterNode = new osg::PositionAttitudeTransform;
|
||||||
mWaterNode->addChild(mWaterGeode);
|
mWaterNode->addChild(mWaterGeom);
|
||||||
mWaterNode->addCullCallback(new FudgeCallback);
|
mWaterNode->addCullCallback(new FudgeCallback);
|
||||||
|
|
||||||
// simple water fallback for the local map
|
// simple water fallback for the local map
|
||||||
osg::ref_ptr<osg::Geode> geode2 (osg::clone(mWaterGeode.get(), osg::CopyOp::DEEP_COPY_NODES));
|
osg::ref_ptr<osg::Geometry> geom2 (osg::clone(mWaterGeom.get(), osg::CopyOp::DEEP_COPY_NODES));
|
||||||
createSimpleWaterStateSet(geode2, mFallback->getFallbackFloat("Water_Map_Alpha"));
|
createSimpleWaterStateSet(geom2, mFallback->getFallbackFloat("Water_Map_Alpha"));
|
||||||
geode2->setNodeMask(Mask_SimpleWater);
|
geom2->setNodeMask(Mask_SimpleWater);
|
||||||
mWaterNode->addChild(geode2);
|
mWaterNode->addChild(geom2);
|
||||||
|
|
||||||
mSceneRoot->addChild(mWaterNode);
|
mSceneRoot->addChild(mWaterNode);
|
||||||
|
|
||||||
@ -521,10 +517,10 @@ void Water::updateWaterMaterial()
|
|||||||
mParent->addChild(mRefraction);
|
mParent->addChild(mRefraction);
|
||||||
}
|
}
|
||||||
|
|
||||||
createShaderWaterStateSet(mWaterGeode, mReflection, mRefraction);
|
createShaderWaterStateSet(mWaterGeom, mReflection, mRefraction);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
createSimpleWaterStateSet(mWaterGeode, mFallback->getFallbackFloat("Water_World_Alpha"));
|
createSimpleWaterStateSet(mWaterGeom, mFallback->getFallbackFloat("Water_World_Alpha"));
|
||||||
|
|
||||||
updateVisible();
|
updateVisible();
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ namespace osg
|
|||||||
{
|
{
|
||||||
class Group;
|
class Group;
|
||||||
class PositionAttitudeTransform;
|
class PositionAttitudeTransform;
|
||||||
class Geode;
|
class Geometry;
|
||||||
class Node;
|
class Node;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ namespace MWRender
|
|||||||
osg::ref_ptr<osg::Group> mParent;
|
osg::ref_ptr<osg::Group> mParent;
|
||||||
osg::ref_ptr<osg::Group> mSceneRoot;
|
osg::ref_ptr<osg::Group> mSceneRoot;
|
||||||
osg::ref_ptr<osg::PositionAttitudeTransform> mWaterNode;
|
osg::ref_ptr<osg::PositionAttitudeTransform> mWaterNode;
|
||||||
osg::ref_ptr<osg::Geode> mWaterGeode;
|
osg::ref_ptr<osg::Geometry> mWaterGeom;
|
||||||
Resource::ResourceSystem* mResourceSystem;
|
Resource::ResourceSystem* mResourceSystem;
|
||||||
const Fallback::Map* mFallback;
|
const Fallback::Map* mFallback;
|
||||||
osg::ref_ptr<osgUtil::IncrementalCompileOperation> mIncrementalCompileOperation;
|
osg::ref_ptr<osgUtil::IncrementalCompileOperation> mIncrementalCompileOperation;
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
#include <MyGUI_Timer.h>
|
#include <MyGUI_Timer.h>
|
||||||
|
|
||||||
#include <osg/Drawable>
|
#include <osg/Drawable>
|
||||||
#include <osg/Geode>
|
|
||||||
#include <osg/BlendFunc>
|
#include <osg/BlendFunc>
|
||||||
#include <osg/Texture2D>
|
#include <osg/Texture2D>
|
||||||
#include <osg/TexMat>
|
#include <osg/TexMat>
|
||||||
@ -394,9 +393,6 @@ void RenderManager::initialise()
|
|||||||
|
|
||||||
mDrawable = new Drawable(this);
|
mDrawable = new Drawable(this);
|
||||||
|
|
||||||
osg::ref_ptr<osg::Geode> geode = new osg::Geode;
|
|
||||||
geode->addDrawable(mDrawable.get());
|
|
||||||
|
|
||||||
osg::ref_ptr<osg::Camera> camera = new osg::Camera();
|
osg::ref_ptr<osg::Camera> camera = new osg::Camera();
|
||||||
camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
|
camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
|
||||||
camera->setProjectionResizePolicy(osg::Camera::FIXED);
|
camera->setProjectionResizePolicy(osg::Camera::FIXED);
|
||||||
@ -404,8 +400,8 @@ void RenderManager::initialise()
|
|||||||
camera->setViewMatrix(osg::Matrix::identity());
|
camera->setViewMatrix(osg::Matrix::identity());
|
||||||
camera->setRenderOrder(osg::Camera::POST_RENDER);
|
camera->setRenderOrder(osg::Camera::POST_RENDER);
|
||||||
camera->setClearMask(GL_NONE);
|
camera->setClearMask(GL_NONE);
|
||||||
geode->setCullingActive(false);
|
mDrawable->setCullingActive(false);
|
||||||
camera->addChild(geode.get());
|
camera->addChild(mDrawable.get());
|
||||||
|
|
||||||
mGuiRoot = camera;
|
mGuiRoot = camera;
|
||||||
mSceneRoot->addChild(mGuiRoot.get());
|
mSceneRoot->addChild(mGuiRoot.get());
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
#include <osg/Matrixf>
|
#include <osg/Matrixf>
|
||||||
#include <osg/MatrixTransform>
|
#include <osg/MatrixTransform>
|
||||||
#include <osg/Geode>
|
|
||||||
#include <osg/Geometry>
|
#include <osg/Geometry>
|
||||||
#include <osg/Array>
|
#include <osg/Array>
|
||||||
#include <osg/LOD>
|
#include <osg/LOD>
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
#include <osg/NodeVisitor>
|
#include <osg/NodeVisitor>
|
||||||
#include <osg/Group>
|
#include <osg/Group>
|
||||||
#include <osg/Geode>
|
|
||||||
#include <osg/FrontFace>
|
#include <osg/FrontFace>
|
||||||
#include <osg/PositionAttitudeTransform>
|
#include <osg/PositionAttitudeTransform>
|
||||||
#include <osg/MatrixTransform>
|
#include <osg/MatrixTransform>
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
#include "statesetupdater.hpp"
|
#include "statesetupdater.hpp"
|
||||||
|
|
||||||
#include <osg/Drawable>
|
#include <osg/Drawable>
|
||||||
#include <osg/Geode>
|
|
||||||
#include <osg/NodeCallback>
|
#include <osg/NodeCallback>
|
||||||
|
|
||||||
namespace SceneUtil
|
namespace SceneUtil
|
||||||
@ -85,21 +84,6 @@ namespace SceneUtil
|
|||||||
traverse(node);
|
traverse(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ControllerVisitor::apply(osg::Geode &geode)
|
|
||||||
{
|
|
||||||
for (unsigned int i=0; i<geode.getNumDrawables(); ++i)
|
|
||||||
{
|
|
||||||
osg::Drawable* drw = geode.getDrawable(i);
|
|
||||||
|
|
||||||
osg::Callback* callback = drw->getUpdateCallback();
|
|
||||||
|
|
||||||
if (Controller* ctrl = dynamic_cast<Controller*>(callback))
|
|
||||||
visit(geode, *ctrl);
|
|
||||||
}
|
|
||||||
|
|
||||||
apply(static_cast<osg::Node&>(geode));
|
|
||||||
}
|
|
||||||
|
|
||||||
AssignControllerSourcesVisitor::AssignControllerSourcesVisitor()
|
AssignControllerSourcesVisitor::AssignControllerSourcesVisitor()
|
||||||
: ControllerVisitor()
|
: ControllerVisitor()
|
||||||
{
|
{
|
||||||
|
@ -63,7 +63,6 @@ namespace SceneUtil
|
|||||||
ControllerVisitor();
|
ControllerVisitor();
|
||||||
|
|
||||||
virtual void apply(osg::Node& node);
|
virtual void apply(osg::Node& node);
|
||||||
virtual void apply(osg::Geode& geode);
|
|
||||||
|
|
||||||
virtual void visit(osg::Node& node, Controller& ctrl) = 0;
|
virtual void visit(osg::Node& node, Controller& ctrl) = 0;
|
||||||
};
|
};
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
#include <osg/NodeVisitor>
|
#include <osg/NodeVisitor>
|
||||||
#include <osg/Geode>
|
|
||||||
|
|
||||||
#include <osgUtil/CullVisitor>
|
#include <osgUtil/CullVisitor>
|
||||||
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
#include "visitor.hpp"
|
#include "visitor.hpp"
|
||||||
|
|
||||||
#include <osg/Geode>
|
|
||||||
|
|
||||||
#include <osgParticle/ParticleSystem>
|
#include <osgParticle/ParticleSystem>
|
||||||
|
|
||||||
#include <components/misc/stringops.hpp>
|
#include <components/misc/stringops.hpp>
|
||||||
@ -19,12 +17,6 @@ namespace SceneUtil
|
|||||||
traverse(group);
|
traverse(group);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisableFreezeOnCullVisitor::apply(osg::Geode &geode)
|
|
||||||
{
|
|
||||||
for (unsigned int i=0; i<geode.getNumDrawables(); ++i)
|
|
||||||
apply(*geode.getDrawable(i));
|
|
||||||
}
|
|
||||||
|
|
||||||
void DisableFreezeOnCullVisitor::apply(osg::Drawable& drw)
|
void DisableFreezeOnCullVisitor::apply(osg::Drawable& drw)
|
||||||
{
|
{
|
||||||
if (osgParticle::ParticleSystem* partsys = dynamic_cast<osgParticle::ParticleSystem*>(&drw))
|
if (osgParticle::ParticleSystem* partsys = dynamic_cast<osgParticle::ParticleSystem*>(&drw))
|
||||||
|
@ -34,7 +34,6 @@ namespace SceneUtil
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void apply(osg::Geode &geode);
|
|
||||||
virtual void apply(osg::Drawable& drw);
|
virtual void apply(osg::Drawable& drw);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
#include <components/esm/loadland.hpp>
|
#include <components/esm/loadland.hpp>
|
||||||
|
|
||||||
#include <osg/Geometry>
|
#include <osg/Geometry>
|
||||||
#include <osg/Geode>
|
|
||||||
#include <osg/KdTree>
|
#include <osg/KdTree>
|
||||||
|
|
||||||
#include <osgFX/Effect>
|
#include <osgFX/Effect>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user