Merge remote-tracking branch 'origin/new-pi' into nw

This commit is contained in:
hiker 2016-12-06 09:26:07 +11:00
commit 746bac00ce
99 changed files with 1458 additions and 877 deletions

View File

@ -15,6 +15,7 @@ if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "STKRelease")
endif()
option(SERVER_ONLY "Create a server only (i.e. no graphics or sound)" OFF)
option(USE_FRIBIDI "Support for right-to-left languages" ON)
option(CHECK_ASSETS "Check if assets are installed in ../stk-assets" ON)
option(USE_SYSTEM_ANGELSCRIPT "Use system angelscript instead of built-in angelscript. If you enable this option, make sure to use a compatible version." OFF)
@ -34,7 +35,7 @@ else()
set(WIIUSE_BUILD ON)
endif()
if(MINGW OR CYGWIN)
if(MINGW OR CYGWIN OR SERVER_ONLY)
option(USE_WIIUSE "Support for wiimote input devices" OFF)
else()
option(USE_WIIUSE "Support for wiimote input devices" ON)
@ -68,6 +69,11 @@ if(USE_GLES2)
add_definitions(-DUSE_GLES2)
endif()
if(SERVER_ONLY)
add_definitions(-DSERVER_ONLY)
add_definitions(-DNO_IRR_COMPILE_WITH_X11_)
endif()
# Build the Bullet physics library
add_subdirectory("${PROJECT_SOURCE_DIR}/lib/bullet")
include_directories("${PROJECT_SOURCE_DIR}/lib/bullet/src")
@ -77,7 +83,7 @@ add_subdirectory("${PROJECT_SOURCE_DIR}/lib/enet")
include_directories("${PROJECT_SOURCE_DIR}/lib/enet/include")
# Build glew library
if(NOT USE_GLES2)
if(NOT USE_GLES2 AND NOT SERVER_ONLY)
add_definitions(-DGLEW_NO_GLU)
add_subdirectory("${PROJECT_SOURCE_DIR}/lib/glew")
include_directories("${PROJECT_SOURCE_DIR}/lib/glew/include")
@ -206,12 +212,13 @@ if (OPENMP_FOUND)
endif()
# OpenGL
if(NOT USE_GLES2)
if(NOT USE_GLES2 AND NOT SERVER_ONLY)
find_package(OpenGL REQUIRED)
include_directories(${OPENGL_INCLUDE_DIR})
endif()
if(UNIX AND NOT APPLE)
if(UNIX AND NOT APPLE AND NOT SERVER_ONLY)
find_package(X11 REQUIRED)
include_directories(${X11_INCLUDE_DIR})
@ -370,11 +377,13 @@ target_link_libraries(supertuxkart
${FREETYPE_LIBRARIES}
)
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)
target_link_libraries(supertuxkart ${X11_LIBRARIES} ${XRANDR_LIBRARIES})

View File

@ -1,5 +1,6 @@
# CMakeLists.txt - glew
if (NOT SERVER_ONLY)
include_directories("include")
if(APPLE)
@ -18,3 +19,5 @@ add_library(glew STATIC
)
target_link_libraries(glew ${OPENGL_LIBRARIES})
endif()

View File

@ -8,10 +8,15 @@ include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include/"
"${ZLIB_INCLUDE_DIR}"
"${CMAKE_CURRENT_BINARY_DIR}/../zlib/") # For zconf.h on WIN32
if (SERVER_ONLY)
add_definitions(-DNO_IRR_COMPILE_WITH_OPENGL_)
add_definitions(-DNO_IRR_COMPILE_WITH_X11_)
else()
if(NOT USE_GLES2)
find_package(OpenGL REQUIRED)
include_directories(${OPENGL_INCLUDE_DIR})
endif()
endif()
if (UNIX AND NOT APPLE)
find_package(X11 REQUIRED)

View File

@ -246,6 +246,10 @@ define out. */
#ifdef NO_IRR_LINUX_XCURSOR_
#undef _IRR_LINUX_XCURSOR_
#endif
#else
#undef _IRR_LINUX_X11_VIDMODE_
#undef _IRR_LINUX_X11_RANDR_
#endif

View File

@ -68,12 +68,14 @@ namespace irr
}
} // end namespace irr
#if defined(_IRR_COMPILE_WITH_X11_)
namespace
{
Atom X_ATOM_CLIPBOARD;
Atom X_ATOM_TARGETS;
Atom X_ATOM_UTF8_STRING;
};
#endif
namespace irr
{
@ -598,6 +600,7 @@ static GLXContext getMeAGLContext(Display *display, GLXFBConfig glxFBConfig, boo
Context = glXCreateNewContext(display, glxFBConfig, GLX_RGBA_TYPE, NULL, True);
return Context;
}
#endif
bool CIrrDeviceLinux::createWindow()

View File

@ -264,6 +264,9 @@ const std::string& getOSVersion()
*/
void reportHardwareStats()
{
#ifdef SERVER_ONLY
return;
#else
if(!UserConfigParams::m_hw_report_enable)
return;
@ -335,8 +338,10 @@ void reportHardwareStats()
if(nr_procs>0)
json.add("cpu_numprocs", nr_procs);
#ifndef SERVER_ONLY
json.add("GL_EXTENSIONS", getGLExtensions());
getGLLimits(&json);
#endif
json.finish();
// ------------------------------------------------------------------------
@ -391,7 +396,7 @@ void reportHardwareStats()
request->setURL((std::string)UserConfigParams::m_server_hw_report+"/upload/v1/");
//request->setURL("http://127.0.0.1:8000/upload/v1/");
request->queue();
#endif // !SERVER_ONLY
} // reportHardwareStats
} // namespace HardwareStats

View File

@ -527,6 +527,7 @@ void FontWithFace::render(const core::stringw& text,
FontSettings* font_settings,
FontCharCollector* char_collector)
{
#ifndef SERVER_ONLY
const bool black_border = font_settings ?
font_settings->useBlackBorder() : false;
const bool rtl = font_settings ? font_settings->isRTL() : false;
@ -778,4 +779,5 @@ void FontWithFace::render(const core::stringw& text,
}
}
}
#endif
} // render

View File

@ -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/2dutils.hpp"
#include "graphics/central_settings.hpp"
@ -779,3 +780,6 @@ void GL32_draw2DRectangle(video::SColor color, const core::rect<s32>& position,
glGetError();
} // GL32_draw2DRectangle
#endif // !SERVER_ONLY

View File

@ -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/central_settings.hpp"
#include "config/user_config.hpp"
@ -442,3 +443,5 @@ bool CentralVideoSettings::isDefferedEnabled() const
{
return UserConfigParams::m_dynamic_lights && !GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_ADVANCED_PIPELINE);
}
#endif // !SERVER_ONLY

View File

@ -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"
@ -253,3 +255,5 @@ void GlowCommandBuffer::fill(OtherMeshMap *mesh_map)
} //GlowCommandBuffer::fill
#endif // !defined(USE_GLES2)
#endif // !SERVER_ONLY

View File

@ -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"
@ -666,4 +668,5 @@ public:
} // multidraw
};
#endif // !defined(USE_GLES2)
#endif // !SERVER_ONLY
#endif // HEADER_COMMAND_BUFFER_HPP

View File

@ -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"
@ -848,3 +850,5 @@ void DrawCalls::multidrawGlow() const
m_glow_cmd_buffer->multidraw();
}
#endif // !defined(USE_GLES2)
#endif // !SERVER_ONLY

View File

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

View File

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

View File

@ -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 // !SERVER_ONLY
#endif // HEADER_DRAW_POLICIES_HPP

View File

@ -41,9 +41,11 @@ Explosion::Explosion(const Vec3& coord, const char* explosion_sound, const char
m_remaining_time = burst_time;
m_emission_frames = 0;
#ifndef SERVER_ONLY
ParticleKindManager* pkm = ParticleKindManager::get();
ParticleKind* particles = pkm->getParticles(particle_file);
m_emitter = new ParticleEmitter(particles, coord, NULL);
#endif
} // Explosion
//-----------------------------------------------------------------------------
@ -51,10 +53,12 @@ Explosion::Explosion(const Vec3& coord, const char* explosion_sound, const char
*/
Explosion::~Explosion()
{
#ifndef SERVER_ONLY
if(m_emitter)
{
delete m_emitter;
}
#endif
} // ~Explosion
//-----------------------------------------------------------------------------
@ -71,6 +75,7 @@ bool Explosion::updateAndDelete(float dt)
m_emission_frames++;
m_remaining_time -= dt;
#ifndef SERVER_ONLY
if (m_remaining_time < 0.0f && m_remaining_time >= -explosion_time)
{
scene::ISceneNode* node = m_emitter->getNode();
@ -88,7 +93,7 @@ bool Explosion::updateAndDelete(float dt)
node->getMaterial(0).DiffuseColor.setRed(intensity);
node->getMaterial(0).EmissiveColor.setRed(intensity);
}
#endif
// Do nothing more if the animation is still playing
if (m_remaining_time>0) return false;
@ -98,6 +103,7 @@ bool Explosion::updateAndDelete(float dt)
// object is removed.
if (m_remaining_time > -explosion_time)
{
#ifndef SERVER_ONLY
// if framerate is very low, emit for at least a few frames, in case
// burst time is lower than the time of 1 frame
if (m_emission_frames > 2)
@ -106,6 +112,7 @@ bool Explosion::updateAndDelete(float dt)
m_emitter->getNode()->getEmitter()->setMinParticlesPerSecond(0);
m_emitter->getNode()->getEmitter()->setMaxParticlesPerSecond(0);
}
#endif
}
else
{

View File

@ -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/fixed_pipeline_renderer.hpp"
#include "config/user_config.hpp"
#include "graphics/camera.hpp"
@ -112,3 +113,4 @@ std::unique_ptr<RenderTarget> FixedPipelineRenderer::createRenderTarget(const ir
{
return std::unique_ptr<RenderTarget>(new GL1RenderTarget(dimension, name));
}
#endif

View File

@ -18,6 +18,7 @@
#ifndef HEADER_FIXED_PIPELINE_RENDERER_HPP
#define HEADER_FIXED_PIPELINE_RENDERER_HPP
#ifndef SERVER_ONLY
#include "graphics/abstract_renderer.hpp"
#include <map>
@ -37,4 +38,5 @@ public:
const std::string &name);
};
#endif // !SERVER_ONLY
#endif //HEADER_FIXED_PIPELINE_RENDERER_HPP

View File

@ -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"
@ -389,5 +391,4 @@ void AbstractGeometryPasses::renderTransparent(const DrawCalls& draw_calls,
} // renderTransparent
#endif // !SERVER_ONLY

View File

@ -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 // !SERVER_ONLY
#endif // HEADER_GEOMETRY_PASSES_HPP

View File

@ -18,6 +18,8 @@
#ifndef GL_HEADER_HPP
#define GL_HEADER_HPP
#ifndef SERVER_ONLY
#define GLEW_STATIC
extern "C" {
@ -79,5 +81,12 @@ struct DrawElementsIndirectCommand{
GLuint baseVertex;
GLuint baseInstance;
};
#else
typedef unsigned int GLuint;
typedef unsigned int GLsync;
typedef unsigned int GLenum;
#endif // server only
#endif

View File

@ -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/glwrap.hpp"
#include "config/hardware_stats.hpp"
@ -758,3 +760,6 @@ else \
#endif // ifdef XX
} // getGLLimits
#endif // !SERVER_ONLY

View File

@ -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 GLWRAP_HEADER_H
#define GLWRAP_HEADER_H
@ -152,3 +154,6 @@ const std::string getGLExtensions();
void getGLLimits(HardwareStats::Json *json);
#endif
#endif // supertuxkart

View File

@ -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/gpu_particles.hpp"
#include "config/user_config.hpp"
@ -633,3 +635,5 @@ void ParticleSystemProxy::render() {
draw();
}
}
#endif // SERVER_ONLY

View File

@ -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_GPU_PARTICLES_HPP
#define HEADER_GPU_PARTICLES_HPP
@ -109,3 +111,5 @@ public:
};
#endif // GPUPARTICLES_H
#endif // !SERVER_ONLY

View File

