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

//--------------------------------------------------------------
// GLSL Programs
//--------------------------------------------------------------
vertex_program Ogre/Instancing/HW_VTF_glsl_vs glsl glsles
{
	source HW_VTFInstancing.vert

	preprocessor_defines DEPTH_SHADOWRECEIVER=1

	uses_vertex_texture_fetch true

	default_params
	{
		param_named			matrixTexture				int 2
	}
}

vertex_program Ogre/Instancing/VTF/HW/shadow_caster_glsl_vs glsl glsles
{
	source HW_VTFInstancing.vert

	preprocessor_defines DEPTH_SHADOWCASTER=1

	uses_vertex_texture_fetch true

	default_params
	{
		param_named			matrixTexture				int 0
	}
}

vertex_program Ogre/Instancing/HW_VTF_dq_glsl_vs glsl glsles
{
	source HW_VTFInstancing.vert

	preprocessor_defines ST_DUAL_QUATERNION,DEPTH_SHADOWRECEIVER=1

	uses_vertex_texture_fetch true

	default_params
	{
		param_named			matrixTexture				int 2
	}
}

vertex_program Ogre/Instancing/VTF/HW/shadow_caster_dq_glsl_vs glsl glsles
{
	source HW_VTFInstancing.vert

	preprocessor_defines ST_DUAL_QUATERNION,DEPTH_SHADOWCASTER=1

	uses_vertex_texture_fetch true

	default_params
	{
		param_named			matrixTexture				int 0
	}
}

vertex_program Ogre/Instancing/HW_VTF_dq_two_weights_glsl_vs glsl glsles
{
	source HW_VTFInstancing.vert

	preprocessor_defines ST_DUAL_QUATERNION,BONE_TWO_WEIGHTS,DEPTH_SHADOWRECEIVER=1

	uses_vertex_texture_fetch true

	default_params
	{
		param_named			matrixTexture				int 2
	}
}

vertex_program Ogre/Instancing/VTF/HW/shadow_caster_dq_two_weights_glsl_vs glsl glsles
{
	source HW_VTFInstancing.vert

	preprocessor_defines ST_DUAL_QUATERNION,BONE_TWO_WEIGHTS,DEPTH_SHADOWCASTER=1

	uses_vertex_texture_fetch true

	default_params
	{
		param_named			matrixTexture				int 0
	}
}

//--------------------------------------------------------------
// hlsl Programs
//--------------------------------------------------------------
vertex_program Ogre/Instancing/HW_VTF_hlsl_vs hlsl
{
	source HW_VTFInstancing.cg
	entry_point main_vs
	target vs_3_0
	
	preprocessor_defines DEPTH_SHADOWRECEIVER

	uses_vertex_texture_fetch true
}

vertex_program Ogre/Instancing/VTF/HW/shadow_caster_hlsl_vs hlsl
{
	source HW_VTFInstancing.cg
	entry_point main_vs
	target vs_3_0
	
	preprocessor_defines DEPTH_SHADOWCASTER

	uses_vertex_texture_fetch true
}

vertex_program Ogre/Instancing/HW_VTF_dq_hlsl_vs hlsl
{
	source HW_VTFInstancing.cg
	entry_point main_vs
	target vs_3_0
	
	preprocessor_defines DEPTH_SHADOWRECEIVER,ST_DUAL_QUATERNION

	uses_vertex_texture_fetch true
}

vertex_program Ogre/Instancing/VTF/HW/shadow_caster_dq_hlsl_vs hlsl
{
	source HW_VTFInstancing.cg
	entry_point main_vs
	target vs_3_0
	
	preprocessor_defines DEPTH_SHADOWCASTER,ST_DUAL_QUATERNION

	uses_vertex_texture_fetch true
}

vertex_program Ogre/Instancing/HW_VTF_dq_two_weights_hlsl_vs hlsl
{
	source HW_VTFInstancing.cg
	entry_point main_vs
	target vs_3_0
	
	preprocessor_defines DEPTH_SHADOWRECEIVER,ST_DUAL_QUATERNION,BONE_TWO_WEIGHTS

	uses_vertex_texture_fetch true
}

vertex_program Ogre/Instancing/VTF/HW/shadow_caster_dq_two_weights_hlsl_vs hlsl
{
	source HW_VTFInstancing.cg
	entry_point main_vs
	target vs_3_0
	
	preprocessor_defines DEPTH_SHADOWCASTER,ST_DUAL_QUATERNION,BONE_TWO_WEIGHTS

	uses_vertex_texture_fetch true
}

//--------------------------------------------------------------
// Unified CG/GLSL Programs
//--------------------------------------------------------------
vertex_program Ogre/Instancing/HW_VTF_vs unified
{
	delegate Ogre/Instancing/HW_VTF_glsl_vs
	delegate Ogre/Instancing/HW_VTF_hlsl_vs

	default_params
	{
		param_named_auto	viewProjMatrix				viewproj_matrix
		param_named_auto	texViewProjMatrix			texture_viewproj_matrix 0
	}
}

vertex_program Ogre/Instancing/VTF/HW/shadow_caster_vs unified
{
	delegate Ogre/Instancing/VTF/HW/shadow_caster_glsl_vs
	delegate Ogre/Instancing/VTF/HW/shadow_caster_hlsl_vs

	default_params
	{
		param_named_auto	viewProjMatrix				viewproj_matrix
	}
}

