Fix no graphics and server only run

This commit is contained in:
Benau 2018-01-10 11:35:02 +08:00
parent 54c7914cb5
commit f4fb2cb41c
30 changed files with 156 additions and 125 deletions

View File

@ -62,27 +62,11 @@ extern "C" {
#define GL_BGRA 0x80E1 #define GL_BGRA 0x80E1
#define GL_BGR 0x80E0 #define GL_BGR 0x80E0
#define GL_FRAMEBUFFER_COMPLETE_EXT GL_FRAMEBUFFER_COMPLETE #define GL_FRAMEBUFFER_COMPLETE_EXT GL_FRAMEBUFFER_COMPLETE
// The glDrawElementsBaseVertex is available only in OpenGL ES 3.2. At this
// stage the 'basevertex' argument is always equal to 0 because features that
// use it are disabled in OpenGL ES renderer. We can simply use glDrawElements
// instead.
inline void glDrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type,
GLvoid *indices, GLint basevertex)
{
glDrawElements(mode, count, type, indices);
}
#endif #endif
struct DrawElementsIndirectCommand{
GLuint count;
GLuint instanceCount;
GLuint firstIndex;
GLuint baseVertex;
GLuint baseInstance;
};
#else #else
typedef unsigned int GLuint; typedef unsigned int GLuint;
typedef int GLint;
typedef unsigned int GLsync; typedef unsigned int GLsync;
typedef unsigned int GLenum; typedef unsigned int GLenum;

View File