@ -71,9 +71,11 @@
* Should help prevent distros building against an incompatible library.
*/
#if (IRRLICHT_VERSION_MAJOR < 1 || IRRLICHT_VERSION_MINOR < 7 || \
#if ( IRRLICHT_VERSION_MAJOR < 1 || \
IRRLICHT_VERSION_MINOR < 7 || \
_IRR_MATERIAL_MAX_TEXTURES_ < 8 || \
( !defined(_IRR_COMPILE_WITH_OPENGL_) && \
!defined(SERVER_ONLY) && \
!defined(_IRR_COMPILE_WITH_OGLES2_) ) || \
!defined(_IRR_COMPILE_WITH_B3D_LOADER_) )
#error "Building against an incompatible Irrlicht. Distros, \
@ -94,8 +96,9 @@ using namespace irr;
/** singleton */
IrrDriver *irr_driver = NULL;
#ifndef SERVER_ONLY
GPUTimer m_perf_query[Q_LAST];
#endif
const int MIN_SUPPORTED_HEIGHT = 768;
const int MIN_SUPPORTED_WIDTH = 1024;
@ -136,16 +139,19 @@ IrrDriver::IrrDriver()
IrrDriver::~IrrDriver()
{
assert(m_device != NULL);
#ifndef SERVER_ONLY
cleanUnicolorTextures();
#endif
m_device->drop();
m_device = NULL;
m_modes.clear();
#ifndef SERVER_ONLY
if (CVS->isGLSL())
{
Shaders::destroy();
}
#endif
delete m_wind;
delete m_renderer;
} // ~IrrDriver
@ -155,7 +161,9 @@ IrrDriver::~IrrDriver()
*/
void IrrDriver::reset()
{
#ifndef SERVER_ONLY
m_renderer->resetPostProcessing();
#endif
} // reset
// ----------------------------------------------------------------------------
@ -183,15 +191,17 @@ core::array<video::IRenderTarget> &IrrDriver::getMainSetup()
} // getMainSetup
// ----------------------------------------------------------------------------
#ifndef SERVER_ONLY
GPUTimer &IrrDriver::getGPUTimer(unsigned i)
{
return m_perf_query[i];
} // getGPUTimer
#endif
// ----------------------------------------------------------------------------
#ifndef SERVER_ONLY
std::unique_ptr<RenderTarget> IrrDriver::createRenderTarget(const irr::core::dimension2du &dimension,
const std::string &name)
{
@ -209,6 +219,7 @@ If window is the root window, returns window.
*/
Window get_toplevel_parent(Display* display, Window window)
{
#ifndef SERVER_ONLY
Window parent;
Window root;
Window * children;
@ -231,6 +242,9 @@ Window get_toplevel_parent(Display* display, Window window)
window = parent;
}
}
#else
return NULL;
#endif
}
#endif
@ -241,6 +255,7 @@ Window get_toplevel_parent(Display* display, Window window)
*/
void IrrDriver::updateConfigIfRelevant()
{
#ifndef SERVER_ONLY
if (!UserConfigParams::m_fullscreen &&
UserConfigParams::m_remember_window_location)
{
@ -294,6 +309,8 @@ void IrrDriver::updateConfigIfRelevant()
}
#endif
}
#endif // !SERVER_ONLY
} // updateConfigIfRelevant
// ----------------------------------------------------------------------------
@ -503,6 +520,7 @@ void IrrDriver::initDevice()
{
Log::fatal("irr_driver", "Couldn't initialise irrlicht device. Quitting.\n");
}
#ifndef SERVER_ONLY
CVS->init();
@ -521,12 +539,14 @@ void IrrDriver::initDevice()
params.ForceLegacyDevice = true;
recreate_device = true;
}
#endif
// This is the ugly hack for intel driver on linux, which doesn't
// use sRGB-capable visual, even if we request it. This causes
// the screen to be darker than expected. It affects mesa 10.6 and newer.
// Though we are able to force to use the proper format on mesa side by
// setting WithAlphaChannel parameter.
#ifndef SERVER_ONLY
else if (CVS->needsSRGBCapableVisualWorkaround())
{
Log::warn("irr_driver", "Created visual is not sRGB-capable. "
@ -552,17 +572,19 @@ void IrrDriver::initDevice()
CVS->init();
}
#endif
m_scene_manager = m_device->getSceneManager();
m_gui_env = m_device->getGUIEnvironment();
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 ||
@ -581,6 +603,7 @@ void IrrDriver::initDevice()
m_video_driver->beginScene(/*backBuffer clear*/true, /* Z */ false);
m_video_driver->endScene();
#ifndef SERVER_ONLY
if (CVS->isGLSL())
{
Log::info("irr_driver", "GLSL supported.");
@ -593,6 +616,7 @@ void IrrDriver::initDevice()
UserConfigParams::m_gi = false;
}*/
// m_glsl might be reset in rtt if an error occurs.
if (CVS->isGLSL())
{
@ -607,11 +631,12 @@ void IrrDriver::initDevice()
Log::warn("irr_driver", "Using the fixed pipeline (old GPU, or "
"shaders disabled in options)");
}
#endif
// Only change video driver settings if we are showing graphics
if (!ProfileWorld::isNoGraphics())
{
#if defined(__linux__) && !defined(ANDROID)
#if defined(__linux__) && !defined(ANDROID) && !defined(SERVER_ONLY)
// Set class hints on Linux, used by Window Managers.
const video::SExposedVideoData& videoData = m_video_driver
->getExposedVideoData();
@ -661,10 +686,12 @@ void IrrDriver::initDevice()
material2D.AntiAliasing=video::EAAM_FULL_BASIC;
//m_video_driver->enableMaterial2D();
#ifndef SERVER_ONLY
// set cursor visible by default (what's the default is not too clearly documented,
// so let's decide ourselves...)
m_device->getCursorControl()->setVisible(true);
m_pointer_shown = true;
#endif
} // initDevice
// ----------------------------------------------------------------------------
@ -688,6 +715,7 @@ void IrrDriver::cleanSunInterposer()
// ----------------------------------------------------------------------------
void IrrDriver::createSunInterposer()
{
#ifndef SERVER_ONLY
scene::IMesh * sphere = m_scene_manager->getGeometryCreator()
->createSphereMesh(1, 16, 16);
for (unsigned i = 0; i < sphere->getMeshBufferCount(); ++i)
@ -716,15 +744,18 @@ void IrrDriver::createSunInterposer()
m_sun_interposer->getMaterial(0).MaterialType = Shaders::getShader(ES_OBJECTPASS);
sphere->drop();
#endif
}
//-----------------------------------------------------------------------------
void IrrDriver::getOpenGLData(std::string *vendor, std::string *renderer,
std::string *version)
{
#ifndef SERVER_ONLY
*vendor = (char*)glGetString(GL_VENDOR );
*renderer = (char*)glGetString(GL_RENDERER);
*version = (char*)glGetString(GL_VERSION );
#endif
} // getOpenGLData
//-----------------------------------------------------------------------------
@ -768,6 +799,7 @@ core::position2di IrrDriver::getMouseLocation()
*/
bool IrrDriver::moveWindow(int x, int y)
{
#ifndef SERVER_ONLY
#ifdef WIN32
const video::SExposedVideoData& videoData =
m_video_driver->getExposedVideoData();
@ -806,6 +838,7 @@ bool IrrDriver::moveWindow(int x, int y)
// TODO: Actually handle possible failure
XMoveWindow(display, videoData.OpenGLLinux.X11Window, x, y);
#endif
#endif
return true;
}
@ -835,6 +868,7 @@ void IrrDriver::changeResolution(const int w, const int h,
void IrrDriver::applyResolutionSettings()
{
#ifndef SERVER_ONLY
// show black before resolution switch so we don't see OpenGL's buffer
// garbage during switch
m_video_driver->beginScene(true, true, video::SColor(255,100,101,140));
@ -924,6 +958,7 @@ void IrrDriver::applyResolutionSettings()
// above) - this happens dynamically when the tracks are loaded.
GUIEngine::reshowCurrentScreen();
MessageQueue::updatePosition();
#endif // !SERVER_ONLY
} // applyResolutionSettings
// ----------------------------------------------------------------------------
@ -1139,6 +1174,7 @@ scene::IMeshSceneNode *IrrDriver::addSphere(float radius,
m.EmissiveColor = color;
m.BackfaceCulling = false;
m.MaterialType = video::EMT_SOLID;
#ifndef SERVER_ONLY
//m.setTexture(0, getUnicolorTexture(video::SColor(128, 255, 105, 180)));
m.setTexture(0, getUnicolorTexture(color));
m.setTexture(1, getUnicolorTexture(video::SColor(0, 0, 0, 0)));
@ -1152,6 +1188,7 @@ scene::IMeshSceneNode *IrrDriver::addSphere(float radius,
NULL, -1, "sphere");
return node;
}
#endif
scene::IMeshSceneNode *node = m_scene_manager->addMeshSceneNode(mesh);
return node;
@ -1177,6 +1214,9 @@ scene::IMeshSceneNode *IrrDriver::addMesh(scene::IMesh *mesh,
bool all_parts_colorized,
int frame_for_mesh)
{
#ifdef SERVER_ONLY
return m_scene_manager->addMeshSceneNode(mesh, parent);
#else
if (!CVS->isGLSL())
return m_scene_manager->addMeshSceneNode(mesh, parent);
@ -1195,6 +1235,7 @@ scene::IMeshSceneNode *IrrDriver::addMesh(scene::IMesh *mesh,
node->drop();
return node;
#endif
} // addMesh
// ----------------------------------------------------------------------------
@ -1218,6 +1259,7 @@ scene::ISceneNode *IrrDriver::addBillboard(const core::dimension2d< f32 > size,
bool alphaTesting)
{
scene::IBillboardSceneNode* node;
#ifndef SERVER_ONLY
if (CVS->isGLSL())
{
if (!parent)
@ -1228,13 +1270,14 @@ scene::ISceneNode *IrrDriver::addBillboard(const core::dimension2d< f32 > size,
node->drop();
}
else
#endif
node = m_scene_manager->addBillboardSceneNode(parent, size);
assert(node->getMaterialCount() > 0);
node->setMaterialTexture(0, texture);
if(alphaTesting)
node->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF);
return node;
} // addMesh
} // addBillboard
// ----------------------------------------------------------------------------
/** Creates a quad mesh with a given material.
@ -1376,13 +1419,16 @@ scene::IAnimatedMeshSceneNode *IrrDriver::addAnimatedMesh(scene::IAnimatedMesh *
const std::string& debug_name, scene::ISceneNode* parent,
RenderInfo* render_info, bool all_parts_colorized)
{
#ifndef SERVER_ONLY
if (!CVS->isGLSL())
{
#endif
return m_scene_manager->addAnimatedMeshSceneNode(mesh, parent, -1,
core::vector3df(0, 0, 0),
core::vector3df(0, 0, 0),
core::vector3df(1, 1, 1),
/*addIfMeshIsZero*/true);
#ifndef SERVER_ONLY
}
if (!parent)
@ -1393,6 +1439,7 @@ scene::IAnimatedMeshSceneNode *IrrDriver::addAnimatedMesh(scene::IAnimatedMesh *
core::vector3df(1, 1, 1), render_info, all_parts_colorized);
node->drop();
return node;
#endif
} // addAnimatedMesh
// ----------------------------------------------------------------------------
@ -1433,19 +1480,24 @@ scene::ISceneNode *IrrDriver::addSkyDome(video::ITexture *texture,
scene::ISceneNode *IrrDriver::addSkyBox(const std::vector<video::ITexture*> &texture,
const std::vector<video::ITexture*> &spherical_harmonics_textures)
{
#ifndef SERVER_ONLY
assert(texture.size() == 6);
m_renderer->addSkyBox(texture, spherical_harmonics_textures);
#endif
return m_scene_manager->addSkyBoxSceneNode(texture[0], texture[1],
texture[2], texture[3],
texture[4], texture[5]);
} // addSkyBox
// ----------------------------------------------------------------------------
void IrrDriver::suppressSkyBox()
{
#ifndef SERVER_ONLY
m_renderer->removeSkyBox();;
}
#endif
} // suppressSkyBox
// ----------------------------------------------------------------------------
/** Adds a camera to the scene.
@ -1796,13 +1848,17 @@ video::ITexture* IrrDriver::applyMask(video::ITexture* texture,
// ----------------------------------------------------------------------------
void IrrDriver::onLoadWorld()
{
#ifndef SERVER_ONLY
m_renderer->onLoadWorld();
}
#endif
} // onLoadWorld
// ----------------------------------------------------------------------------
void IrrDriver::onUnloadWorld()
{
m_renderer->onUnloadWorld();
}
} // onUnloadWorld
// ----------------------------------------------------------------------------
/** Sets the ambient light.
* \param light The colour of the light to set.
@ -1811,10 +1867,13 @@ void IrrDriver::onUnloadWorld()
*/
void IrrDriver::setAmbientLight(const video::SColorf &light, bool force_SH_computation)
{
#ifndef SERVER_ONLY
m_scene_manager->setAmbientLight(light);
m_renderer->setAmbientLight(light, force_SH_computation);
#endif
} // setAmbientLight
// ----------------------------------------------------------------------------
video::SColorf IrrDriver::getAmbientLight() const
{
return m_scene_manager->getAmbientLight();
@ -1825,6 +1884,7 @@ video::SColorf IrrDriver::getAmbientLight() const
*/
void IrrDriver::displayFPS()
{
#ifndef SERVER_ONLY
gui::IGUIFont* font = GUIEngine::getSmallFont();
core::rect<s32> position;
@ -1895,6 +1955,7 @@ void IrrDriver::displayFPS()
static video::SColor fpsColor = video::SColor(255, 0, 0, 0);
font->draw( fps_string.c_str(), position, fpsColor, false );
#endif
} // updateFPS
// ----------------------------------------------------------------------------
@ -1993,6 +2054,7 @@ void IrrDriver::update(float dt)
if (world)
{
#ifndef SERVER_ONLY
m_renderer->render(dt);
GUIEngine::Screen* current_screen = GUIEngine::getCurrentScreen();
@ -2009,6 +2071,7 @@ void IrrDriver::update(float dt)
debug_drawer->beginNextFrame();
}
}
#endif
}
else
{
@ -2078,10 +2141,16 @@ bool IrrDriver::OnEvent(const irr::SEvent &event)
// ----------------------------------------------------------------------------
bool IrrDriver::supportsSplatting()
{
#ifndef SERVER_ONLY
return CVS->isGLSL();
}
#else
return false;
#endif
} // supportsSplatting
// ----------------------------------------------------------------------------
#ifndef SERVER_ONLY
void IrrDriver::applyObjectPassShader(scene::ISceneNode * const node, bool rimlit)
{
if (!CVS->isGLSL())
@ -2159,6 +2228,8 @@ void IrrDriver::applyObjectPassShader()
applyObjectPassShader(m_scene_manager->getRootSceneNode());
}
#endif // !SERVER_ONLY
// ----------------------------------------------------------------------------
scene::ISceneNode *IrrDriver::addLight(const core::vector3df &pos,
@ -2166,6 +2237,7 @@ scene::ISceneNode *IrrDriver::addLight(const core::vector3df &pos,
float r, float g, float b,
bool sun, scene::ISceneNode* parent)
{
#ifndef SERVER_ONLY
if (CVS->isGLSL())
{
if (parent == NULL) parent = m_scene_manager->getRootSceneNode();
@ -2202,6 +2274,9 @@ scene::ISceneNode *IrrDriver::addLight(const core::vector3df &pos,
light->setRadius(radius);
return light;
}
#else
return NULL;
#endif
} // addLight
// ----------------------------------------------------------------------------

View File

@ -297,8 +297,10 @@ public:
void unsetTextureErrorMessage();
class GPUTimer &getGPUTimer(unsigned);
#ifndef SERVER_ONLY
std::unique_ptr<RenderTarget> createRenderTarget(const irr::core::dimension2du &dimension,
const std::string &name);
#endif
// ------------------------------------------------------------------------
/** Convenience function that loads a texture with default parameters

View File

@ -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/lighting_passes.hpp"
#include "config/user_config.hpp"
#include "graphics/central_settings.hpp"
@ -744,3 +746,5 @@ void LightingPasses::renderLightsScatter(GLuint depth_stencil_texture,
colors_framebuffer.getHeight());
} // renderLightsScatter
#endif // !SERVER_ONLY

View File

@ -296,5 +296,8 @@ void LODNode::add(int level, scene::ISceneNode* node, bool reparent)
node->drop();
node->updateAbsolutePosition();
#ifndef SERVER_ONLY
irr_driver->applyObjectPassShader(node);
#endif
}

View File

@ -716,6 +716,7 @@ void Material::setMaterialProperties(video::SMaterial *m, scene::IMeshBuffer* m
m_texname.c_str());
}
#ifndef SERVER_ONLY
if (CVS->isGLSL())
{
ITexture *tex;
@ -865,7 +866,7 @@ void Material::setMaterialProperties(video::SMaterial *m, scene::IMeshBuffer* m
}
m->setTexture(1, glossytex);
}
#endif
if (m_shader_type == SHADERTYPE_SOLID_UNLIT)
{
@ -1013,6 +1014,7 @@ void Material::setMaterialProperties(video::SMaterial *m, scene::IMeshBuffer* m
void Material::adjustForFog(scene::ISceneNode* parent, video::SMaterial *m,
bool use_fog) const
{
#ifndef SERVER_ONLY
if (CVS->isGLSL())
{
// to disable fog in the new pipeline, we slightly abuse the steps :
@ -1036,6 +1038,7 @@ void Material::adjustForFog(scene::ISceneNode* parent, video::SMaterial *m,
if (parent != NULL)
parent->setMaterialFlag(video::EMF_FOG_ENABLE, m_fog && use_fog);
}
#endif
} // adjustForFog
//-----------------------------------------------------------------------------
@ -1043,7 +1046,9 @@ void Material::adjustForFog(scene::ISceneNode* parent, video::SMaterial *m,
/** Callback from LOD nodes to create some effects */
void Material::onMadeVisible(scene::IMeshBuffer* who)
{
#ifndef SERVER_ONLY
if (!CVS->isGLSL()) return;
#endif
}
//-----------------------------------------------------------------------------
@ -1051,14 +1056,18 @@ void Material::onMadeVisible(scene::IMeshBuffer* who)
/** Callback from LOD nodes to create some effects */
void Material::onHidden(scene::IMeshBuffer* who)
{
#ifndef SERVER_ONLY
if (!CVS->isGLSL()) return;
#endif
}
//-----------------------------------------------------------------------------
void Material::isInitiallyHidden(scene::IMeshBuffer* who)
{
#ifndef SERVER_ONLY
if (!CVS->isGLSL()) return;
#endif
}
//-----------------------------------------------------------------------------

View File

@ -145,6 +145,7 @@ Material* MaterialManager::getDefaultMaterial(video::E_MATERIAL_TYPE shader_type
// Try to find a cleaner way
// If graphics are disabled, shaders should not be accessed (getShader
// asserts that shaders are initialised).
#ifndef SERVER_ONLY
if(!ProfileWorld::isNoGraphics() && CVS->isGLSL() &&
shader_type == Shaders::getShader(ShaderType::ES_OBJECT_UNLIT))
default_material->setShaderType(Material::SHADERTYPE_SOLID_UNLIT);
@ -156,7 +157,7 @@ Material* MaterialManager::getDefaultMaterial(video::E_MATERIAL_TYPE shader_type
// default_material->setShaderType(Material::SHADERTYPE_ALPHA_BLEND);
else
default_material->setShaderType(Material::SHADERTYPE_SOLID);
#endif
m_default_materials[shader_type] = default_material;
return default_material;
}

View File

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

View File

@ -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 // !SERVER_ONLY
#endif // HEADER_MATERIAL_TYPE_HPP

View File

@ -328,6 +328,7 @@ void recalculateTangents(scene::IMesh* mesh, bool recalculate_normals, bool smoo
}
}
#ifndef SERVER_ONLY
bool MeshTools::isNormalMap(scene::IMeshBuffer* mb)
{
if (!CVS->isGLSL())
@ -335,6 +336,7 @@ bool MeshTools::isNormalMap(scene::IMeshBuffer* mb)
return (mb->getMaterial().MaterialType == Shaders::getShader(ES_NORMAL_MAP) &&
mb->getVertexType() != video::EVT_TANGENTS);
}
#endif
// Copied from irrlicht
scene::IMesh* MeshTools::createMeshWithTangents(scene::IMesh* mesh,

View File

@ -16,6 +16,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/particle_emitter.hpp"
#include "graphics/central_settings.hpp"
@ -764,3 +766,5 @@ void ParticleEmitter::resizeBox(float size)
}
#endif
}
#endif // !SERVER_ONLY

View File

@ -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/post_processing.hpp"
#include "config/user_config.hpp"
@ -1596,3 +1598,5 @@ FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode,
return out_fbo;
} // render
#endif // !SERVER_ONLY

