Make SPMeshBuffer uniform-assignable (for slipstream)
This commit is contained in:
parent
0da5922722
commit
17c337284e
@ -1743,7 +1743,7 @@ void draw(RenderPass rp, DrawCallType dct)
|
||||
for (unsigned k = 0; k < p.second[j].second.size(); k++)
|
||||
{
|
||||
static std::vector<SPUniformAssigner*> draw_call_uniforms;
|
||||
p.first->setUniformsPerObject(dynamic_cast<SPPerObjectUniform*>
|
||||
p.first->setUniformsPerObject(static_cast<SPPerObjectUniform*>
|
||||
(p.second[j].second[k].first), &draw_call_uniforms, rp);
|
||||
p.second[j].second[k].first->draw(dct,
|
||||
p.second[j].second[k].second/*material_id*/,
|
||||
|
@ -19,7 +19,6 @@
|
||||
#define HEADER_SP_DYNAMIC_DRAW_CALL_HPP
|
||||
|
||||
#include "graphics/sp/sp_mesh_buffer.hpp"
|
||||
#include "graphics/sp/sp_per_object_uniform.hpp"
|
||||
|
||||
#include <IMeshBuffer.h>
|
||||
|
||||
@ -40,7 +39,7 @@ namespace SP
|
||||
class SPShader;
|
||||
|
||||
|
||||
class SPDynamicDrawCall : public SPMeshBuffer, public SPPerObjectUniform
|
||||
class SPDynamicDrawCall : public SPMeshBuffer
|
||||
{
|
||||
private:
|
||||
core::matrix4 m_trans;
|
||||
@ -128,7 +127,11 @@ public:
|
||||
std::vector<video::S3DVertexSkinnedMesh>& getVerticesVector()
|
||||
{ return m_vertices; }
|
||||
// ------------------------------------------------------------------------
|
||||
core::vector2df& getTextureTrans() { return m_texture_trans; }
|
||||
core::vector2df& getTextureTrans()
|
||||
{
|
||||
m_update_trans = true;
|
||||
return m_texture_trans;
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
void setUpdateOffset(int offset) { m_update_offset = offset; }
|
||||
// ------------------------------------------------------------------------
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "graphics/gl_headers.hpp"
|
||||
#include "graphics/sp/sp_base.hpp"
|
||||
#include "graphics/sp/sp_instanced_data.hpp"
|
||||
#include "graphics/sp/sp_per_object_uniform.hpp"
|
||||
#include "utils/types.hpp"
|
||||
|
||||
#include <IMeshBuffer.h>
|
||||
@ -42,7 +43,7 @@ namespace SP
|
||||
{
|
||||
class SPTexture;
|
||||
|
||||
class SPMeshBuffer : public IMeshBuffer
|
||||
class SPMeshBuffer : public IMeshBuffer, public SPPerObjectUniform
|
||||
{
|
||||
protected:
|
||||
std::vector<std::tuple<size_t/*first_index_id*/,
|
||||
|
@ -60,6 +60,8 @@ public:
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
bool assignUniform(const std::string& name, SPUniformAssigner* ua) const;
|
||||
// ------------------------------------------------------------------------
|
||||
bool isEmpty() const { return m_all_uniforms.empty(); }
|
||||
|
||||
};
|
||||
|
||||
|
@ -218,7 +218,7 @@ void SPShader::setUniformsPerObject(SPPerObjectUniform* sppou,
|
||||
RenderPass rp)
|
||||
{
|
||||
#ifndef SERVER_ONLY
|
||||
if (sppou == NULL)
|
||||
if (sppou->isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user