// -------------------------------
// Cel Shading Section
// -------------------------------
vertex_program Ogre/CelShadingVPCg cg
{
	source Example_CelShading.cg
	entry_point main_vp
	profiles vs_4_0 vs_3_0 vs_1_1 arbvp1

	default_params
	{
		param_named_auto lightPosition light_position_object_space 0
		param_named_auto eyePosition camera_position_object_space
		param_named_auto worldViewProj worldviewproj_matrix
		param_named shininess float 10 
	}
}

fragment_program Ogre/CelShadingFPCg cg
{
	source Example_CelShading.cg
	entry_point main_fp
	profiles ps_4_0 ps_3_0 ps_2_0 ps_1_1 arbfp1 fp20

}

vertex_program Ogre/CelShadingVPhlsl hlsl
{
	source Example_CelShading.cg
	entry_point main_vp
	target vs_2_0

	default_params
	{
		param_named_auto lightPosition light_position_object_space 0
		param_named_auto eyePosition camera_position_object_space
		param_named_auto worldViewProj worldviewproj_matrix
		param_named shininess float 10 
	}
}

fragment_program Ogre/CelShadingFPhlsl hlsl
{
	source Example_CelShading.cg
	entry_point main_fp
	target ps_4_0 ps_2_0
}

vertex_program Ogre/CelShadingVPGLSLES glsles
{
	source Example_CelShadingVp.glsles
	profiles glsles

	default_params
	{
		param_named_auto lightPosition light_position_object_space 0
		param_named_auto eyePosition camera_position_object_space
		param_named_auto worldViewProj worldviewproj_matrix
		param_named shininess float 10 
	}
}

fragment_program Ogre/CelShadingFPGLSLES glsles
{
	source Example_CelShadingFp.glsles
	profiles glsles
}

//! [celshading_vp]
vertex_program Ogre/CelShadingVPGLSL glsl
{
	source Example_CelShadingVp.glsl
	syntax glsl150

	default_params
	{
		param_named_auto lightPosition light_position_object_space 0
		param_named_auto eyePosition camera_position_object_space
		param_named_auto worldViewProj worldviewproj_matrix
		param_named shininess float 10 
	}
}
//! [celshading_vp]

fragment_program Ogre/CelShadingFPGLSL glsl
{
	source Example_CelShadingFp.glsl
	syntax glsl150
}

fragment_program Ogre/CelShadingFP unified
{
	delegate Ogre/CelShadingFPhlsl
	delegate Ogre/CelShadingFPGLSL
	delegate Ogre/CelShadingFPGLSLES
	delegate Ogre/CelShadingFPCg
}

vertex_program Ogre/CelShadingVP unified
{
	delegate Ogre/CelShadingVPhlsl
	delegate Ogre/CelShadingVPGLSL
	delegate Ogre/CelShadingVPGLSLES
	delegate Ogre/CelShadingVPCg
}

//shared_params lighting
//{
//    shared_param_named diffuse float4 0 0.5 0 1
//    shared_param_named specular float4 0.3 0.5 0.3 1.0
//}

sampler CelShading
{
	tex_address_mode clamp
	filtering none
}

material Examples/CelShading
{
	technique
	{
		pass
		{
			vertex_program_ref Ogre/CelShadingVP
			{
				// map shininess from custom renderable param 1
				param_named_auto shininess custom 1
			}
			fragment_program_ref Ogre/CelShadingFP
			{
//    			shared_params_ref lighting
				// map diffuse from custom renderable param 2
				param_named_auto diffuse custom 2
				// map specular from custom renderable param 3
				param_named_auto specular custom 3
			}
			texture_unit
			{
				texture cel_shading_diffuse.png 1d
				sampler_ref CelShading
			}
			texture_unit
			{
				texture cel_shading_specular.png 1d
				sampler_ref CelShading
			}
			texture_unit
			{
				texture cel_shading_edge.png 1d
				sampler_ref CelShading
			}
		}
	}
	
}

// Any number of lights, diffuse and specular.
material Examples/BumpMapping/MultiLightSpecular
{
	technique
	{
		pass
		{
			specular 1 1 1 4

			texture_unit decalmap
			{
				texture RustedMetal.jpg
			}

			rtshader_system
			{
				lighting_stage normal_map NMBumpsOut.png
			}
		}
		
	}

}

// Any number of lights, diffuse only, correct for tangent parity.
material Examples/BumpMapping/MultiLightTangentParity
{
	technique
	{
		pass
		{
			texture_unit decalmap
			{
				texture RustedMetal.jpg
			}

			rtshader_system
			{
				lighting_stage normal_map NMBumpsOut.png
			}
		}
	}

}