View File

@ -147,7 +147,7 @@ Referee::Referee()
m_scene_node->setScale(m_st_scale.toIrrVector());
m_scene_node->setFrameLoop(m_st_first_start_frame,
m_st_last_start_frame);
#ifndef SERVER_ONLY
irr_driver->applyObjectPassShader(m_scene_node);
if (CVS->isGLSL() && CVS->isDefferedEnabled())
@ -156,6 +156,7 @@ Referee::Referee()
0.7f /* r */, 0.0 /* g */, 0.0f /* b */, false /* sun */, m_scene_node);
}
else
#endif
{
m_light = NULL;
}
@ -184,7 +185,9 @@ Referee::Referee(const AbstractKart &kart)
m_scene_node->setFrameLoop(m_st_first_rescue_frame,
m_st_last_rescue_frame);
#ifndef SERVER_ONLY
irr_driver->applyObjectPassShader(m_scene_node);
#endif
} // Referee
// ----------------------------------------------------------------------------

View File

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

View File

@ -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/rtts.hpp"
#include "config/user_config.hpp"
@ -317,3 +319,5 @@ RTT::~RTT()
}
}
#endif // !SERVER_ONLY

View File

@ -16,6 +16,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.hpp"
#include "graphics/central_settings.hpp"
@ -362,3 +364,5 @@ GLuint ShaderBase::createVAO()
} // createVAO
// ============================================================================
#endif // !SERVER_ONLY

View File

@ -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_SHADER_HPP
#define HEADER_SHADER_HPP
@ -382,3 +384,6 @@ public:
// ============================================================================
#endif
#endif // !SERVER_ONLY

View File

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

View File

@ -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 // !SERVER_ONLY
#endif // HEADER_SHADER_BASED_RENDERER_HPP

View File

@ -16,6 +16,8 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef SERVER_ONLY
/**
\page shaders_overview Shaders Overview
@ -397,3 +399,5 @@ Shaders::ColoredLine::ColoredLine()
glBindVertexArray(0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
} // Shaders::ColoredLine
#endif // !SERVER_ONLY

View File

@ -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_SHADERS_HPP
#define HEADER_SHADERS_HPP
@ -164,3 +166,5 @@ public:
}; // class Shaders
#endif
#endif // SHADER_ONLY

View File

@ -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/shadow_matrices.hpp"
#include "config/user_config.hpp"
@ -523,3 +525,5 @@ void ShadowMatrices::renderShadowsDebug(const FrameBuffer &shadow_framebuffer,
renderWireFrameFrustrum(m_shadows_cam[3], 3);
glViewport(0, 0, UserConfigParams::m_width, UserConfigParams::m_height);
}
#endif // !SERVER_ONLY

View File

@ -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/shared_gpu_objects.hpp"
#include "graphics/central_settings.hpp"
@ -213,3 +215,6 @@ void SharedGPUObjects::reset()
{
m_has_been_initialised = false;
} // reset
#endif // !SERVER_ONLY

View File

@ -16,6 +16,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/show_curve.hpp"
#include "graphics/irr_driver.hpp"
@ -200,3 +202,6 @@ void ShowCurve::setPosition(const Vec3 &xyz)
m_scene_node->setPosition(xyz.toIrrVector());
} // setPosition
// ----------------------------------------------------------------------------
#endif // !SERVER_ONLY

View File

@ -131,12 +131,14 @@ void SkidMarks::update(float dt, bool force_skid_marks,
if (!is_skidding) // end skid marking
{
m_skid_marking = false;
#ifndef SERVER_ONLY
// The vertices and indices will not change anymore
// (till these skid mark quads are deleted)
m_left[m_current]->setHardwareMappingHint(scene::EHM_STATIC);
m_right[m_current]->setHardwareMappingHint(scene::EHM_STATIC);
if (STKMeshSceneNode* stkm = dynamic_cast<STKMeshSceneNode*>(m_nodes[m_current]))
stkm->setReloadEachFrame(false);
#endif
return;
}
@ -192,11 +194,13 @@ void SkidMarks::update(float dt, bool force_skid_marks,
custom_color);
new_mesh->addMeshBuffer(smq_right);
scene::IMeshSceneNode *new_node = irr_driver->addMesh(new_mesh, "skidmark");
#ifndef SERVER_ONLY
if (STKMeshSceneNode* stkm = dynamic_cast<STKMeshSceneNode*>(new_node))
stkm->setReloadEachFrame(true);
#ifdef DEBUG
std::string debug_name = m_kart.getIdent()+" (skid-mark)";
new_node->setName(debug_name.c_str());
#endif
#endif
// We don't keep a reference to the mesh here, so we have to decrement

View File

@ -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/skybox.hpp"
#include "graphics/central_settings.hpp"
@ -375,4 +376,5 @@ void Skybox::render(const scene::ICameraSceneNode *camera) const
glBindVertexArray(0);
} // renderSkybox
#endif // !SERVER_ONLY

View File

@ -51,10 +51,12 @@ SlipStream::SlipStream(AbstractKart* kart) : MovingTexture(0, 0), m_kart(kart)
scene::IMeshBuffer* buffer = m_mesh->getMeshBuffer(0);
material->setMaterialProperties(&buffer->getMaterial(), buffer);
#ifndef SERVER_ONLY
STKMeshSceneNode* stk_node = dynamic_cast<STKMeshSceneNode*>(m_node);
if (stk_node != NULL)
stk_node->setReloadEachFrame(true);
m_mesh->drop();
#endif
#ifdef DEBUG
std::string debug_name = m_kart->getIdent()+" (slip-stream)";
@ -99,8 +101,10 @@ SlipStream::SlipStream(AbstractKart* kart) : MovingTexture(0, 0), m_kart(kart)
}
video::SMaterial &mat = buffer->getMaterial();
// Meshes need a texture, otherwise stk crashes.
#ifndef SERVER_ONLY
video::ITexture *red_texture = getUnicolorTexture(red);
mat.setTexture(0, red_texture);
#endif
buffer->recalculateBoundingBox();
m_mesh->setBoundingBox(buffer->getBoundingBox());
@ -231,7 +235,9 @@ void SlipStream::createMesh(Material* material)
} // for j<num_circles-1
material->setMaterialProperties(&buffer->getMaterial(), buffer);
#ifndef SERVER_ONLY
if (!CVS->isGLSL())
#endif
{
buffer->Material.setFlag(video::EMF_BACK_FACE_CULLING, false);
buffer->Material.setFlag(video::EMF_COLOR_MATERIAL, true);

View File

@ -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/irr_driver.hpp"
#include "graphics/spherical_harmonics.hpp"
@ -528,3 +529,5 @@ void SphericalHarmonics::unprojectSH(size_t width, size_t height,
}
} // unprojectSH
#endif // !SERVER_ONLY

View File

@ -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/stk_animated_mesh.hpp"
#include "graphics/central_settings.hpp"
@ -281,3 +283,6 @@ void STKAnimatedMesh::render()
updateNoGL();
updateGL();
}
#endif // !SERVER_ONLY

View File

@ -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/stk_billboard.hpp"
#include "graphics/irr_driver.hpp"
@ -118,3 +120,6 @@ void STKBillboard::render()
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glBindVertexArray(0);
} // render
#endif // !SERVER_ONLY

View File

@ -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/stk_mesh.hpp"
#include "graphics/callbacks.hpp"
@ -447,3 +449,6 @@ void initTexturesTransparent(GLMesh &mesh)
}
#endif
} // initTexturesTransparent
#endif // !SERVER_ONLY

View File

@ -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/stk_mesh_scene_node.hpp"
#include "graphics/central_settings.hpp"
@ -580,3 +582,6 @@ void STKMeshSceneNode::render()
}
}
}
#endif // !SERVER_ONLY

View File

@ -73,8 +73,10 @@ public:
scene::IMeshBuffer* mb = Mesh->getMeshBuffer(i);
if (!mb)
continue;
#ifndef SERVER_ONLY
if (isDisplacement)
mb->getMaterial().MaterialType = Shaders::getShader(ES_DISPLACE);
#endif
}
}
virtual bool glow() const { return isGlow; }

View File

@ -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/stk_scene_manager.hpp"
#include <SViewFrustum.h>
#include <vector>
@ -61,3 +63,5 @@ bool isCulledPrecise(const scene::ICameraSceneNode *cam, const scene::ISceneNode
return true;
return false;
}
#endif // !SERVER_ONLY

View File

@ -19,6 +19,8 @@
// Not really a scene manager yet but hold algorithm that
// rework scene manager output
#ifndef SERVER_ONLY
#ifndef HEADER_STKSCENEMANAGER_HPP
#define HEADER_STKSCENEMANAGER_HPP
@ -31,3 +33,5 @@ void addEdge(const irr::core::vector3df &P0, const irr::core::vector3df &P1);
bool isCulledPrecise(const irr::scene::ICameraSceneNode *cam, const irr::scene::ISceneNode *node);
#endif
#endif // supertuxkart

View File

@ -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/stk_text_billboard.hpp"
#include "graphics/shaders.hpp"
#include "graphics/irr_driver.hpp"
@ -190,3 +192,6 @@ void STKTextBillboard::collectChar(video::ITexture* texture,
{
m_chars.push_back(STKTextBillboardChar(texture, destRect, sourceRect, colors));
}
#endif // !SERVER_ONLY

View File

@ -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/texture_manager.hpp"
#include "graphics/central_settings.hpp"
@ -258,3 +260,6 @@ video::ITexture* getUnicolorTexture(const video::SColor &c)
return tex;
}
}
#endif // !SERVER_ONLY

View File

@ -16,6 +16,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/texture_shader.hpp"
#include "graphics/central_settings.hpp"
@ -366,3 +368,6 @@ GLuint TextureShaderBase::createSemiTrilinearSampler()
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
#endif // !SERVER_ONLY

View File

@ -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 SHADER_ONLY
#ifndef HEADER_TEXTURE_SHADER_HPP
#define HEADER_TEXTURE_SHADER_HPP
@ -254,3 +256,5 @@ public:
}; // class TextureShader
#endif
#endif // SHADER_ONLY

View File

@ -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/vao_manager.hpp"
#include "graphics/central_settings.hpp"
@ -343,3 +345,5 @@ std::pair<unsigned, unsigned> VAOManager::getBase(scene::IMeshBuffer *mb, Render
assert(It != mappedBaseIndex[tp].end());
return std::pair<unsigned, unsigned>(vtx, It->second);
}
#endif // !SERVER_ONLY

View File

@ -16,6 +16,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/water.hpp"
#include "graphics/callbacks.hpp"
@ -89,3 +91,6 @@ void WaterNode::OnRegisterSceneNode()
ISceneNode::OnRegisterSceneNode();
}
}
#endif // !SERVER_ONLY

View File

@ -174,6 +174,7 @@ void STKModifiedSpriteBank::draw2DSprite(u32 index,
const core::rect<s32>* clip, const video::SColor& color,
u32 starttime, u32 currenttime, bool loop, bool center)
{
#ifndef SERVER_ONLY
assert( m_magic_number == 0xCAFEC001 );
if (index >= Sprites.size() || Sprites[index].Frames.empty() )
return;
@ -221,7 +222,7 @@ void STKModifiedSpriteBank::draw2DSprite(u32 index,
*/
draw2DImage(tex, dest, r /* source rect */, clip,
NULL /* colors */, true);
#endif
} // draw2DSprite
// ----------------------------------------------------------------------------