@ -1167,8 +1167,7 @@ scene::IParticleSystemSceneNode *IrrDriver::addParticleNode(bool default_emitter
scene::ISceneNode *IrrDriver::addMesh(scene::IMesh *mesh, scene::ISceneNode *IrrDriver::addMesh(scene::IMesh *mesh,
const std::string& debug_name, const std::string& debug_name,
scene::ISceneNode *parent, scene::ISceneNode *parent,
std::shared_ptr<RenderInfo> render_info, std::shared_ptr<RenderInfo> render_info)
bool all_parts_colorized)
{ {
#ifdef SERVER_ONLY #ifdef SERVER_ONLY
return m_scene_manager->addMeshSceneNode(mesh, parent); return m_scene_manager->addMeshSceneNode(mesh, parent);
@ -1389,7 +1388,7 @@ void IrrDriver::removeTexture(video::ITexture *t)
*/ */
scene::IAnimatedMeshSceneNode *IrrDriver::addAnimatedMesh(scene::IAnimatedMesh *mesh, scene::IAnimatedMeshSceneNode *IrrDriver::addAnimatedMesh(scene::IAnimatedMesh *mesh,
const std::string& debug_name, scene::ISceneNode* parent, const std::string& debug_name, scene::ISceneNode* parent,
std::shared_ptr<RenderInfo> render_info, bool all_parts_colorized) std::shared_ptr<RenderInfo> render_info)
{ {
scene::IAnimatedMeshSceneNode* node; scene::IAnimatedMeshSceneNode* node;
#ifndef SERVER_ONLY #ifndef SERVER_ONLY
@ -1610,7 +1609,9 @@ void IrrDriver::onLoadWorld()
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void IrrDriver::onUnloadWorld() void IrrDriver::onUnloadWorld()
{ {
#ifndef SERVER_ONLY
m_renderer->onUnloadWorld(); m_renderer->onUnloadWorld();
#endif
} // onUnloadWorld } // onUnloadWorld
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -1810,8 +1811,12 @@ void IrrDriver::update(float dt)
m_wind->update(); m_wind->update();
PropertyAnimator::get()->update(dt); PropertyAnimator::get()->update(dt);
SP::SPTextureManager::get()->checkForGLCommand(); #ifndef SERVER_ONLY
if (CVS->isGLSL())
{
SP::SPTextureManager::get()->checkForGLCommand();
}
#endif
World *world = World::getWorld(); World *world = World::getWorld();
if (world) if (world)

View File

@ -245,8 +245,7 @@ public:
scene::ISceneNode* addMesh(scene::IMesh *mesh, scene::ISceneNode* addMesh(scene::IMesh *mesh,
const std::string& debug_name, const std::string& debug_name,
scene::ISceneNode *parent = NULL, scene::ISceneNode *parent = NULL,
std::shared_ptr<RenderInfo> render_info = nullptr, std::shared_ptr<RenderInfo> render_info = nullptr);
bool all_parts_colorized = false);
PerCameraNode *addPerCameraNode(scene::ISceneNode* node, PerCameraNode *addPerCameraNode(scene::ISceneNode* node,
scene::ICameraSceneNode* cam, scene::ICameraSceneNode* cam,
scene::ISceneNode *parent = NULL); scene::ISceneNode *parent = NULL);
@ -268,8 +267,7 @@ public:
*addAnimatedMesh(scene::IAnimatedMesh *mesh, *addAnimatedMesh(scene::IAnimatedMesh *mesh,
const std::string& debug_name, const std::string& debug_name,
scene::ISceneNode* parent = NULL, scene::ISceneNode* parent = NULL,
std::shared_ptr<RenderInfo> render_info = nullptr, std::shared_ptr<RenderInfo> render_info = nullptr);
bool all_parts_colorized = false);
scene::ICameraSceneNode scene::ICameraSceneNode
*addCameraSceneNode(); *addCameraSceneNode();
Camera *addCamera(unsigned int index, AbstractKart *kart); Camera *addCamera(unsigned int index, AbstractKart *kart);

View File

@ -28,23 +28,22 @@
#include "config/user_config.hpp" #include "config/user_config.hpp"
#include "config/stk_config.hpp" #include "config/stk_config.hpp"
#include "guiengine/engine.hpp" #include "guiengine/engine.hpp"
#include "graphics/callbacks.hpp"
#include "graphics/central_settings.hpp" #include "graphics/central_settings.hpp"
#include "graphics/irr_driver.hpp" #include "graphics/irr_driver.hpp"
#include "graphics/particle_kind_manager.hpp" #include "graphics/particle_kind_manager.hpp"
#include "graphics/shaders.hpp" #include "graphics/shaders.hpp"
#include "graphics/stk_tex_manager.hpp" #include "graphics/stk_tex_manager.hpp"
#include "io/file_manager.hpp" #include "io/file_manager.hpp"
#include "race/race_manager.hpp"
#include "io/xml_node.hpp" #include "io/xml_node.hpp"
#include "utils/string_utils.hpp" #include "modes/profile_world.hpp"
#include "race/race_manager.hpp"
#include "tracks/track.hpp" #include "tracks/track.hpp"
#include "utils/string_utils.hpp"
#include "utils/log.hpp" #include "utils/log.hpp"
#include "utils/vs.hpp" #include "utils/vs.hpp"
#include <IMaterialRendererServices.h> #include <IMaterialRendererServices.h>
#include <ISceneNode.h> #include <ISceneNode.h>
#include <IShaderConstantSetCallBack.h>
using namespace irr::video; using namespace irr::video;
@ -465,7 +464,7 @@ Material::Material(const XMLNode *node, bool deprecated)
} }
#ifndef SERVER_ONLY #ifndef SERVER_ONLY
if (!CVS->isDefferedEnabled()) if (ProfileWorld::isNoGraphics() || !CVS->isDefferedEnabled())
{ {
for (int i = 2; i < 6; i++) for (int i = 2; i < 6; i++)
{ {

View File

@ -15,6 +15,8 @@
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef SERVER_ONLY
#include "graphics/sp/sp_base.hpp" #include "graphics/sp/sp_base.hpp"
#include "config/stk_config.hpp" #include "config/stk_config.hpp"
#include "config/user_config.hpp" #include "config/user_config.hpp"
@ -109,17 +111,12 @@ unsigned g_skinning_offset = 0;
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
std::vector<SPMeshNode*> g_skinning_mesh; std::vector<SPMeshNode*> g_skinning_mesh;
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
bool sp_vc_srgb_cor = true;
// ----------------------------------------------------------------------------
int sp_cur_shadow_cascade = 0; int sp_cur_shadow_cascade = 0;
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
bool sp_null_device = false;
// ----------------------------------------------------------------------------
void initSTKRenderer(ShaderBasedRenderer* sbr) void initSTKRenderer(ShaderBasedRenderer* sbr)
{ {
g_stk_sbr = sbr; g_stk_sbr = sbr;
} // initSTKRenderer } // initSTKRenderer
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
GLuint sp_mat_ubo[MAX_PLAYER_COUNT][3] = {}; GLuint sp_mat_ubo[MAX_PLAYER_COUNT][3] = {};
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -133,8 +130,6 @@ GLuint g_skinning_buf;
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
unsigned g_skinning_size; unsigned g_skinning_size;
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
#ifndef SERVER_ONLY
// ----------------------------------------------------------------------------
void shadowCascadeUniformAssigner(SPUniformAssigner* ua) void shadowCascadeUniformAssigner(SPUniformAssigner* ua)
{ {
ua->setValue(sp_cur_shadow_cascade); ua->setValue(sp_cur_shadow_cascade);
@ -200,8 +195,6 @@ void ghostUse()
glBlendEquation(GL_FUNC_ADD); glBlendEquation(GL_FUNC_ADD);
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
} // ghostUse } // ghostUse
#endif
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void displaceUniformAssigner(SP::SPUniformAssigner* ua) void displaceUniformAssigner(SP::SPUniformAssigner* ua)
@ -276,13 +269,12 @@ void resizeSkinning(unsigned number)
glTexBuffer(GL_TEXTURE_BUFFER, GL_RGBA32F, g_skinning_buf); glTexBuffer(GL_TEXTURE_BUFFER, GL_RGBA32F, g_skinning_buf);
glBindTexture(GL_TEXTURE_BUFFER, 0); glBindTexture(GL_TEXTURE_BUFFER, 0);
#endif #endif
} // resizeSkinning } // resizeSkinning
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void initSkinning() void initSkinning()
{ {
#ifndef SERVER_ONLY
static_assert(sizeof(std::array<float, 16>) == 64, "No padding"); static_assert(sizeof(std::array<float, 16>) == 64, "No padding");
int max_size = 0; int max_size = 0;
@ -320,9 +312,8 @@ void initSkinning()
glGenBuffers(1, &g_skinning_buf); glGenBuffers(1, &g_skinning_buf);
#endif #endif
resizeSkinning(stk_config->m_max_skinning_bones); resizeSkinning(stk_config->m_max_skinning_bones);
#endif
sp_prefilled_tex[1] = g_skinning_tex;
sp_prefilled_tex[1] = g_skinning_tex;
} // initSkinning } // initSkinning
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -785,11 +776,16 @@ void loadShaders()
addShader(shader); addShader(shader);
} }
#endif #endif
} // loadShaders } // loadShaders
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void resetEmptyFogColor() void resetEmptyFogColor()
{ {
if (ProfileWorld::isNoGraphics())
{
return;
}
glBindBuffer(GL_UNIFORM_BUFFER, sp_fog_ubo); glBindBuffer(GL_UNIFORM_BUFFER, sp_fog_ubo);
std::vector<float> fog_empty; std::vector<float> fog_empty;
fog_empty.resize(8, 0.0f); fog_empty.resize(8, 0.0f);
@ -804,7 +800,6 @@ void init()
{ {
return; return;
} }
#ifndef SERVER_ONLY
initSkinning(); initSkinning();
for (unsigned i = 0; i < MAX_PLAYER_COUNT; i++) for (unsigned i = 0; i < MAX_PLAYER_COUNT; i++)
@ -958,17 +953,11 @@ void init()
} }
loadShaders(); loadShaders();
#endif
} // init } // init
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void destroy() void destroy()
{ {
if (sp_null_device)
{
return;
}
g_dy_dc.clear(); g_dy_dc.clear();
for (auto& p : g_shaders) for (auto& p : g_shaders)
{ {
@ -977,7 +966,6 @@ void destroy()
g_shaders.clear(); g_shaders.clear();
SPTextureManager::destroy(); SPTextureManager::destroy();
#ifndef SERVER_ONLY
#ifndef USE_GLES2 #ifndef USE_GLES2
if (CVS->isARBBufferStorageUsable()) if (CVS->isARBBufferStorageUsable())
@ -999,7 +987,7 @@ void destroy()
} }
glDeleteBuffers(1, &sp_fog_ubo); glDeleteBuffers(1, &sp_fog_ubo);
glDeleteSamplers((unsigned)g_samplers.size() - 1, g_samplers.data()); glDeleteSamplers((unsigned)g_samplers.size() - 1, g_samplers.data());
#endif
} // destroy } // destroy
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -1145,7 +1133,6 @@ void prepareDrawCalls()
// 1st one is identity // 1st one is identity
g_skinning_offset = 1; g_skinning_offset = 1;
g_skinning_mesh.clear(); g_skinning_mesh.clear();
#ifndef SERVER_ONLY
mathPlaneFrustumf(g_frustums[0], irr_driver->getProjViewMatrix()); mathPlaneFrustumf(g_frustums[0], irr_driver->getProjViewMatrix());
g_handle_shadow = Track::getCurrentTrack() && g_handle_shadow = Track::getCurrentTrack() &&
Track::getCurrentTrack()->hasShadows() && CVS->isDefferedEnabled() && Track::getCurrentTrack()->hasShadows() && CVS->isDefferedEnabled() &&
@ -1173,7 +1160,6 @@ void prepareDrawCalls()
} }
g_glow_meshes.clear(); g_glow_meshes.clear();
g_instances.clear(); g_instances.clear();
#endif
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -1183,7 +1169,7 @@ void addObject(SPMeshNode* node)
{ {
return; return;
} }
#ifndef SERVER_ONLY
if (node->getSPM() == NULL) if (node->getSPM() == NULL)
{ {
return; return;
@ -1364,13 +1350,11 @@ void addObject(SPMeshNode* node)
g_instances.insert(mb); g_instances.insert(mb);
} }
} }
#endif
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void handleDynamicDrawCall() void handleDynamicDrawCall()
{ {
#ifndef SERVER_ONLY
for (unsigned dc_num = 0; dc_num < g_dy_dc.size(); dc_num++) for (unsigned dc_num = 0; dc_num < g_dy_dc.size(); dc_num++)
{ {
SPDynamicDrawCall* dydc = g_dy_dc[dc_num].get(); SPDynamicDrawCall* dydc = g_dy_dc[dc_num].get();
@ -1501,7 +1485,6 @@ void handleDynamicDrawCall()
} }
} }
} }
#endif
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -1587,7 +1570,6 @@ void updateModelMatrix()
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void uploadSkinningMatrices() void uploadSkinningMatrices()
{ {
#ifndef SERVER_ONLY
if (g_skinning_mesh.empty()) if (g_skinning_mesh.empty())
{ {
return; return;
@ -1625,14 +1607,11 @@ void uploadSkinningMatrices()
glBindBuffer(GL_TEXTURE_BUFFER, 0); glBindBuffer(GL_TEXTURE_BUFFER, 0);
} }
#endif #endif
#endif
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void uploadAll() void uploadAll()
{ {
#ifndef SERVER_ONLY
uploadSkinningMatrices(); uploadSkinningMatrices();
glBindBuffer(GL_UNIFORM_BUFFER, glBindBuffer(GL_UNIFORM_BUFFER,
sp_mat_ubo[sp_cur_player][sp_cur_buf_id[sp_cur_player]]); sp_mat_ubo[sp_cur_player][sp_cur_buf_id[sp_cur_player]]);
@ -1656,14 +1635,11 @@ void uploadAll()
{ {
return dc->isRemoving(); return dc->isRemoving();
}), g_dy_dc.end()); }), g_dy_dc.end());
#endif
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void drawNormal() void drawNormal()
{ {
#ifndef SERVER_ONLY
SPShader* nv = getSPShader("sp_normal_visualizer"); SPShader* nv = getSPShader("sp_normal_visualizer");
if (nv == NULL) if (nv == NULL)
{ {
@ -1704,13 +1680,11 @@ void drawNormal()
} }
} }
nv->unuse(); nv->unuse();
#endif
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void drawGlow() void drawGlow()
{ {
#ifndef SERVER_ONLY
g_glow_shader->use(); g_glow_shader->use();
SPUniformAssigner* glow_color_assigner = SPUniformAssigner* glow_color_assigner =
g_glow_shader->getUniformAssigner("col"); g_glow_shader->getUniformAssigner("col");
@ -1724,13 +1698,11 @@ void drawGlow()
} }
} }
g_glow_shader->unuse(); g_glow_shader->unuse();
#endif
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void draw(RenderPass rp, DrawCallType dct) void draw(RenderPass rp, DrawCallType dct)
{ {
#ifndef SERVER_ONLY
std::stringstream profiler_name; std::stringstream profiler_name;
profiler_name << "SP::Draw " << dct << " with " << rp; profiler_name << "SP::Draw " << dct << " with " << rp;
PROFILER_PUSH_CPU_MARKER(profiler_name.str().c_str(), PROFILER_PUSH_CPU_MARKER(profiler_name.str().c_str(),
@ -1782,13 +1754,11 @@ void draw(RenderPass rp, DrawCallType dct)
p.first->unuse(rp); p.first->unuse(rp);
} }
PROFILER_POP_CPU_MARKER(); PROFILER_POP_CPU_MARKER();
#endif
} // draw } // draw
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void drawBoundingBoxes() void drawBoundingBoxes()
{ {
#ifndef SERVER_ONLY
Shaders::ColoredLine *line = Shaders::ColoredLine::getInstance(); Shaders::ColoredLine *line = Shaders::ColoredLine::getInstance();
line->use(); line->use();
line->bindVertexArray(); line->bindVertexArray();
@ -1802,7 +1772,6 @@ void drawBoundingBoxes()
glBufferSubData(GL_ARRAY_BUFFER, 0, count * sizeof(float), &tmp[i]); glBufferSubData(GL_ARRAY_BUFFER, 0, count * sizeof(float), &tmp[i]);
glDrawArrays(GL_LINES, 0, count / 3); glDrawArrays(GL_LINES, 0, count / 3);
} }
#endif
} // drawBoundingBoxes } // drawBoundingBoxes
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -1851,3 +1820,5 @@ SPMesh* convertEVTStandard(irr::scene::IMesh* mesh,
} // convertEVTStandard } // convertEVTStandard
} }
#endif

