Merge pull request #1478 from Areloch/VolFog2

Volumetric Fog Take 2
This commit is contained in:
Areloch 2016-01-15 11:22:25 -06:00
commit ff2df5c43f
66 changed files with 4494 additions and 6 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,243 @@
//-----------------------------------------------------------------------------
// Copyright (c) 2012 GarageGames, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#ifndef _VolumetricFog_H_
#define _VolumetricFog_H_
#ifndef _SCENEOBJECT_H_
#include "scene/sceneObject.h"
#endif
#ifndef _MATTEXTURETARGET_H_
#include "materials/matTextureTarget.h"
#endif
#ifndef _GFXSHADER_H_
#include "gfx/gfxShader.h"
#endif
#ifndef _GFXTARGET_H_
#include "gfx/gfxTarget.h"
#endif
#ifndef _GFXVERTEXBUFFER_H_
#include "gfx/gfxVertexBuffer.h"
#endif
#ifndef _TSSHAPE_H_
#include "ts/tsShape.h"
#endif
#ifndef _POST_EFFECT_H_
#include "postFx/postEffect.h"
#endif
#include "gui/core/guiCanvas.h"
class VolumetricFogRTManager;
class VolumetricFog : public SceneObject
{
typedef SceneObject Parent;
// Maskbits for updating
enum
{
VolumetricFogMask = Parent::NextFreeMask,
FogColorMask = Parent::NextFreeMask << 1,
FogDensityMask = Parent::NextFreeMask << 2,
FogModulationMask = Parent::NextFreeMask << 3,
FogPostFXMask = Parent::NextFreeMask << 4,
FogShapeMask = Parent::NextFreeMask << 5,
NextFreeMask = Parent::NextFreeMask << 6
};
// Struct which holds the shape details
struct meshes
{
F32 det_size;
S32 sub_shape;
S32 obj_det;
U32 num_verts;
GFXVertexPNTT *verts;
Vector <GFXPrimitive> *piArray;
Vector <U32> *indices;
};
protected:
// Rendertargets;
GFXTextureTargetRef z_buf;
NamedTexTargetRef mPrepassTarget;
NamedTexTargetRef mDepthBufferTarget;
NamedTexTargetRef mFrontBufferTarget;
// Fog Modulation texture
GFXTexHandle mTexture;
// Shaders
GFXShaderRef mShader;
GFXShaderRef mPrePassShader;
GFXShaderRef mReflectionShader;
// Stateblocks
GFXStateBlockDesc descD;
GFXStateBlockDesc descF;
GFXStateBlockDesc desc_preD;
GFXStateBlockDesc desc_preF;
GFXStateBlockDesc desc_refl;
GFXStateBlockRef mStateblockD;
GFXStateBlockRef mStateblockF;
GFXStateBlockRef mStateblock_preD;
GFXStateBlockRef mStateblock_preF;
GFXStateBlockRef mStateblock_refl;
// Shaderconstants
GFXShaderConstBufferRef mShaderConsts;
GFXShaderConstHandle *mModelViewProjSC;
GFXShaderConstHandle *mFadeSizeSC;
GFXShaderConstHandle *mFogColorSC;
GFXShaderConstHandle *mFogDensitySC;
GFXShaderConstHandle *mPreBias;
GFXShaderConstHandle *mAccumTime;
GFXShaderConstHandle *mIsTexturedSC;
GFXShaderConstHandle *mModSpeedSC;
GFXShaderConstHandle *mModStrengthSC;
GFXShaderConstHandle *mViewPointSC;
GFXShaderConstHandle *mTexScaleSC;
GFXShaderConstHandle *mTexTilesSC;
GFXShaderConstBufferRef mPPShaderConsts;
GFXShaderConstHandle *mPPModelViewProjSC;
GFXShaderConstHandle *mAmbientColorSC;
GFXShaderConstBufferRef mReflShaderConsts;
GFXShaderConstHandle *mReflModelViewProjSC;
GFXShaderConstHandle *mReflFogColorSC;
GFXShaderConstHandle *mReflFogDensitySC;
GFXShaderConstHandle *mReflFogStrengthSC;
// Vertex and Prim. Buffer
GFXVertexBufferHandle<GFXVertexPNTT> mVB;
GFXPrimitiveBufferHandle mPB;
// Fog volume data;
StringTableEntry mShapeName;
ColorI mFogColor;
F32 mFogDensity;
bool mIgnoreWater;
bool mReflect;
Vector<meshes> det_size;
bool mShapeLoaded;
F32 mPixelSize;
F32 mFadeSize;
U32 mCurDetailLevel;
U32 mNumDetailLevels;
F32 mObjSize;
F32 mRadius;
OrientedBox3F ColBox;
VectorF mObjScale;
F32 mMinDisplaySize;
F32 mInvScale;
// Fog Modulation data
String mTextureName;
bool mIsTextured;
F32 mTexTiles;
F32 mStrength;
Point2F mSpeed1;
Point2F mSpeed2;
Point4F mSpeed;
Point2F mTexScale;
// Fog Rendering data
Point3F camPos;
Point2F mViewPoint;
F32 mFOV;
F32 viewDist;
bool mIsVBDirty;
bool mIsPBDirty;
bool mCamInFog;
bool mResizing;
PlatformWindow *mPlatformWindow;
// Reflections
F32 mFogReflStrength;
// PostFX
PostEffect *glowFX;
bool mUseGlow;
F32 mGlowStrength;
U8 mGlowing;
F32 mCurGlow;
bool mModifLightRays;
F32 mLightRayMod;
F32 mOldLightRayStrength;
GameConnection* conn;
U32 mCounter;
void ResizeRT(PlatformWindow *win, bool resize);
protected:
// Protected methods
bool onAdd();
void onRemove();
void handleResize(VolumetricFogRTManager *RTM, bool resize);
void handleCanvasResize(GuiCanvas* canvas);
bool LoadShape();
bool setupRenderer();
void InitTexture();
bool UpdateBuffers(U32 dl,bool force=true);
void processTick(const Move *move);
void _enterFog(ShapeBase *control);
void _leaveFog(ShapeBase *control);
public:
// Public methods
VolumetricFog();
~VolumetricFog();
static void initPersistFields();
virtual void inspectPostApply();
U32 packUpdate(NetConnection *conn, U32 mask, BitStream *stream);
void unpackUpdate(NetConnection *conn, BitStream *stream);
void prepRenderImage(SceneRenderState* state);
void render(ObjectRenderInst *ri, SceneRenderState *state, BaseMatInstance *overrideMat);
void reflect_render(ObjectRenderInst *ri, SceneRenderState *state, BaseMatInstance *overrideMat);
// Methods for modifying & networking various fog elements
// Used in script
void setFogColor(ColorF color);
void setFogColor(ColorI color);
void setFogDensity(F32 density);
void setFogModulation(F32 strength, Point2F speed1, Point2F speed2);
void setFogGlow(bool on_off, F32 strength);
void setFogLightray(bool on_off, F32 strength);
bool isInsideFog();
DECLARE_CONOBJECT(VolumetricFog);
DECLARE_CALLBACK(void, onEnterFog, (SimObjectId obj));
DECLARE_CALLBACK(void, onLeaveFog, (SimObjectId obj));
};
#endif