View File

@ -664,7 +664,9 @@ namespace GUIEngine
#include "font/regular_face.hpp"
#include "input/input_manager.hpp"
#include "io/file_manager.hpp"
#ifndef SERVER_ONLY
#include "graphics/2dutils.hpp"
#endif
#include "graphics/irr_driver.hpp"
#include "guiengine/event_handler.hpp"
#include "guiengine/modaldialog.hpp"
@ -1121,6 +1123,7 @@ namespace GUIEngine
void render(float elapsed_time)
{
#ifndef SERVER_ONLY
GUIEngine::dt = elapsed_time;
// Not yet initialized, or already cleaned up
@ -1208,9 +1211,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),
@ -1244,7 +1248,7 @@ namespace GUIEngine
DemoWorld::resetIdleTime();
}
#endif
} // render
// -----------------------------------------------------------------------
@ -1252,6 +1256,7 @@ namespace GUIEngine
void renderLoading(bool clearIcons)
{
#ifndef SERVER_ONLY
if (clearIcons) g_loading_icons.clear();
g_skin->drawBgImage();
@ -1315,7 +1320,7 @@ namespace GUIEngine
x = ICON_MARGIN;
}
}
#endif
} // renderLoading
// -----------------------------------------------------------------------

View File

@ -93,6 +93,8 @@ void ScalableFont::draw(const core::stringw& text,
const video::SColor& color, bool hcenter, bool vcenter,
const core::rect<s32>* clip, bool ignoreRTL)
{
#ifndef SERVER_ONLY
bool previousRTL = m_font_settings->isRTL();
if (ignoreRTL)
m_font_settings->setRTL(false);
@ -102,7 +104,7 @@ void ScalableFont::draw(const core::stringw& text,
if (ignoreRTL)
m_font_settings->setRTL(previousRTL);
#endif
} // draw
// ----------------------------------------------------------------------------

View File

@ -326,7 +326,7 @@ Skin::~Skin()
// ----------------------------------------------------------------------------
void Skin::drawBgImage()
{
#ifndef SERVER_ONLY
// ---- background image
// on one end, making these static is not too clean.
// on another end, these variables are really only used locally,
@ -370,6 +370,7 @@ void Skin::drawBgImage()
/* no clipping */0, /*color*/ 0,
/*alpha*/false);
irr_driver->getVideoDriver()->enableMaterial2D(false);
#endif
} // drawBgImage
// ----------------------------------------------------------------------------
@ -401,6 +402,7 @@ void Skin::drawBoxFromStretchableTexture(SkinWidgetContainer* w,
bool deactivated,
const core::recti* clipRect)
{
#ifndef SERVER_ONLY
// check if widget moved. if so, recalculate coords
if (w->m_skin_x != dest.UpperLeftCorner.X ||
w->m_skin_y != dest.UpperLeftCorner.Y ||
@ -701,7 +703,7 @@ X##_yflip.LowerRightCorner.Y = w->m_skin_dest_y + \
{
delete[] colorptr;
}
#endif
} // drawBoxFromStretchableTexture
// ----------------------------------------------------------------------------
@ -844,6 +846,7 @@ void Skin::drawProgress(Widget* w, const core::recti &rect,
void Skin::drawRatingBar(Widget *w, const core::recti &rect,
const bool pressed, const bool focused)
{
#ifndef SERVER_ONLY
RatingBarWidget *ratingBar = (RatingBarWidget*)w;
const ITexture *texture = SkinConfig::m_render_params["rating::neutral"].getImage();
@ -897,7 +900,7 @@ void Skin::drawRatingBar(Widget *w, const core::recti &rect,
(w->m_deactivated || ID_DEBUG) ? colors : 0,
true /* alpha */);
}
#endif
} // drawRatingBar
// ----------------------------------------------------------------------------
@ -921,6 +924,7 @@ void Skin::drawRibbon(const core::recti &rect, Widget* widget,
void Skin::drawRibbonChild(const core::recti &rect, Widget* widget,
const bool pressed, bool focused)
{
#ifndef SERVER_ONLY
// for now, when this kind of widget is disabled, just hide it. we can
// change that behaviour if we ever need to...
//if (widget->m_deactivated) return;
@ -1220,6 +1224,7 @@ void Skin::drawRibbonChild(const core::recti &rect, Widget* widget,
m_tooltips.push_back(widget);
}
}
#endif
} // drawRibbonChild
// ----------------------------------------------------------------------------
@ -1435,6 +1440,7 @@ void Skin::drawSpinnerChild(const core::recti &rect, Widget* widget,
void Skin::drawIconButton(const core::recti &rect, Widget* widget,
const bool pressed, bool focused)
{
#ifndef SERVER_ONLY
RibbonWidget* parentRibbon = dynamic_cast<RibbonWidget*>(widget->m_event_handler);
IGUIElement* focusedElem = NULL;
if (GUIEngine::getFocusForPlayer(PLAYER_ID_GAME_MASTER) != NULL)
@ -1543,6 +1549,7 @@ void Skin::drawIconButton(const core::recti &rect, Widget* widget,
{
irr_driver->getVideoDriver()->enableMaterial2D();
}
#endif
} // drawIconButton
// ----------------------------------------------------------------------------
@ -1662,6 +1669,7 @@ void Skin::drawListSelection(const core::recti &rect, Widget* widget,
void Skin::drawListHeader(const irr::core::rect< irr::s32 > &rect,
Widget* widget)
{
#ifndef SERVER_ONLY
bool isSelected =
(((ListWidget*)widget->m_event_handler)->m_selected_column == widget &&
((ListWidget*)widget->m_event_handler)->m_sort_default == false);
@ -1689,7 +1697,7 @@ void Skin::drawListHeader(const irr::core::rect< irr::s32 > &rect,
draw2DImage(img, destRect, srcRect,
NULL, NULL, /* alpha */true);
}
#endif
} // drawListHeader
// ----------------------------------------------------------------------------
@ -1698,6 +1706,7 @@ void Skin::drawListHeader(const irr::core::rect< irr::s32 > &rect,
*/
void Skin::renderSections(PtrVector<Widget>* within_vector)
{
#ifndef SERVER_ONLY
if (within_vector == NULL) within_vector = &getCurrentScreen()->m_widgets;
const unsigned short widgets_amount = within_vector->size();
@ -1770,12 +1779,13 @@ void Skin::renderSections(PtrVector<Widget>* within_vector)
}
}
} // next
#endif // !SERVER_ONLY
} // renderSections
// ----------------------------------------------------------------------------
void Skin::drawScrollbarBackground(const irr::core::rect< irr::s32 > &rect)
{
#ifndef SERVER_ONLY
// leave square space at both ends for up/down buttons (yeah, irrlicht
// doesn't handle that)
core::recti rect2 = rect;
@ -1789,12 +1799,13 @@ void Skin::drawScrollbarBackground(const irr::core::rect< irr::s32 > &rect)
p.m_source_area_center,
0 /* no clipping */, 0,
true /* alpha */);
#endif
} // drawScrollbarBackground
// ----------------------------------------------------------------------------
void Skin::drawScrollbarThumb(const irr::core::rect< irr::s32 > &rect)
{
#ifndef SERVER_ONLY
BoxRenderParams& p =
SkinConfig::m_render_params["scrollbar_thumb::neutral"];
@ -1802,7 +1813,7 @@ void Skin::drawScrollbarThumb(const irr::core::rect< irr::s32 > &rect)
p.m_source_area_center,
0 /* no clipping */, 0,
true /* alpha */);
#endif
} // drawScrollbarThumb
// ----------------------------------------------------------------------------
@ -1958,7 +1969,9 @@ void Skin::process3DPane(IGUIElement *element, const core::recti &rect,
else if (type == WTYPE_MODEL_VIEW)
{
ModelViewWidget* mvw = dynamic_cast<ModelViewWidget*>(widget);
#ifndef SERVER_ONLY
mvw->drawRTTScene(rect);
#endif
}
else if (type == WTYPE_ICON_BUTTON)
{
@ -2016,6 +2029,7 @@ void Skin::process3DPane(IGUIElement *element, const core::recti &rect,
void doDrawBadge(ITexture* texture, const core::recti& rect,
float max_icon_size, bool badge_at_left)
{
#ifndef SERVER_ONLY
// In case of a problem
if(!texture) return;
@ -2041,6 +2055,7 @@ void doDrawBadge(ITexture* texture, const core::recti& rect,
draw2DImage(texture, rect2, source_area,
0 /* no clipping */, 0,
true /* alpha */);
#endif
} // doDrawBadge
// ----------------------------------------------------------------------------
@ -2139,6 +2154,7 @@ void Skin::draw3DSunkenPane (IGUIElement *element, video::SColor bgcolor,
bool flat, bool fillBackGround,
const core::recti &rect, const core::recti *clip)
{
#ifndef SERVER_ONLY
const int id = element->getID();
Widget* widget = GUIEngine::getWidget(id);
@ -2257,18 +2273,21 @@ void Skin::draw3DSunkenPane (IGUIElement *element, video::SColor bgcolor,
return;
}
#endif
} // draw3DSunkenPane
// -----------------------------------------------------------------------------
void Skin::drawBGFadeColor()
{
#ifndef SERVER_ONLY
// fade out background
SColor color = SkinConfig::m_colors["dialog_background::neutral"];
if (m_dialog_size < 1.0f)
color.setAlpha( (unsigned int)(color.getAlpha()*m_dialog_size ));
GL32_draw2DRectangle(color, core::recti(position2d< s32 >(0,0),
irr_driver->getActualScreenSize()));
#endif
} // drawBGFadeColor
// -----------------------------------------------------------------------------
@ -2316,8 +2335,10 @@ core::recti Skin::draw3DWindowBackground(IGUIElement *element,
void Skin::draw3DMenuPane (IGUIElement *element, const core::recti &rect,
const core::recti *clip)
{
#ifndef SERVER_ONLY
SColor color = SColor(150, 96, 74, 196);
GL32_draw2DRectangle(color, rect);
#endif
} // draw3DMenuPane
// -----------------------------------------------------------------------------
@ -2376,7 +2397,9 @@ void Skin::draw2DImage(const video::ITexture* texture, const core::rect<s32>& de
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect,
const video::SColor* const colors, bool useAlphaChannelOfTexture)
{
#ifndef SERVER_ONLY
::draw2DImage(texture, destRect, sourceRect, clipRect, colors, useAlphaChannelOfTexture);
#endif
}
// -----------------------------------------------------------------------------

View File

@ -903,6 +903,7 @@ core::position2di CGUIEditBox::calculateICPos()
//! draws the element and its children
void CGUIEditBox::draw()
{
#ifndef SERVER_ONLY
if (!IsVisible)
return;
@ -1104,6 +1105,7 @@ void CGUIEditBox::draw()
// draw children
IGUIElement::draw();
#endif
}

View File

@ -52,13 +52,17 @@ IconButtonWidget(IconButtonWidget::SCALE_MODE_KEEP_TEXTURE_ASPECT_RATIO, false,
m_properties[PROP_ICON]="gui/main_help.png";
m_rtt_unsupported = false;
}
} // ModelViewWidget
// -----------------------------------------------------------------------------
ModelViewWidget::~ModelViewWidget()
{
GUIEngine::needsUpdate.remove(this);
#ifndef SERVER_ONLY
delete m_render_info;
}
#endif
} // ~ModelViewWidget
// -----------------------------------------------------------------------------
void ModelViewWidget::add()
{
@ -92,7 +96,7 @@ void ModelViewWidget::clearModels()
m_rtt_main_node = NULL;
m_camera = NULL;
m_light = NULL;
}
} // clearModels
// -----------------------------------------------------------------------------
@ -107,10 +111,11 @@ void ModelViewWidget::addModel(irr::scene::IMesh* mesh, const Vec3& location,
m_model_scale.push_back(scale);
m_model_frames.push_back(frame);
m_model_render_info_affected.push_back(all_parts_colorized);
#ifndef SERVER_ONLY
if (!CVS->isGLSL())
m_render_target = NULL;
}
#endif
} // addModel
// -----------------------------------------------------------------------------
void ModelViewWidget::update(float delta)
@ -162,6 +167,9 @@ void ModelViewWidget::update(float delta)
if (fabsf(m_angle - m_rotation_target) < 2.0f) m_rotation_mode = ROTATE_OFF;
}
#ifdef SERVER_ONLY
return;
#else
if (m_render_target == NULL)
{
std::string name = "model view ";
@ -181,10 +189,13 @@ void ModelViewWidget::update(float delta)
m_render_target->renderToTexture(m_camera, GUIEngine::getLatestDt());
m_rtt_main_node->setVisible(false);
}
#endif
} // update
// ----------------------------------------------------------------------------
void ModelViewWidget::setupRTTScene()
{
#ifndef SERVER_ONLY
irr_driver->suppressSkyBox();
if (m_rtt_main_node != NULL) m_rtt_main_node->remove();
@ -297,42 +308,57 @@ void ModelViewWidget::setupRTTScene()
m_camera->setFOV(DEGREE_TO_RAD*50.0f);
m_camera->updateAbsolutePosition();
}
#endif
} // setupRTTScene
// ----------------------------------------------------------------------------
void ModelViewWidget::setRotateOff()
{
m_rotation_mode = ROTATE_OFF;
}
} // setRotateOff
// ----------------------------------------------------------------------------
void ModelViewWidget::setRotateContinuously(float speed)
{
m_rotation_mode = ROTATE_CONTINUOUSLY;
m_rotation_speed = speed;
}
} // setRotateContinuously
// ----------------------------------------------------------------------------
void ModelViewWidget::setRotateTo(float targetAngle, float speed)
{
m_rotation_mode = ROTATE_TO;
m_rotation_speed = speed;
m_rotation_target = targetAngle;
}
} // setRotateTo
// ----------------------------------------------------------------------------
bool ModelViewWidget::isRotating()
{
return m_rotation_mode != ROTATE_OFF ? true : false;
}
} // isRotating
// ----------------------------------------------------------------------------
void ModelViewWidget::elementRemoved()
{
#ifndef SERVER_ONLY
m_render_target = NULL;
IconButtonWidget::elementRemoved();
}
#endif
} // elementRemoved
// ----------------------------------------------------------------------------
void ModelViewWidget::clearRttProvider()
{
m_render_target = NULL;
}
} // clearRttProvider
// ----------------------------------------------------------------------------
void ModelViewWidget::drawRTTScene(const irr::core::rect<s32>& dest_rect) const
{
#ifndef SERVER_ONLY
if(m_render_target != NULL)
m_render_target->draw2DImage(dest_rect, NULL, video::SColor(255, 255, 255, 255), true);
}
#endif
} // drawRTTScene

