#ifndef INCLUDED_phoenix_Shader
#define INCLUDED_phoenix_Shader

#ifndef HXCPP_H
#include <hxcpp.h>
#endif

#include <luxe/resource/Resource.h>
HX_DECLARE_CLASS0(IMap)
HX_DECLARE_CLASS2(haxe,ds,StringMap)
HX_DECLARE_CLASS2(luxe,resource,Resource)
HX_DECLARE_CLASS2(luxe,resource,ResourceManager)
HX_DECLARE_CLASS1(phoenix,Color)
HX_DECLARE_CLASS1(phoenix,Shader)
HX_DECLARE_CLASS1(phoenix,Texture)
HX_DECLARE_CLASS1(phoenix,Vector)
HX_DECLARE_CLASS5(snow,platform,native,render,opengl,GLObject)
HX_DECLARE_CLASS5(snow,platform,native,render,opengl,GLProgram)
HX_DECLARE_CLASS5(snow,platform,native,render,opengl,GLShader)
namespace phoenix{


class HXCPP_CLASS_ATTRIBUTES  Shader_obj : public ::luxe::resource::Resource_obj{
	public:
		typedef ::luxe::resource::Resource_obj super;
		typedef Shader_obj OBJ_;
		Shader_obj();
		Void __construct(::luxe::resource::ResourceManager _manager);

	public:
		inline void *operator new( size_t inSize, bool inContainer=true)
			{ return hx::Object::operator new(inSize,inContainer); }
		static hx::ObjectPtr< Shader_obj > __new(::luxe::resource::ResourceManager _manager);
		static Dynamic __CreateEmpty();
		static Dynamic __Create(hx::DynamicArray inArgs);
		//~Shader_obj();

		HX_DO_RTTI;
		static void __boot();
		static void __register();
		void __Mark(HX_MARK_PARAMS);
		void __Visit(HX_VISIT_PARAMS);
		::String __ToString() const { return HX_CSTRING("Shader"); }

		::String errors;
		::String log;
		::String vertex_source_name;
		::String fragment_source_name;
		::snow::platform::native::render::opengl::GLShader vert_shader;
		::snow::platform::native::render::opengl::GLShader frag_shader;
		::snow::platform::native::render::opengl::GLProgram program;
		::snow::platform::native::render::opengl::GLShader shader;
		int vert_attribute;
		int tcoord_attribute;
		int color_attribute;
		int normal_attribute;
		int projectionmatrix_attribute;
		int modelviewmatrix_attribute;
		int tex0_attribute;
		int tex1_attribute;
		int tex2_attribute;
		int tex3_attribute;
		int tex4_attribute;
		int tex5_attribute;
		int tex6_attribute;
		int tex7_attribute;
		::haxe::ds::StringMap uniforms;
		::haxe::ds::StringMap uniform_textures;
		virtual Void activate( );
		Dynamic activate_dyn();

		virtual Void deactivate( );
		Dynamic deactivate_dyn();

		virtual Void set_uniform_int( ::String _name,int _value);
		Dynamic set_uniform_int_dyn();

		virtual Void set_uniform_float( ::String _name,Float _value);
		Dynamic set_uniform_float_dyn();

		virtual Void set_uniform_vector2( ::String _name,::phoenix::Vector _value);
		Dynamic set_uniform_vector2_dyn();

		virtual Void set_uniform_vector3( ::String _name,::phoenix::Vector _value);
		Dynamic set_uniform_vector3_dyn();

		virtual Void set_uniform_vector4( ::String _name,::phoenix::Vector _value);
		Dynamic set_uniform_vector4_dyn();

		virtual Void set_uniform_color( ::String _name,::phoenix::Color _value);
		Dynamic set_uniform_color_dyn();

		virtual Void set_uniform_texture( ::String _name,::phoenix::Texture _value);
		Dynamic set_uniform_texture_dyn();

		virtual ::snow::platform::native::render::opengl::GLShader compile( int _type,::String _source,hx::Null< bool >  _verbose);
		Dynamic compile_dyn();

		virtual ::snow::platform::native::render::opengl::GLProgram link( );
		Dynamic link_dyn();

		virtual Void drop( );

		virtual Void destroy( );
		Dynamic destroy_dyn();

		virtual bool from_string( ::String _vertex_source,::String _fragment_source,::String _frag_name,::String _vertex_name,hx::Null< bool >  _verbose);
		Dynamic from_string_dyn();

		virtual Void apply_uniforms( );
		Dynamic apply_uniforms_dyn();

		virtual int getUniform( ::String uniform_name);
		Dynamic getUniform_dyn();

		virtual Void setUniformInt( ::String uniform_name,int value,Dynamic location);
		Dynamic setUniformInt_dyn();

		virtual Void setUniformFloat( ::String uniform_name,Float value,Dynamic location);
		Dynamic setUniformFloat_dyn();

		virtual Void setUniformVector2( ::String uniform_name,::phoenix::Vector value,Dynamic location);
		Dynamic setUniformVector2_dyn();

		virtual Void setUniformVector3( ::String uniform_name,::phoenix::Vector value,Dynamic location);
		Dynamic setUniformVector3_dyn();

		virtual Void setUniformVector4( ::String uniform_name,::phoenix::Vector value,Dynamic location);
		Dynamic setUniformVector4_dyn();

		virtual Void setUniformColor( ::String uniform_name,::phoenix::Color value,Dynamic location);
		Dynamic setUniformColor_dyn();

		virtual Void setUniformTexture( ::String uniform_name,::phoenix::Texture value,Dynamic location);
		Dynamic setUniformTexture_dyn();

		virtual Void addLog( ::String _log);
		Dynamic addLog_dyn();

		virtual Void addError( ::String _error);
		Dynamic addError_dyn();

		static ::phoenix::Shader load( ::String _psid,::String _vsid,Dynamic _onloaded);
		static Dynamic load_dyn();

};

} // end namespace phoenix

#endif /* INCLUDED_phoenix_Shader */ 
