Removed Shaders instance out of irr-driver, and use a class

with static members instead.
This commit is contained in:
hiker 2015-05-08 23:46:52 +10:00
parent 824b6906c1
commit 93f24f2a74
22 changed files with 177 additions and 125 deletions

View File

@ -16,7 +16,9 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "2dutils.hpp"
#include "central_settings.hpp"
#include "graphics/central_settings.hpp"
#include "graphics/shaders.hpp"
#include "glwrap.hpp"
#include "utils/cpp2011.hpp"

View File

@ -15,11 +15,13 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "central_settings.hpp"
#include "graphics/central_settings.hpp"
#include "config/user_config.hpp"
#include "modes/profile_world.hpp"
#include "gl_headers.hpp"
#include "glwrap.hpp"
#include "graphics_restrictions.hpp"
#include "graphics/gl_headers.hpp"
#include "graphics/glwrap.hpp"
#include "graphics/graphics_restrictions.hpp"
CentralVideoSettings *CVS = new CentralVideoSettings();

View File

@ -15,11 +15,13 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "graphics/central_settings.hpp"
#include "graphics/glwrap.hpp"
#include "config/user_config.hpp"
#include "config/hardware_stats.hpp"
#include "config/user_config.hpp"
#include "graphics/central_settings.hpp"
#include "graphics/shaders.hpp"
#include "graphics/stkmesh.hpp"
#include "utils/profiler.hpp"
#include "utils/cpp2011.hpp"

View File

@ -15,15 +15,19 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "graphics/irr_driver.hpp"
#include "graphics/glwrap.hpp"
#include "gpuparticles.hpp"
#include "io/file_manager.hpp"
#include "graphics/gpuparticles.hpp"
#include "config/user_config.hpp"
#include "graphics/glwrap.hpp"
#include "graphics/irr_driver.hpp"
#include "graphics/particle_emitter.hpp"
#include "graphics/shaders.hpp"
#include "graphics/texture_read.hpp"
#include "guiengine/engine.hpp"
#include "io/file_manager.hpp"
#include <ICameraSceneNode.h>
#include <IParticleSystemSceneNode.h>
#include "guiengine/engine.hpp"
#include "graphics/particle_emitter.hpp"
#include "../../lib/irrlicht/source/Irrlicht/os.h"
#define COMPONENTCOUNT 8

View File