View File

@ -182,7 +182,7 @@ void Attachment::set(AttachmentType type, float time,
}
}
m_node->setVisible(true);
#ifndef SERVER_ONLY
irr_driver->applyObjectPassShader(m_node);
// Save event about the new attachment
@ -193,6 +193,7 @@ void Attachment::set(AttachmentType type, float time,
saveState(buffer);
rwm->addEvent(this, buffer);
}
#endif
} // set
// -----------------------------------------------------------------------------

View File

@ -76,6 +76,7 @@ Flyable::Flyable(AbstractKart *kart, PowerupManager::PowerupType type,
m_max_lifespan = -1;
// Add the graphical model
#ifndef SERVER_ONLY
setNode(irr_driver->addMesh(m_st_model[type], StringUtils::insertValues("flyable_%i", (int)type)));
irr_driver->applyObjectPassShader(getNode());
#ifdef DEBUG
@ -83,7 +84,7 @@ Flyable::Flyable(AbstractKart *kart, PowerupManager::PowerupType type,
debug_name += type;
getNode()->setName(debug_name.c_str());
#endif
#endif
} // Flyable
// ----------------------------------------------------------------------------

View File

@ -185,6 +185,7 @@ void Item::switchTo(ItemType type, scene::IMesh *mesh, scene::IMesh *lowmesh)
scene::ISceneNode* node = m_node->getAllNodes()[0];
((scene::IMeshSceneNode*)node)->setMesh(mesh);
#ifndef SERVER_ONLY
if (lowmesh != NULL)
{
node = m_node->getAllNodes()[1];
@ -195,6 +196,7 @@ void Item::switchTo(ItemType type, scene::IMesh *mesh, scene::IMesh *lowmesh)
irr_driver->applyObjectPassShader(m_node->getAllNodes()[0]);
World::getWorld()->getTrack()->adjustForFog(m_node);
#endif
} // switchTo
//-----------------------------------------------------------------------------

View File

@ -68,14 +68,17 @@ RubberBand::RubberBand(Plunger *plunger, AbstractKart *kart)
verts[i].Color = color;
}
#ifndef SERVER_ONLY
// Color
mb->getMaterial().setTexture(0, getUnicolorTexture(video::SColor(255, 255, 255, 255)));
// Gloss
mb->getMaterial().setTexture(1, getUnicolorTexture(video::SColor(0, 0, 0, 0)));
// Colorization mask
mb->getMaterial().setTexture(7, getUnicolorTexture(video::SColor(0, 0, 0, 0)));
#endif
updatePosition();
m_node = irr_driver->addMesh(m_mesh, "rubberband");
#ifndef SERVER_ONLY
irr_driver->applyObjectPassShader(m_node);
if (STKMeshSceneNode *stkm = dynamic_cast<STKMeshSceneNode *>(m_node))
stkm->setReloadEachFrame(true);
@ -83,6 +86,7 @@ RubberBand::RubberBand(Plunger *plunger, AbstractKart *kart)
std::string debug_name = m_owner->getIdent()+" (rubber-band)";
m_node->setName(debug_name.c_str());
#endif
#endif
} // RubberBand

View File

@ -299,8 +299,11 @@ void LocalPlayerController::handleZipper(bool play_sound)
m_wee_sound->play();
}
#ifndef SERVER_ONLY
// Apply the motion blur according to the speed of the kart
irr_driver->giveBoost(m_camera_index);
#endif
} // handleZipper
//-----------------------------------------------------------------------------

View File

@ -212,7 +212,11 @@ void Kart::init(RaceManager::KartType type)
}
#ifdef SERVER_ONLY
bool animations = false; // server never animates
#else
bool animations = true;
#endif
const int anims = UserConfigParams::m_show_steering_animations;
if (anims == ANIMS_NONE)
{
@ -333,9 +337,10 @@ void Kart::reset()
m_kart_gfx->reset();
m_skidding->reset();
#ifndef SERVER_ONLY
if (m_collision_particles)
m_collision_particles->setCreationRateAbsolute(0.0f);
#endif
m_race_position = m_initial_position;
m_finished_race = false;
@ -2051,6 +2056,7 @@ void Kart::crashed(const Material *m, const Vec3 &normal)
if(m && m->getCollisionReaction() != Material::NORMAL &&
!getKartAnimation())
{
#ifndef SERVER_ONLY
std::string particles = m->getCrashResetParticles();
if (particles.size() > 0)
{
@ -2076,7 +2082,7 @@ void Kart::crashed(const Material *m, const Vec3 &normal)
"crash-reset properties\n", particles.c_str());
}
}
#endif
if (m->getCollisionReaction() == Material::RESCUE)
{
new RescueAnimation(this);
@ -2533,6 +2539,30 @@ void Kart::loadData(RaceManager::KartType type, bool is_animated_model)
m_attachment = new Attachment(this);
createPhysics();
// Attach Particle System
Track *track = World::getWorld()->getTrack();
#ifndef SERVER_ONLY
if (type == RaceManager::KT_PLAYER &&
UserConfigParams::m_weather_effects &&
track->getSkyParticles() != NULL)
{
track->getSkyParticles()->setBoxSizeXZ(150.0f, 150.0f);
m_sky_particles_emitter =
new ParticleEmitter(track->getSkyParticles(),
core::vector3df(0.0f, 30.0f, 100.0f),
getNode(),
true);
// FIXME: in multiplayer mode, this will result in several instances
// of the heightmap being calculated and kept in memory
m_sky_particles_emitter->addHeightMapAffector(track);
}
#endif
Vec3 position(0, getKartHeight()*0.35f, -getKartLength()*0.35f);
m_slipstream = new SlipStream(this);
if (m_kart_properties->getSkidEnabled())
@ -2542,12 +2572,13 @@ void Kart::loadData(RaceManager::KartType type, bool is_animated_model)
track_manager->getTrack(race_manager->getTrackName())
->isFogEnabled() );
}
#ifndef SERVER_ONLY
if (!CVS->supportsShadows())
{
m_shadow = new Shadow(m_kart_properties.get(), m_node,
-m_kart_model->getLowestPoint());
}
#endif
World::getWorld()->kartAdded(this, m_node);
} // loadData
@ -2857,6 +2888,7 @@ btQuaternion Kart::getVisualRotation() const
*/
void Kart::setOnScreenText(const wchar_t *text)
{
#ifndef SERVER_ONLY
BoldFace* bold_face = font_manager->getFont<BoldFace>();
core::dimension2d<u32> textsize = bold_face->getDimension(text);
@ -2889,6 +2921,7 @@ void Kart::setOnScreenText(const wchar_t *text)
// No need to store the reference to the billboard scene node:
// It has one reference to the parent, and will get deleted
// when the parent is deleted.
#endif
} // setOnScreenText
// ------------------------------------------------------------------------

View File

