From 61a3d10e10198223b91cde2a209fc793c436c806 Mon Sep 17 00:00:00 2001 From: hiker <henrichsjoerg@gmail.com> Date: Sat, 12 Nov 2016 00:09:39 +1100 Subject: [PATCH] More Compile SERVER_ONLY, still not fully working. --- CMakeLists.txt | 10 ++++++---- lib/irrlicht/source/Irrlicht/CIrrDeviceLinux.cpp | 1 - src/graphics/command_buffer.cpp | 6 +++++- src/graphics/command_buffer.hpp | 7 +++++-- src/graphics/draw_calls.cpp | 4 ++++ src/graphics/draw_calls.hpp | 2 ++ src/graphics/draw_policies.cpp | 4 ++++ src/graphics/draw_policies.hpp | 6 ++++-- src/graphics/geometry_passes.cpp | 5 +++-- src/graphics/geometry_passes.hpp | 5 ++++- src/graphics/irr_driver.cpp | 8 +++++--- src/graphics/materials.cpp | 4 ++++ src/graphics/materials.hpp | 5 ++++- src/graphics/render_target.cpp | 3 +++ src/graphics/shader_based_renderer.cpp | 4 ++++ src/graphics/shader_based_renderer.hpp | 5 ++++- src/guiengine/engine.cpp | 6 ++++-- 17 files changed, 65 insertions(+), 20 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4d2794b7f..d78b6b14c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -375,10 +375,12 @@ target_link_libraries(supertuxkart ${FREETYPE_LIBRARIES} ) -if(NOT USE_GLES2) - target_link_libraries(supertuxkart ${OPENGL_LIBRARIES} glew) -else() - target_link_libraries(supertuxkart EGL GLESv2) +if(NOT SERVER_ONLY) + if(NOT USE_GLES2) + target_link_libraries(supertuxkart ${OPENGL_LIBRARIES} glew) + else() + target_link_libraries(supertuxkart EGL GLESv2) + endif() endif() if(UNIX AND NOT APPLE) diff --git a/lib/irrlicht/source/Irrlicht/CIrrDeviceLinux.cpp b/lib/irrlicht/source/Irrlicht/CIrrDeviceLinux.cpp index 9a15967bb..9a7f95aa2 100644 --- a/lib/irrlicht/source/Irrlicht/CIrrDeviceLinux.cpp +++ b/lib/irrlicht/source/Irrlicht/CIrrDeviceLinux.cpp @@ -596,7 +596,6 @@ static GLXContext getMeAGLContext(Display *display, GLXFBConfig glxFBConfig, boo Context = glXCreateNewContext(display, glxFBConfig, GLX_RGBA_TYPE, NULL, True); return Context; } -#endif #endif diff --git a/src/graphics/command_buffer.cpp b/src/graphics/command_buffer.cpp index 5c68bab18..ed8160b20 100644 --- a/src/graphics/command_buffer.cpp +++ b/src/graphics/command_buffer.cpp @@ -15,6 +15,8 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +#ifndef SERVER_ONLY + #include "graphics/command_buffer.hpp" #include "graphics/central_settings.hpp" #include "utils/cpp2011.hpp" @@ -252,4 +254,6 @@ void GlowCommandBuffer::fill(OtherMeshMap *mesh_map) glUnmapBuffer(GL_DRAW_INDIRECT_BUFFER); } //GlowCommandBuffer::fill -#endif // !defined(USE_GLES2) +#endif // !defined(USE_GLES2) + +#endif // !SERVER_ONLY \ No newline at end of file diff --git a/src/graphics/command_buffer.hpp b/src/graphics/command_buffer.hpp index f216fab15..3764de8e2 100644 --- a/src/graphics/command_buffer.hpp +++ b/src/graphics/command_buffer.hpp @@ -18,6 +18,8 @@ #ifndef HEADER_COMMAND_BUFFER_HPP #define HEADER_COMMAND_BUFFER_HPP +#ifndef SERVER_ONLY + #include "graphics/draw_tools.hpp" #include "graphics/gl_headers.hpp" #include "graphics/material.hpp" @@ -665,5 +667,6 @@ public: } } // multidraw }; -#endif // !defined(USE_GLES2) -#endif //HEADER_COMMAND_BUFFER_HPP +#endif // !defined(USE_GLES2) +#endif // !SERVER_ONLY +#endif // HEADER_COMMAND_BUFFER_HPP diff --git a/src/graphics/draw_calls.cpp b/src/graphics/draw_calls.cpp index 02153a870..cebbdd4b0 100644 --- a/src/graphics/draw_calls.cpp +++ b/src/graphics/draw_calls.cpp @@ -15,7 +15,9 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +#ifndef SERVER_ONLY #include "graphics/draw_calls.hpp" + #include "config/user_config.hpp" #include "graphics/draw_tools.hpp" #include "graphics/gpu_particles.hpp" @@ -845,3 +847,5 @@ void DrawCalls::multidrawGlow() const m_glow_cmd_buffer->multidraw(); } #endif // !defined(USE_GLES2) + +#endif // !SERVER_ONLY \ No newline at end of file diff --git a/src/graphics/draw_calls.hpp b/src/graphics/draw_calls.hpp index a9b7e3759..083ef606d 100644 --- a/src/graphics/draw_calls.hpp +++ b/src/graphics/draw_calls.hpp @@ -18,6 +18,7 @@ #ifndef HEADER_DRAW_CALLS_HPP #define HEADER_DRAW_CALLS_HPP +#ifndef SERVER_ONLY #include "graphics/command_buffer.hpp" #include <irrlicht.h> #include <unordered_map> @@ -106,4 +107,5 @@ public: }; +#endif // !SERVER_ONLY #endif //HEADER_DRAW_CALLS_HPP diff --git a/src/graphics/draw_policies.cpp b/src/graphics/draw_policies.cpp index 29655f310..fb6b7b376 100644 --- a/src/graphics/draw_policies.cpp +++ b/src/graphics/draw_policies.cpp @@ -15,6 +15,8 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +#ifndef SERVER_ONLY + #include "graphics/draw_policies.hpp" #include "graphics/draw_tools.hpp" #include "graphics/materials.hpp" @@ -336,3 +338,5 @@ void MultidrawPolicy::drawReflectiveShadowMap(const DrawCalls& draw_calls, draw_calls.multidrawReflectiveShadowMaps(rsm_matrix); #endif //!defined(USE_GLES2) } + +#endif // !SERVER_ONLY \ No newline at end of file diff --git a/src/graphics/draw_policies.hpp b/src/graphics/draw_policies.hpp index d77bb9c22..ff362440f 100644 --- a/src/graphics/draw_policies.hpp +++ b/src/graphics/draw_policies.hpp @@ -18,6 +18,8 @@ #ifndef HEADER_DRAW_POLICIES_HPP #define HEADER_DRAW_POLICIES_HPP +#ifndef SERVER_ONLY + #include "graphics/draw_calls.hpp" @@ -91,5 +93,5 @@ public: const core::matrix4 &rsm_matrix ) const; }; - -#endif //HEADER_DRAW_POLICIES_HPP +#endif // !SERVER_ONLY +#endif // HEADER_DRAW_POLICIES_HPP diff --git a/src/graphics/geometry_passes.cpp b/src/graphics/geometry_passes.cpp index 999b15fd9..2028de911 100644 --- a/src/graphics/geometry_passes.cpp +++ b/src/graphics/geometry_passes.cpp @@ -15,6 +15,8 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +#ifndef SERVER_ONLY + #include "graphics/geometry_passes.hpp" #include "graphics/callbacks.hpp" #include "graphics/draw_tools.hpp" @@ -385,5 +387,4 @@ void AbstractGeometryPasses::renderTransparent(const DrawCalls& draw_calls, } // renderTransparent - - +#endif // !SERVER_ONLY \ No newline at end of file diff --git a/src/graphics/geometry_passes.hpp b/src/graphics/geometry_passes.hpp index 80e6836a1..ef8f7abab 100644 --- a/src/graphics/geometry_passes.hpp +++ b/src/graphics/geometry_passes.hpp @@ -15,6 +15,8 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +#ifndef SERVER_ONLY + #ifndef HEADER_GEOMETRY_PASSES_HPP #define HEADER_GEOMETRY_PASSES_HPP @@ -170,4 +172,5 @@ public: }; -#endif //HEADER_GEOMETRY_PASSES_HPP +#endif // !SERVER_ONLY +#endif // HEADER_GEOMETRY_PASSES_HPP diff --git a/src/graphics/irr_driver.cpp b/src/graphics/irr_driver.cpp index f776cfd8e..b3869fe87 100644 --- a/src/graphics/irr_driver.cpp +++ b/src/graphics/irr_driver.cpp @@ -75,9 +75,9 @@ IRRLICHT_VERSION_MINOR < 7 || \ _IRR_MATERIAL_MAX_TEXTURES_ < 8 || \ ( !defined(_IRR_COMPILE_WITH_OPENGL_) && \ - !defined(SERVER_ONLY) ) && \ + !defined(SERVER_ONLY) && \ !defined(_IRR_COMPILE_WITH_OGLES2_) ) || \ - !defined(_IRR_COMPILE_WITH_B3D_LOADER_)) + !defined(_IRR_COMPILE_WITH_B3D_LOADER_) ) #error "Building against an incompatible Irrlicht. Distros, \ please use the included version." #endif @@ -556,11 +556,13 @@ void IrrDriver::initDevice() m_video_driver = m_device->getVideoDriver(); m_actual_screen_size = m_video_driver->getCurrentRenderTargetSize(); - + +#ifndef SERVER_ONLY if(CVS->isGLSL()) m_renderer = new ShaderBasedRenderer(); else m_renderer = new FixedPipelineRenderer(); +#endif if (UserConfigParams::m_shadows_resolution != 0 && (UserConfigParams::m_shadows_resolution < 512 || diff --git a/src/graphics/materials.cpp b/src/graphics/materials.cpp index 35ed9be0b..bee04392c 100644 --- a/src/graphics/materials.cpp +++ b/src/graphics/materials.cpp @@ -17,6 +17,8 @@ #include "graphics/materials.hpp" +#ifndef SERVER_ONLY + const STK::Tuple<size_t> DefaultMaterial::FirstPassTextures = STK::Tuple<size_t>(1); const STK::Tuple<size_t, size_t, size_t> DefaultMaterial::SecondPassTextures @@ -76,3 +78,5 @@ const STK::Tuple<size_t, size_t, size_t, size_t, size_t> const STK::Tuple<> SplattingMat::ShadowTextures; const STK::Tuple<size_t, size_t, size_t, size_t, size_t> SplattingMat::RSMTextures = STK::Tuple<size_t, size_t, size_t, size_t, size_t>(1, 2, 3, 4, 5); + +#endif \ No newline at end of file diff --git a/src/graphics/materials.hpp b/src/graphics/materials.hpp index 6657ff252..b3c8786ab 100644 --- a/src/graphics/materials.hpp +++ b/src/graphics/materials.hpp @@ -18,6 +18,8 @@ #ifndef HEADER_MATERIAL_TYPE_HPP #define HEADER_MATERIAL_TYPE_HPP +#ifndef SERVER_ONLY + #include "graphics/shader.hpp" #include "graphics/shaders.hpp" #include "graphics/stk_mesh.hpp" @@ -796,4 +798,5 @@ struct SplattingMat }; // SplattingMat -#endif //HEADER_MATERIAL_TYPE_HPP +#endif // !SERVER_ONLY +#endif // HEADER_MATERIAL_TYPE_HPP diff --git a/src/graphics/render_target.cpp b/src/graphics/render_target.cpp index e9e45b64c..b15c21004 100644 --- a/src/graphics/render_target.cpp +++ b/src/graphics/render_target.cpp @@ -15,6 +15,7 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +#ifndef SERVER_ONLY #include "graphics/render_target.hpp" #include "graphics/2dutils.hpp" @@ -151,3 +152,5 @@ void GL3RenderTarget::draw2DImage(const irr::core::rect<s32>& dest_rect, glDisable(GL_FRAMEBUFFER_SRGB); } // draw2DImage + +#endif // !SERVER_ONLY \ No newline at end of file diff --git a/src/graphics/shader_based_renderer.cpp b/src/graphics/shader_based_renderer.cpp index 6dab1d95c..c42967751 100644 --- a/src/graphics/shader_based_renderer.cpp +++ b/src/graphics/shader_based_renderer.cpp @@ -15,6 +15,8 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +#ifndef SERVER_ONLY + #include "graphics/shader_based_renderer.hpp" #include "config/user_config.hpp" @@ -973,3 +975,5 @@ void ShaderBasedRenderer::renderToTexture(GL3RenderTarget *render_target, irr_driver->getSceneManager()->setActiveCamera(NULL); } //renderToTexture + +#endif // !SERVER_ONLY diff --git a/src/graphics/shader_based_renderer.hpp b/src/graphics/shader_based_renderer.hpp index 4df4602fb..15190a5cc 100644 --- a/src/graphics/shader_based_renderer.hpp +++ b/src/graphics/shader_based_renderer.hpp @@ -18,6 +18,8 @@ #ifndef HEADER_SHADER_BASED_RENDERER_HPP #define HEADER_SHADER_BASED_RENDERER_HPP +#ifndef SERVER_ONLY + #include "graphics/abstract_renderer.hpp" #include "graphics/draw_calls.hpp" #include "graphics/lighting_passes.hpp" @@ -126,4 +128,5 @@ public: }; -#endif //HEADER_SHADER_BASED_RENDERER_HPP +#endif // !SERVER_ONLY +#endif // HEADER_SHADER_BASED_RENDERER_HPP diff --git a/src/guiengine/engine.cpp b/src/guiengine/engine.cpp index b7bbd28eb..2f6ffc988 100644 --- a/src/guiengine/engine.cpp +++ b/src/guiengine/engine.cpp @@ -1210,9 +1210,10 @@ namespace GUIEngine y_from - count*text_height), core::dimension2d<s32>(screen_size.Width, text_height) ); - +#ifndef SERVER_ONLY GL32_draw2DRectangle(SColor(255,252,248,230), msgRect); +#endif Private::g_font->draw((*it).m_message.c_str(), msgRect, video::SColor(255, 255, 0, 0), @@ -1254,6 +1255,7 @@ namespace GUIEngine void renderLoading(bool clearIcons) { +#ifndef SERVER_ONLY if (clearIcons) g_loading_icons.clear(); g_skin->drawBgImage(); @@ -1317,7 +1319,7 @@ namespace GUIEngine x = ICON_MARGIN; } } - +#endif } // renderLoading // -----------------------------------------------------------------------