Use shared_ptr SPShader in mesh buffer

This commit is contained in:
Benau 2018-01-21 15:35:38 +08:00
parent 390554eca1
commit a39977d550
17 changed files with 64 additions and 89 deletions

View File

@ -32,8 +32,7 @@ Shadow::Shadow(Material* shadow_mat, const AbstractKart& kart)
{ {
m_dy_dc = std::make_shared<SP::SPDynamicDrawCall> m_dy_dc = std::make_shared<SP::SPDynamicDrawCall>
(scene::EPT_TRIANGLE_STRIP, (scene::EPT_TRIANGLE_STRIP,
SP::SPShaderManager::get()->getSPShaderPtr("alphablend"), SP::SPShaderManager::get()->getSPShader("alphablend"), shadow_mat);
shadow_mat);
m_dy_dc->getVerticesVector().resize(4); m_dy_dc->getVerticesVector().resize(4);
video::S3DVertexSkinnedMesh* v = m_dy_dc->getVerticesVector().data(); video::S3DVertexSkinnedMesh* v = m_dy_dc->getVerticesVector().data();

View File

@ -20,8 +20,8 @@
#include "graphics/show_curve.hpp" #include "graphics/show_curve.hpp"
#include "graphics/material_manager.hpp" #include "graphics/material_manager.hpp"
#include "graphics/sp/sp_base.hpp"
#include "graphics/sp/sp_dynamic_draw_call.hpp" #include "graphics/sp/sp_dynamic_draw_call.hpp"
#include "graphics/sp/sp_shader_manager.hpp"
#include "utils/mini_glm.hpp" #include "utils/mini_glm.hpp"
#include "utils/vec3.hpp" #include "utils/vec3.hpp"
@ -33,7 +33,8 @@ ShowCurve::ShowCurve(float width, float height,
m_first_vertices(true), m_visible(true) m_first_vertices(true), m_visible(true)
{ {
m_dy_dc = std::make_shared<SP::SPDynamicDrawCall> m_dy_dc = std::make_shared<SP::SPDynamicDrawCall>
(irr::scene::EPT_TRIANGLES, SP::getSPShader("alphablend"), (irr::scene::EPT_TRIANGLES,
SP::SPShaderManager::get()->getSPShader("alphablend"),
material_manager->getDefaultSPMaterial("alphablend")); material_manager->getDefaultSPMaterial("alphablend"));
SP::addDynamicDrawCall(m_dy_dc); SP::addDynamicDrawCall(m_dy_dc);
} // ShowCurve } // ShowCurve

View File

@ -44,8 +44,8 @@ SkidMarks::SkidMarks(const AbstractKart& kart, float width) : m_kart(kart)
m_width = width; m_width = width;
m_material = material_manager->getMaterialSPM("skidmarks.png", "", m_material = material_manager->getMaterialSPM("skidmarks.png", "",
"alphablend"); "alphablend");
m_shader = SP::SPShaderManager::get()->getSPShaderPtr("alphablend"); m_shader = SP::SPShaderManager::get()->getSPShader("alphablend");
assert(m_shader != NULL); assert(m_shader);
m_skid_marking = false; m_skid_marking = false;
} // SkidMark } // SkidMark
@ -200,7 +200,7 @@ SkidMarks::SkidMarkQuads::SkidMarkQuads(const Vec3 &left,
const Vec3 &right, const Vec3 &right,
const Vec3 &normal, const Vec3 &normal,
Material* material, Material* material,
SP::SPShader* shader, std::shared_ptr<SP::SPShader> shader,
float z_offset, float z_offset,
video::SColor* custom_color) video::SColor* custom_color)
{ {

View File

@ -65,7 +65,7 @@ private:
Material* m_material; Material* m_material;
/** Shader(alphablend) to use for the skid marks. */ /** Shader(alphablend) to use for the skid marks. */
SP::SPShader* m_shader; std::shared_ptr<SP::SPShader> m_shader;
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
class SkidMarkQuads : public NoCopy class SkidMarkQuads : public NoCopy
@ -88,7 +88,7 @@ private:
public: public:
SkidMarkQuads (const Vec3 &left, const Vec3 &right, SkidMarkQuads (const Vec3 &left, const Vec3 &right,
const Vec3 &normal, Material* material, const Vec3 &normal, Material* material,
SP::SPShader* shader, std::shared_ptr<SP::SPShader> shader,
float z_offset, video::SColor* custom_color = NULL); float z_offset, video::SColor* custom_color = NULL);
~SkidMarkQuads(); ~SkidMarkQuads();
void add (const Vec3 &left, void add (const Vec3 &left,

View File

@ -21,10 +21,10 @@
#include "config/user_config.hpp" #include "config/user_config.hpp"
#include "graphics/irr_driver.hpp" #include "graphics/irr_driver.hpp"
#include "graphics/material_manager.hpp" #include "graphics/material_manager.hpp"
#include "graphics/sp/sp_base.hpp"
#include "graphics/sp/sp_dynamic_draw_call.hpp" #include "graphics/sp/sp_dynamic_draw_call.hpp"
#include "graphics/sp/sp_mesh.hpp" #include "graphics/sp/sp_mesh.hpp"
#include "graphics/sp/sp_mesh_node.hpp" #include "graphics/sp/sp_mesh_node.hpp"
#include "graphics/sp/sp_shader_manager.hpp"
#include "graphics/sp/sp_uniform_assigner.hpp" #include "graphics/sp/sp_uniform_assigner.hpp"
#include "io/file_manager.hpp" #include "io/file_manager.hpp"
#include "karts/abstract_kart.hpp" #include "karts/abstract_kart.hpp"
@ -80,7 +80,8 @@ SlipStream::SlipStream(AbstractKart* kart) : MovingTexture(0, 0), m_kart(kart)
if (UserConfigParams::m_slipstream_debug) if (UserConfigParams::m_slipstream_debug)
{ {
m_debug_dc = std::make_shared<SP::SPDynamicDrawCall> m_debug_dc = std::make_shared<SP::SPDynamicDrawCall>
(scene::EPT_TRIANGLE_STRIP, SP::getSPShader("additive"), (scene::EPT_TRIANGLE_STRIP,
SP::SPShaderManager::get()->getSPShader("additive"),
material_manager->getDefaultSPMaterial("additive")); material_manager->getDefaultSPMaterial("additive"));
m_debug_dc->getVerticesVector().resize(4); m_debug_dc->getVerticesVector().resize(4);
video::S3DVertexSkinnedMesh* v = video::S3DVertexSkinnedMesh* v =

View File

@ -69,8 +69,6 @@ bool sp_culling = true;
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
bool g_handle_shadow = false; bool g_handle_shadow = false;
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
std::unordered_map<std::string, SPShader*> g_shaders;
// ----------------------------------------------------------------------------
SPShader* g_normal_visualizer = NULL; SPShader* g_normal_visualizer = NULL;
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
SPShader* g_glow_shader = NULL; SPShader* g_glow_shader = NULL;
@ -324,13 +322,6 @@ void initSkinning()
sp_prefilled_tex[0] = g_skinning_tex; sp_prefilled_tex[0] = g_skinning_tex;
} // initSkinning } // initSkinning
// ----------------------------------------------------------------------------
void addShader(SPShader* shader)
{
g_shaders[shader->getName()] = shader;
} // addShader
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void loadShaders() void loadShaders()
{ {
@ -583,15 +574,9 @@ void init()
void destroy() void destroy()
{ {
g_dy_dc.clear(); g_dy_dc.clear();
for (auto& p : g_shaders)
{
delete p.second;
}
g_shaders.clear();
SPShaderManager::destroy(); SPShaderManager::destroy();
g_glow_shader = NULL; g_glow_shader = NULL;
g_normal_visualizer = NULL; g_normal_visualizer = NULL;
SPTextureManager::destroy(); SPTextureManager::destroy();
#ifndef USE_GLES2 #ifndef USE_GLES2
@ -636,17 +621,6 @@ SPShader* getNormalVisualizer()
return g_normal_visualizer; return g_normal_visualizer;
} // getNormalVisualizer } // getNormalVisualizer
// ----------------------------------------------------------------------------
SPShader* getSPShader(const std::string& name)
{
auto ret = g_shaders.find(name);
if (ret != g_shaders.end())
{
return ret->second;
}
return NULL;
} // getSPShader
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
inline void mathPlaneNormf(float *p) inline void mathPlaneNormf(float *p)
{ {

View File

@ -99,8 +99,6 @@ extern irr::core::vector3df sp_wind_dir;
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void init(); void init();
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void addShader(SPShader*);
// ----------------------------------------------------------------------------
void destroy(); void destroy();
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
GLuint getSampler(SamplerType); GLuint getSampler(SamplerType);
@ -109,8 +107,6 @@ SPShader* getNormalVisualizer();
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
SPShader* getGlowShader(); SPShader* getGlowShader();
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
SPShader* getSPShader(const std::string& name);
// ----------------------------------------------------------------------------
void prepareDrawCalls(); void prepareDrawCalls();
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void draw(RenderPass, DrawCallType dct = DCT_NORMAL); void draw(RenderPass, DrawCallType dct = DCT_NORMAL);

View File

@ -16,10 +16,10 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "graphics/sp/sp_dynamic_draw_call.hpp" #include "graphics/sp/sp_dynamic_draw_call.hpp"
#include "graphics/sp/sp_texture.hpp"
#include "graphics/central_settings.hpp"
#include "graphics/graphics_restrictions.hpp" #include "graphics/graphics_restrictions.hpp"
#include "graphics/material.hpp" #include "graphics/material.hpp"
#include "graphics/sp/sp_shader.hpp"
#include "graphics/sp/sp_texture.hpp"
#include "graphics/sp/sp_texture_manager.hpp" #include "graphics/sp/sp_texture_manager.hpp"
#include "utils/mini_glm.hpp" #include "utils/mini_glm.hpp"
#include "utils/string_utils.hpp" #include "utils/string_utils.hpp"
@ -28,12 +28,13 @@ namespace SP
{ {
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
SPDynamicDrawCall::SPDynamicDrawCall(scene::E_PRIMITIVE_TYPE pt, SPDynamicDrawCall::SPDynamicDrawCall(scene::E_PRIMITIVE_TYPE pt,
SPShader* shader, Material* m) std::shared_ptr<SPShader> shader,
Material* m)
: SPMeshBuffer() : SPMeshBuffer()
{ {
#ifndef SERVER_ONLY #ifndef SERVER_ONLY
m_primitive_type = pt; m_primitive_type = pt;
m_shader = shader; m_shaders[0] = shader;
m_stk_material[0] = std::make_tuple(0u, 0u, m); m_stk_material[0] = std::make_tuple(0u, 0u, m);
m_textures.resize(m_stk_material.size()); m_textures.resize(m_stk_material.size());
for (unsigned j = 0; j < 6; j++) for (unsigned j = 0; j < 6; j++)
@ -41,7 +42,7 @@ SPDynamicDrawCall::SPDynamicDrawCall(scene::E_PRIMITIVE_TYPE pt,
m_textures[0][j] = SPTextureManager::get()->getTexture m_textures[0][j] = SPTextureManager::get()->getTexture
(std::get<2>(m_stk_material[0])->getSamplerPath(j), (std::get<2>(m_stk_material[0])->getSamplerPath(j),
j == 0 ? std::get<2>(m_stk_material[0]) : NULL, j == 0 ? std::get<2>(m_stk_material[0]) : NULL,
j < 2 && CVS->isDefferedEnabled(), m_shaders[0] && m_shaders[0]->isSrgbForTextureLayer(j),
std::get<2>(m_stk_material[0])->getContainerId()); std::get<2>(m_stk_material[0])->getContainerId());
} }
m_tex_cmp[m_textures[0][0]->getPath() + m_textures[0][1]->getPath()] = 0; m_tex_cmp[m_textures[0][0]->getPath() + m_textures[0][1]->getPath()] = 0;

View File

@ -43,8 +43,6 @@ class SPDynamicDrawCall : public SPMeshBuffer
private: private:
core::matrix4 m_trans; core::matrix4 m_trans;
SPShader* m_shader;
scene::ISceneNode* m_parent = NULL; scene::ISceneNode* m_parent = NULL;
core::vector2df m_texture_trans; core::vector2df m_texture_trans;
@ -65,8 +63,8 @@ private:
bool initTextureDyDc(); bool initTextureDyDc();
public: public:
SPDynamicDrawCall(scene::E_PRIMITIVE_TYPE pt, SPShader* shader, SPDynamicDrawCall(scene::E_PRIMITIVE_TYPE pt,
Material* m); std::shared_ptr<SPShader> shader, Material* m);
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
~SPDynamicDrawCall() {} ~SPDynamicDrawCall() {}
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
@ -130,8 +128,6 @@ public:
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
virtual void enableTextureMatrix(unsigned mat_id) {} virtual void enableTextureMatrix(unsigned mat_id) {}
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
SPShader* getShader() const { return m_shader; }
// ------------------------------------------------------------------------
std::vector<video::S3DVertexSkinnedMesh>& getVerticesVector() std::vector<video::S3DVertexSkinnedMesh>& getVerticesVector()
{ return m_vertices; } { return m_vertices; }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------

View File

@ -20,6 +20,8 @@
#include "graphics/central_settings.hpp" #include "graphics/central_settings.hpp"
#include "graphics/graphics_restrictions.hpp" #include "graphics/graphics_restrictions.hpp"
#include "graphics/material.hpp" #include "graphics/material.hpp"
#include "graphics/sp/sp_shader.hpp"
#include "graphics/sp/sp_shader_manager.hpp"
#include "graphics/sp/sp_texture_manager.hpp" #include "graphics/sp/sp_texture_manager.hpp"
#include "race/race_manager.hpp" #include "race/race_manager.hpp"
#include "utils/mini_glm.hpp" #include "utils/mini_glm.hpp"
@ -111,17 +113,22 @@ void SPMeshBuffer::uploadGLMesh()
} }
m_uploaded_gl = true; m_uploaded_gl = true;
#ifndef SERVER_ONLY #ifndef SERVER_ONLY
if (!m_shaders[0])
{
Log::warn("SPMeshBuffer", "%s shader is missing",
std::get<2>(m_stk_material[0])->getShaderName().c_str());
return;
}
m_textures.resize(m_stk_material.size()); m_textures.resize(m_stk_material.size());
for (unsigned i = 0; i < m_stk_material.size(); i++) for (unsigned i = 0; i < m_stk_material.size(); i++)
{ {
for (unsigned j = 0; j < 6; j++) for (unsigned j = 0; j < 6; j++)
{ {
// Undo the effect of srgb on 0 and 1 channel of textures
// which is the uv textures from .spm when advanced lighting
m_textures[i][j] = SPTextureManager::get()->getTexture m_textures[i][j] = SPTextureManager::get()->getTexture
(std::get<2>(m_stk_material[i])->getSamplerPath(j), (std::get<2>(m_stk_material[i])->getSamplerPath(j),
j == 0 ? std::get<2>(m_stk_material[i]) : NULL, j == 0 ? std::get<2>(m_stk_material[i]) : NULL,
j < 2 && CVS->isDefferedEnabled(), m_shaders[0]->isSrgbForTextureLayer(j),
std::get<2>(m_stk_material[i])->getContainerId()); std::get<2>(m_stk_material[i])->getContainerId());
} }
// Use .spm uv texture 1 and 2 for compare in scene manager // Use .spm uv texture 1 and 2 for compare in scene manager
@ -130,9 +137,7 @@ void SPMeshBuffer::uploadGLMesh()
} }
bool use_2_uv = std::get<2>(m_stk_material[0])->use2UV(); bool use_2_uv = std::get<2>(m_stk_material[0])->use2UV();
bool use_tangents = bool use_tangents = m_shaders[0]->useTangents();
std::get<2>(m_stk_material[0])->getShaderName() == "normalmap" &&
CVS->isDefferedEnabled();
const unsigned pitch = 48 - (use_tangents ? 0 : 4) - (use_2_uv ? 0 : 4) - const unsigned pitch = 48 - (use_tangents ? 0 : 4) - (use_2_uv ? 0 : 4) -
(m_skinned ? 0 : 16); (m_skinned ? 0 : 16);
m_pitch = pitch; m_pitch = pitch;
@ -212,10 +217,12 @@ void SPMeshBuffer::uploadGLMesh()
void SPMeshBuffer::recreateVAO(unsigned i) void SPMeshBuffer::recreateVAO(unsigned i)
{ {
#ifndef SERVER_ONLY #ifndef SERVER_ONLY
if (!m_shaders[0])
{
return;
}
bool use_2_uv = std::get<2>(m_stk_material[0])->use2UV(); bool use_2_uv = std::get<2>(m_stk_material[0])->use2UV();
bool use_tangents = bool use_tangents = m_shaders[0]->useTangents();
std::get<2>(m_stk_material[0])->getShaderName() == "normalmap" &&
CVS->isDefferedEnabled();
const unsigned pitch = m_pitch; const unsigned pitch = m_pitch;
size_t offset = 0; size_t offset = 0;
@ -458,4 +465,14 @@ void SPMeshBuffer::reloadTextureCompare()
} }
} // reloadTextureCompare } // reloadTextureCompare
// ----------------------------------------------------------------------------
void SPMeshBuffer::setSTKMaterial(Material* m)
{
m_stk_material[0] = std::make_tuple(0u, getIndexCount(), m);
m_shaders[0] = SPShaderManager::get()->getSPShader(
std::get<2>(m_stk_material[0])->getShaderName());
m_shaders[1] = SPShaderManager::get()->getSPShader(
std::get<2>(m_stk_material[0])->getShaderName() + "_skinned");
} // setSTKMaterial
} }

View File

@ -47,7 +47,7 @@ class SPTexture;
class SPMeshBuffer : public IMeshBuffer, public SPPerObjectUniform class SPMeshBuffer : public IMeshBuffer, public SPPerObjectUniform
{ {
protected: protected:
std::shared_ptr<SPShader> m_shaders[2];
std::vector<std::tuple<size_t/*first_index_id*/, std::vector<std::tuple<size_t/*first_index_id*/,
unsigned/*indices_count*/, Material*> > m_stk_material; unsigned/*indices_count*/, Material*> > m_stk_material;
@ -273,10 +273,7 @@ public:
m_indices = std::move(indices); m_indices = std::move(indices);
} }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
void setSTKMaterial(Material* m) void setSTKMaterial(Material* m);
{
m_stk_material[0] = std::make_tuple(0u, getIndexCount(), m);
}
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
void reloadTextureCompare(); void reloadTextureCompare();
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
@ -286,6 +283,9 @@ public:
m_indices.shrink_to_fit(); m_indices.shrink_to_fit();
} }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
SPShader* getShader(bool skinned = false) const
{ return skinned ? m_shaders[1].get() : m_shaders[0].get(); }
// ------------------------------------------------------------------------
virtual const video::SMaterial& getMaterial() const virtual const video::SMaterial& getMaterial() const
{ {
static video::SMaterial unused; static video::SMaterial unused;

View File

@ -192,11 +192,8 @@ SPShader* SPMeshNode::getShader(unsigned mesh_buffer_id) const
#ifndef SERVER_ONLY #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() ? SPShader* shader =
m_mesh->getSPMeshBuffer(mesh_buffer_id)->getSTKMaterial() m_mesh->getSPMeshBuffer(mesh_buffer_id)->getShader(m_animated);
->getShaderName() : m_shader_override) +
(m_animated ? "_skinned" : "");
SPShader* shader = SPShaderManager::get()->getSPShaderPtr(sn);
if (shader && shader->isTransparent()) if (shader && shader->isTransparent())
{ {
// Use real transparent shader first // Use real transparent shader first
@ -204,8 +201,8 @@ SPShader* SPMeshNode::getShader(unsigned mesh_buffer_id) const
} }
if (m_first_render_info && m_first_render_info->isTransparent()) if (m_first_render_info && m_first_render_info->isTransparent())
{ {
return SPShaderManager::get()->getSPShaderPtr return SPShaderManager::get()->getSPShader
(std::string("ghost") + (m_animated ? "_skinned" : "")); (std::string("ghost") + (m_animated ? "_skinned" : "")).get();
} }
return shader; return shader;
} }

View File

@ -52,8 +52,6 @@ private:
std::vector<std::array<float, 16> > m_skinning_matrices; std::vector<std::array<float, 16> > m_skinning_matrices;
std::string m_shader_override;
video::SColorf m_glow_color; video::SColorf m_glow_color;
std::vector<std::array<float, 2> > m_texture_matrices; std::vector<std::array<float, 2> > m_texture_matrices;
@ -119,8 +117,6 @@ public:
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
SPShader* getShader(unsigned mesh_buffer_id) const; SPShader* getShader(unsigned mesh_buffer_id) const;
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
void setShaderOverride(const std::string& so) { m_shader_override = so; }
// ------------------------------------------------------------------------
const std::array<float, 16>* getSkinningMatrices() const const std::array<float, 16>* getSkinningMatrices() const
{ return m_skinning_matrices.data(); } { return m_skinning_matrices.data(); }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------

View File

@ -139,11 +139,6 @@ public:
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
~SPShaderManager(); ~SPShaderManager();
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
SPShader* getSPShaderPtr(const std::string& name)
{
return getSPShader(name).get();
}
// ------------------------------------------------------------------------
std::shared_ptr<SPShader> getSPShader(const std::string& name) std::shared_ptr<SPShader> getSPShader(const std::string& name)
{ {
auto ret = m_shaders.find(name); auto ret = m_shaders.find(name);

View File

@ -21,8 +21,8 @@
#include "graphics/central_settings.hpp" #include "graphics/central_settings.hpp"
#include "graphics/irr_driver.hpp" #include "graphics/irr_driver.hpp"
#include "graphics/material_manager.hpp" #include "graphics/material_manager.hpp"
#include "graphics/sp/sp_base.hpp"
#include "graphics/sp/sp_dynamic_draw_call.hpp" #include "graphics/sp/sp_dynamic_draw_call.hpp"
#include "graphics/sp/sp_shader_manager.hpp"
#include "items/plunger.hpp" #include "items/plunger.hpp"
#include "items/projectile_manager.hpp" #include "items/projectile_manager.hpp"
#include "karts/abstract_kart.hpp" #include "karts/abstract_kart.hpp"
@ -59,8 +59,8 @@ RubberBand::RubberBand(Plunger *plunger, AbstractKart *kart)
color.setBlue(SP::srgb255ToLinear(color.getBlue())); color.setBlue(SP::srgb255ToLinear(color.getBlue()));
} }
m_dy_dc = std::make_shared<SP::SPDynamicDrawCall> m_dy_dc = std::make_shared<SP::SPDynamicDrawCall>
(scene::EPT_TRIANGLE_STRIP, SP::getSPShader("unlit"), (scene::EPT_TRIANGLE_STRIP, SP::SPShaderManager::get()->getSPShader
material_manager->getDefaultSPMaterial("unlit")); ("unlit"), material_manager->getDefaultSPMaterial("unlit"));
m_dy_dc->getVerticesVector().resize(4); m_dy_dc->getVerticesVector().resize(4);
// Set the vertex colors properly, as the new pipeline doesn't use the old // Set the vertex colors properly, as the new pipeline doesn't use the old
// light values // light values

View File

@ -23,8 +23,8 @@
#include "config/user_config.hpp" #include "config/user_config.hpp"
#include "graphics/show_curve.hpp" #include "graphics/show_curve.hpp"
#include "graphics/material_manager.hpp" #include "graphics/material_manager.hpp"
#include "graphics/sp/sp_base.hpp"
#include "graphics/sp/sp_dynamic_draw_call.hpp" #include "graphics/sp/sp_dynamic_draw_call.hpp"
#include "graphics/sp/sp_shader_manager.hpp"
#include "io/xml_node.hpp" #include "io/xml_node.hpp"
#include "items/flyable.hpp" #include "items/flyable.hpp"
#include "karts/abstract_kart.hpp" #include "karts/abstract_kart.hpp"
@ -68,7 +68,8 @@ CheckCannon::CheckCannon(const XMLNode &node, unsigned int index)
if (UserConfigParams::m_check_debug) if (UserConfigParams::m_check_debug)
{ {
m_debug_target_dy_dc = std::make_shared<SP::SPDynamicDrawCall> m_debug_target_dy_dc = std::make_shared<SP::SPDynamicDrawCall>
(scene::EPT_TRIANGLE_STRIP, SP::getSPShader("additive"), (scene::EPT_TRIANGLE_STRIP,
SP::SPShaderManager::get()->getSPShader("additive"),
material_manager->getDefaultSPMaterial("additive")); material_manager->getDefaultSPMaterial("additive"));
SP::addDynamicDrawCall(m_debug_target_dy_dc); SP::addDynamicDrawCall(m_debug_target_dy_dc);
m_debug_target_dy_dc->getVerticesVector().resize(4); m_debug_target_dy_dc->getVerticesVector().resize(4);

View File

@ -21,8 +21,8 @@
#include "config/user_config.hpp" #include "config/user_config.hpp"
#include "graphics/irr_driver.hpp" #include "graphics/irr_driver.hpp"
#include "graphics/material_manager.hpp" #include "graphics/material_manager.hpp"
#include "graphics/sp/sp_base.hpp"
#include "graphics/sp/sp_dynamic_draw_call.hpp" #include "graphics/sp/sp_dynamic_draw_call.hpp"
#include "graphics/sp/sp_shader_manager.hpp"
#include "io/xml_node.hpp" #include "io/xml_node.hpp"
#include "karts/abstract_kart.hpp" #include "karts/abstract_kart.hpp"
#include "modes/linear_world.hpp" #include "modes/linear_world.hpp"
@ -77,7 +77,8 @@ CheckLine::CheckLine(const XMLNode &node, unsigned int index)
{ {
#ifndef SERVER_ONLY #ifndef SERVER_ONLY
m_debug_dy_dc = std::make_shared<SP::SPDynamicDrawCall> m_debug_dy_dc = std::make_shared<SP::SPDynamicDrawCall>
(scene::EPT_TRIANGLE_STRIP, SP::getSPShader("additive"), (scene::EPT_TRIANGLE_STRIP,
SP::SPShaderManager::get()->getSPShader("additive"),
material_manager->getDefaultSPMaterial("additive")); material_manager->getDefaultSPMaterial("additive"));
SP::addDynamicDrawCall(m_debug_dy_dc); SP::addDynamicDrawCall(m_debug_dy_dc);
m_debug_dy_dc->getVerticesVector().resize(4); m_debug_dy_dc->getVerticesVector().resize(4);