@ -26,8 +26,7 @@
namespace irr { namespace video{ class ITexture; } }
using namespace irr;
class ParticleSystemProxy : public scene::CParticleSystemSceneNode
{

View File

@ -115,7 +115,6 @@ IrrDriver::IrrDriver()
/*event receiver*/ NULL,
file_manager->getFileSystem());
m_request_screenshot = false;
m_shaders = NULL;
m_rtts = NULL;
m_post_processing = NULL;
m_wind = new Wind();
@ -153,7 +152,7 @@ IrrDriver::~IrrDriver()
m_device = NULL;
m_modes.clear();
delete m_shaders;
Shaders::destroy();
delete m_wind;
} // ~IrrDriver
@ -515,7 +514,7 @@ void IrrDriver::initDevice()
// m_glsl might be reset in rtt if an error occurs.
if (CVS->isGLSL())
{
m_shaders = new Shaders();
Shaders::init();
m_mrt.clear();
m_mrt.reallocate(2);
@ -628,7 +627,7 @@ void IrrDriver::createSunInterposer()
m_sun_interposer->getMaterial(0).Lighting = false;
m_sun_interposer->getMaterial(0).ColorMask = video::ECP_NONE;
m_sun_interposer->getMaterial(0).ZWriteEnable = false;
m_sun_interposer->getMaterial(0).MaterialType = m_shaders->getShader(ES_OBJECTPASS);
m_sun_interposer->getMaterial(0).MaterialType = Shaders::getShader(ES_OBJECTPASS);
sphere->drop();
}
@ -781,7 +780,7 @@ void IrrDriver::applyResolutionSettings()
// FIXME: this load sequence is (mostly) duplicated from main.cpp!!
// That's just error prone
// (we're sure to update main.cpp at some point and forget this one...)
m_shaders->killShaders();
Shaders::destroy();
VAOManager::getInstance()->kill();
SolidPassCmd::getInstance()->kill();
ShadowPassCmd::getInstance()->kill();
@ -2425,13 +2424,13 @@ void IrrDriver::applyObjectPassShader(scene::ISceneNode * const node, bool rimli
const u32 mcount = node->getMaterialCount();
u32 i;
const video::E_MATERIAL_TYPE ref = rimlit ? m_shaders->getShader(ES_OBJECTPASS_RIMLIT):
m_shaders->getShader(ES_OBJECTPASS_REF);
const video::E_MATERIAL_TYPE pass = rimlit ? m_shaders->getShader(ES_OBJECTPASS_RIMLIT):
m_shaders->getShader(ES_OBJECTPASS);
const video::E_MATERIAL_TYPE ref = Shaders::getShader(rimlit ? ES_OBJECTPASS_RIMLIT
: ES_OBJECTPASS_REF);
const video::E_MATERIAL_TYPE pass = Shaders::getShader(rimlit ? ES_OBJECTPASS_RIMLIT
: ES_OBJECTPASS);
const video::E_MATERIAL_TYPE origref = m_shaders->getShader(ES_OBJECTPASS_REF);
const video::E_MATERIAL_TYPE origpass = m_shaders->getShader(ES_OBJECTPASS);
const video::E_MATERIAL_TYPE origref = Shaders::getShader(ES_OBJECTPASS_REF);
const video::E_MATERIAL_TYPE origpass = Shaders::getShader(ES_OBJECTPASS);
bool viamb = false;
scene::IMesh *mesh = NULL;
@ -2521,7 +2520,7 @@ scene::ISceneNode *IrrDriver::addLight(const core::vector3df &pos, float energy,
m_rsm_matrix_initialized = false;
((WaterShaderProvider *) m_shaders->m_callbacks[ES_WATER])->setSunPosition(pos);
((WaterShaderProvider *) Shaders::getCallback(ES_WATER) )->setSunPosition(pos);
}
return light;

View File

@ -36,8 +36,8 @@
#include <SColor.h>
#include "IrrlichtDevice.h"
#include "ISkinnedMesh.h"
#include "graphics/shaders.hpp"
#include "graphics/wind.hpp"
#include "graphics/gl_headers.hpp"
#include "io/file_manager.hpp"
#include "utils/aligned_array.hpp"
#include "utils/no_copy.hpp"
@ -195,8 +195,7 @@ private:
gui::IGUIFont *m_race_font;
/** Post-processing. */
PostProcessing *m_post_processing;
/** Shaders. */
Shaders *m_shaders;
/** Wind. */
Wind *m_wind;
/** RTTs. */
@ -557,13 +556,6 @@ public:
{
m_suncolor = col;
}
// -----------------------------------------------------------------------
inline video::E_MATERIAL_TYPE getShader(const ShaderType num) {return m_shaders->getShader(num);}
// -----------------------------------------------------------------------
inline video::IShaderConstantSetCallBack* getCallback(const ShaderType num)
{
return (m_shaders == NULL ? NULL : m_shaders->m_callbacks[num]);
}
// ------------------------------------------------------------------------
GLuint getRenderTargetTexture(TypeRTT which);
FrameBuffer& getFBO(TypeFBO which);

View File

@ -723,7 +723,7 @@ void Material::setMaterialProperties(video::SMaterial *m, scene::IMeshBuffer* m
switch (m_shader_type)
{
case SHADERTYPE_SOLID_UNLIT:
m->MaterialType = irr_driver->getShader(ES_OBJECT_UNLIT);
m->MaterialType = Shaders::getShader(ES_OBJECT_UNLIT);
m->setTexture(1, glossytex);
return;
case SHADERTYPE_ALPHA_TEST:
@ -747,7 +747,7 @@ void Material::setMaterialProperties(video::SMaterial *m, scene::IMeshBuffer* m
video::EAS_VERTEX_COLOR);
return;
case SHADERTYPE_SPHERE_MAP:
m->MaterialType = irr_driver->getShader(ES_SPHERE_MAP);
m->MaterialType = Shaders::getShader(ES_SPHERE_MAP);
m->setTexture(1, glossytex);
return;
case SHADERTYPE_SPLATTING:
@ -774,7 +774,7 @@ void Material::setMaterialProperties(video::SMaterial *m, scene::IMeshBuffer* m
m->setTexture(6, glossytex);
// Material and shaders
m->MaterialType = irr_driver->getShader(ES_SPLATTING);
m->MaterialType = Shaders::getShader(ES_SPLATTING);
return;
case SHADERTYPE_WATER:
m->setTexture(1, irr_driver->getTexture(FileManager::TEXTURE,
@ -782,18 +782,18 @@ void Material::setMaterialProperties(video::SMaterial *m, scene::IMeshBuffer* m
m->setTexture(2, irr_driver->getTexture(FileManager::TEXTURE,
"waternormals2.jpg"));
((WaterShaderProvider *)irr_driver->getCallback(ES_WATER))->
((WaterShaderProvider *)Shaders::getCallback(ES_WATER))->
setSpeed(m_water_shader_speed_1 / 100.0f, m_water_shader_speed_2 / 100.0f);
m->MaterialType = irr_driver->getShader(ES_WATER);
m->MaterialType = Shaders::getShader(ES_WATER);
return;
case SHADERTYPE_VEGETATION:
// Only one grass speed & amplitude per map for now
((GrassShaderProvider *)irr_driver->getCallback(ES_GRASS))->
((GrassShaderProvider *)Shaders::getCallback(ES_GRASS))->
setSpeed(m_grass_speed);
((GrassShaderProvider *)irr_driver->getCallback(ES_GRASS))->
((GrassShaderProvider *)Shaders::getCallback(ES_GRASS))->
setAmplitude(m_grass_amplitude);
m->MaterialType = irr_driver->getShader(ES_GRASS_REF);
m->MaterialType = Shaders::getShader(ES_GRASS_REF);
m->setTexture(1, glossytex);
return;
}
@ -807,7 +807,7 @@ void Material::setMaterialProperties(video::SMaterial *m, scene::IMeshBuffer* m
m->setTexture(2, tex);
// Material and shaders
m->MaterialType = irr_driver->getShader(ES_NORMAL_MAP);
m->MaterialType = Shaders::getShader(ES_NORMAL_MAP);
m->setTexture(1, glossytex);
return;
}

View File

@ -17,14 +17,17 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "graphics/mesh_tools.hpp"
#include "graphics/central_settings.hpp"
#include "graphics/irr_driver.hpp"
#include "graphics/shaders.hpp"
#include "modes/world.hpp"
#include "tracks/track.hpp"
#include "utils/log.hpp"
#include <irrlicht.h>
#include <IMesh.h>
#include <IMeshBuffer.h>
#include "utils/log.hpp"
#include "graphics/irr_driver.hpp"
#include "modes/world.hpp"
#include "tracks/track.hpp"
void MeshTools::minMax3D(scene::IMesh* mesh, Vec3 *min, Vec3 *max) {
@ -328,8 +331,8 @@ bool MeshTools::isNormalMap(scene::IMeshBuffer* mb)
{
if (!CVS->isGLSL())
return false;
return (mb->getMaterial().MaterialType == irr_driver->getShader(ES_NORMAL_MAP) &&
mb->getVertexType() != video::EVT_TANGENTS);
return (mb->getMaterial().MaterialType == Shaders::getShader(ES_NORMAL_MAP) &&
mb->getVertexType() != video::EVT_TANGENTS);
}
// Copied from irrlicht

View File

@ -88,8 +88,8 @@ void PostProcessing::reset()
m_center.resize(n);
m_direction.resize(n);
MotionBlurProvider * const cb = (MotionBlurProvider *) irr_driver->
getCallback(ES_MOTIONBLUR);
MotionBlurProvider * const cb =
(MotionBlurProvider *) Shaders::getCallback(ES_MOTIONBLUR);
for(unsigned int i=0; i<n; i++)
{
@ -147,8 +147,8 @@ void PostProcessing::reset()
void PostProcessing::setMotionBlurCenterY(const u32 num, const float y)
{
MotionBlurProvider * const cb = (MotionBlurProvider *) irr_driver->
getCallback(ES_MOTIONBLUR);
MotionBlurProvider * const cb =
(MotionBlurProvider *) Shaders::getCallback(ES_MOTIONBLUR);
const float tex_height = m_vertices[num].v1.TCoords.Y - m_vertices[num].v0.TCoords.Y;
m_center[num].Y = m_vertices[num].v0.TCoords.Y + y * tex_height;
@ -174,8 +174,8 @@ void PostProcessing::giveBoost(unsigned int camera_index)
{
m_boost_time[camera_index] = 0.75f;
MotionBlurProvider * const cb = (MotionBlurProvider *)irr_driver->
getCallback(ES_MOTIONBLUR);
MotionBlurProvider * const cb =
(MotionBlurProvider *)Shaders::getCallback(ES_MOTIONBLUR);
cb->setBoostTime(camera_index, m_boost_time[camera_index]);
}
} // giveBoost
@ -190,7 +190,7 @@ void PostProcessing::update(float dt)
return;
MotionBlurProvider* const cb =
(MotionBlurProvider*) irr_driver->getCallback(ES_MOTIONBLUR);
(MotionBlurProvider*) Shaders::getCallback(ES_MOTIONBLUR);
if (cb == NULL) return;
@ -518,8 +518,7 @@ void PostProcessing::renderSSAO()
void PostProcessing::renderMotionBlur(unsigned , FrameBuffer &in_fbo, FrameBuffer &out_fbo)
{
MotionBlurProvider * const cb = (MotionBlurProvider *)irr_driver->
getCallback(ES_MOTIONBLUR);
MotionBlurProvider * const cb = (MotionBlurProvider *)Shaders::getCallback(ES_MOTIONBLUR);
Camera *cam = Camera::getActiveCamera();
unsigned camID = cam->getIndex();
@ -788,10 +787,11 @@ FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode, boo
{
PROFILER_PUSH_CPU_MARKER("- Motion blur", 0xFF, 0x00, 0x00);
ScopedGPUTimer Timer(irr_driver->getGPUTimer(Q_MOTIONBLUR));
MotionBlurProvider * const cb = (MotionBlurProvider *)irr_driver->
getCallback(ES_MOTIONBLUR);
MotionBlurProvider * const cb =
(MotionBlurProvider *)Shaders::getCallback(ES_MOTIONBLUR);
if (isRace && UserConfigParams::m_motionblur && World::getWorld() != NULL && cb->getBoostTime(Camera::getActiveCamera()->getIndex()) > 0.) // motion blur
if (isRace && UserConfigParams::m_motionblur && World::getWorld() &&
cb->getBoostTime(Camera::getActiveCamera()->getIndex()) > 0.) // motion blur
{
renderMotionBlur(0, *in_fbo, *out_fbo);
std::swap(in_fbo, out_fbo);

View File

@ -84,7 +84,7 @@ void IrrDriver::renderGLSL(float dt)
}
if (m_mipviz)
{
overridemat.Material.MaterialType = m_shaders->getShader(ES_MIPVIZ);
overridemat.Material.MaterialType = Shaders::getShader(ES_MIPVIZ);
overridemat.EnableFlags |= video::EMF_MATERIAL_TYPE;
overridemat.EnablePasses = scene::ESNRP_SOLID;
}

View File

@ -829,7 +829,7 @@ void IrrDriver::renderTransparent()
irr_driver->getFBO(FBO_DISPLACE).Bind();
glClear(GL_COLOR_BUFFER_BIT);
DisplaceProvider * const cb = (DisplaceProvider *)irr_driver->getCallback(ES_DISPLACE);
DisplaceProvider * const cb = (DisplaceProvider *)Shaders::getCallback(ES_DISPLACE);
cb->update();
glEnable(GL_DEPTH_TEST);

View File

@ -92,23 +92,30 @@
#define SHADER_NAMES
#include "graphics/shaders.hpp"
#include "graphics/callbacks.hpp"
#include "graphics/central_settings.hpp"
#include "graphics/irr_driver.hpp"
#include "graphics/gpuparticles.hpp"
#include "graphics/shaders.hpp"
#include "io/file_manager.hpp"
#include "utils/log.hpp"
#include "graphics/glwrap.hpp"
#include <assert.h>
#include <IGPUProgrammingServices.h>
bool Shaders::m_has_been_initialised = false;
video::IShaderConstantSetCallBack *Shaders::m_callbacks[ES_COUNT];
int Shaders::m_shaders[ES_COUNT];
using namespace video;
std::vector<void(*)()> CleanTable;
Shaders::Shaders()
void Shaders::init()
{
assert(!m_has_been_initialised);
// Callbacks
memset(m_callbacks, 0, sizeof(m_callbacks));
@ -122,8 +129,25 @@ Shaders::Shaders()
m_shaders[i] = -1;
loadShaders();
}
m_has_been_initialised = true;
} // init
// ----------------------------------------------------------------------------
/** Frees all memory used by the shader manager.
*/
void Shaders::destroy()
{
assert(m_has_been_initialised);
u32 i;
for (i = 0; i < ES_COUNT; i++)
{
if (i == ES_GAUSSIAN3V || !m_callbacks[i]) continue;
delete m_callbacks[i];
}
m_has_been_initialised = false;
} // destroy
// ----------------------------------------------------------------------------
// Shader loading related hook
static std::string LoadHeader()
@ -436,38 +460,26 @@ void Shaders::loadShaders()
initParticleQuadVBO();
}
// ----------------------------------------------------------------------------
/** C
*/
void Shaders::killShaders()
{
for (unsigned i = 0; i < CleanTable.size(); i++)
CleanTable[i]();
}
} // killShaders
Shaders::~Shaders()
{
u32 i;
for (i = 0; i < ES_COUNT; i++)
{
if (i == ES_GAUSSIAN3V || !m_callbacks[i]) continue;
delete m_callbacks[i];
}
}
E_MATERIAL_TYPE Shaders::getShader(const ShaderType num) const
{
assert(num < ES_COUNT);
return (E_MATERIAL_TYPE)m_shaders[num];
}
void Shaders::check(const int num) const
// ----------------------------------------------------------------------------
void Shaders::check(const int num)
{
if (m_shaders[num] == -1)
{
Log::error("shaders", "Shader %s failed to load. Update your drivers, if the issue "
"persists, report a bug to us.", shader_names[num] + 3);
}
}
} // check
// ----------------------------------------------------------------------------
void bypassUBO(GLuint Program)
{
GLint VM = glGetUniformLocation(Program, "ViewMatrix");

View File

@ -24,6 +24,8 @@
#include <IMeshSceneNode.h>
#include <IShaderConstantSetCallBack.h>
#include <EMaterialTypes.h>
using namespace irr;
class ParticleSystemProxy;
@ -824,20 +826,42 @@ static const char *shader_names[] = {
class Shaders
{
private:
static bool m_has_been_initialised;
static int m_shaders[ES_COUNT];
static video::IShaderConstantSetCallBack *m_callbacks[ES_COUNT];
static void check(const int num);
static void loadShaders();
public:
Shaders();
~Shaders();
static void init();
static void destroy();
// ------------------------------------------------------------------------
/** Returns the material type of a shader.
* \param num The shader type.
*/
static video::E_MATERIAL_TYPE getShader(const ShaderType num)
{
assert(m_has_been_initialised);
assert(num < ES_COUNT);
return (video::E_MATERIAL_TYPE)m_shaders[num];
} // getShader
// ------------------------------------------------------------------------
/** Returns the callback for the specified shader type.
*/
static video::IShaderConstantSetCallBack* getCallback(const ShaderType num)
{
return m_has_been_initialised ? m_callbacks[num] : NULL;
} // getCallback
// ------------------------------------------------------------------------
video::E_MATERIAL_TYPE getShader(const ShaderType num) const;
video::IShaderConstantSetCallBack * m_callbacks[ES_COUNT];
void loadShaders();
void killShaders();
private:
void check(const int num) const;
int m_shaders[ES_COUNT];
};
#undef ENUM

View File

@ -111,7 +111,7 @@ scene::IMesh* STKTextBillboard::getTextMesh(core::stringw text, gui::ScalableFon
buffer = new scene::SMeshBuffer();
buffer->getMaterial().setTexture(0, m_chars[i].m_texture);
buffer->getMaterial().setTexture(1, getUnicolorTexture(video::SColor(0, 0, 0, 0)));
buffer->getMaterial().MaterialType = irr_driver->getShader(ES_OBJECT_UNLIT);
buffer->getMaterial().MaterialType = Shaders::getShader(ES_OBJECT_UNLIT);
buffers[m_chars[i].m_texture] = buffer;
}
else
@ -166,7 +166,7 @@ scene::IMesh* STKTextBillboard::getTextMesh(core::stringw text, gui::ScalableFon
map_itr->second->drop();
}
getMaterial(0).MaterialType = irr_driver->getShader(ES_OBJECT_UNLIT);
getMaterial(0).MaterialType = Shaders::getShader(ES_OBJECT_UNLIT);
return Mesh;
}

View File

@ -15,18 +15,21 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "graphics/stkmesh.hpp"
#include "config/user_config.hpp"
#include "central_settings.hpp"
#include "graphics/callbacks.hpp"
#include "graphics/camera.hpp"
#include "graphics/glwrap.hpp"
#include "graphics/irr_driver.hpp"
#include "graphics/stkmesh.hpp"
#include "graphics/shaders.hpp"
#include "modes/world.hpp"
#include "tracks/track.hpp"
#include "utils/helpers.hpp"
#include <ISceneManager.h>
#include <IMaterialRenderer.h>
#include "config/user_config.hpp"
#include "graphics/callbacks.hpp"
#include "utils/helpers.hpp"
#include "graphics/camera.hpp"
#include "modes/world.hpp"
Material::ShaderType MaterialTypeToMeshMaterial(video::E_MATERIAL_TYPE MaterialType, video::E_VERTEX_TYPE tp,
@ -40,7 +43,7 @@ Material::ShaderType MaterialTypeToMeshMaterial(video::E_MATERIAL_TYPE MaterialT
default:
return material->getShaderType();
case Material::SHADERTYPE_SOLID:
if (MaterialType == irr_driver->getShader(ES_NORMAL_MAP))
if (MaterialType == Shaders::getShader(ES_NORMAL_MAP))
return Material::SHADERTYPE_NORMAL_MAP;
else if (tp == video::EVT_2TCOORDS)
return Material::SHADERTYPE_DETAIL_MAP;
@ -50,7 +53,7 @@ Material::ShaderType MaterialTypeToMeshMaterial(video::E_MATERIAL_TYPE MaterialT
TransparentMaterial MaterialTypeToTransparentMaterial(video::E_MATERIAL_TYPE type, f32 MaterialTypeParam, Material* material)
{
if (type == irr_driver->getShader(ES_DISPLACE))
if (type == Shaders::getShader(ES_DISPLACE))
return TM_DISPLACEMENT;
if (material->getShaderType() == Material::SHADERTYPE_ADDITIVE)
return TM_ADDITIVE;
@ -252,7 +255,7 @@ core::matrix4 computeMVP(const core::matrix4 &ModelMatrix)
core::vector3df getWindDir()
{
const float time = irr_driver->getDevice()->getTimer()->getTime() / 1000.0f;
GrassShaderProvider *gsp = (GrassShaderProvider *)irr_driver->getCallback(ES_GRASS);
GrassShaderProvider *gsp = (GrassShaderProvider *)Shaders::getCallback(ES_GRASS);
float m_speed = gsp->getSpeed();
return m_speed * vector3df(1., 0., 0.) * cos(time);
@ -260,25 +263,25 @@ core::vector3df getWindDir()
bool isObject(video::E_MATERIAL_TYPE type)
{
if (type == irr_driver->getShader(ES_OBJECTPASS))
if (type == Shaders::getShader(ES_OBJECTPASS))
return true;
if (type == irr_driver->getShader(ES_OBJECTPASS_REF))
if (type == Shaders::getShader(ES_OBJECTPASS_REF))
return true;
if (type == irr_driver->getShader(ES_OBJECTPASS_RIMLIT))
if (type == Shaders::getShader(ES_OBJECTPASS_RIMLIT))
return true;
if (type == irr_driver->getShader(ES_NORMAL_MAP))
if (type == Shaders::getShader(ES_NORMAL_MAP))
return true;
if (type == irr_driver->getShader(ES_SPHERE_MAP))
if (type == Shaders::getShader(ES_SPHERE_MAP))
return true;
if (type == irr_driver->getShader(ES_SPLATTING))
if (type == Shaders::getShader(ES_SPLATTING))
return true;
if (type == irr_driver->getShader(ES_GRASS))
if (type == Shaders::getShader(ES_GRASS))
return true;
if (type == irr_driver->getShader(ES_GRASS_REF))
if (type == Shaders::getShader(ES_GRASS_REF))
return true;
if (type == irr_driver->getShader(ES_DISPLACE))
if (type == Shaders::getShader(ES_DISPLACE))
return true;
if (type == irr_driver->getShader(ES_OBJECT_UNLIT))
if (type == Shaders::getShader(ES_OBJECT_UNLIT))
return true;
if (type == video::EMT_TRANSPARENT_ALPHA_CHANNEL)
return true;

View File

@ -20,6 +20,8 @@
#define STKMESH_H
#include "graphics/irr_driver.hpp"
#include "graphics/material.hpp"
#include "utils/singleton.hpp"
#include "utils/tuple.hpp"
#include <IMeshSceneNode.h>
@ -27,7 +29,6 @@
#include "../lib/irrlicht/source/Irrlicht/CMeshSceneNode.h"
#include <vector>
#include "material.hpp"
class Material;

View File

@ -19,6 +19,8 @@
#define STKMESHSCENENODE_H
#include "stkmesh.hpp"
#include "graphics/shaders.hpp"
#include "utils/ptr_vector.hpp"
class STKMeshSceneNode : public irr::scene::CMeshSceneNode, public STKMeshCommon
@ -66,7 +68,7 @@ public:
if (!mb)
continue;
if (isDisplacement)
mb->getMaterial().MaterialType = irr_driver->getShader(ES_DISPLACE);
mb->getMaterial().MaterialType = Shaders::getShader(ES_DISPLACE);
}
}
virtual bool glow() const { return isGlow; }

View File

@ -38,9 +38,9 @@ WaterNode::WaterNode(scene::ISceneManager* mgr, IMesh *mesh, float height, float
m_mat.Lighting = false;
if (m_mat.MaterialType != irr_driver->getShader(ES_WATER))
if (m_mat.MaterialType != Shaders::getShader(ES_WATER))
{
m_mat.MaterialType = irr_driver->getShader(ES_WATER_SURFACE);
m_mat.MaterialType = Shaders::getShader(ES_WATER_SURFACE);
} else
{
m_mat.BlendOperation = EBO_ADD;
@ -68,7 +68,8 @@ void WaterNode::render()
if (SceneManager->getSceneNodeRenderPass() != scene::ESNRP_TRANSPARENT)
return;
WaterShaderProvider * const cb = (WaterShaderProvider *) irr_driver->getCallback(ES_WATER);
WaterShaderProvider * const cb =
(WaterShaderProvider *) Shaders::getCallback(ES_WATER);
cb->setSpeed(m_speed);
cb->setHeight(m_height);
cb->setLength(m_length);

View File

@ -22,12 +22,15 @@
#include "graphics/irr_driver.hpp"
#include "graphics/post_processing.hpp"
#include "graphics/rtts.hpp"
#include <algorithm>
#include <IAnimatedMesh.h>
#include <IAnimatedMeshSceneNode.h>
#include <ICameraSceneNode.h>
#include <ILightSceneNode.h>
#include <ISceneManager.h>
#include <IMeshSceneNode.h>
#include <algorithm>
using namespace GUIEngine;
using namespace irr::core;

View File

@ -16,10 +16,12 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "guiengine/widgets/player_kart_widget.hpp"
#include "config/player_manager.hpp"
#include "config/user_config.hpp"
#include "guiengine/widgets/kart_stats_widget.hpp"
#include "guiengine/widgets/model_view_widget.hpp"
#include "guiengine/widgets/player_kart_widget.hpp"
#include "guiengine/widgets/player_name_spinner.hpp"
#include "input/input_device.hpp"
#include "karts/kart_properties.hpp"

View File

@ -22,6 +22,7 @@
#include "graphics/camera.hpp"
#include "graphics/irr_driver.hpp"
#include "graphics/light.hpp"
#include "graphics/shaders.hpp"
#include "items/powerup_manager.hpp"
#include "items/attachment.hpp"
#include "karts/abstract_kart.hpp"