@ -56,6 +56,7 @@ KartGFX::KartGFX(const AbstractKart *kart)
/*radius*/CVS->isGLSL() ? 5.0f : 1.0f,
0.0f, 0.4f, 1.0f,
false, node);
#ifndef SERVER_ONLY
m_nitro_light->setVisible(false);
#ifdef DEBUG
m_nitro_light->setName( ("nitro emitter (" + m_kart->getIdent()
@ -82,13 +83,16 @@ KartGFX::KartGFX(const AbstractKart *kart)
m_skidding_light_2->setVisible(false);
m_skidding_light_2->setName( ("skidding emitter 2 (" + m_kart->getIdent()
+ ")").c_str() );
#endif
#ifndef SERVER_ONLY
if (CVS->isGLSL())
{
m_nitro_light->grab();
m_skidding_light_1->grab();
m_skidding_light_2->grab();
}
#endif
// Create particle effects
Vec3 rear_left(kart->getWheelGraphicsPosition(3).getX(), 0.05f,
@ -132,12 +136,14 @@ KartGFX::~KartGFX()
delete m_all_emitters[i];
} // for i < KGFX_COUNT
#ifndef SERVER_ONLY
if (CVS->isGLSL())
{
m_nitro_light->drop();
m_skidding_light_1->drop();
m_skidding_light_2->drop();
}
#endif
} // ~KartGFX
@ -151,6 +157,7 @@ KartGFX::~KartGFX()
void KartGFX::addEffect(KartGFXType type, const std::string &file_name,
const Vec3 &position, bool important)
{
#ifndef SERVER_ONLY
if (!UserConfigParams::m_graphical_effects &&
(!important || m_kart->getType() == RaceManager::KT_AI ||
m_kart->getType() == RaceManager::KT_SPARE_TIRE))
@ -196,6 +203,7 @@ void KartGFX::addEffect(KartGFXType type, const std::string &file_name,
m_skid_kind1 = kind;
else if (type==KGFX_SKID2L || type==KGFX_SKID2R)
m_skid_kind2 = kind;
#endif
} // addEffect
// ----------------------------------------------------------------------------
@ -204,6 +212,7 @@ void KartGFX::addEffect(KartGFXType type, const std::string &file_name,
void KartGFX::reset()
{
m_wheel_toggle = 1;
#ifndef SERVER_ONLY
for(unsigned int i=0; i<m_all_emitters.size(); i++)
{
if(m_all_emitters[i])
@ -212,6 +221,7 @@ void KartGFX::reset()
m_all_emitters[i]->clearParticles();
}
}
#endif
} // reset
// ----------------------------------------------------------------------------
@ -224,6 +234,7 @@ void KartGFX::setSkidLevel(const unsigned int level)
assert(level >= 1);
assert(level <= 2);
const ParticleKind *pk = level==1 ? m_skid_kind1 : m_skid_kind2;
#ifndef SERVER_ONLY
if(m_all_emitters[KGFX_SKID1L])
m_all_emitters[KGFX_SKID1L]->setParticleType(pk);
if(m_all_emitters[KGFX_SKID1R])
@ -232,6 +243,7 @@ void KartGFX::setSkidLevel(const unsigned int level)
// set to indicate that the bonus is now available.
setCreationRateRelative(KartGFX::KGFX_SKIDL, 0.0f);
setCreationRateRelative(KartGFX::KGFX_SKIDR, 0.0f);
#endif
} // setSkidLevel
// ----------------------------------------------------------------------------
@ -242,10 +254,12 @@ void KartGFX::setSkidLevel(const unsigned int level)
*/
void KartGFX::setParticleKind(const KartGFXType type, const ParticleKind *pk)
{
#ifndef SERVER_ONLY
ParticleEmitter *pe = m_all_emitters[KGFX_TERRAIN];
if(!pe) return;
pe->setParticleType(pk);
#endif
} // setParticleKind
// ----------------------------------------------------------------------------
@ -255,9 +269,11 @@ void KartGFX::setParticleKind(const KartGFXType type, const ParticleKind *pk)
*/
void KartGFX::setXYZ(const KartGFXType type, const Vec3 &xyz)
{
#ifndef SERVER_ONLY
ParticleEmitter *pe = m_all_emitters[KGFX_TERRAIN];
if(!pe) return;
pe->setPosition(xyz);
#endif
} // setXYZ
// ----------------------------------------------------------------------------
@ -268,8 +284,10 @@ void KartGFX::setXYZ(const KartGFXType type, const Vec3 &xyz)
*/
void KartGFX::setCreationRateAbsolute(KartGFXType type, float f)
{
#ifndef SERVER_ONLY
if(m_all_emitters[type])
m_all_emitters[type]->setCreationRateAbsolute(f);
#endif
} // setCreationRateAbsolute
// ----------------------------------------------------------------------------
@ -282,6 +300,7 @@ void KartGFX::setCreationRateAbsolute(KartGFXType type, float f)
*/
void KartGFX::setCreationRateRelative(KartGFXType type, float f)
{
#ifndef SERVER_ONLY
if(m_all_emitters[type])
{
if(f<0)
@ -289,6 +308,7 @@ void KartGFX::setCreationRateRelative(KartGFXType type, float f)
else
m_all_emitters[type]->setCreationRateRelative(f);
}
#endif
} // setCreationRateRelative
// ----------------------------------------------------------------------------
@ -301,8 +321,10 @@ void KartGFX::setCreationRateRelative(KartGFXType type, float f)
*/
void KartGFX::resizeBox(KartGFXType type, float new_size)
{
#ifndef SERVER_ONLY
if(m_all_emitters[type])
m_all_emitters[type]->resizeBox(std::max(0.25f, new_size));
#endif
} // resizeBox
// ----------------------------------------------------------------------------
@ -314,6 +336,7 @@ void KartGFX::resizeBox(KartGFXType type, float new_size)
*/
void KartGFX::updateTerrain(const ParticleKind *pk)
{
#ifndef SERVER_ONLY
ParticleEmitter *pe = m_all_emitters[KGFX_TERRAIN];
if(!pe) return;
@ -346,6 +369,7 @@ void KartGFX::updateTerrain(const ParticleKind *pk)
// m_skidding can be > 2, and speed > maxSpeed (if powerups are used).
if(rate>1.0f) rate = 1.0f;
pe->setCreationRateRelative(rate);
#endif
} // updateTerrain
// ----------------------------------------------------------------------------
@ -370,6 +394,7 @@ void KartGFX::update(float dt)
*/
void KartGFX::updateNitroGraphics(float nitro_frac)
{
#ifndef SERVER_ONLY
// Upate particle effects (creation rate, and emitter size
// depending on speed)
// --------------------------------------------------------
@ -389,7 +414,7 @@ void KartGFX::updateNitroGraphics(float nitro_frac)
setCreationRateAbsolute(KartGFX::KGFX_NITROSMOKE2, 0);
m_nitro_light->setVisible(false);
}
#endif
} // updateGraphics
// ----------------------------------------------------------------------------
@ -399,14 +424,17 @@ void KartGFX::updateNitroGraphics(float nitro_frac)
*/
void KartGFX::updateSkidLight(unsigned int level)
{
#ifndef SERVER_ONLY
m_skidding_light_1->setVisible(level == 1);
m_skidding_light_2->setVisible(level > 1);
#endif
} // updateSkidLight
// ----------------------------------------------------------------------------
void KartGFX::getGFXStatus(int* nitro, bool* zipper,
int* skidding, bool* red_skidding) const
{
#ifndef SERVER_ONLY
int n = 0;
bool z = false;
int s = 0;
@ -432,13 +460,14 @@ void KartGFX::getGFXStatus(int* nitro, bool* zipper,
*zipper = z;
*skidding = s;
*red_skidding = r;
#endif
} // getGFXStatus
// ----------------------------------------------------------------------------
void KartGFX::setGFXFromReplay(int nitro, bool zipper,
int skidding, bool red_skidding)
{
#ifndef SERVER_ONLY
if (nitro > 0)
{
setCreationRateAbsolute(KartGFX::KGFX_NITRO1, (float)nitro);
@ -492,12 +521,15 @@ void KartGFX::setGFXFromReplay(int nitro, bool zipper,
m_skidding_light_1->setVisible(false);
m_skidding_light_2->setVisible(false);
}
#endif
} // setGFXFromReplay
// ----------------------------------------------------------------------------
void KartGFX::setGFXInvisible()
{
#ifndef SERVER_ONLY
m_nitro_light->setVisible(false);
m_skidding_light_1->setVisible(false);
m_skidding_light_2->setVisible(false);
#endif
} // setGFXInvisible

View File

@ -357,6 +357,7 @@ scene::ISceneNode* KartModel::attachModel(bool animated_models, bool always_anim
irr_driver->getSceneManager()->getRootSceneNode(),
irr_driver->getSceneManager() );
#ifndef SERVER_ONLY
node = irr_driver->addAnimatedMesh(m_mesh, "kartmesh",
NULL/*parent*/, getRenderInfo());
@ -365,7 +366,7 @@ scene::ISceneNode* KartModel::attachModel(bool animated_models, bool always_anim
node->setAutomaticCulling(scene::EAC_OFF);
else
node->setAutomaticCulling(scene::EAC_FRUSTUM_BOX);
#endif
if (always_animated)
{
// give a huge LOD distance for the player's kart. the reason is that it should
@ -409,7 +410,7 @@ scene::ISceneNode* KartModel::attachModel(bool animated_models, bool always_anim
if(!m_speed_weighted_objects[i].m_node) continue;
m_speed_weighted_objects[i].m_node->setParent(lod_node);
}
#ifndef SERVER_ONLY
// Enable rim lighting for the kart
irr_driver->applyObjectPassShader(lod_node, true);
std::vector<scene::ISceneNode*> &lodnodes = lod_node->getAllNodes();
@ -418,6 +419,7 @@ scene::ISceneNode* KartModel::attachModel(bool animated_models, bool always_anim
{
irr_driver->applyObjectPassShader(lodnodes[i], true);
}
#endif
}
else
{
@ -428,12 +430,13 @@ scene::ISceneNode* KartModel::attachModel(bool animated_models, bool always_anim
: 0;
scene::IMesh* main_frame = m_mesh;
#ifndef SERVER_ONLY
if (!CVS->isGLSL())
{
main_frame = m_mesh->getMesh(straight_frame);
main_frame->setHardwareMappingHint(scene::EHM_STATIC);
}
#endif
std::string debug_name;
#ifdef DEBUG
@ -510,12 +513,13 @@ bool KartModel::loadModels(const KartProperties &kart_properties)
return false;
}
#ifndef SERVER_ONLY
scene::ISkinnedMesh* sm = dynamic_cast<scene::ISkinnedMesh*>(m_mesh);
if (sm)
{
MeshTools::createSkinnedMeshWithTangents(sm, &MeshTools::isNormalMap);
}
#endif
m_mesh->grab();
irr_driver->grabAllTextures(m_mesh);
@ -564,7 +568,7 @@ bool KartModel::loadModels(const KartProperties &kart_properties)
// Grab all textures. This is done for the master only, so
// the destructor will only free the textures if a master
// copy is freed.
#ifndef SERVER_ONLY
scene::ISkinnedMesh* sm =
dynamic_cast<scene::ISkinnedMesh*>(obj.m_model);
if (sm)
@ -573,7 +577,7 @@ bool KartModel::loadModels(const KartProperties &kart_properties)
&MeshTools::isNormalMap);
}
irr_driver->grabAllTextures(obj.m_model);
#endif
// Update min/max
Vec3 obj_min, obj_max;
MeshTools::minMax3D(obj.m_model, &obj_min, &obj_max);
@ -614,8 +618,10 @@ bool KartModel::loadModels(const KartProperties &kart_properties)
std::string full_wheel =
kart_properties.getKartDir()+m_wheel_filename[i];
m_wheel_model[i] = irr_driver->getMesh(full_wheel);
#ifndef SERVER_ONLY
m_wheel_model[i] = MeshTools::createMeshWithTangents(m_wheel_model[i],
&MeshTools::isNormalMap);
#endif
// Grab all textures. This is done for the master only, so
// the destructor will only free the textures if a master
// copy is freed.

View File

@ -249,10 +249,12 @@ void KartProperties::load(const std::string &filename, const std::string &node)
else
m_minimap_icon = NULL;
#ifndef SERVER_ONLY
if (m_minimap_icon == NULL)
{
m_minimap_icon = getUnicolorTexture(m_color);
}
#endif
// Only load the model if the .kart file has the appropriate version,
// otherwise warnings are printed.

View File

@ -66,6 +66,7 @@ void Moveable::setNode(scene::ISceneNode *n)
void Moveable::updateGraphics(float dt, const Vec3& offset_xyz,
const btQuaternion& rotation)
{
#ifndef SERVER_ONLY
Vec3 xyz=getXYZ()+offset_xyz;
m_node->setPosition(xyz.toIrrVector());
btQuaternion r_all = getRotation()*rotation;
@ -75,6 +76,7 @@ void Moveable::updateGraphics(float dt, const Vec3& offset_xyz,
Vec3 hpr;
hpr.setHPR(r_all);
m_node->setRotation(hpr.toIrrHPR());
#endif
} // updateGraphics
//-----------------------------------------------------------------------------

View File

@ -1644,6 +1644,7 @@ int main(int argc, char *argv[] )
}
Log::warn("OpenGL", "Driver is too old!");
}
#ifndef SERVER_ONLY
else if (!CVS->isGLSL())
{
if (UserConfigParams::m_old_driver_popup)
@ -1662,7 +1663,7 @@ int main(int argc, char *argv[] )
}
Log::warn("OpenGL", "OpenGL version is too old!");
}
#endif
// Note that on the very first run of STK internet status is set to
// "not asked", so the report will only be sent in the next run.
if(UserConfigParams::m_internet_status==Online::RequestManager::IPERM_ALLOWED)

View File

@ -320,6 +320,7 @@ void SoccerWorld::countdownReachedZero()
//-----------------------------------------------------------------------------
void SoccerWorld::initKartList()
{
#ifndef SERVER_ONLY
const unsigned int kart_amount = (unsigned int)m_karts.size();
//Loading the indicator textures
@ -340,13 +341,14 @@ void SoccerWorld::initKartList()
float arrow_pos_height = km->getHeight() + 0.5f;
SoccerTeam team = getKartTeam(i);
arrow_node = irr_driver->addBillboard(core::dimension2d<irr::f32>(0.3f,
0.3f), team == SOCCER_TEAM_BLUE ? blue : red, m_karts[i]
->getNode(), true);
arrow_node = irr_driver->addBillboard(
core::dimension2d<irr::f32>(0.3f,0.3f),
team == SOCCER_TEAM_BLUE ? blue : red,
m_karts[i]->getNode(), true);
arrow_node->setPosition(core::vector3df(0, arrow_pos_height, 0));
}
#endif
} // initKartList
//-----------------------------------------------------------------------------

View File

@ -224,8 +224,10 @@ void World::init()
// Load other custom models if needed
loadCustomModels();
#ifndef SERVER_ONLY
// Now that all models are loaded, apply the overrides
irr_driver->applyObjectPassShader();
#endif
// Must be called after all karts are created
m_race_gui->init();

View File

@ -94,7 +94,7 @@ namespace Scripting
core::dimension2d<u32> textsize = digit_face->getDimension(wtext.c_str());
core::vector3df xyz(location->getX(), location->getY(), location->getZ());
#ifndef SERVER_ONLY
if (CVS->isGLSL())
{
STKTextBillboard* tb = new STKTextBillboard(wtext.c_str(), digit_face,
@ -123,6 +123,7 @@ namespace Scripting
GUIEngine::getSkin()->getColor("font::top"));
World::getWorld()->getTrack()->addNode(sn);
}
#endif
}
/** Exits the race to the main menu */

View File

@ -40,6 +40,7 @@ CutsceneGUI::~CutsceneGUI()
void CutsceneGUI::renderGlobal(float dt)
{
#ifndef SERVER_ONLY
core::dimension2d<u32> screen_size = irr_driver->getActualScreenSize();
if (m_fade_level > 0.0f)
@ -67,5 +68,6 @@ void CutsceneGUI::renderGlobal(float dt)
video::SColor(255,255,255,255), true, true, NULL);
}
}
#endif
}

View File

