put transparent objects in a seperate render queue, in order to not mess up the mrt textures

actorid
scrawl 13 years ago
parent 88c50c5171
commit b8a470efcd

@ -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<MWWorld::RefData>& 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)

@ -15,6 +15,7 @@ class Objects{
std::map<MWWorld::Ptr::CellStore *, Ogre::SceneNode *> mCellSceneNodes;
std::map<MWWorld::Ptr::CellStore *, Ogre::StaticGeometry*> mStaticGeometry;
std::map<MWWorld::Ptr::CellStore *, Ogre::StaticGeometry*> mStaticGeometrySmall;
std::map<MWWorld::Ptr::CellStore *, Ogre::StaticGeometry*> mStaticGeometryAlpha;
std::map<MWWorld::Ptr::CellStore *, Ogre::AxisAlignedBox> mBounds;
std::vector<std::string> mLights;
Ogre::SceneNode* mMwRoot;

@ -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
};

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

@ -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
}
}

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

Loading…
Cancel
Save