View file

@ -0,0 +1,299 @@
//-----------------------------------------------------------------------------
// Copyright (c) 2012 GarageGames, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Volumetric Fog Rendertarget Manager
//
// Creates and maintains one set of rendertargets to be used by every
// VolumetricFog object in the scene.
//
// Will be loaded at startup end removed when ending game.
//
//-----------------------------------------------------------------------------
#include "VolumetricFogRTManager.h"
#include "core/module.h"
#include "scene/sceneManager.h"
#include "windowManager/platformWindowMgr.h"
#include "console/engineAPI.h"
#include "gui/core/guiCanvas.h"
MODULE_BEGIN(VolumetricFogRTManager)
MODULE_INIT_AFTER(Scene)
MODULE_SHUTDOWN_BEFORE(Scene)
MODULE_INIT
{
gVolumetricFogRTManager = new VolumetricFogRTManager;
gClientSceneGraph->addObjectToScene(gVolumetricFogRTManager);
}
MODULE_SHUTDOWN
{
gClientSceneGraph->removeObjectFromScene(gVolumetricFogRTManager);
SAFE_DELETE(gVolumetricFogRTManager);
}
MODULE_END;
ConsoleDocClass( VolumetricFogRTManager,
"@brief Creates and maintains one set of rendertargets to be used by every\n"
"VolumetricFog object in the scene.\n\n"
"Will be loaded at startup end removed when ending game.\n\n"
"Methods:\n"
" get() returns the currently loaded VolumetricFogRTManager, also accessible\n"
" through VFRTM define.\n"
" Init() Initializes the rendertargets, called when a VolumetricFog object is\n"
" added to the scene.\n"
" isInitialed() returns true if Rendertargets are present, false if not, then\n"
" Init() should be called to create the rendertargets.\n"
" setQuality(U32 Quality) Normally a rendertarget has the same size as the view,\n"
" with this method you can scale down the size of it.\n"
" Be aware that scaling down will introduce renderartefacts.\n"
"@ingroup Atmosphere"
);
VolumetricFogRTMResizeSignal VolumetricFogRTManager::smVolumetricFogRTMResizeSignal;
VolumetricFogRTManager *gVolumetricFogRTManager = NULL;
S32 VolumetricFogRTManager::mTargetScale = 1;
IMPLEMENT_CONOBJECT(VolumetricFogRTManager);
VolumetricFogRTManager::VolumetricFogRTManager()
{
setGlobalBounds();
mTypeMask |= EnvironmentObjectType;
mNetFlags.set(IsGhost);
mIsInitialized = false;
mNumFogObjects = 0;
}
VolumetricFogRTManager::~VolumetricFogRTManager()
{
if (mFrontTarget.isRegistered())
mFrontTarget.unregister();
if (mDepthTarget.isRegistered())
mDepthTarget.unregister();
if (mDepthBuffer.isValid())
mDepthBuffer->kill();
if (mFrontBuffer.isValid())
mFrontBuffer->kill();
}
void VolumetricFogRTManager::onSceneRemove()
{
if (mIsInitialized)
mPlatformWindow->getScreenResChangeSignal().remove(this, &VolumetricFogRTManager::ResizeRT);
}
void VolumetricFogRTManager::onRemove()
{
removeFromScene();
Parent::onRemove();
}
void VolumetricFogRTManager::consoleInit()
{
Con::addVariable("$pref::VolumetricFog::Quality", TypeS32, &mTargetScale,
"The scale of the rendertargets.\n"
"@ingroup Rendering\n");
}
bool VolumetricFogRTManager::Init()
{
if (mIsInitialized)
{
Con::errorf("VolumetricFogRTManager allready initialized!!");
return true;
}
GuiCanvas* cv = dynamic_cast<GuiCanvas*>(Sim::findObject("Canvas"));
if (cv == NULL)
{
Con::errorf("VolumetricFogRTManager::Init() - Canvas not found!!");
return false;
}
mPlatformWindow = cv->getPlatformWindow();
mPlatformWindow->getScreenResChangeSignal().notify(this,&VolumetricFogRTManager::ResizeRT);
if (mTargetScale < 1)
mTargetScale = 1;
mWidth = mFloor(mPlatformWindow->getClientExtent().x / mTargetScale);
mHeight = mPlatformWindow->getClientExtent().y;
mFullScreen = mPlatformWindow->isFullscreen();
if (!mFullScreen)
mHeight -= 20;//subtract caption bar from rendertarget size.
mHeight = mFloor(mHeight / mTargetScale);
mDepthBuffer = GFXTexHandle(mWidth, mHeight, GFXFormatR32F,
&GFXDefaultRenderTargetProfile, avar("%s() - mDepthBuffer (line %d)", __FUNCTION__, __LINE__));
if (!mDepthBuffer.isValid())
{
Con::errorf("VolumetricFogRTManager Fatal Error: Unable to create Depthbuffer");
return false;
}
if (!mDepthTarget.registerWithName("volfogdepth"))
{
Con::errorf("VolumetricFogRTManager Fatal Error : Unable to register Depthbuffer");
return false;
}
mDepthTarget.setTexture(mDepthBuffer);
mFrontBuffer = GFXTexHandle(mWidth, mHeight, GFXFormatR32F,
&GFXDefaultRenderTargetProfile, avar("%s() - mFrontBuffer (line %d)", __FUNCTION__, __LINE__));
if (!mFrontBuffer.isValid())
{
Con::errorf("VolumetricFogRTManager Fatal Error: Unable to create front buffer");
return false;
}
if (!mFrontTarget.registerWithName("volfogfront"))
{
Con::errorf("VolumetricFogRTManager Fatal Error : Unable to register Frontbuffer");
return false;
}
mFrontTarget.setTexture(mFrontBuffer);
Con::setVariable("$VolumetricFog::density", "0.0");
mIsInitialized = true;
return true;
}
U32 VolumetricFogRTManager::IncFogObjects()
{
mNumFogObjects++;
return mNumFogObjects;
}
U32 VolumetricFogRTManager::DecFogObjects()
{
if (mNumFogObjects > 0)
mNumFogObjects--;
return mNumFogObjects;
}
void VolumetricFogRTManager::ResizeRT(PlatformWindow* win,bool resize)
{
mFogHasAnswered = 0;
smVolumetricFogRTMResizeSignal.trigger(this, true);
}
void VolumetricFogRTManager::FogAnswered()
{
mFogHasAnswered++;
if (mFogHasAnswered == mNumFogObjects)
{
if (Resize())
smVolumetricFogRTMResizeSignal.trigger(this, false);
else
Con::errorf("VolumetricFogRTManager::FogAnswered - Error resizing rendertargets!");
}
}
bool VolumetricFogRTManager::Resize()
{
if (mTargetScale < 1)
mTargetScale = 1;
mWidth = mFloor(mPlatformWindow->getClientExtent().x / mTargetScale);
mHeight = mPlatformWindow->getClientExtent().y;
if (!mPlatformWindow->isFullscreen())
mHeight -= 20;//subtract caption bar from rendertarget size.
mHeight = mFloor(mHeight / mTargetScale);
if (mWidth < 16 || mHeight < 16)
return false;
if (mFrontTarget.isRegistered())
mFrontTarget.setTexture(NULL);
if (mDepthTarget.isRegistered())
mDepthTarget.setTexture(NULL);
if (mDepthBuffer.isValid())
mDepthBuffer->kill();
if (mFrontBuffer.isValid())
mFrontBuffer->kill();
mFrontBuffer = GFXTexHandle(mWidth, mHeight, GFXFormatR32F,
&GFXDefaultRenderTargetProfile, avar("%s() - mFrontBuffer (line %d)", __FUNCTION__, __LINE__));
if (!mFrontBuffer.isValid())
{
Con::errorf("VolumetricFogRTManager::Resize() Fatal Error: Unable to create front buffer");
return false;
}
mFrontTarget.setTexture(mFrontBuffer);
mDepthBuffer = GFXTexHandle(mWidth, mHeight, GFXFormatR32F,
&GFXDefaultRenderTargetProfile, avar("%s() - mDepthBuffer (line %d)", __FUNCTION__, __LINE__));
if (!mDepthBuffer.isValid())
{
Con::errorf("VolumetricFogRTManager::Resize() Fatal Error: Unable to create Depthbuffer");
return false;
}
mDepthTarget.setTexture(mDepthBuffer);
return true;
}
S32 VolumetricFogRTManager::setQuality(U32 Quality)
{
if (!mIsInitialized)
return (mTargetScale = Quality);
if (Quality < 1)
Quality = 1;
if (Quality == mTargetScale)
return mTargetScale;
mTargetScale = Quality;
mFogHasAnswered = 0;
smVolumetricFogRTMResizeSignal.trigger(this, true);
return mTargetScale;
}
VolumetricFogRTManager* VolumetricFogRTManager::get()
{
return gVolumetricFogRTManager;
}
DefineConsoleFunction(SetFogVolumeQuality, S32, (U32 new_quality), ,
"@brief Resizes the rendertargets of the Volumetric Fog object.\n"
"@params new_quality new quality for the rendertargets 1 = full size, 2 = halfsize, 3 = 1/3, 4 = 1/4 ...")
{
if (VFRTM == NULL)
return -1;
return VFRTM->setQuality(new_quality);
}