@ -52,6 +52,7 @@ CustomVideoSettingsDialog::~CustomVideoSettingsDialog()
void CustomVideoSettingsDialog::beforeAddingWidgets()
{
#ifndef SERVER_ONLY
getWidget<CheckBoxWidget>("anim_gfx")->setState(UserConfigParams::m_graphical_effects);
getWidget<CheckBoxWidget>("weather_gfx")->setState(UserConfigParams::m_weather_effects);
getWidget<CheckBoxWidget>("dof")->setState(UserConfigParams::m_dof);
@ -115,12 +116,14 @@ void CustomVideoSettingsDialog::beforeAddingWidgets()
shadows->setActive(false);
getWidget<CheckBoxWidget>("global_illumination")->setActive(false);
}
#endif
}
// -----------------------------------------------------------------------------
GUIEngine::EventPropagation CustomVideoSettingsDialog::processEvent(const std::string& eventSource)
{
#ifndef SERVER_ONLY
if (eventSource == "close")
{
bool advanced_pipeline = getWidget<CheckBoxWidget>("dynamiclight")->getState();
@ -219,7 +222,7 @@ GUIEngine::EventPropagation CustomVideoSettingsDialog::processEvent(const std::s
{
updateActivation();
}
#endif
return GUIEngine::EVENT_LET;
} // processEvent
@ -227,6 +230,7 @@ GUIEngine::EventPropagation CustomVideoSettingsDialog::processEvent(const std::s
void CustomVideoSettingsDialog::updateActivation()
{
#ifndef SERVER_ONLY
bool light = getWidget<CheckBoxWidget>("dynamiclight")->getState();
getWidget<CheckBoxWidget>("motionblur")->setActive(light);
getWidget<CheckBoxWidget>("dof")->setActive(light);
@ -244,5 +248,6 @@ void CustomVideoSettingsDialog::updateActivation()
getWidget<SpinnerWidget>("shadows")->setActive(false);
getWidget<CheckBoxWidget>("global_illumination")->setActive(false);
}
#endif
} // updateActivation

View File

@ -27,6 +27,9 @@ using namespace irr;
#include "config/user_config.hpp"
#include "graphics/camera.hpp"
#include "graphics/2dutils.hpp"
#ifndef SERVER_ONLY
#include "graphics/glwrap.hpp"
#endif
#include "graphics/irr_driver.hpp"
#include "graphics/material_manager.hpp"
#include "guiengine/engine.hpp"
@ -89,7 +92,7 @@ RaceGUI::RaceGUI()
else if (UserConfigParams::m_multitouch_enabled)
{
m_map_left = irr_driver->getActualScreenSize().Width - m_map_width;
m_map_bottom = irr_driver->getActualScreenSize().Height * 0.55f;
m_map_bottom = int(irr_driver->getActualScreenSize().Height * 0.55f);
}
m_is_tutorial = (race_manager->getTrackName() == "tutorial");
@ -165,6 +168,7 @@ void RaceGUI::reset()
*/
void RaceGUI::renderGlobal(float dt)
{
#ifndef SERVER_ONLY
RaceGUIBase::renderGlobal(dt);
cleanupMessages(dt);
@ -213,6 +217,7 @@ void RaceGUI::renderGlobal(float dt)
if (!m_is_tutorial) drawGlobalPlayerIcons(m_map_height);
if(world->getTrack()->isSoccer()) drawScores();
#endif
} // renderGlobal
//-----------------------------------------------------------------------------
@ -260,6 +265,7 @@ void RaceGUI::renderPlayerView(const Camera *camera, float dt)
*/
void RaceGUI::drawScores()
{
#ifndef SERVER_ONLY
SoccerWorld* sw = dynamic_cast<SoccerWorld*>(World::getWorld());
int offset_y = 5;
int offset_x = 5;
@ -301,6 +307,7 @@ void RaceGUI::drawScores()
NULL,NULL,true);
offset_x += position.LowerRightCorner.X + 30;
}
#endif
} // drawScores
//-----------------------------------------------------------------------------
@ -370,6 +377,7 @@ void RaceGUI::drawGlobalTimer()
*/
void RaceGUI::drawGlobalMiniMap()
{
#ifndef SERVER_ONLY
World *world = World::getWorld();
// draw a map when arena has a navigation mesh.
if ((world->getTrack()->isArena() || world->getTrack()->isSoccer()) &&
@ -428,7 +436,7 @@ void RaceGUI::drawGlobalMiniMap()
lower_y -(int)(draw_at.getY()-(m_minimap_player_size/2.5f)));
draw2DImage(icon, position, source, NULL, NULL, true);
}
#endif
} // drawGlobalMiniMap
//-----------------------------------------------------------------------------
@ -444,6 +452,7 @@ void RaceGUI::drawEnergyMeter(int x, int y, const AbstractKart *kart,
const core::recti &viewport,
const core::vector2df &scaling)
{
#ifndef SERVER_ONLY
float min_ratio = std::min(scaling.X, scaling.Y);
const int GAUGEWIDTH = 78;
int gauge_width = (int)(GAUGEWIDTH*min_ratio);
@ -638,7 +647,7 @@ void RaceGUI::drawEnergyMeter(int x, int y, const AbstractKart *kart,
index, count-2, video::EVT_STANDARD, scene::EPT_TRIANGLE_FAN);
}
#endif
} // drawEnergyMeter
//-----------------------------------------------------------------------------
@ -738,6 +747,7 @@ void RaceGUI::drawSpeedEnergyRank(const AbstractKart* kart,
const core::vector2df &scaling,
float dt)
{
#ifndef SERVER_ONLY
float min_ratio = std::min(scaling.X, scaling.Y);
const int SPEEDWIDTH = 128;
int meter_width = (int)(SPEEDWIDTH*min_ratio);
@ -844,7 +854,7 @@ void RaceGUI::drawSpeedEnergyRank(const AbstractKart* kart,
irr_driver->getVideoDriver()->setMaterial(m);
draw2DVertexPrimitiveList(m_speed_bar_icon->getTexture(), vertices, count,
index, count-2, video::EVT_STANDARD, scene::EPT_TRIANGLE_FAN);
#endif
} // drawSpeedEnergyRank
//-----------------------------------------------------------------------------
@ -912,26 +922,26 @@ void RaceGUI::initMultitouchSteering()
const float small_ratio = 0.6f;
device->addButton(BUTTON_STEERING,
0.5f * margin, h - 0.5f * margin - btn2_size,
btn2_size, btn2_size);
int(0.5f * margin), int(h - 0.5f * margin - btn2_size),
int(btn2_size), int(btn2_size));
device->addButton(BUTTON_ESCAPE,
top_margin, small_ratio * margin,
small_ratio * btn_size, small_ratio * btn_size);
top_margin, int(small_ratio * margin),
int(small_ratio * btn_size), int(small_ratio * btn_size));
device->addButton(BUTTON_RESCUE,
top_margin + small_ratio * col_size, small_ratio * margin,
small_ratio * btn_size, small_ratio * btn_size);
int(top_margin + small_ratio * col_size), int(small_ratio * margin),
int(small_ratio * btn_size), int(small_ratio * btn_size));
device->addButton(BUTTON_NITRO,
w - 1 * col_size, h - 2 * col_size,
btn_size, btn_size);
int(btn_size), int(btn_size));
device->addButton(BUTTON_SKIDDING,
w - 1 * col_size, h - 1 * col_size,
btn_size, btn_size);
int(btn_size), int(btn_size));
device->addButton(BUTTON_FIRE,
w - 2 * col_size, h - 2 * col_size,
btn_size, btn_size);
int(btn_size), int(btn_size));
device->addButton(BUTTON_LOOK_BACKWARDS,
w - 2 * col_size, h - 1 * col_size,
btn_size, btn_size);
int(btn_size), int(btn_size));
} // initMultitouchSteering
@ -945,6 +955,7 @@ void RaceGUI::drawMultitouchSteering(const AbstractKart* kart,
const core::recti &viewport,
const core::vector2df &scaling)
{
#ifndef SERVER_ONLY
MultitouchDevice* device = input_manager->getDeviceManager()->
getMultitouchDevice();
@ -1042,4 +1053,5 @@ void RaceGUI::drawMultitouchSteering(const AbstractKart* kart,
}
}
}
#endif
} // drawMultitouchSteering

View File

@ -305,6 +305,7 @@ void RaceGUIBase::drawPowerupIcons(const AbstractKart* kart,
const core::recti &viewport,
const core::vector2df &scaling)
{
#ifndef SERVER_ONLY
// If player doesn't have any powerups or has completed race, do nothing.
const Powerup* powerup = kart->getPowerup();
if (powerup->getType() == PowerupManager::POWERUP_NOTHING
@ -354,6 +355,7 @@ void RaceGUIBase::drawPowerupIcons(const AbstractKart* kart,
pos, video::SColor(255, 255, 255, 255));
font->setScale(1.0f);
}
#endif
} // drawPowerupIcons
// ----------------------------------------------------------------------------
@ -454,6 +456,7 @@ void RaceGUIBase::addMessage(const core::stringw &msg,
*/
void RaceGUIBase::drawGlobalMusicDescription()
{
#ifndef SERVER_ONLY
// show no music description when it's off
if (!UserConfigParams::m_music) return;
@ -550,6 +553,7 @@ void RaceGUIBase::drawGlobalMusicDescription()
draw2DImage(t, dest, source,
NULL, NULL, true);
#endif
} // drawGlobalMusicDescription
//-----------------------------------------------------------------------------
@ -621,6 +625,7 @@ void RaceGUIBase::drawGlobalReadySetGo()
*/
void RaceGUIBase::drawGlobalPlayerIcons(int bottom_margin)
{
#ifndef SERVER_ONLY
// For now, don't draw player icons when in soccer mode
const RaceManager::MinorRaceModeType minor_mode = race_manager->getMinorMode();
if(minor_mode == RaceManager::MINOR_MODE_SOCCER)
@ -934,6 +939,7 @@ void RaceGUIBase::drawGlobalPlayerIcons(int bottom_margin)
}
} //next position
#endif
} // drawGlobalPlayerIcons
// ----------------------------------------------------------------------------
@ -943,6 +949,7 @@ void RaceGUIBase::drawGlobalPlayerIcons(int bottom_margin)
*/
void RaceGUIBase::drawPlungerInFace(const Camera *camera, float dt)
{
#ifndef SERVER_ONLY
const AbstractKart *kart = camera->getKart();
if (kart->getBlockedByPlungerTime()<=0)
{
@ -1029,4 +1036,5 @@ void RaceGUIBase::drawPlungerInFace(const Camera *camera, float dt)
&viewport /* clip */,
NULL /* color */,
true /* alpha */ );
#endif // !SERVER_ONLY
} // drawPlungerInFace

View File

@ -25,6 +25,9 @@
#include "config/user_config.hpp"
#include "graphics/camera.hpp"
#include "graphics/2dutils.hpp"
#ifndef SERVER_ONLY
#include "graphics/glwrap.hpp"
#endif
#include "graphics/irr_driver.hpp"
#include "graphics/material_manager.hpp"
#include "guiengine/engine.hpp"
@ -137,6 +140,7 @@ RaceGUIOverworld::~RaceGUIOverworld()
*/
void RaceGUIOverworld::renderGlobal(float dt)
{
#ifndef SERVER_ONLY
RaceGUIBase::renderGlobal(dt);
cleanupMessages(dt);
@ -173,6 +177,7 @@ void RaceGUIOverworld::renderGlobal(float dt)
//irr_driver->getVideoDriver()->enableMaterial2D();
m_is_first_render_call = false;
#endif
} // renderGlobal
//-----------------------------------------------------------------------------
@ -208,6 +213,7 @@ void RaceGUIOverworld::renderPlayerView(const Camera *camera, float dt)
*/
void RaceGUIOverworld::drawTrophyPoints()
{
#ifndef SERVER_ONLY
PlayerProfile *player = PlayerManager::getCurrentPlayer();
const int points = player->getPoints();
std::string s = StringUtils::toString(points);
@ -286,7 +292,7 @@ void RaceGUIOverworld::drawTrophyPoints()
font->draw(sw.c_str(), pos, time_color, false, vcenter, NULL, true /* ignore RTL */);
font->disableShadow();
#endif
} // drawTrophyPoints
//-----------------------------------------------------------------------------
@ -294,6 +300,7 @@ void RaceGUIOverworld::drawTrophyPoints()
*/
void RaceGUIOverworld::drawGlobalMiniMap()
{
#ifndef SERVER_ONLY
World *world = World::getWorld();
// arenas currently don't have a map.
if(world->getTrack()->isArena() || world->getTrack()->isSoccer()) return;
@ -534,7 +541,7 @@ void RaceGUIOverworld::drawGlobalMiniMap()
true, true /* vcenter */, NULL);
}
}
#endif // SERVER_ONLY
} // drawGlobalMiniMap
//-----------------------------------------------------------------------------
@ -550,6 +557,7 @@ void RaceGUIOverworld::drawEnergyMeter(int x, int y, const AbstractKart *kart,
const core::recti &viewport,
const core::vector2df &scaling)
{
#ifndef SERVER_ONLY
float state = (float)(kart->getEnergy())
/ kart->getKartProperties()->getNitroMax();
if (state < 0.0f) state = 0.0f;
@ -603,7 +611,7 @@ void RaceGUIOverworld::drawEnergyMeter(int x, int y, const AbstractKart *kart,
&clip, NULL /* colors */, true /* alpha */);
}
#endif
} // drawEnergyMeter
//-----------------------------------------------------------------------------

View File

@ -658,6 +658,7 @@ void RaceResultGUI::backToLobby()
*/
void RaceResultGUI::renderGlobal(float dt)
{
#ifndef SERVER_ONLY
bool isSoccerWorld = race_manager->getMinorMode() == RaceManager::MINOR_MODE_SOCCER;
m_timer += dt;
@ -829,6 +830,7 @@ void RaceResultGUI::backToLobby()
{
displayPostRaceInfo();
}
#endif
} // renderGlobal
//-----------------------------------------------------------------------------
@ -837,6 +839,7 @@ void RaceResultGUI::backToLobby()
*/
void RaceResultGUI::determineGPLayout()
{
#ifndef SERVER_ONLY
unsigned int num_karts = race_manager->getNumberOfKarts();
std::vector<int> old_rank(num_karts, 0);
for (unsigned int kart_id = 0; kart_id < num_karts; kart_id++)
@ -899,6 +902,7 @@ void RaceResultGUI::backToLobby()
int p = race_manager->getKartScore(i);
ri->m_new_overall_points = p;
} // i < num_karts
#endif
} // determineGPLayout
//-----------------------------------------------------------------------------
@ -932,6 +936,7 @@ void RaceResultGUI::backToLobby()
void RaceResultGUI::displayOneEntry(unsigned int x, unsigned int y,
unsigned int n, bool display_points)
{
#ifndef SERVER_ONLY
RowInfo *ri = &(m_all_row_infos[n]);
video::SColor color = ri->m_is_player_kart
? video::SColor(255, 255, 0, 0)
@ -1002,12 +1007,13 @@ void RaceResultGUI::backToLobby()
m_font->draw(point_inc_string, dest_rect, color, false, false, NULL,
true /* ignoreRTL */);
}
#endif
} // displayOneEntry
//-----------------------------------------------------------------------------
void RaceResultGUI::displaySoccerResults()
{
#ifndef SERVER_ONLY
//Draw win text
core::stringw result_text;
static video::SColor color = video::SColor(255, 255, 255, 255);
@ -1176,6 +1182,7 @@ void RaceResultGUI::backToLobby()
draw2DImage(scorer_icon, dest_rect, source_rect,
NULL, NULL, true);
}
#endif
}
//-----------------------------------------------------------------------------
@ -1323,6 +1330,7 @@ void RaceResultGUI::backToLobby()
// ----------------------------------------------------------------------------
void RaceResultGUI::displayPostRaceInfo()
{
#ifndef SERVER_ONLY
// This happens in demo world
if (!World::getWorld())
return;
@ -1440,8 +1448,9 @@ void RaceResultGUI::backToLobby()
GUIEngine::getFont()->draw(best_lap_string,
core::recti(x, current_y, 0, 0), white_color, false, false,
nullptr, true);
}
}
} // if mode has laps
} // if not soccer mode
#endif
}
// ----------------------------------------------------------------------------

View File

