diff --git a/apps/openmw/mwrender/objects.cpp b/apps/openmw/mwrender/objects.cpp index 9d743fe90..a388d3163 100644 --- a/apps/openmw/mwrender/objects.cpp +++ b/apps/openmw/mwrender/objects.cpp @@ -131,7 +131,6 @@ void Objects::insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh) } } } - ent->setRenderQueueGroup(transparent ? RQG_Alpha : RQG_Main); if(!mIsStatic || !Settings::Manager::getBool("use static geometry", "Objects")) { @@ -139,12 +138,24 @@ void Objects::insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh) ent->setRenderingDistance(small ? Settings::Manager::getInt("small object distance", "Viewing distance") : 0); ent->setVisibilityFlags(mIsStatic ? (small ? RV_StaticsSmall : RV_Statics) : RV_Misc); + ent->setRenderQueueGroup(transparent ? RQG_Alpha : RQG_Main); } else { Ogre::StaticGeometry* sg = 0; - if (small) + if (transparent) + { + if( mStaticGeometryAlpha.find(ptr.getCell()) == mStaticGeometryAlpha.end()) + { + uniqueID = uniqueID +1; + sg = mRenderer.getScene()->createStaticGeometry( "sg" + Ogre::StringConverter::toString(uniqueID)); + mStaticGeometryAlpha[ptr.getCell()] = sg; + } + else + sg = mStaticGeometryAlpha[ptr.getCell()]; + } + else if (small) { if( mStaticGeometrySmall.find(ptr.getCell()) == mStaticGeometrySmall.end()) { @@ -152,7 +163,7 @@ void Objects::insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh) sg = mRenderer.getScene()->createStaticGeometry( "sg" + Ogre::StringConverter::toString(uniqueID)); mStaticGeometrySmall[ptr.getCell()] = sg; - sg->setRenderingDistance(Settings::Manager::getInt("small object distance", "Viewing distance")); /// \todo config value + sg->setRenderingDistance(Settings::Manager::getInt("small object distance", "Viewing distance")); } else sg = mStaticGeometrySmall[ptr.getCell()]; @@ -182,6 +193,8 @@ void Objects::insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh) sg->setVisibilityFlags(small ? RV_StaticsSmall : RV_Statics); + sg->setRenderQueueGroup(transparent ? RQG_Alpha : RQG_Main); + mRenderer.getScene()->destroyEntity(ent); } } @@ -275,6 +288,13 @@ void Objects::removeCell(MWWorld::Ptr::CellStore* store) mRenderer.getScene()->destroyStaticGeometry (sg); sg = 0; } + if(mStaticGeometryAlpha.find(store) != mStaticGeometryAlpha.end()) + { + Ogre::StaticGeometry* sg = mStaticGeometryAlpha[store]; + mStaticGeometryAlpha.erase(store); + mRenderer.getScene()->destroyStaticGeometry (sg); + sg = 0; + } if(mBounds.find(store) != mBounds.end()) mBounds.erase(store); @@ -292,6 +312,11 @@ void Objects::buildStaticGeometry(ESMS::CellStore& cell) Ogre::StaticGeometry* sg = mStaticGeometrySmall[&cell]; sg->build(); } + if(mStaticGeometryAlpha.find(&cell) != mStaticGeometryAlpha.end()) + { + Ogre::StaticGeometry* sg = mStaticGeometryAlpha[&cell]; + sg->build(); + } } Ogre::AxisAlignedBox Objects::getDimensions(MWWorld::Ptr::CellStore* cell) diff --git a/apps/openmw/mwrender/objects.hpp b/apps/openmw/mwrender/objects.hpp index 5911aa4cc..4326ce326 100644 --- a/apps/openmw/mwrender/objects.hpp +++ b/apps/openmw/mwrender/objects.hpp @@ -15,6 +15,7 @@ class Objects{ std::map mCellSceneNodes; std::map mStaticGeometry; std::map mStaticGeometrySmall; + std::map mStaticGeometryAlpha; std::map mBounds; std::vector mLights; Ogre::SceneNode* mMwRoot; diff --git a/apps/openmw/mwrender/renderconst.hpp b/apps/openmw/mwrender/renderconst.hpp index 113024ace..26d56a75c 100644 --- a/apps/openmw/mwrender/renderconst.hpp +++ b/apps/openmw/mwrender/renderconst.hpp @@ -14,10 +14,12 @@ enum RenderQueueGroups RQG_Main = Ogre::RENDER_QUEUE_MAIN, - RQG_OcclusionQuery = Ogre::RENDER_QUEUE_MAIN+1, + RQG_Water = Ogre::RENDER_QUEUE_6, RQG_Alpha = Ogre::RENDER_QUEUE_7, + RQG_OcclusionQuery = Ogre::RENDER_QUEUE_8, + // Sky late (sun & sun flare) RQG_SkiesLate = Ogre::RENDER_QUEUE_SKIES_LATE }; diff --git a/apps/openmw/mwrender/water.cpp b/apps/openmw/mwrender/water.cpp index cce25d1e9..d4ec9aeea 100644 --- a/apps/openmw/mwrender/water.cpp +++ b/apps/openmw/mwrender/water.cpp @@ -30,7 +30,7 @@ Water::Water (Ogre::Camera *camera, SkyManager* sky, const ESM::Cell* cell) : mWater = mSceneManager->createEntity("water"); mWater->setVisibilityFlags(RV_Water); - mWater->setRenderQueueGroup(RQG_Alpha); + mWater->setRenderQueueGroup(RQG_Water); mVisibilityFlags = RV_Terrain * Settings::Manager::getBool("reflect terrain", "Water") + RV_Statics * Settings::Manager::getBool("reflect statics", "Water") diff --git a/files/gbuffer/gbuffer.compositor b/files/gbuffer/gbuffer.compositor index fb12b8bf4..8ab5665dd 100644 --- a/files/gbuffer/gbuffer.compositor +++ b/files/gbuffer/gbuffer.compositor @@ -17,7 +17,7 @@ compositor gbuffer pass render_scene { first_render_queue 0 - last_render_queue 69 + last_render_queue 59 } } @@ -63,7 +63,7 @@ compositor gbufferFinalizer } pass render_scene { - first_render_queue 70 + first_render_queue 60 last_render_queue 100 } } diff --git a/files/water/water.material b/files/water/water.material index 95a0aef78..f21f929d4 100644 --- a/files/water/water.material +++ b/files/water/water.material @@ -43,9 +43,6 @@ material Water { pass { - scene_blend alpha_blend - depth_write off - vertex_program_ref Water_VP { param_named_auto camPosObjSpace camera_position_object_space