//---------------------------------------------------------------------------
//These materials/shaders are part of the NEW InstanceManager implementation
//Written by Matias N. Goldberg ("dark_sylinc")
//---------------------------------------------------------------------------

//--------------------------------------------------------------
// GLSL Programs
//--------------------------------------------------------------
fragment_program Ogre/Shadow/Utils glsl
{
	source shadows.glsl
}

fragment_program Ogre/Instancing_glsl_ps glsl
{
	source Instancing.frag
	attach Ogre/Shadow/Utils

	preprocessor_defines DEPTH_SHADOWRECEIVER=1

	default_params
	{
		param_named			diffuseMap				int 0
		param_named			shadowMap				int 1
	}
}

fragment_program Ogre/Instancing/shadow_caster_glsl_ps glsl
{
    source DepthShadowmapCasterFp.glsl

	preprocessor_defines LINEAR_RANGE=1
}

//--------------------------------------------------------------
// GLSL ES Programs
//--------------------------------------------------------------
fragment_program Ogre/Shadow/Utils glsles
{
	source shadows.glsles
}

fragment_program Ogre/Instancing_glsles_ps glsles
{
	source Instancing.frag

	preprocessor_defines DEPTH_SHADOWRECEIVER=1

	default_params
	{
		param_named			diffuseMap				int 0
		param_named			shadowMap				int 1
	}
}

fragment_program Ogre/Instancing/shadow_caster_glsles_ps glsles
{
    source DepthShadowmapCasterFp.glsles

	preprocessor_defines LINEAR_RANGE=1
}

//--------------------------------------------------------------
// CG Programs
//--------------------------------------------------------------
fragment_program Ogre/Instancing_cg_ps cg
{
	source Instancing_ps.cg
	entry_point main_ps
	profiles ps_4_0 ps_3_0 ps_2_x fp40

	compile_arguments -DDEPTH_SHADOWRECEIVER
}

fragment_program Ogre/Instancing/shadow_caster_cg_ps cg
{
	source depthshadowobject.cg
	profiles ps_4_0 ps_3_0 ps_2_x fp40
	entry_point main_fp
	compile_arguments -DSHADOWCASTER=1 -DDEPTH_SHADOWCASTER=1 -DDEPTH_SHADOWRECEIVER=0

	default_params
	{
	}
}

fragment_program Ogre/Instancing_hlsl_ps hlsl
{
	source Instancing_ps.hlsl
	entry_point main_ps
	target ps_4_0

	preprocessor_defines DEPTH_SHADOWRECEIVER
	//default_params
	//{
	//	param_named_auto lightAttenuation light_attenuation_color 0
	//}
}

fragment_program Ogre/Instancing/shadow_caster_hlsl_ps hlsl
{
	source depthshadowobject.hlsl
	target ps_4_0
	entry_point caster_fp
	preprocessor_defines SHADOWCASTER=1;DEPTH_SHADOWCASTER=1;DEPTH_SHADOWRECEIVER=0

	default_params
	{
	}
}


//--------------------------------------------------------------
// Unified CG/GLSL Programs
//--------------------------------------------------------------
fragment_program Ogre/Instancing_ps unified
{
	delegate Ogre/Instancing_glsl_ps
	delegate Ogre/Instancing_glsles_ps
	//delegate Ogre/Instancing_hlsl_ps
	delegate Ogre/Instancing_cg_ps
	
	default_params
	{
		param_named_auto	lightPosition		light_position			0
		param_named_auto	cameraPosition		camera_position			0
		param_named_auto	lightAmbient		ambient_light_colour
		param_named_auto	lightDiffuse		light_diffuse_colour	0
		param_named_auto	lightSpecular		light_specular_colour	0
		param_named_auto	lightGloss			surface_shininess

		param_named_auto	invShadowMapSize	inverse_texture_size	1
	}
}

fragment_program Ogre/Instancing/shadow_caster_ps unified
{
	delegate Ogre/Instancing/shadow_caster_glsl_ps
	delegate Ogre/Instancing/shadow_caster_glsles_ps
	//delegate Ogre/Instancing/shadow_caster_hlsl_ps
	delegate Ogre/Instancing/shadow_caster_cg_ps
}