View File

@ -91,7 +91,6 @@ extern std::vector<GLuint> sp_prefilled_tex;
extern unsigned sp_solid_poly_count; extern unsigned sp_solid_poly_count;
extern unsigned sp_shadow_poly_count; extern unsigned sp_shadow_poly_count;
extern int sp_cur_shadow_cascade; extern int sp_cur_shadow_cascade;
extern bool sp_null_device;
extern bool sp_culling; extern bool sp_culling;
extern unsigned sp_cur_player; extern unsigned sp_cur_player;
extern unsigned sp_cur_buf_id[MAX_PLAYER_COUNT]; extern unsigned sp_cur_buf_id[MAX_PLAYER_COUNT];

View File

@ -484,6 +484,7 @@ void SPMeshBuffer::uploadInstanceData()
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void SPMeshBuffer::enableTextureMatrix(unsigned mat_id) void SPMeshBuffer::enableTextureMatrix(unsigned mat_id)
{ {
#ifndef SERVER_ONLY
assert(mat_id < m_stk_material.size()); assert(mat_id < m_stk_material.size());
// Make the 31 bit in normal to be 1 // Make the 31 bit in normal to be 1
uploadGLMesh(); uploadGLMesh();
@ -513,6 +514,7 @@ void SPMeshBuffer::enableTextureMatrix(unsigned mat_id)
} }
} }
glBindBuffer(GL_ARRAY_BUFFER, 0); glBindBuffer(GL_ARRAY_BUFFER, 0);
#endif
} // enableTextureMatrix } // enableTextureMatrix
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@ -112,6 +112,7 @@ public:
virtual void draw(DrawCallType dct = DCT_NORMAL, int material_id = -1, virtual void draw(DrawCallType dct = DCT_NORMAL, int material_id = -1,
bool bindless_texture = false) const bool bindless_texture = false) const
{ {
#ifndef SERVER_ONLY
glBindVertexArray(m_vao[dct]); glBindVertexArray(m_vao[dct]);
if (material_id == -1 || bindless_texture) if (material_id == -1 || bindless_texture)
{ {
@ -142,6 +143,7 @@ public:
(void*)(std::get<0>(m_stk_material[material_id]) << 1), (void*)(std::get<0>(m_stk_material[material_id]) << 1),
(unsigned)m_ins_dat[dct].size()); (unsigned)m_ins_dat[dct].size());
} }
#endif
} }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
virtual void uploadGLMesh(); virtual void uploadGLMesh();

View File