View file

@ -0,0 +1,92 @@
//-----------------------------------------------------------------------------
// Copyright (c) 2012 GarageGames, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#ifndef _VolumetricFogRTManager_H_
#define _VolumetricFogRTManager_H_
#ifndef _SCENEOBJECT_H_
#include "scene/sceneObject.h"
#endif
#ifndef _MATTEXTURETARGET_H_
#include "materials/matTextureTarget.h"
#endif
#ifndef _GFXTARGET_H_
#include "gfx/gfxTarget.h"
#endif
#ifndef _SIGNAL_H_
#include "core/util/tSignal.h"
#endif
class VolumetricFogRTManager;
typedef Signal<void(VolumetricFogRTManager *VolumetricFogRTManager, bool resize)> VolumetricFogRTMResizeSignal;
#define VFRTM VolumetricFogRTManager::get()
class VolumetricFogRTManager : public SceneObject
{
public:
typedef SceneObject Parent;
protected:
GFXTexHandle mDepthBuffer;
GFXTexHandle mFrontBuffer;
NamedTexTarget mDepthTarget;
NamedTexTarget mFrontTarget;
PlatformWindow* mPlatformWindow;
static S32 mTargetScale;
bool mIsInitialized;
U32 mNumFogObjects;
U32 mFogHasAnswered;
U32 mWidth;
U32 mHeight;
bool mFullScreen;
void onRemove();
void onSceneRemove();
void ResizeRT(PlatformWindow *win, bool resize);
static VolumetricFogRTMResizeSignal smVolumetricFogRTMResizeSignal;
public:
VolumetricFogRTManager();
~VolumetricFogRTManager();
static VolumetricFogRTManager *get();
bool Init();
bool IsInitialized() { return mIsInitialized; }
static void consoleInit();
static VolumetricFogRTMResizeSignal& getVolumetricFogRTMResizeSignal() { return smVolumetricFogRTMResizeSignal; }
void FogAnswered();
S32 setQuality(U32 Quality);
bool Resize();
U32 IncFogObjects();
U32 DecFogObjects();
DECLARE_CONOBJECT(VolumetricFogRTManager);
};
extern VolumetricFogRTManager* gVolumetricFogRTManager;
#endif