//---------------------------
// Projective texture section
//---------------------------


vertex_program Examples/TexProjectionVP cg
{
	source Example_Projection.cg
	entry_point generalPurposeProjection_vp
	profiles vs_1_1 arbvp1
}

fragment_program Examples/TexProjectionFP cg
{
	source Example_Projection.cg
	entry_point generalPurposeProjection_fp
	// sorry, ps_1_1 can't do this, fp20 can though
	profiles ps_2_0 arbfp1 fp20
}

material Examples/GeneralTexProjection
{
	technique
	{
		pass 
		{
			
			vertex_program_ref Examples/TexProjectionVP
			{
				param_named_auto worldViewProjMatrix worldviewproj_matrix
				param_named_auto worldMatrix world_matrix
				// You'll need to update the tex projection, I suggest using
				// the Frustum class
				//param_named_auto texWorldViewProj worldviewproj_matrix
			}
			fragment_program_ref Examples/TexProjectionFP
			{
				// no params
			}
			texture_unit
			{
				// Project the OGRE logo
				texture ogrelogo.png
				tex_address_mode clamp
			}
		}
		
			
	}
    
}

//----------------------------
// Distortion effects
//----------------------------
vertex_program Examples/FresnelRefractReflectVP glsl glsles glslang hlsl
{
	source Example_FresnelVp.glsl
}
fragment_program Examples/FresnelRefractReflectFP glsl glsles glslang hlsl
{
	source Example_FresnelFp.glsl
	default_params
	{
		// assign samplers as required by GLSL
		param_named noiseMap int 0
		param_named reflectMap int 1
		param_named refractMap int 2
	}
}

material Examples/FresnelReflectionRefraction
{
	// ps_2_0 / arbfp1
	technique
	{
		pass 
		{
			
			vertex_program_ref Examples/FresnelRefractReflectVP
			{
				param_named_auto worldViewProjMatrix worldviewproj_matrix
				param_named_auto textureProjMatrix texture_worldviewproj_matrix 0
				param_named_auto eyePosition camera_position_object_space
				param_named_auto timeVal time 0.05
				param_named scroll float 1  
				param_named scale float 1 
				param_named noise float 1 
				// scroll and noisePos will need updating per frame
			}
			fragment_program_ref Examples/FresnelRefractReflectFP
			{
				param_named fresnelBias float -0.1 
				param_named fresnelScale float 1.8 
				param_named fresnelPower float 8  
				param_named tintColour float4 0 0.05 0.05 1
				param_named noiseScale float 0.05 
			}
			// Noise
			texture_unit
			{
				// Perlin noise volume
				texture waves2.dds
				// min / mag filtering, no mip
				filtering linear linear none
			}
			// Reflection
			texture_unit
			{
				content_type compositor Fresnel reflection
				tex_address_mode clamp
				filtering linear linear none
			}
			// Refraction
			texture_unit
			{
				content_type compositor Fresnel refraction
				tex_address_mode clamp
				filtering linear linear none
			}
		}
		
			
	}
}

// Basic Athene statue
material Examples/Athene/Basic
{

	technique
	{
		pass
		{
			ambient 0.3 0.3 0.3
			diffuse 1.0 1.0 0.9

			texture_unit
			{
				texture egyptrockyfull.jpg 
			}
			
		}
	}
}

vertex_program Examples/TextureArrayVS glsl glsles hlsl glslang
{
	source Example_TextureArrayVS.glsl

	default_params
	{
		param_named_auto worldViewProj worldviewproj_matrix
	}
}

fragment_program Examples/TextureArrayPSglsl glsl glslang
{
	source Example_TextureArrayPS.glsl
}

fragment_program Examples/TextureArrayPSglsles glsles
{
	source Example_TextureArrayPS.glsl
	syntax glsl300es
}

fragment_program Examples/TextureArrayPShlsl4 hlsl
{
	source Example_TextureArrayPS.glsl
	target ps_4_0 ps_4_0_level_9_1 ps_4_0_level_9_3
}

fragment_program Examples/TextureArrayPS unified
{
	delegate Examples/TextureArrayPSglsl
	delegate Examples/TextureArrayPSglsles
	delegate Examples/TextureArrayPShlsl4
	default_params
	{
		param_named TextureArrayTex int 0
	}
}

material Examples/TextureArray
{
	technique
	{
		pass
		{
			vertex_program_ref Examples/TextureArrayVS
			{
			}

			fragment_program_ref Examples/TextureArrayPS
			{
			}
		}
	}
}
