diff --git a/.gitignore b/.gitignore index 844b0764..4e831c2b 100644 --- a/.gitignore +++ b/.gitignore @@ -38,3 +38,4 @@ LOCALTODO tags Thumbs.db .directory +src/framework/graphics/dx/ diff --git a/src/client/creature.cpp b/src/client/creature.cpp index 29e47ae9..e3ede2bf 100644 --- a/src/client/creature.cpp +++ b/src/client/creature.cpp @@ -36,7 +36,7 @@ #include #include -#include +#include #include #include #include "spritemanager.h" diff --git a/src/client/lightview.h b/src/client/lightview.h index 22926b88..c14363e4 100644 --- a/src/client/lightview.h +++ b/src/client/lightview.h @@ -25,7 +25,7 @@ #include "declarations.h" #include -#include +#include #include "thingtype.h" struct LightSource { diff --git a/src/client/shadermanager.cpp b/src/client/shadermanager.cpp index 05d89706..b84265fb 100644 --- a/src/client/shadermanager.cpp +++ b/src/client/shadermanager.cpp @@ -23,7 +23,7 @@ #include "shadermanager.h" #include #include -#include +#include #include ShaderManager g_shaders; diff --git a/src/framework/CMakeLists.txt b/src/framework/CMakeLists.txt index 27cc7137..60070058 100644 --- a/src/framework/CMakeLists.txt +++ b/src/framework/CMakeLists.txt @@ -311,6 +311,10 @@ if(FRAMEWORK_GRAPHICS) set(framework_DEFINITIONS ${framework_DEFINITIONS} -DDIRECTX) set(framework_INCLUDE_DIRS ${framework_INCLUDE_DIRS} ${DirectX_INCLUDE_DIR}) set(framework_LIBRARIES ${framework_LIBRARIES} ${DirectX_LIBRARY} ${DirectX_LIBRARIES}) + set(framework_SOURCES ${framework_SOURCES} + ${CMAKE_CURRENT_LIST_DIR}/graphics/dx/painterdx9.cpp + ${CMAKE_CURRENT_LIST_DIR}/graphics/dx/painterdx9.h + ) endif() else() @@ -342,15 +346,13 @@ if(FRAMEWORK_GRAPHICS) ${CMAKE_CURRENT_LIST_DIR}/graphics/image.h ${CMAKE_CURRENT_LIST_DIR}/graphics/painter.cpp ${CMAKE_CURRENT_LIST_DIR}/graphics/painter.h - ${CMAKE_CURRENT_LIST_DIR}/graphics/painterogl.cpp - ${CMAKE_CURRENT_LIST_DIR}/graphics/painterogl.h - ${CMAKE_CURRENT_LIST_DIR}/graphics/painterogl1.cpp - ${CMAKE_CURRENT_LIST_DIR}/graphics/painterogl1.h - ${CMAKE_CURRENT_LIST_DIR}/graphics/painterogl2.cpp - ${CMAKE_CURRENT_LIST_DIR}/graphics/painterogl2.h - ${CMAKE_CURRENT_LIST_DIR}/graphics/painterdx9.cpp - ${CMAKE_CURRENT_LIST_DIR}/graphics/painterdx9.h - ${CMAKE_CURRENT_LIST_DIR}/graphics/painterogl2_shadersources.h + ${CMAKE_CURRENT_LIST_DIR}/graphics/ogl/painterogl.cpp + ${CMAKE_CURRENT_LIST_DIR}/graphics/ogl/painterogl.h + ${CMAKE_CURRENT_LIST_DIR}/graphics/ogl/painterogl1.cpp + ${CMAKE_CURRENT_LIST_DIR}/graphics/ogl/painterogl1.h + ${CMAKE_CURRENT_LIST_DIR}/graphics/ogl/painterogl2.cpp + ${CMAKE_CURRENT_LIST_DIR}/graphics/ogl/painterogl2.h + ${CMAKE_CURRENT_LIST_DIR}/graphics/ogl/painterogl2_shadersources.h ${CMAKE_CURRENT_LIST_DIR}/graphics/paintershaderprogram.cpp ${CMAKE_CURRENT_LIST_DIR}/graphics/paintershaderprogram.h ${CMAKE_CURRENT_LIST_DIR}/graphics/particleaffector.cpp diff --git a/src/framework/graphics/graphics.cpp b/src/framework/graphics/graphics.cpp index 898db23d..8fcd8e04 100644 --- a/src/framework/graphics/graphics.cpp +++ b/src/framework/graphics/graphics.cpp @@ -23,16 +23,16 @@ #include "fontmanager.h" #if OPENGL_ES==2 -#include "painterogl2.h" +#include "ogl/painterogl2.h" #elif OPENGL_ES==1 -#include "painterogl1.h" +#include "ogl/painterogl1.h" #else -#include "painterogl1.h" -#include "painterogl2.h" +#include "ogl/painterogl1.h" +#include "ogl/painterogl2.h" #endif #if defined(WIN32) && defined(DIRECTX) -#include "painterdx9.h" +#include "dx/painterdx9.h" #endif #include @@ -184,8 +184,8 @@ bool Graphics::isPainterEngineAvailable(Graphics::PainterEngine painterEngine) bool Graphics::selectPainterEngine(PainterEngine painterEngine) { - PainterOGL *painter = nullptr; - PainterOGL *fallbackPainter = nullptr; + Painter *painter = nullptr; + Painter *fallbackPainter = nullptr; PainterEngine fallbackPainterEngine = Painter_Any; #ifdef PAINTER_DX9 diff --git a/src/framework/graphics/painterogl.cpp b/src/framework/graphics/ogl/painterogl.cpp similarity index 99% rename from src/framework/graphics/painterogl.cpp rename to src/framework/graphics/ogl/painterogl.cpp index 146d231f..866851b1 100644 --- a/src/framework/graphics/painterogl.cpp +++ b/src/framework/graphics/ogl/painterogl.cpp @@ -21,8 +21,7 @@ */ #include "painterogl.h" -#include "graphics.h" - +#include #include PainterOGL::PainterOGL() diff --git a/src/framework/graphics/painterogl.h b/src/framework/graphics/ogl/painterogl.h similarity index 97% rename from src/framework/graphics/painterogl.h rename to src/framework/graphics/ogl/painterogl.h index 1ec6494b..39bd9967 100644 --- a/src/framework/graphics/painterogl.h +++ b/src/framework/graphics/ogl/painterogl.h @@ -23,11 +23,7 @@ #ifndef PAINTEROGL_H #define PAINTEROGL_H -#include "declarations.h" -#include "coordsbuffer.h" -#include "paintershaderprogram.h" -#include "texture.h" -#include "painter.h" +#include class PainterOGL : public Painter { diff --git a/src/framework/graphics/painterogl1.cpp b/src/framework/graphics/ogl/painterogl1.cpp similarity index 99% rename from src/framework/graphics/painterogl1.cpp rename to src/framework/graphics/ogl/painterogl1.cpp index 2efa7b0b..2d98a78d 100644 --- a/src/framework/graphics/painterogl1.cpp +++ b/src/framework/graphics/ogl/painterogl1.cpp @@ -23,7 +23,7 @@ #if !defined(OPENGL_ES) || OPENGL_ES==1 #include "painterogl1.h" -#include "graphics.h" +#include PainterOGL1 *g_painterOGL1 = nullptr; diff --git a/src/framework/graphics/painterogl1.h b/src/framework/graphics/ogl/painterogl1.h similarity index 100% rename from src/framework/graphics/painterogl1.h rename to src/framework/graphics/ogl/painterogl1.h diff --git a/src/framework/graphics/painterogl2.cpp b/src/framework/graphics/ogl/painterogl2.cpp similarity index 99% rename from src/framework/graphics/painterogl2.cpp rename to src/framework/graphics/ogl/painterogl2.cpp index 65165c5b..5dc817e2 100644 --- a/src/framework/graphics/painterogl2.cpp +++ b/src/framework/graphics/ogl/painterogl2.cpp @@ -21,8 +21,6 @@ */ #include "painterogl2.h" -#include "texture.h" -#include "graphics.h" #include "painterogl2_shadersources.h" #include diff --git a/src/framework/graphics/painterogl2.h b/src/framework/graphics/ogl/painterogl2.h similarity index 100% rename from src/framework/graphics/painterogl2.h rename to src/framework/graphics/ogl/painterogl2.h diff --git a/src/framework/graphics/painterogl2_shadersources.h b/src/framework/graphics/ogl/painterogl2_shadersources.h similarity index 100% rename from src/framework/graphics/painterogl2_shadersources.h rename to src/framework/graphics/ogl/painterogl2_shadersources.h diff --git a/src/framework/graphics/painter.h b/src/framework/graphics/painter.h index b2ce5937..c08d23d8 100644 --- a/src/framework/graphics/painter.h +++ b/src/framework/graphics/painter.h @@ -23,10 +23,10 @@ #ifndef PAINTER_H #define PAINTER_H -#include "declarations.h" -#include "coordsbuffer.h" -#include "paintershaderprogram.h" -#include "texture.h" +#include +#include +#include +#include class Painter { diff --git a/src/framework/graphics/painterdx9.cpp b/src/framework/graphics/painterdx9.cpp deleted file mode 100644 index 9bd591ca..00000000 --- a/src/framework/graphics/painterdx9.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2010-2013 OTClient - * - * 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. - */ - -#if defined(WIN32) && defined(DIRECTX) - -#include "painterdx9.h" -#include "graphics.h" - -PainterDX9 *g_painterDX9 = nullptr; - -PainterDX9::PainterDX9() -{ -} - -#endif diff --git a/src/framework/graphics/painterdx9.h b/src/framework/graphics/painterdx9.h deleted file mode 100644 index 21edc736..00000000 --- a/src/framework/graphics/painterdx9.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2010-2013 OTClient - * - * 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 PAINTERDX9_H -#define PAINTERDX9_H - -#define PAINTER_DX9 - -#include "painter.h" - -/** - * Painter using DirectX9 fixed-function rendering pipeline. - */ -class PainterDX9 : public Painter -{ -public: - PainterDX9(); - - void bind() {} - void unbind() {} - - void refreshState() {} - - void drawCoords(CoordsBuffer& coordsBuffer, DrawMode drawMode = Triangles) {} - void drawTextureCoords(CoordsBuffer& coordsBuffer, const TexturePtr& texture) {} - void drawTexturedRect(const Rect& dest, const TexturePtr& texture, const Rect& src) {} - void drawUpsideDownTexturedRect(const Rect& dest, const TexturePtr& texture, const Rect& src) {} - void drawRepeatedTexturedRect(const Rect& dest, const TexturePtr& texture, const Rect& src) {} - void drawFilledRect(const Rect& dest) {} - void drawFilledTriangle(const Point& a, const Point& b, const Point& c) {} - void drawBoundingRect(const Rect& dest, int innerLineWidth) {} - - bool hasShaders() { return false; } - -}; - -extern PainterDX9 *g_painterDX9; - -#endif diff --git a/src/framework/graphics/particle.h b/src/framework/graphics/particle.h index fa6da84d..f75f2dad 100644 --- a/src/framework/graphics/particle.h +++ b/src/framework/graphics/particle.h @@ -24,7 +24,7 @@ #define PARTICLE_H #include "declarations.h" -#include "painterogl.h" +#include "painter.h" class Particle : public stdext::shared_object { diff --git a/src/framework/graphics/particletype.h b/src/framework/graphics/particletype.h index 76ddc887..fbad2136 100644 --- a/src/framework/graphics/particletype.h +++ b/src/framework/graphics/particletype.h @@ -24,7 +24,7 @@ #define PARTICLETYPE_H #include "declarations.h" -#include +#include #include #include