View file

@ -321,8 +321,11 @@ void GuiCanvas::setWindowTitle(const char *newTitle)
mPlatformWindow->setCaption(newTitle);
}
CanvasSizeChangeSignal GuiCanvas::smCanvasSizeChangeSignal;
void GuiCanvas::handleResize( WindowId did, S32 width, S32 height )
{
getCanvasSizeChangeSignal().trigger(this);
if (Journal::IsPlaying() && mPlatformWindow)
{
mPlatformWindow->lockSize(false);

View file

@ -33,6 +33,10 @@
#include "platform/platformInput.h"
#endif
#ifndef _SIGNAL_H_
#include "core/util/tSignal.h"
#endif
#include "component/interfaces/IProcessInput.h"
#include "windowManager/platformWindowMgr.h"
#include "gfx/gfxFence.h"
@ -74,6 +78,8 @@
/// screen will be painted normally. If you are making an animated GuiControl
/// you need to add your control to the dirty areas of the canvas.
///
class guiCanvas;
typedef Signal<void(GuiCanvas* canvas)> CanvasSizeChangeSignal;
class GuiCanvas : public GuiControl, public IProcessInput
{
@ -183,6 +189,8 @@ protected:
virtual void setupFences();
void checkLockMouseMove( const GuiEvent& event );
//Signal used to let others know this canvas has changed size.
static CanvasSizeChangeSignal smCanvasSizeChangeSignal;
GuiControl *mMenuBarCtrl;
@ -200,6 +208,8 @@ public:
static void initPersistFields();
static CanvasSizeChangeSignal& getCanvasSizeChangeSignal() { return smCanvasSizeChangeSignal; }
/// @name Rendering methods
///
/// @{

View file

@ -53,6 +53,7 @@ const RenderInstType RenderPassManager::RIT_ObjectTranslucent("ObjectTranslucent
const RenderInstType RenderPassManager::RIT_Decal("Decal");
const RenderInstType RenderPassManager::RIT_Water("Water");
const RenderInstType RenderPassManager::RIT_Foliage("Foliage");
const RenderInstType RenderPassManager::RIT_VolumetricFog("ObjectVolumetricFog");
const RenderInstType RenderPassManager::RIT_Translucent("Translucent");
const RenderInstType RenderPassManager::RIT_Begin("Begin");
const RenderInstType RenderPassManager::RIT_Custom("Custom");

View file

@ -110,6 +110,7 @@ public:
static const RenderInstType RIT_Decal;
static const RenderInstType RIT_Water;
static const RenderInstType RIT_Foliage;
static const RenderInstType RIT_VolumetricFog;
static const RenderInstType RIT_Translucent;
static const RenderInstType RIT_Begin;
static const RenderInstType RIT_Custom;

View file

@ -51,6 +51,7 @@ RenderTranslucentMgr::RenderTranslucentMgr()
{
notifyType( RenderPassManager::RIT_ObjectTranslucent );
notifyType( RenderPassManager::RIT_Particle );
notifyType( RenderPassManager::RIT_VolumetricFog);
}
RenderTranslucentMgr::~RenderTranslucentMgr()
@ -187,6 +188,15 @@ void RenderTranslucentMgr::render( SceneRenderState *state )
j++;
continue;
}
else if (baseRI->type == RenderPassManager::RIT_VolumetricFog)
{
ObjectRenderInst* objRI = static_cast<ObjectRenderInst*>(baseRI);
objRI->renderDelegate(objRI, state, NULL);
lastVB = NULL;
lastPB = NULL;
j++;
continue;
}
else if ( baseRI->type == RenderPassManager::RIT_Particle )
{
ParticleRenderInst *ri = static_cast<ParticleRenderInst*>(baseRI);

View file

@ -22,7 +22,7 @@
#include "windowManager/platformWindow.h"
ScreenResChangeSignal PlatformWindow::smScreenResChangeSignal;
//-----------------------------------------------------------------------------
void PlatformWindow::setFullscreen( const bool fullscreen )
@ -48,3 +48,8 @@ bool PlatformWindow::shouldNotTranslate( U32 modifiers, U32 keyCode ) const
else
return false;
}
void PlatformWindow::setVideoMode(const GFXVideoMode &mode)
{
_setVideoMode(mode);
getScreenResChangeSignal().trigger(this, true);
}

View file

@ -28,6 +28,9 @@
#include "core/util/safeDelete.h"
#include "windowManager/platformCursorController.h"
#include "windowManager/windowInputGenerator.h"
#ifndef _SIGNAL_H_ //Volumetric Fog
#include "core/util/tSignal.h"
#endif
//forward decl's
class PlatformWindowManager;
@ -35,7 +38,7 @@ class GFXDevice;
struct GFXVideoMode;
class GFXWindowTarget;
class IProcessInput;
typedef Signal<void(PlatformWindow *PlatformWindow, bool resize)> ScreenResChangeSignal;
/// Abstract representation of a native OS window.
///
/// Every windowing system has its own representations and conventions as
@ -110,7 +113,7 @@ protected:
// This controller maps window input (Mouse/Keyboard) to a generic input consumer
mWindowInputGenerator = new WindowInputGenerator( this );
}
static ScreenResChangeSignal smScreenResChangeSignal;
public:
/// To get rid of a window, just delete it. Make sure the GFXDevice is
@ -158,7 +161,7 @@ public:
virtual GFXWindowTarget *getGFXTarget()=0;
/// Set the video mode for this window.
virtual void setVideoMode(const GFXVideoMode &mode)=0;
virtual void setVideoMode(const GFXVideoMode &mode);
/// Get our current video mode - if the window has been resized, it will
/// reflect this.
@ -497,6 +500,7 @@ public:
IdleEvent idleEvent;
/// @}
static ScreenResChangeSignal& getScreenResChangeSignal() { return smScreenResChangeSignal; }
/// Get the platform specific object needed to create or attach an accelerated
/// graohics drawing context on or to the window
@ -507,6 +511,7 @@ public:
virtual void* getPlatformDrawable() const = 0;
protected:
virtual void _setFullscreen(const bool fullScreen) {};
virtual void _setVideoMode(const GFXVideoMode &mode) {};
};
#endif

View file

@ -287,6 +287,8 @@ void Win32Window::setVideoMode( const GFXVideoMode &mode )
mOwningManager->raiseCurtain();
SetForegroundWindow(getHWND());
getScreenResChangeSignal().trigger(this, true);
}
bool Win32Window::clearFullscreen()