#ifndef CPURESHADER_H_INCLUDED
#define CPURESHADER_H_INCLUDED



#include <irrlicht.h>

using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;


class CPureShader : public video::IShaderConstantSetCallBack
{
private:
	struct sShaderConstant
	{
		core::stringc Name;
		f32 val[16];
		u32 Size;
	};

	core::array< sShaderConstant > ps_constants;
	core::array< sShaderConstant > vs_constants;

    core::stringc ps_shader;
    core::stringc vs_shader;

    u32 m_Material; // Handle/id of fade material

public:
   CPureShader(const c8* pixelshader,  const c8* vertexshader);

    void CPureShader::init( const c8 *vertexShaderEntryPointName="main",
                        E_VERTEX_SHADER_TYPE vsCompileTarget=EVST_VS_1_1,
                        const c8 *pixelShaderEntryPointName="main",
                        E_PIXEL_SHADER_TYPE psCompileTarget=EPST_PS_1_1,
                        E_MATERIAL_TYPE baseMaterial=video::EMT_SOLID
                        );

   virtual void OnSetConstants(video::IMaterialRendererServices* services, s32 userData);

    u32 getMaterial() { return m_Material; };

    void setVSConstant(const c8* constantname, f32* values, u32 count);
    u32 getVSConstant(const c8* constantname, f32* values);
    void setPSConstant(const c8* constantname, f32* values, u32 count);
    u32 getPSConstant(const c8* constantname, f32* values);
};
/*

           // set clip matrix at register 4
           core::matrix4 worldViewProj(driver->getTransform(video::ETS_PROJECTION));
           worldViewProj *= driver->getTransform(video::ETS_VIEW);
           worldViewProj *= driver->getTransform(video::ETS_WORLD);
           services->setVertexShaderConstant(&worldViewProj.M[0], 4, 4);
           // for high level shading languages, this would be another solution:
           //services->setVertexShaderConstant("mWorldViewProj", worldViewProj.M, 16);

           // set some light color at register 9
           video::SColorf col(0.0f,1.0f,1.0f,0.0f);
           services->setVertexShaderConstant(reinterpret_cast<const f32*>(&col), 9, 1);
           // for high level shading languages, this would be another solution:
           //services->setVertexShaderConstant("myColor", reinterpret_cast<f32*>(&col), 4);
         }


	struct sShaderConstant
	{
		core::stringc Name;
		f32 val[16];
		u32 Size;
	};

	core::stringc Path;
*/
#endif // CPURESHADER_H_INCLUDED
