From da23098692fcb9f87a2cb23fee1ea30362a217ab Mon Sep 17 00:00:00 2001 From: fgenesis Date: Sat, 21 May 2022 18:56:27 +0200 Subject: [PATCH] remove PostProcessingFX It was broken on modern graphics cards anyway and should rather be re-introduced in a cleaner way once the renderer is ready for it --- Aquaria/Continuity.cpp | 14 ---- Aquaria/DSQ.cpp | 5 -- BBGE/CMakeLists.txt | 2 - BBGE/Core.cpp | 12 --- BBGE/Core.h | 3 - BBGE/Effects.cpp | 164 ----------------------------------------- BBGE/Effects.h | 61 --------------- 7 files changed, 261 deletions(-) delete mode 100644 BBGE/Effects.cpp delete mode 100644 BBGE/Effects.h diff --git a/Aquaria/Continuity.cpp b/Aquaria/Continuity.cpp index f62b312..4a479bd 100644 --- a/Aquaria/Continuity.cpp +++ b/Aquaria/Continuity.cpp @@ -2025,16 +2025,6 @@ void Continuity::applyWorldEffects(WorldType type, bool transition, bool affectM if (!transition) time = 0; if (type == WT_SPIRIT) { - - if(dsq->user.video.blur) - { - core->postProcessingFx.blendType = 1; - core->postProcessingFx.intensity = 0.2f; - core->postProcessingFx.layer = LR_AFTER_EFFECTS; - core->postProcessingFx.renderLayer = LR_AFTER_EFFECTS; - core->postProcessingFx.enable(FXT_RADIALBLUR); - } - dsq->game->avatar->canWarp = false; dsq->game->sceneColor.interpolateTo(Vector(0.4f, 0.8f, 0.9f), time); @@ -2044,10 +2034,6 @@ void Continuity::applyWorldEffects(WorldType type, bool transition, bool affectM { dsq->game->avatar->canWarp = true; - core->postProcessingFx.disable(FXT_RADIALBLUR); - - - dsq->game->sceneColor.interpolateTo(Vector(1,1,1), time); dsq->game->avatar->applyWorldEffects(type); } diff --git a/Aquaria/DSQ.cpp b/Aquaria/DSQ.cpp index 069f586..8fea5e2 100644 --- a/Aquaria/DSQ.cpp +++ b/Aquaria/DSQ.cpp @@ -1020,11 +1020,6 @@ void DSQ::init() dsq->darkLayer.toggle(0); debugLog("done"); - debugLog("post FX init"); - dsq->postProcessingFx.init(); - debugLog("done"); - - debugLog("Creating console"); console = new DebugFont; { diff --git a/BBGE/CMakeLists.txt b/BBGE/CMakeLists.txt index 4ca087e..49eab53 100644 --- a/BBGE/CMakeLists.txt +++ b/BBGE/CMakeLists.txt @@ -23,8 +23,6 @@ set(BBGE_SRCS DarkLayer.h DebugFont.cpp DebugFont.h - Effects.cpp - Effects.h Emitter.cpp EngineEnums.h Event.cpp diff --git a/BBGE/Core.cpp b/BBGE/Core.cpp index 1450914..b29f79b 100644 --- a/BBGE/Core.cpp +++ b/BBGE/Core.cpp @@ -1143,9 +1143,6 @@ void Core::run(float runTime) runTime = 0; } - // UPDATE - postProcessingFx.update(dt); - updateRenderObjects(dt); if (particleManager) @@ -1786,15 +1783,6 @@ void Core::render(int startLayer, int endLayer, bool useFrameBufferIfAvail) if (i == -1) continue; if ((startLayer != -1 && endLayer != -1) && (i < startLayer || i > endLayer)) continue; - if (i == postProcessingFx.layer) - { - postProcessingFx.preRender(); - } - if (i == postProcessingFx.renderLayer) - { - postProcessingFx.render(); - } - if (darkLayer.isUsed() ) { diff --git a/BBGE/Core.h b/BBGE/Core.h index 6bd8312..90a793e 100644 --- a/BBGE/Core.h +++ b/BBGE/Core.h @@ -26,7 +26,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "SoundManager.h" #include "Event.h" #include "StateManager.h" -#include "Effects.h" #include "Localization.h" #include "Window.h" @@ -242,8 +241,6 @@ public: CountedPtr addTexture(const std::string &texture); - PostProcessingFX postProcessingFx; - enum RemoveRenderObjectFlag { DESTROY_RENDER_OBJECT=0, DO_NOT_DESTROY_RENDER_OBJECT }; void removeRenderObject(RenderObject *r, RemoveRenderObjectFlag flag = DESTROY_RENDER_OBJECT); diff --git a/BBGE/Effects.cpp b/BBGE/Effects.cpp deleted file mode 100644 index 9a78c6e..0000000 --- a/BBGE/Effects.cpp +++ /dev/null @@ -1,164 +0,0 @@ -/* -Copyright (C) 2007, 2010 - Bit-Blot - -This file is part of Aquaria. - -Aquaria is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#include "Effects.h" -#include "RenderBase.h" -#include "Core.h" -#include - - -PostProcessingFX::PostProcessingFX() -{ - blendType = 0; - layer = renderLayer = 0; - intensity = 0.1f; - blurTimes = 12; - radialBlurColor = Vector(1,1,1); - for (int i = 0; i < FXT_MAX; i++) - enabled[i] = false; -} - -void PostProcessingFX::init() -{ -} - - -void PostProcessingFX::update(float dt) -{ -} - -void PostProcessingFX::preRender() -{ -} - -void PostProcessingFX::toggle(FXTypes type) -{ - enabled[int(type)] = !enabled[int(type)]; -} - -void PostProcessingFX::enable(FXTypes type) -{ - enabled[int(type)] = true; -} - -bool PostProcessingFX::isEnabled(FXTypes type) -{ - return enabled[int(type)]; -} - -void PostProcessingFX::disable(FXTypes type) -{ - enabled[int(type)] = false; -} - -void PostProcessingFX::render() const -{ - if(!core->frameBuffer.isInited()) - return; - - for (int i = 0; i < FXT_MAX; i++) - { - if (enabled[i]) - { - glPushMatrix(); - FXTypes type = (FXTypes)i; - switch(type) - { - case FXT_MAX: - break; - case FXT_RADIALBLUR: - - float windowW = core->getWindowWidth(); - float windowH = core->getWindowHeight(); - float textureW = core->frameBuffer.getWidth(); - float textureH = core->frameBuffer.getHeight(); - - float alpha = intensity; - - float offX = -(core->getVirtualOffX() * windowW / core->getVirtualWidth()); - float offY = -(core->getVirtualOffY() * windowH / core->getVirtualHeight()); - - float width2 = windowW / 2; - float height2 = windowH / 2; - - float pw = float(windowW)/float(textureW); - float ph = float(windowH)/float(textureH); - - glLoadIdentity(); - - - glTranslatef(width2 + offX, height2 + offY, 0); - - glEnable(GL_TEXTURE_2D); - - core->frameBuffer.bindTexture(); - - glEnable(GL_BLEND); - - if (blendType == 1) - glBlendFunc(GL_SRC_ALPHA,GL_ONE); - else - glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); - - float percentX = pw, percentY = ph; - - float inc = 0.01f; - float spost = 0.0f; // Starting Texture Coordinate Offset - float alphadec = alpha / blurTimes; - - glBegin(GL_QUADS); // Begin Drawing Quads - for (int num = 0;num < blurTimes; num++) // Number Of Times To Render Blur - { - glColor4f(radialBlurColor.x, radialBlurColor.y, radialBlurColor.z, alpha); // Set The Alpha Value (Starts At 0.2) - - glTexCoord2d(spost, spost); - glVertex3f(-width2, height2, 0.0); - - glTexCoord2d(percentX-spost, spost); - glVertex3f( width2, height2, 0.0); - - glTexCoord2d(percentX-spost, percentY-spost); - glVertex3f( width2, -height2, 0.0); - - glTexCoord2d(spost, percentY-spost); - glVertex3f(-width2, -height2, 0.0); - - spost += inc; // Gradually Increase spost (Zooming Closer To Texture Center) - alpha -= alphadec; // Gradually Decrease alpha (Gradually Fading Image Out) - } - glEnd(); - - - glColor4f(1,1,1,1); - glBindTexture(GL_TEXTURE_2D, 0); - RenderObject::lastTextureApplied = 0; - - - break; - } - glPopMatrix(); - - } - } -} - - - diff --git a/BBGE/Effects.h b/BBGE/Effects.h deleted file mode 100644 index d5de261..0000000 --- a/BBGE/Effects.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -Copyright (C) 2007, 2010 - Bit-Blot - -This file is part of Aquaria. - -Aquaria is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef EFFECTS_H -#define EFFECTS_H - -#include "Vector.h" -#include "Base.h" - -enum FXTypes -{ - FXT_RADIALBLUR =0, - FXT_MAX -}; - -class PostProcessingFX -{ -public: - PostProcessingFX(); - void init(); - void update(float dt); - void preRender(); - void render() const; - void toggle(FXTypes type); - void enable(FXTypes type); - void disable(FXTypes type); - bool isEnabled(FXTypes type); - - // blur - Vector radialBlurColor; - int blurTimes; - - /// misc - int renderLayer; - int layer; - float intensity; - int blendType; - -protected: - bool enabled[FXT_MAX]; -}; - -#endif -