aboutsummaryrefslogtreecommitdiff
path: root/APEX_1.4/media/SampleRenderer/4/shaders/fragment/pointsprite_normal.cg
blob: 42bc61dc4e29b6d4005c72f740c3cee3f528cb31 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <phong_lighting.cg>
#include <fragment_entry.cg>

DECLARE_TEXTURE(normalTexture)

SurfaceMaterial computeSurfaceMaterial(const FragmentParameters params)
{
	SurfaceMaterial mout;
	
#if defined(PX_X360) && defined(RENDERER_FRAGMENT)
	half4 normalTextureColor  = tex2D(normalTexture, float2(params.spriteTexCoord.x, 1-params.spriteTexCoord.y));
#else	
	half4 normalTextureColor  = (half4)tex2D(normalTexture, float2(params.texcoord0.x, 1-params.texcoord0.y));
#endif
	mout.alpha              = normalTextureColor.a;
	mout.diffuseColor       = params.color.rgb;
	mout.emissiveColor      = 0;
	mout.specularColor      = half3(1,1,1); // TODO: make this a constant parameter set by the material.
	mout.specularPower      = 16;
	mout.tangentSpaceNormal = normalTextureColor.rgb*2-1;
	
	return mout;
}