@ -42,7 +42,7 @@ CheckCannon::CheckCannon(const XMLNode &node, unsigned int index)
m_curve = new Ipo(*(node.getNode("curve")),
/*fps*/25,
/*reverse*/race_manager->getReverseTrack());
#ifdef DEBUG
#if defined(DEBUG) && !defined(SERVER_ONLY)
if(UserConfigParams::m_track_debug)
{
m_show_curve = new ShowCurve(0.5f, 0.5f);
@ -50,7 +50,7 @@ CheckCannon::CheckCannon(const XMLNode &node, unsigned int index)
for(unsigned int i=0; i<p.size(); i++)
m_show_curve->addPoint(p[i]);
}
#endif
#endif // DEBUG AND !SERVER_ONLY
} // CheckCannon
// ----------------------------------------------------------------------------
@ -60,7 +60,7 @@ CheckCannon::CheckCannon(const XMLNode &node, unsigned int index)
CheckCannon::~CheckCannon()
{
delete m_curve;
#ifdef DEBUG
#if defined(DEBUG) && !defined(SERVER_ONLY)
if(UserConfigParams::m_track_debug)
delete m_show_curve;
#endif

View File

@ -72,6 +72,7 @@ CheckLine::CheckLine(const XMLNode &node, unsigned int index)
m_line.setLine(p1, p2);
if(UserConfigParams::m_check_debug)
{
#ifndef SERVER_ONLY
video::SMaterial material;
material.setFlag(video::EMF_BACK_FACE_CULLING, false);
material.setFlag(video::EMF_LIGHTING, false);
@ -109,6 +110,7 @@ CheckLine::CheckLine(const XMLNode &node, unsigned int index)
//mesh->setBoundingBox(buffer->getBoundingBox());
m_debug_node = irr_driver->addMesh(mesh, "checkdebug");
mesh->drop();
#endif
}
else
{
@ -150,7 +152,9 @@ void CheckLine::changeDebugColor(bool is_active)
{
vertices[i].Color = color;
}
#ifndef SERVER_ONLY
buffer->getMaterial().setTexture(0, getUnicolorTexture(color));
#endif
} // changeDebugColor

View File

@ -101,6 +101,7 @@ void Graph::cleanupDebugMesh()
void Graph::createMesh(bool show_invisible, bool enable_transparency,
const video::SColor *track_color)
{
#ifndef SERVER_ONLY
// The debug track will not be lighted or culled.
video::SMaterial m;
m.BackfaceCulling = false;
@ -229,6 +230,7 @@ void Graph::createMesh(bool show_invisible, bool enable_transparency,
delete[] ind;
delete[] new_v;
#endif
} // createMesh
// -----------------------------------------------------------------------------
@ -245,9 +247,9 @@ RenderTarget* Graph::makeMiniMap(const core::dimension2du &dimension,
World::getWorld()
->setClearbackBufferColor(video::SColor(0, 255, 255, 255));
World::getWorld()->forceFogDisabled(true);
#ifndef SERVER_ONLY
m_render_target = irr_driver->createRenderTarget(dimension, name);
#endif
irr_driver->getSceneManager()
->setAmbientLight(video::SColor(255, 255, 255, 255));

View File

@ -35,7 +35,7 @@ using namespace irr;
ModelDefinitionLoader::ModelDefinitionLoader(Track* track)
{
m_track = track;
}
} // ModelDefinitionLoader
// ----------------------------------------------------------------------------
@ -54,12 +54,13 @@ void ModelDefinitionLoader::addModelDefinition(const XMLNode* xml)
xml->get("model", &model_name);
m_lod_groups[lodgroup].push_back(ModelDefinition(xml, (int)lod_distance, model_name, false, skeletal_animation));
}
} // addModelDefinition
// ----------------------------------------------------------------------------
LODNode* ModelDefinitionLoader::instanciateAsLOD(const XMLNode* node, scene::ISceneNode* parent, RenderInfo* ri)
{
#ifndef SERVER_ONLY
scene::ISceneManager* sm = irr_driver->getSceneManager();
std::string groupname = "";
@ -142,21 +143,24 @@ LODNode* ModelDefinitionLoader::instanciateAsLOD(const XMLNode* node, scene::ISc
Log::warn("ModelDefinitionLoader", "LOD group '%s' is empty", groupname.c_str());
return NULL;
}
}
#else
return NULL;
#endif
} // instanciateAsLOD
// ----------------------------------------------------------------------------
void ModelDefinitionLoader::clear()
{
m_lod_groups.clear();
}
} // clear
// ----------------------------------------------------------------------------
scene::IMesh* ModelDefinitionLoader::getFirstMeshFor(const std::string& name)
{
return irr_driver->getMesh(m_lod_groups[name][0].m_model_file);
}
} // getFirstMeshFor
// ----------------------------------------------------------------------------
@ -170,4 +174,4 @@ void ModelDefinitionLoader::cleanLibraryNodesAfterLoad()
file_manager->popTextureSearchPath();
file_manager->popModelSearchPath();
}
}
} // cleanLibraryNodesAfterLoad

View File

@ -280,11 +280,13 @@ void Track::cleanup()
{
Graph::destroy();
ItemManager::destroy();
#ifndef SERVER_ONLY
VAOManager::kill();
ParticleKindManager::get()->cleanUpTrackSpecificGfx();
// Clear reminder of transformed textures
resetTextureTable();
#endif
// Clear reminder of the link between textures and file names.
irr_driver->clearTexturesFileName();
@ -320,16 +322,20 @@ void Track::cleanup()
m_object_physics_only_nodes.clear();
irr_driver->removeNode(m_sun);
#ifndef SERVER_ONLY
if (CVS->isGLSL())
m_sun->drop();
#endif
delete m_track_mesh;
m_track_mesh = NULL;
delete m_gfx_effect_mesh;
m_gfx_effect_mesh = NULL;
#ifndef SERVER_ONLY
if (CVS->isGLSL())
irr_driver->cleanSunInterposer();
#endif
// The m_all_cached_mesh contains each mesh loaded from a file, which
@ -787,12 +793,16 @@ void Track::createPhysicsModel(unsigned int main_track_count)
}
// Color
#ifndef SERVER_ONLY
mb->getMaterial().setTexture(0, getUnicolorTexture(video::SColor(255, 255, 105, 180)));
#endif
irr_driver->grabAllTextures(mesh);
// Gloss
#ifndef SERVER_ONLY
mb->getMaterial().setTexture(1, getUnicolorTexture(video::SColor(0, 0, 0, 0)));
// Colorization mask
mb->getMaterial().setTexture(7, getUnicolorTexture(video::SColor(0, 0, 0, 0)));
#endif
}
else
irr_driver->removeNode(m_static_physics_only_nodes[i]);
@ -1029,6 +1039,7 @@ void Track::convertTrackToBullet(scene::ISceneNode *node)
void Track::loadMinimap()
{
#ifndef SERVER_ONLY
//Check whether the hardware can do nonsquare or
// non power-of-two textures
video::IVideoDriver* const video_driver = irr_driver->getVideoDriver();
@ -1055,6 +1066,7 @@ void Track::loadMinimap()
m_minimap_y_scale = float(m_mini_map_size.Height) / float(mini_map_texture_size.Height);
else
m_minimap_y_scale = 0;
#endif
} // loadMinimap
// ----------------------------------------------------------------------------
@ -1122,10 +1134,13 @@ bool Track::loadMainTrack(const XMLNode &root)
scene::CBatchingMesh *merged_mesh = new scene::CBatchingMesh();
merged_mesh->addMesh(mesh);
merged_mesh->finalize();
#ifndef SERVER_ONLY
scene::IMesh* tangent_mesh = MeshTools::createMeshWithTangents(merged_mesh, &MeshTools::isNormalMap);
adjustForFog(tangent_mesh, NULL);
#else
scene::IMesh* tangent_mesh = merged_mesh;
#endif
// The merged mesh is grabbed by the octtree, so we don't need
// to keep a reference to it.
@ -1243,8 +1258,9 @@ bool Track::loadMainTrack(const XMLNode &root)
full_path.c_str());
continue;
}
#ifndef SERVER_ONLY
a_mesh = MeshTools::createMeshWithTangents(a_mesh, &MeshTools::isNormalMap);
#endif
// The meshes loaded here are in irrlicht's mesh cache. So we
// have to keep track of them in order to properly remove them
@ -1753,6 +1769,7 @@ void Track::loadTrackModel(bool reverse_track, unsigned int mode_id)
// It's important to execute this BEFORE the code that creates the skycube,
// otherwise the skycube node could be modified to have fog enabled, which
// we don't want
#ifndef SERVER_ONLY
if (m_use_fog && Camera::getDefaultCameraType()!=Camera::CM_TYPE_DEBUG &&
!CVS->isGLSL())
{
@ -1763,6 +1780,7 @@ void Track::loadTrackModel(bool reverse_track, unsigned int mode_id)
m_fog_start, m_fog_end,
1.0f);
}
#endif
// Enable for for all track nodes if fog is used
const unsigned int count = (int)m_all_nodes.size();
@ -1830,6 +1848,7 @@ void Track::loadTrackModel(bool reverse_track, unsigned int mode_id)
const video::SColorf tmpf(m_sun_diffuse_color);
m_sun = irr_driver->addLight(m_sun_position, 0., 0., tmpf.r, tmpf.g, tmpf.b, true);
#ifndef SERVER_ONLY
if (!CVS->isGLSL())
{
scene::ILightSceneNode *sun = (scene::ILightSceneNode *) m_sun;
@ -1852,6 +1871,7 @@ void Track::loadTrackModel(bool reverse_track, unsigned int mode_id)
irr_driver->createSunInterposer();
m_sun->grab();
}
#endif
createPhysicsModel(main_track_count);

View File

@ -363,6 +363,7 @@ TrackObjectPresentationMesh::TrackObjectPresentationMesh(
throw std::runtime_error("Model '" + model_name + "' cannot be found");
}
#ifndef SERVER_ONLY
if (!animated)
{
m_mesh = MeshTools::createMeshWithTangents(m_mesh,
@ -378,6 +379,7 @@ TrackObjectPresentationMesh::TrackObjectPresentationMesh(
&MeshTools::isNormalMap);
}
}
#endif
init(&xml_node, parent, enabled);
} // TrackObjectPresentationMesh
@ -416,6 +418,7 @@ TrackObjectPresentationMesh::TrackObjectPresentationMesh(
m_model_file = model_file;
file_manager->pushTextureSearchPath(StringUtils::getPath(model_file));
#ifndef SERVER_ONLY
if (file_manager->fileExists(model_file))
{
if (animated)
@ -435,6 +438,7 @@ TrackObjectPresentationMesh::TrackObjectPresentationMesh(
irr_driver->getMesh(model_file), &MeshTools::isNormalMap);
}
}
#endif
if (!m_mesh)
{
@ -534,9 +538,11 @@ void TrackObjectPresentationMesh::init(const XMLNode* xml_node,
m_node = irr_driver->addMesh(m_mesh, m_model_file, parent, m_render_info);
#ifndef SERVER_ONLY
STKMeshSceneNode* stkmesh = dynamic_cast<STKMeshSceneNode*>(m_node);
if (displacing && stkmesh != NULL)
stkmesh->setIsDisplacement(displacing);
#endif
m_frame_start = 0;
m_frame_end = 0;
@ -857,7 +863,6 @@ TrackObjectPresentationParticles::TrackObjectPresentationParticles(
{
m_emitter = NULL;
m_lod_emitter_node = NULL;
std::string path;
xml_node.get("kind", &path);
@ -871,6 +876,7 @@ TrackObjectPresentationParticles::TrackObjectPresentationParticles(
m_delayed_stop = false;
m_delayed_stop_time = 0.0;
#ifndef SERVER_ONLY
try
{
ParticleKind* kind = ParticleKindManager::get()->getParticles(path);
@ -907,6 +913,7 @@ TrackObjectPresentationParticles::TrackObjectPresentationParticles(
Log::warn ("Track", "Could not load particles '%s'; cause :\n %s",
path.c_str(), e.what());
}
#endif
} // TrackObjectPresentationParticles
// ----------------------------------------------------------------------------
@ -945,20 +952,24 @@ void TrackObjectPresentationParticles::update(float dt)
// ----------------------------------------------------------------------------
void TrackObjectPresentationParticles::triggerParticles()
{
#ifndef SERVER_ONLY
if (m_emitter != NULL)
{
m_emitter->setCreationRateAbsolute(1.0f);
m_emitter->setParticleType(m_emitter->getParticlesInfo());
}
#endif
} // triggerParticles
// ----------------------------------------------------------------------------
void TrackObjectPresentationParticles::stop()
{
#ifndef SERVER_ONLY
if (m_emitter != NULL)
{
m_emitter->setCreationRateAbsolute(0.0f);
m_emitter->clearParticles();
}
#endif
}
// ----------------------------------------------------------------------------
void TrackObjectPresentationParticles::stopIn(double delay)
@ -969,12 +980,15 @@ void TrackObjectPresentationParticles::stopIn(double delay)
// ----------------------------------------------------------------------------
void TrackObjectPresentationParticles::setRate(float rate)
{
#ifndef SERVER_ONLY
if (m_emitter != NULL)
{
m_emitter->setCreationRateAbsolute(rate);
m_emitter->setParticleType(m_emitter->getParticlesInfo());
}
}
#endif
} // setRate
// ----------------------------------------------------------------------------
TrackObjectPresentationLight::TrackObjectPresentationLight(
const XMLNode& xml_node,
@ -990,7 +1004,7 @@ TrackObjectPresentationLight::TrackObjectPresentationLight(
m_distance = 20.f * m_energy;
xml_node.get("distance", &m_distance);
#ifndef SERVER_ONLY
if (CVS->isGLSL())
{
m_node = irr_driver->addLight(m_init_xyz, m_energy, m_distance,
@ -998,6 +1012,7 @@ TrackObjectPresentationLight::TrackObjectPresentationLight(
parent);
}
else
#endif
{
m_node = NULL; // lights require shaders to work
}

View File

@ -234,8 +234,10 @@ bool handleContextMenuAction(s32 cmd_id)
switch(cmd_id)
{
case DEBUG_GRAPHICS_RELOAD_SHADERS:
#ifndef SERVER_ONLY
Log::info("Debug", "Reloading shaders...");
ShaderBase::updateShaders();
#endif
break;
case DEBUG_GRAPHICS_RESET:
if (physics)

View File

@ -17,11 +17,13 @@
#include "profiler.hpp"
#include "graphics/glwrap.hpp"
#include "graphics/irr_driver.hpp"
#include "graphics/2dutils.hpp"
#include "guiengine/event_handler.hpp"
#include "guiengine/engine.hpp"
#include "graphics/irr_driver.hpp"
#include "guiengine/scalable_font.hpp"
#include "io/file_manager.hpp"
#include "utils/vs.hpp"
#include <assert.h>
@ -266,6 +268,7 @@ void Profiler::synchronizeFrame()
/// Draw the markers
void Profiler::draw()
{
#ifndef SERVER_ONLY
PROFILER_PUSH_CPU_MARKER("ProfilerDraw", 0xFF, 0xFF, 0x00);
video::IVideoDriver* driver = irr_driver->getVideoDriver();
std::stack<Marker> hovered_markers;
@ -372,7 +375,9 @@ void Profiler::draw()
unsigned int gpu_timers[Q_LAST];
for (unsigned i = 0; i < Q_LAST; i++)
{
#ifndef SERVER_ONLY
gpu_timers[i] = irr_driver->getGPUTimer(i).elapsedTimeus();
#endif
total += gpu_timers[i];
}
@ -466,6 +471,7 @@ void Profiler::draw()
}
PROFILER_POP_CPU_MARKER();
#endif
}
//-----------------------------------------------------------------------------
@ -506,6 +512,7 @@ void Profiler::onClick(const core::vector2di& mouse_pos)
/// Helper to draw a white background
void Profiler::drawBackground()
{
#ifndef SERVER_ONLY
video::IVideoDriver* driver = irr_driver->getVideoDriver();
const core::dimension2d<u32>& screen_size = driver->getScreenSize();
@ -516,4 +523,5 @@ void Profiler::drawBackground()
video::SColor color(0x88, 0xFF, 0xFF, 0xFF);
GL32_draw2DRectangle(color, background_rect);
#endif
}