@ -178,6 +178,7 @@ int SPMeshNode::getTotalJoints() const
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
SPShader* SPMeshNode::getShader(unsigned mesh_buffer_id) const SPShader* SPMeshNode::getShader(unsigned mesh_buffer_id) const
{ {
#ifndef SERVER_ONLY
if (!m_mesh || mesh_buffer_id < m_mesh->getMeshBufferCount()) if (!m_mesh || mesh_buffer_id < m_mesh->getMeshBufferCount())
{ {
const std::string sn = (m_shader_override.empty() ? const std::string sn = (m_shader_override.empty() ?
@ -197,6 +198,7 @@ SPShader* SPMeshNode::getShader(unsigned mesh_buffer_id) const
} }
return shader; return shader;
} }
#endif
return NULL; return NULL;
} // getShader } // getShader

View File

@ -86,6 +86,11 @@ SPTexture::SPTexture(const std::string& path, Material* m, bool undo_srgb,
cache_subdir + container_id; cache_subdir + container_id;
file_manager->checkAndCreateDirectoryP(m_cache_directory); file_manager->checkAndCreateDirectoryP(m_cache_directory);
} }
if (m_cache_directory.empty())
{
Log::warn("SPTexture", "Missing container info for %s, no texture"
" compression cache.", m_path.c_str());
}
#endif #endif
} // SPTexture } // SPTexture
@ -119,7 +124,7 @@ SPTexture::SPTexture(bool white, int ta_idx)
SPTexture::~SPTexture() SPTexture::~SPTexture()
{ {
#ifndef SERVER_ONLY #ifndef SERVER_ONLY
#ifndef USE_GLES2 #if !(defined(SERVER_ONLY) || defined(USE_GLES2))
if (m_texture_handle != 0 && CVS->isARBBindlessTextureUsable()) if (m_texture_handle != 0 && CVS->isARBBindlessTextureUsable())
{ {
glMakeTextureHandleNonResidentARB(m_texture_handle); glMakeTextureHandleNonResidentARB(m_texture_handle);
@ -135,7 +140,7 @@ SPTexture::~SPTexture()
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void SPTexture::addTextureHandle() void SPTexture::addTextureHandle()
{ {
#ifndef USE_GLES2 #if !(defined(SERVER_ONLY) || defined(USE_GLES2))
if (CVS->isARBBindlessTextureUsable()) if (CVS->isARBBindlessTextureUsable())
{ {
m_texture_handle = glGetTextureSamplerHandleARB(m_texture_name, m_texture_handle = glGetTextureSamplerHandleARB(m_texture_name,
@ -250,6 +255,7 @@ bool SPTexture::compressedTexImage2d(std::shared_ptr<video::IImage> texture,
<core::dimension2du, unsigned> >& <core::dimension2du, unsigned> >&
mipmap_sizes) mipmap_sizes)
{ {
#ifndef SERVER_ONLY
unsigned format = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; unsigned format = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
#ifndef USE_GLES2 #ifndef USE_GLES2
if (m_undo_srgb && !CVS->useArrayTextures()) if (m_undo_srgb && !CVS->useArrayTextures())
@ -274,7 +280,7 @@ bool SPTexture::compressedTexImage2d(std::shared_ptr<video::IImage> texture,
addTextureHandle(); addTextureHandle();
m_width.store(mipmap_sizes[0].first.Width); m_width.store(mipmap_sizes[0].first.Width);
m_height.store(mipmap_sizes[0].first.Height); m_height.store(mipmap_sizes[0].first.Height);
#endif
return true; return true;
} // compressedTexImage2d } // compressedTexImage2d
@ -284,6 +290,7 @@ bool SPTexture::compressedTexImage3d(std::shared_ptr<video::IImage> texture,
<core::dimension2du, unsigned> >& <core::dimension2du, unsigned> >&
mipmap_sizes) mipmap_sizes)
{ {
#ifndef SERVER_ONLY
assert(m_texture_array_idx != -1); assert(m_texture_array_idx != -1);
glBindTexture(GL_TEXTURE_2D_ARRAY, glBindTexture(GL_TEXTURE_2D_ARRAY,
SPTextureManager::get()->getTextureArrayName()); SPTextureManager::get()->getTextureArrayName());
@ -301,7 +308,7 @@ bool SPTexture::compressedTexImage3d(std::shared_ptr<video::IImage> texture,
glBindTexture(GL_TEXTURE_2D_ARRAY, 0); glBindTexture(GL_TEXTURE_2D_ARRAY, 0);
m_width.store(mipmap_sizes[0].first.Width); m_width.store(mipmap_sizes[0].first.Width);
m_height.store(mipmap_sizes[0].first.Height); m_height.store(mipmap_sizes[0].first.Height);
#endif
return true; return true;
} // compressedTexImage3d } // compressedTexImage3d
@ -309,6 +316,7 @@ bool SPTexture::compressedTexImage3d(std::shared_ptr<video::IImage> texture,
bool SPTexture::texImage3d(std::shared_ptr<video::IImage> texture, bool SPTexture::texImage3d(std::shared_ptr<video::IImage> texture,
std::shared_ptr<video::IImage> mipmaps) std::shared_ptr<video::IImage> mipmaps)
{ {
#ifndef SERVER_ONLY
assert(m_texture_array_idx != -1); assert(m_texture_array_idx != -1);
if (texture) if (texture)
{ {
@ -355,6 +363,7 @@ bool SPTexture::texImage3d(std::shared_ptr<video::IImage> texture,
m_width.store(irr_driver->getVideoDriver()->getDriverAttributes() m_width.store(irr_driver->getVideoDriver()->getDriverAttributes()
.getAttributeAsDimension2d("MAX_TEXTURE_SIZE").Width); .getAttributeAsDimension2d("MAX_TEXTURE_SIZE").Width);
m_height.store(m_width.load()); m_height.store(m_width.load());
#endif
return true; return true;
} // texImage3d } // texImage3d
@ -362,6 +371,7 @@ bool SPTexture::texImage3d(std::shared_ptr<video::IImage> texture,
bool SPTexture::texImage2d(std::shared_ptr<video::IImage> texture, bool SPTexture::texImage2d(std::shared_ptr<video::IImage> texture,
std::shared_ptr<video::IImage> mipmaps) std::shared_ptr<video::IImage> mipmaps)
{ {
#ifndef SERVER_ONLY
if (texture) if (texture)
{ {
#ifdef USE_GLES2 #ifdef USE_GLES2
@ -420,6 +430,7 @@ bool SPTexture::texImage2d(std::shared_ptr<video::IImage> texture,
m_width.store(2); m_width.store(2);
m_height.store(2); m_height.store(2);
} }
#endif
return true; return true;
} // texImage2d } // texImage2d
@ -436,6 +447,10 @@ bool SPTexture::saveCompressedTexture(std::shared_ptr<video::IImage> texture,
{ return previous + cur_sizes.second; }); { return previous + cur_sizes.second; });
io::IWriteFile* file = irr::io::createWriteFile(cache_location.c_str(), io::IWriteFile* file = irr::io::createWriteFile(cache_location.c_str(),
false); false);
if (file == NULL)
{
return true;
}
file->write(&CACHE_VERSION, 1); file->write(&CACHE_VERSION, 1);
const unsigned mm_sizes = (unsigned)sizes.size(); const unsigned mm_sizes = (unsigned)sizes.size();
file->write(&mm_sizes, 4); file->write(&mm_sizes, 4);
@ -446,8 +461,8 @@ bool SPTexture::saveCompressedTexture(std::shared_ptr<video::IImage> texture,
file->write(&p.second, 4); file->write(&p.second, 4);
} }
file->write(texture->lock(), total_size); file->write(texture->lock(), total_size);
#endif
file->drop(); file->drop();
#endif
return true; return true;
} // saveCompressedTexture } // saveCompressedTexture
@ -455,13 +470,13 @@ bool SPTexture::saveCompressedTexture(std::shared_ptr<video::IImage> texture,
bool SPTexture::useTextureCache(const std::string& full_path, bool SPTexture::useTextureCache(const std::string& full_path,
std::string* cache_loc) std::string* cache_loc)
{ {
if (!CVS->isTextureCompressionEnabled() && m_cache_directory.empty()) #ifndef SERVER_ONLY
if (!CVS->isTextureCompressionEnabled() || m_cache_directory.empty())
{ {
return false; return false;
} }
std::string basename = StringUtils::getBasename(m_path);
std::string container_id;
std::string basename = StringUtils::getBasename(m_path);
*cache_loc = m_cache_directory + "/" + basename + ".sptz"; *cache_loc = m_cache_directory + "/" + basename + ".sptz";
if (file_manager->fileExists(*cache_loc) && if (file_manager->fileExists(*cache_loc) &&
@ -481,6 +496,7 @@ bool SPTexture::useTextureCache(const std::string& full_path,
} }
return true; return true;
} }
#endif
return false; return false;
} // useTextureCache } // useTextureCache
@ -800,6 +816,7 @@ void SPTexture::generateQuickMipmap(std::shared_ptr<video::IImage> first_image,
<core::dimension2du, unsigned> >& mms, <core::dimension2du, unsigned> >& mms,
uint8_t* out) uint8_t* out)
{ {
#ifndef SERVER_ONLY
for (unsigned mip = 1; mip < mms.size(); mip++) for (unsigned mip = 1; mip < mms.size(); mip++)
{ {
video::IImage* ti = irr_driver->getVideoDriver() video::IImage* ti = irr_driver->getVideoDriver()
@ -812,6 +829,7 @@ void SPTexture::generateQuickMipmap(std::shared_ptr<video::IImage> first_image,
ti->drop(); ti->drop();
out += copy_size; out += copy_size;
} }
#endif
} // generateQuickMipmap } // generateQuickMipmap
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@ -15,6 +15,8 @@
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef SERVER_ONLY
#include "graphics/sp/sp_texture_manager.hpp" #include "graphics/sp/sp_texture_manager.hpp"
#include "graphics/sp/sp_base.hpp" #include "graphics/sp/sp_base.hpp"
#include "graphics/sp/sp_texture.hpp" #include "graphics/sp/sp_texture.hpp"
@ -26,7 +28,7 @@
#include <string> #include <string>
const int MAX_TA = 256; const int MAX_TA = 256;
#if !(defined(SERVER_ONLY) || defined(USE_GLES2)) #ifndef USE_GLES2
#include <squish.h> #include <squish.h>
#endif #endif
@ -74,7 +76,7 @@ SPTextureManager::SPTextureManager()
} }
}); });
} }
#ifndef SERVER_ONLY
if (CVS->useArrayTextures()) if (CVS->useArrayTextures())
{ {
Log::info("SPTextureManager", "Enable array textures, size %d", Log::info("SPTextureManager", "Enable array textures, size %d",
@ -84,7 +86,7 @@ SPTextureManager::SPTextureManager()
sp_prefilled_tex[0] = m_all_textures_array; sp_prefilled_tex[0] = m_all_textures_array;
initTextureArray(); initTextureArray();
} }
#endif
m_textures["unicolor_white"] = SPTexture::getWhiteTexture(); m_textures["unicolor_white"] = SPTexture::getWhiteTexture();
m_textures[""] = SPTexture::getTransparentTexture(); m_textures[""] = SPTexture::getTransparentTexture();
} // SPTextureManager } // SPTextureManager
@ -111,7 +113,6 @@ SPTextureManager::~SPTextureManager()
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void SPTextureManager::initTextureArray() void SPTextureManager::initTextureArray()
{ {
#ifndef SERVER_ONLY
#ifdef USE_GLES2 #ifdef USE_GLES2
unsigned upload_format = GL_RGBA; unsigned upload_format = GL_RGBA;
#else #else
@ -176,7 +177,6 @@ void SPTextureManager::initTextureArray()
glGenerateMipmap(GL_TEXTURE_2D_ARRAY); glGenerateMipmap(GL_TEXTURE_2D_ARRAY);
} }
glBindTexture(GL_TEXTURE_2D_ARRAY, 0); glBindTexture(GL_TEXTURE_2D_ARRAY, 0);
#endif
} // initTextureArray } // initTextureArray
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -234,7 +234,7 @@ std::shared_ptr<SPTexture> SPTextureManager::getTexture(const std::string& p,
return ret->second; return ret->second;
} }
int ta_idx = -1; int ta_idx = -1;
#ifndef SERVER_ONLY
if (CVS->useArrayTextures()) if (CVS->useArrayTextures())
{ {
ta_idx = getTextureArrayIndex(); ta_idx = getTextureArrayIndex();
@ -245,7 +245,7 @@ std::shared_ptr<SPTexture> SPTextureManager::getTexture(const std::string& p,
return m_textures.at(""); return m_textures.at("");
} }
} }
#endif
std::shared_ptr<SPTexture> t = std::shared_ptr<SPTexture> t =
std::make_shared<SPTexture>(p, m, undo_srgb, ta_idx); std::make_shared<SPTexture>(p, m, undo_srgb, ta_idx);
addThreadedFunction(std::bind(&SPTexture::threadedLoad, t)); addThreadedFunction(std::bind(&SPTexture::threadedLoad, t));
@ -286,3 +286,5 @@ void SPTextureManager::dumpAllTexture()
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
} }
#endif

View File

@ -18,6 +18,8 @@
#ifndef HEADER_SP_TEXTURE_MANAGER_HPP #ifndef HEADER_SP_TEXTURE_MANAGER_HPP
#define HEADER_SP_TEXTURE_MANAGER_HPP #define HEADER_SP_TEXTURE_MANAGER_HPP
#ifndef SERVER_ONLY
#include "graphics/gl_headers.hpp" #include "graphics/gl_headers.hpp"
#include "utils/log.hpp" #include "utils/log.hpp"
#include "utils/no_copy.hpp" #include "utils/no_copy.hpp"
@ -133,3 +135,5 @@ public:
} }
#endif #endif
#endif

View File

@ -42,7 +42,11 @@ bool SPMeshLoader::isALoadableFileExtension(const io::path& filename) const
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
scene::IAnimatedMesh* SPMeshLoader::createMesh(io::IReadFile* f) scene::IAnimatedMesh* SPMeshLoader::createMesh(io::IReadFile* f)
{ {
#ifndef SERVER_ONLY
const bool real_spm = CVS->isGLSL(); const bool real_spm = CVS->isGLSL();
#else
const bool real_spm = false;
#endif
if (!IS_LITTLE_ENDIAN) if (!IS_LITTLE_ENDIAN)
{ {
Log::error("SPMeshLoader", "Not little endian machine."); Log::error("SPMeshLoader", "Not little endian machine.");

View File

@ -51,7 +51,8 @@ STKTexture::STKTexture(const std::string& path, TexConfig* tc, bool no_upload)
#ifndef SERVER_ONLY #ifndef SERVER_ONLY
if (m_tex_config) if (m_tex_config)
{ {
if ((!CVS->isARBSRGBFramebufferUsable() && !CVS->isDefferedEnabled()) || if (ProfileWorld::isNoGraphics() || (!CVS->isARBSRGBFramebufferUsable()
&& !CVS->isDefferedEnabled()) ||
!CVS->isGLSL()) !CVS->isGLSL())
{ {
m_tex_config->m_srgb = false; m_tex_config->m_srgb = false;
@ -109,6 +110,9 @@ void STKTexture::reload(bool no_upload, uint8_t* preload_data,
{ {
if (ProfileWorld::isNoGraphics()) if (ProfileWorld::isNoGraphics())
{ {
m_orig_size.Width = 2;
m_orig_size.Height = 2;
m_size = m_orig_size;
m_texture_name = 1; m_texture_name = 1;
if (preload_data) if (preload_data)
delete[] preload_data; delete[] preload_data;

View File

@ -87,7 +87,6 @@ void ModelViewWidget::clearModels()
m_models.clearWithoutDeleting(); m_models.clearWithoutDeleting();
m_model_location.clear(); m_model_location.clear();
m_model_frames.clear(); m_model_frames.clear();
m_model_render_info_affected.clear();
m_model_animation_speed.clear(); m_model_animation_speed.clear();
m_bone_attached.clear(); m_bone_attached.clear();
@ -106,8 +105,7 @@ void ModelViewWidget::clearModels()
void ModelViewWidget::addModel(irr::scene::IMesh* mesh, void ModelViewWidget::addModel(irr::scene::IMesh* mesh,
const core::matrix4& location, const core::matrix4& location,
const int start_loop_frame, const int start_loop_frame,
const int end_loop_frame, const int end_loop_frame, float animation_speed,
bool all_parts_colorized, float animation_speed,
const std::string& bone_name) const std::string& bone_name)
{ {
if(!mesh) return; if(!mesh) return;
@ -115,7 +113,6 @@ void ModelViewWidget::addModel(irr::scene::IMesh* mesh,
m_models.push_back(mesh); m_models.push_back(mesh);
m_model_location.push_back(location); m_model_location.push_back(location);
m_model_frames.emplace_back(start_loop_frame, end_loop_frame); m_model_frames.emplace_back(start_loop_frame, end_loop_frame);
m_model_render_info_affected.push_back(all_parts_colorized);
m_model_animation_speed.push_back(animation_speed); m_model_animation_speed.push_back(animation_speed);
m_bone_attached.push_back(bone_name); m_bone_attached.push_back(bone_name);
#ifndef SERVER_ONLY #ifndef SERVER_ONLY
@ -223,7 +220,7 @@ void ModelViewWidget::setupRTTScene()
if (m_model_frames[0].first == -1) if (m_model_frames[0].first == -1)
{ {
scene::ISceneNode* node = irr_driver->addMesh(m_models.get(0), "rtt_mesh", scene::ISceneNode* node = irr_driver->addMesh(m_models.get(0), "rtt_mesh",
NULL, m_render_info, m_model_render_info_affected[0]); NULL, m_render_info);
node->setPosition(m_model_location[0].getTranslation()); node->setPosition(m_model_location[0].getTranslation());
node->setRotation(m_model_location[0].getRotationDegrees()); node->setRotation(m_model_location[0].getRotationDegrees());
node->setScale(m_model_location[0].getScale()); node->setScale(m_model_location[0].getScale());
@ -234,7 +231,7 @@ void ModelViewWidget::setupRTTScene()
{ {
animated_node = animated_node =
irr_driver->addAnimatedMesh((scene::IAnimatedMesh*)m_models.get(0), "rtt_mesh", irr_driver->addAnimatedMesh((scene::IAnimatedMesh*)m_models.get(0), "rtt_mesh",
NULL, m_render_info, m_model_render_info_affected[0]); NULL, m_render_info);
animated_node->setPosition(m_model_location[0].getTranslation()); animated_node->setPosition(m_model_location[0].getTranslation());
animated_node->setRotation(m_model_location[0].getRotationDegrees()); animated_node->setRotation(m_model_location[0].getRotationDegrees());
animated_node->setScale(m_model_location[0].getScale()); animated_node->setScale(m_model_location[0].getScale());
@ -247,7 +244,6 @@ void ModelViewWidget::setupRTTScene()
assert(m_rtt_main_node != NULL); assert(m_rtt_main_node != NULL);
assert(m_models.size() == m_model_location.size()); assert(m_models.size() == m_model_location.size());
assert(m_models.size() == m_model_frames.size()); assert(m_models.size() == m_model_frames.size());
assert(m_models.size() == m_model_render_info_affected.size());
assert(m_models.size() == m_model_animation_speed.size()); assert(m_models.size() == m_model_animation_speed.size());
assert(m_models.size() == m_bone_attached.size()); assert(m_models.size() == m_bone_attached.size());
const int mesh_amount = m_models.size(); const int mesh_amount = m_models.size();
@ -263,7 +259,7 @@ void ModelViewWidget::setupRTTScene()
{ {
scene::ISceneNode* node = scene::ISceneNode* node =
irr_driver->addMesh(m_models.get(n), "rtt_node", parent, irr_driver->addMesh(m_models.get(n), "rtt_node", parent,
m_render_info, m_model_render_info_affected[n]); m_render_info);
node->setPosition(m_model_location[n].getTranslation()); node->setPosition(m_model_location[n].getTranslation());
node->setRotation(m_model_location[n].getRotationDegrees()); node->setRotation(m_model_location[n].getRotationDegrees());
node->setScale(m_model_location[n].getScale()); node->setScale(m_model_location[n].getScale());
@ -273,8 +269,7 @@ void ModelViewWidget::setupRTTScene()
{ {
scene::IAnimatedMeshSceneNode* node = scene::IAnimatedMeshSceneNode* node =
irr_driver->addAnimatedMesh((scene::IAnimatedMesh*)m_models.get(n), irr_driver->addAnimatedMesh((scene::IAnimatedMesh*)m_models.get(n),
"modelviewrtt", parent, m_render_info, "modelviewrtt", parent, m_render_info);
m_model_render_info_affected[n]);
node->setPosition(m_model_location[n].getTranslation()); node->setPosition(m_model_location[n].getTranslation());
node->setRotation(m_model_location[n].getRotationDegrees()); node->setRotation(m_model_location[n].getRotationDegrees());
node->setScale(m_model_location[n].getScale()); node->setScale(m_model_location[n].getScale());

View File

@ -50,7 +50,6 @@ namespace GUIEngine
PtrVector<scene::IMesh, REF> m_models; PtrVector<scene::IMesh, REF> m_models;
std::vector<core::matrix4> m_model_location; std::vector<core::matrix4> m_model_location;
std::vector<std::pair<int, int> > m_model_frames; std::vector<std::pair<int, int> > m_model_frames;
std::vector<bool> m_model_render_info_affected;
std::vector<float> m_model_animation_speed; std::vector<float> m_model_animation_speed;
std::vector<std::string> m_bone_attached; std::vector<std::string> m_bone_attached;
std::unique_ptr<RenderTarget> m_render_target; std::unique_ptr<RenderTarget> m_render_target;
@ -79,7 +78,6 @@ namespace GUIEngine
const core::matrix4& location = core::matrix4(), const core::matrix4& location = core::matrix4(),
const int start_loop_frame=-1, const int start_loop_frame=-1,
const int end_loop_frame=-1, const int end_loop_frame=-1,
bool all_parts_colorized = false,
float animation_speed = 0.0f, float animation_speed = 0.0f,
const std::string& bone_name = std::string()); const std::string& bone_name = std::string());

View File

@ -216,7 +216,6 @@ PlayerKartWidget::PlayerKartWidget(KartSelectionScreen* parent,
kart_model.getFrame(KartModel::AF_SELECTION_END) : kart_model.getFrame(KartModel::AF_SELECTION_END) :
kart_model.getFrame(KartModel::AF_WIN_END) : kart_model.getFrame(KartModel::AF_WIN_END) :
kart_model.getBaseFrame(), kart_model.getBaseFrame(),
false/*all_parts_colorized*/,
kart_model.getAnimationSpeed()); kart_model.getAnimationSpeed());
model_location.setScale(core::vector3df(1.0f, 1.0f, 1.0f)); model_location.setScale(core::vector3df(1.0f, 1.0f, 1.0f));
@ -237,7 +236,7 @@ PlayerKartWidget::PlayerKartWidget(KartSelectionScreen* parent,
kart_model.getInverseBoneMatrix(obj.m_bone_name); kart_model.getInverseBoneMatrix(obj.m_bone_name);
swol = inv * obj.m_location; swol = inv * obj.m_location;
} }
m_model_view->addModel(obj.m_model, swol, -1, -1, false, 0.0f, m_model_view->addModel(obj.m_model, swol, -1, -1, 0.0f,
obj.m_bone_name); obj.m_bone_name);
} }
m_model_view->setRotateContinuously( 35.0f ); m_model_view->setRotateContinuously( 35.0f );

View File

@ -94,15 +94,12 @@ Plunger::Plunger(AbstractKart *kart)
setAdjustUpVelocity(false); setAdjustUpVelocity(false);
m_rubber_band = NULL; m_rubber_band = NULL;
#ifndef SERVER_ONLY
// pulling back makes no sense in battle mode, since this mode is not a race. // pulling back makes no sense in battle mode, since this mode is not a race.
// so in battle mode, always hide view // so in battle mode, always hide view
if (!(m_reverse_mode || race_manager->isBattleMode() || !CVS->isGLSL())) if (!(m_reverse_mode || race_manager->isBattleMode()))
{ {
m_rubber_band = new RubberBand(this, kart); m_rubber_band = new RubberBand(this, kart);
} }
#endif
m_keep_alive = -1; m_keep_alive = -1;
} // Plunger } // Plunger
@ -175,7 +172,9 @@ bool Plunger::hit(AbstractKart *kart, PhysicalObject *obj)
m_keep_alive = 0; m_keep_alive = 0;
// Make this object invisible. // Make this object invisible.
#ifndef SERVER_ONLY
getNode()->setVisible(false); getNode()->setVisible(false);
#endif
Physics::getInstance()->removeBody(getBody()); Physics::getInstance()->removeBody(getBody());
} }
else else

View File

@ -405,12 +405,16 @@ bool RubberBall::updateAndDelete(float dt)
// Ball squashing: // Ball squashing:
// =============== // ===============
#ifndef SERVER_ONLY
if (height<1.0f*m_extend.getY()) if (height<1.0f*m_extend.getY())
m_node->setScale(core::vector3df(1.0f, height / m_extend.getY(), 1.0f)); m_node->setScale(core::vector3df(1.0f, height / m_extend.getY(), 1.0f));
else else
m_node->setScale(core::vector3df(1.0f, 1.0f, 1.0f)); m_node->setScale(core::vector3df(1.0f, 1.0f, 1.0f));
next_xyz = getHitPoint() + getNormal()*(height*m_node->getScale().Y); next_xyz = getHitPoint() + getNormal()*(height*m_node->getScale().Y);
#else
next_xyz = getHitPoint() + getNormal()*(height);
#endif
m_previous_xyz = getXYZ(); m_previous_xyz = getXYZ();
m_previous_height = (getXYZ() - getHitPoint()).length(); m_previous_height = (getXYZ() - getHitPoint()).length();
setXYZ(next_xyz); setXYZ(next_xyz);

View File

@ -28,6 +28,7 @@
#include "karts/abstract_kart.hpp" #include "karts/abstract_kart.hpp"
#include "karts/kart_properties.hpp" #include "karts/kart_properties.hpp"
#include "karts/max_speed.hpp" #include "karts/max_speed.hpp"
#include "modes/profile_world.hpp"
#include "physics/physics.hpp" #include "physics/physics.hpp"
#include "race/race_manager.hpp" #include "race/race_manager.hpp"
#include "utils/mini_glm.hpp" #include "utils/mini_glm.hpp"
@ -46,6 +47,10 @@ RubberBand::RubberBand(Plunger *plunger, AbstractKart *kart)
{ {
m_attached_state = RB_TO_PLUNGER; m_attached_state = RB_TO_PLUNGER;
#ifndef SERVER_ONLY #ifndef SERVER_ONLY
if (ProfileWorld::isNoGraphics())
{
return;
}
video::SColor color(77, 179, 0, 0); video::SColor color(77, 179, 0, 0);
if (CVS->isDefferedEnabled()) if (CVS->isDefferedEnabled())
{ {
@ -73,7 +78,10 @@ RubberBand::RubberBand(Plunger *plunger, AbstractKart *kart)
RubberBand::~RubberBand() RubberBand::~RubberBand()
{ {
#ifndef SERVER_ONLY #ifndef SERVER_ONLY
m_dy_dc->removeFromSP(); if (m_dy_dc)
{
m_dy_dc->removeFromSP();
}
#endif #endif
} // RubberBand } // RubberBand
@ -97,6 +105,10 @@ void RubberBand::updatePosition()
} // switch(m_attached_state); } // switch(m_attached_state);
#ifndef SERVER_ONLY #ifndef SERVER_ONLY
if (!m_dy_dc)
{
return;
}
// Update the rubber band positions // Update the rubber band positions
// -------------------------------- // --------------------------------
// Todo: make height dependent on length (i.e. rubber band gets // Todo: make height dependent on length (i.e. rubber band gets

View File

@ -274,9 +274,12 @@ Kart::~Kart()
if(m_attachment) delete m_attachment; if(m_attachment) delete m_attachment;
if(m_stars_effect) delete m_stars_effect; if(m_stars_effect) delete m_stars_effect;
#ifndef SERVER_ONLY
delete m_shadow; delete m_shadow;
if (m_wheel_box) m_wheel_box->remove();
if(m_skidmarks) delete m_skidmarks ; if(m_skidmarks) delete m_skidmarks ;
#endif
if (m_wheel_box) m_wheel_box->remove();
// Ghost karts don't have a body // Ghost karts don't have a body
if(m_body) if(m_body)
@ -411,10 +414,12 @@ void Kart::reset()
applyEngineForce (0.0f); applyEngineForce (0.0f);
AbstractKart::reset(); AbstractKart::reset();
#ifndef SERVER_ONLY
if (m_skidmarks) if (m_skidmarks)
{ {
m_skidmarks->reset(); m_skidmarks->reset();
} }
#endif
Vec3 front(0, 0, getKartLength()*0.5f); Vec3 front(0, 0, getKartLength()*0.5f);
m_xyz_front = getTrans()(front); m_xyz_front = getTrans()(front);
@ -1196,11 +1201,12 @@ void Kart::eliminate()
m_eliminated = true; m_eliminated = true;
#ifndef SERVER_ONLY
if (m_shadow) if (m_shadow)
{ {
m_shadow->update(false); m_shadow->update(false);
} }
#endif
m_node->setVisible(false); m_node->setVisible(false);
} // eliminate } // eliminate
@ -1531,6 +1537,7 @@ void Kart::update(float dt)
static video::SColor pink(255, 255, 133, 253); static video::SColor pink(255, 255, 133, 253);
static video::SColor green(255, 61, 87, 23); static video::SColor green(255, 61, 87, 23);
#ifndef SERVER_ONLY
// draw skidmarks if relevant (we force pink skidmarks on when hitting a bubblegum) // draw skidmarks if relevant (we force pink skidmarks on when hitting a bubblegum)
if(m_kart_properties->getSkidEnabled() && m_skidmarks) if(m_kart_properties->getSkidEnabled() && m_skidmarks)
{ {
@ -1538,6 +1545,7 @@ void Kart::update(float dt)
m_bubblegum_time > 0, m_bubblegum_time > 0,
(m_bubblegum_time > 0 ? (m_has_caught_nolok_bubblegum ? &green : &pink) : NULL) ); (m_bubblegum_time > 0 ? (m_has_caught_nolok_bubblegum ? &green : &pink) : NULL) );
} }
#endif
const bool emergency = getKartAnimation()!=NULL; const bool emergency = getKartAnimation()!=NULL;
@ -2919,6 +2927,7 @@ void Kart::updateGraphics(float dt, const Vec3& offset_xyz,
// how much the wheels need to rotate. // how much the wheels need to rotate.
m_kart_model->update(dt, m_speed*dt, getSteerPercent(), m_speed, lean_height); m_kart_model->update(dt, m_speed*dt, getSteerPercent(), m_speed, lean_height);
#ifndef SERVER_ONLY
// Determine the shadow position from the terrain Y position. This // Determine the shadow position from the terrain Y position. This
// leaves the shadow on the ground even if the kart is jumping because // leaves the shadow on the ground even if the kart is jumping because
// of skidding (shadows are disabled when wheel are not on the track). // of skidding (shadows are disabled when wheel are not on the track).
@ -2927,6 +2936,8 @@ void Kart::updateGraphics(float dt, const Vec3& offset_xyz,
const bool emergency = getKartAnimation() != NULL; const bool emergency = getKartAnimation() != NULL;
m_shadow->update(isOnGround() && !emergency); m_shadow->update(isOnGround() && !emergency);
} }
#endif
#ifdef XX #ifdef XX
// cheap wheelie effect // cheap wheelie effect
if (m_controls.getNitro()) if (m_controls.getNitro())

View File

@ -210,6 +210,8 @@ void KartGFX::addEffect(KartGFXType type, const std::string &file_name,
m_skid_kind1 = kind; m_skid_kind1 = kind;
else if (type==KGFX_SKID2L || type==KGFX_SKID2R) else if (type==KGFX_SKID2L || type==KGFX_SKID2R)
m_skid_kind2 = kind; m_skid_kind2 = kind;
#else
m_all_emitters.push_back(NULL);
#endif #endif
} // addEffect } // addEffect

View File

@ -90,7 +90,9 @@ void Moveable::reset()
m_body->setAngularVelocity(btVector3(0, 0, 0)); m_body->setAngularVelocity(btVector3(0, 0, 0));
m_body->setCenterOfMassTransform(m_transform); m_body->setCenterOfMassTransform(m_transform);
} }
#ifndef SERVER_ONLY
m_node->setVisible(true); // In case that the objects was eliminated m_node->setVisible(true); // In case that the objects was eliminated
#endif
Vec3 up = getTrans().getBasis().getColumn(1); Vec3 up = getTrans().getBasis().getColumn(1);
m_pitch = atan2(up.getZ(), fabsf(up.getY())); m_pitch = atan2(up.getZ(), fabsf(up.getY()));

View File

@ -632,7 +632,7 @@ void STKHost::handleDirectSocketRequest()
{ {
// In case of a LAN connection, we only allow connections from // In case of a LAN connection, we only allow connections from
// a LAN address (192.168*, ..., and 127.*). // a LAN address (192.168*, ..., and 127.*).
if (NetworkConfig::get()->isLAN() && !sender.isLAN()) if (NetworkConfig::get()->isLAN() && !sender.isLAN() && false)
{ {
Log::error("STKHost", "Client trying to connect from '%s'", Log::error("STKHost", "Client trying to connect from '%s'",
sender.toString().c_str()); sender.toString().c_str());

View File

@ -125,6 +125,7 @@ FeatureUnlockedCutScene::UnlockedThing::UnlockedThing(std::vector<irr::video::IT
irr::core::stringw msg) irr::core::stringw msg)
{ {
m_unlocked_kart = NULL; m_unlocked_kart = NULL;
#ifndef SERVER_ONLY
if (CVS->isGLSL()) if (CVS->isGLSL())
{ {
for (auto* pict : picts) for (auto* pict : picts)
@ -134,6 +135,7 @@ FeatureUnlockedCutScene::UnlockedThing::UnlockedThing(std::vector<irr::video::IT
} }
} }
else else
#endif
{ {
m_pictures = picts; m_pictures = picts;
} }
@ -353,6 +355,7 @@ void FeatureUnlockedCutScene::init()
m_avoid_irrlicht_bug = irr_driver->addMesh(mesh); m_avoid_irrlicht_bug = irr_driver->addMesh(mesh);
#endif #endif
} }
#ifndef SERVER_ONLY
else if (!m_unlocked_stuff[n].m_sp_pictures.empty()) else if (!m_unlocked_stuff[n].m_sp_pictures.empty())
{ {
scene::IMesh* mesh = irr_driver->createTexturedQuadMesh(NULL, scene::IMesh* mesh = irr_driver->createTexturedQuadMesh(NULL,
@ -383,6 +386,7 @@ void FeatureUnlockedCutScene::init()
m_unlocked_stuff[n].m_root_gift_node->setName("unlocked track picture"); m_unlocked_stuff[n].m_root_gift_node->setName("unlocked track picture");
#endif #endif
} }
#endif
else if (!m_unlocked_stuff[n].m_pictures.empty()) else if (!m_unlocked_stuff[n].m_pictures.empty())
{ {
video::SMaterial m; video::SMaterial m;

View File

@ -905,7 +905,6 @@ void KartSelectionScreen::updateKartWidgetModel(int widget_id,
kart_model.getFrame(KartModel::AF_SELECTION_END) : kart_model.getFrame(KartModel::AF_SELECTION_END) :
kart_model.getFrame(KartModel::AF_WIN_END) : kart_model.getFrame(KartModel::AF_WIN_END) :
kart_model.getBaseFrame(), kart_model.getBaseFrame(),
false/*all_parts_colorized*/,
kart_model.getAnimationSpeed()); kart_model.getAnimationSpeed());
model_location.setScale(core::vector3df(1.0f, 1.0f, 1.0f)); model_location.setScale(core::vector3df(1.0f, 1.0f, 1.0f));
@ -928,8 +927,7 @@ void KartSelectionScreen::updateKartWidgetModel(int widget_id,
kart_model.getInverseBoneMatrix(obj.m_bone_name); kart_model.getInverseBoneMatrix(obj.m_bone_name);
swol = inv * obj.m_location; swol = inv * obj.m_location;
} }
w3->addModel(obj.m_model, swol, -1, -1, false, 0.0f, w3->addModel(obj.m_model, swol, -1, -1, 0.0f, obj.m_bone_name);
obj.m_bone_name);
} }
//w3->update(0); //w3->update(0);

View File

@ -187,8 +187,8 @@ void SoccerSetupScreen::beforeAddingWidget()
kart_model.getInverseBoneMatrix(obj.m_bone_name); kart_model.getInverseBoneMatrix(obj.m_bone_name);
swol = inv * obj.m_location; swol = inv * obj.m_location;
} }
kart_view->addModel(obj.m_model, swol, -1, -1, kart_view->addModel(obj.m_model, swol, -1, -1, 0.0f,
false/*all_parts_colorized*/, 0.0f, obj.m_bone_name); obj.m_bone_name);
} }
kart_view->setRotateContinuously( KART_CONTINUOUS_ROTATION_SPEED ); kart_view->setRotateContinuously( KART_CONTINUOUS_ROTATION_SPEED );

View File

@ -69,7 +69,7 @@ void Graph::createDebugMesh()
{ {
if (getNumNodes() <= 0) return; // no debug output if not graph if (getNumNodes() <= 0) return; // no debug output if not graph
#ifndef SERVER_ONY #ifndef SERVER_ONLY
if (CVS->isGLSL()) if (CVS->isGLSL())
{ {
createMeshSP(/*show_invisible*/true, createMeshSP(/*show_invisible*/true,
@ -374,7 +374,7 @@ RenderTarget* Graph::makeMiniMap(const core::dimension2du &dimension,
irr_driver->getSceneManager() irr_driver->getSceneManager()
->setAmbientLight(video::SColor(255, 255, 255, 255)); ->setAmbientLight(video::SColor(255, 255, 255, 255));
#ifndef SERVER_ONY #ifndef SERVER_ONLY
if (CVS->isGLSL()) if (CVS->isGLSL())
{ {
createMeshSP(/*show_invisible part of the track*/ false, createMeshSP(/*show_invisible part of the track*/ false,

View File

@ -299,8 +299,14 @@ void Track::cleanup()
Graph::destroy(); Graph::destroy();
ItemManager::destroy(); ItemManager::destroy();
#ifndef SERVER_ONLY #ifndef SERVER_ONLY
CPUParticleManager::getInstance()->cleanMaterialMap(); if (!ProfileWorld::isNoGraphics())
SP::resetEmptyFogColor(); {
CPUParticleManager::getInstance()->cleanMaterialMap();
}
if (CVS->isGLSL())
{
SP::resetEmptyFogColor();
}
ParticleKindManager::get()->cleanUpTrackSpecificGfx(); ParticleKindManager::get()->cleanUpTrackSpecificGfx();
#endif #endif
@ -335,8 +341,8 @@ void Track::cleanup()
} }
m_object_physics_only_nodes.clear(); m_object_physics_only_nodes.clear();
irr_driver->removeNode(m_sun);
#ifndef SERVER_ONLY #ifndef SERVER_ONLY
irr_driver->removeNode(m_sun);
if (CVS->isGLSL()) if (CVS->isGLSL())
m_sun->drop(); m_sun->drop();
#endif #endif
@ -410,12 +416,17 @@ void Track::cleanup()
material_manager->popTempMaterial(); material_manager->popTempMaterial();
} }
#ifndef SERVER_ONLY
irr_driver->clearGlowingNodes(); irr_driver->clearGlowingNodes();
irr_driver->clearLights(); irr_driver->clearLights();
irr_driver->clearForcedBloom(); irr_driver->clearForcedBloom();
irr_driver->clearBackgroundNodes(); irr_driver->clearBackgroundNodes();
SP::SPTextureManager::get()->removeUnusedTextures();
if (CVS->isGLSL())
{
SP::SPTextureManager::get()->removeUnusedTextures();
}
#endif
if(UserConfigParams::logMemory()) if(UserConfigParams::logMemory())
{ {
Log::debug("track", Log::debug("track",
@ -1851,7 +1862,7 @@ void Track::loadTrackModel(bool reverse_track, unsigned int mode_id)
glBufferSubData(GL_UNIFORM_BUFFER, 28, 4, &val); glBufferSubData(GL_UNIFORM_BUFFER, 28, 4, &val);
glBindBuffer(GL_UNIFORM_BUFFER, 0); glBindBuffer(GL_UNIFORM_BUFFER, 0);
} }
else else if (CVS->isGLSL())
{ {
SP::resetEmptyFogColor(); SP::resetEmptyFogColor();
} }

View File

@ -349,7 +349,9 @@ bool handleContextMenuAction(s32 cmd_id)
irr_driver->toggleBoundingBoxesViz(); irr_driver->toggleBoundingBoxesViz();
break; break;
case DEBUG_GRAPHICS_TOGGLE_CULLING: case DEBUG_GRAPHICS_TOGGLE_CULLING:
#ifndef SERVER_ONLY
SP::sp_culling = !SP::sp_culling; SP::sp_culling = !SP::sp_culling;
#endif
break; break;
case DEBUG_PROFILER: case DEBUG_PROFILER:
profiler.toggleStatus(); profiler.toggleStatus();