vertex_program Ogre/Instancing/HW_VTF_dq_vs unified
{
	delegate Ogre/Instancing/HW_VTF_dq_glsl_vs
	delegate Ogre/Instancing/HW_VTF_dq_hlsl_vs

	default_params
	{
		param_named_auto	viewProjMatrix				viewproj_matrix
		param_named_auto	texViewProjMatrix			texture_viewproj_matrix 0
	}
}

vertex_program Ogre/Instancing/VTF/HW/shadow_caster_dq_vs unified
{
	delegate Ogre/Instancing/VTF/HW/shadow_caster_dq_glsl_vs
	delegate Ogre/Instancing/VTF/HW/shadow_caster_dq_hlsl_vs

	default_params
	{
		param_named_auto	viewProjMatrix				viewproj_matrix
	}
}

vertex_program Ogre/Instancing/HW_VTF_dq_two_weights_vs unified
{
	delegate Ogre/Instancing/HW_VTF_dq_two_weights_glsl_vs
	delegate Ogre/Instancing/HW_VTF_dq_two_weights_hlsl_vs

	default_params
	{
		param_named_auto	viewProjMatrix				viewproj_matrix
		param_named_auto	texViewProjMatrix			texture_viewproj_matrix 0
	}
}

vertex_program Ogre/Instancing/VTF/HW/shadow_caster_dq_two_weights_vs unified
{
	delegate Ogre/Instancing/VTF/HW/shadow_caster_dq_two_weights_glsl_vs
	delegate Ogre/Instancing/VTF/HW/shadow_caster_dq_two_weights_hlsl_vs

	default_params
	{
		param_named_auto	viewProjMatrix				viewproj_matrix
	}
}

material Examples/Instancing/VTF/HW/shadow_caster
{
	technique
	{
		pass
		{
			vertex_program_ref Ogre/Instancing/VTF/HW/shadow_caster_vs
			{
			}
			fragment_program_ref Ogre/Instancing/shadow_caster_ps
			{
			}

			texture_unit InstancingVTF
			{
				filtering		none
			}
		}
	}
}

material Examples/Instancing/VTF/HW/shadow_caster_dq
{
	technique
	{
		pass
		{
			vertex_program_ref Ogre/Instancing/VTF/HW/shadow_caster_dq_vs
			{
			}
			fragment_program_ref Ogre/Instancing/shadow_caster_ps
			{
			}

			texture_unit InstancingVTF
			{
				filtering	none
			}
		}
	}
}

material Examples/Instancing/VTF/HW/shadow_caster_dq_two_weights
{
	technique
	{
		pass
		{
			vertex_program_ref Ogre/Instancing/VTF/HW/shadow_caster_dq_two_weights_vs
			{
				param_named_auto	viewProjMatrix				viewproj_matrix
			}
			fragment_program_ref Ogre/Instancing/shadow_caster_ps
			{
			}

			texture_unit InstancingVTF
			{
				filtering	none
			}
		}
	}
}

abstract material Examples/Instancing/HW_VTF
{
	technique
	{
		shadow_caster_material Examples/Instancing/VTF/HW/shadow_caster

		pass
		{
			specular	1 1 1 1 12.5
			vertex_program_ref Ogre/Instancing/HW_VTF_vs
			{
			}

			fragment_program_ref Ogre/Instancing_ps
			{
			}

			texture_unit Diffuse
			{
				texture		$DiffuseMap
			}

			texture_unit shadow0
			{
				content_type shadow
				tex_address_mode border
				tex_border_colour 1 1 1 1
			}

			texture_unit InstancingVTF
			{
				filtering	none
			}
		}
	}
}

material Examples/Instancing/VTF/HW/Robot : Examples/Instancing/HW_VTF
{
	set	$DiffuseMap	r2skin.jpg
}

abstract material Examples/Instancing/HW_VTF_dq
{
	technique
	{
		shadow_caster_material Examples/Instancing/VTF/HW/shadow_caster_dq

		pass
		{
			specular	1 1 1 1 12.5

			vertex_program_ref Ogre/Instancing/HW_VTF_dq_vs
			{
			}

			fragment_program_ref Ogre/Instancing_ps
			{
			}

			texture_unit Diffuse
			{
				texture		$DiffuseMap
			}

			texture_unit shadow0
			{
				content_type shadow
				tex_address_mode border
				tex_border_colour 1 1 1 1
			}

			texture_unit InstancingVTF
			{
				filtering		none
			}
		}
	}
}

material Examples/Instancing/VTF/HW/Robot_dq : Examples/Instancing/HW_VTF_dq
{
	set	$DiffuseMap	r2skin.jpg
}

abstract material Examples/Instancing/HW_VTF_dq_two_weights
{
	technique
	{
		shadow_caster_material Examples/Instancing/VTF/HW/shadow_caster_dq_two_weights

		pass
		{
			diffuse		0.3 0.3 0.3
			specular	0.1 0.1 0.1 0.1 12.5
			
			vertex_program_ref Ogre/Instancing/HW_VTF_dq_two_weights_vs
			{
				param_named_auto	viewProjMatrix				viewproj_matrix
			}

			fragment_program_ref Ogre/Instancing_ps
			{
			}

			texture_unit Diffuse
			{
				texture		$DiffuseMap
				tex_address_mode clamp
			}

			texture_unit shadow0
			{
				content_type shadow
				tex_address_mode border
				tex_border_colour 1 1 1 1
			}

			texture_unit InstancingVTF
			{
				filtering		none
			}
		}
	}
}

material Examples/Instancing/VTF/HW/spine_dq_two_weights : Examples/Instancing/HW_VTF_dq_two_weights
{
	set	$DiffuseMap	circuit.dds
}
