summaryrefslogtreecommitdiffstats
path: root/o3d/compiler/technique/test_data/fur.fx
blob: 6c326a6b4055aaf93c6d73dead89db8670905745 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/*****************************************************************************/
/*                                                                           */
/* File: fur.fx                                                              */
/*                                                                           */
/*****************************************************************************/

// fur.fx

//---------------------------------------------------------------------------//

int shellcount = 20;
int shellnumber = 0;

float FurScale = 0;
float FurLength = 0;
float UVScale = 0;


texture FurTexture
< 
    string TextureType = "2D";
>;


// transformations
float4x4 worldViewProj : WORLDVIEWPROJ;

//------------------------------------
struct vertexInput {
    float3 position				: POSITION;
    float3 normal				: NORMAL;
    //float4 color                : COLOR0;
    float4 texCoordDiffuse		: TEXCOORD0;
    float4 tex1					: TEXCOORD1;
};

struct vertexOutput {
    float4 HPOS		: POSITION;    
    //float4 color    : COLOR;
    float4 T0	    : TEXCOORD0;
    float3 normal   : TEXCOORD1;

};


//------------------------------------
vertexOutput VS_TransformAndTexture(vertexInput IN) 
{
    vertexOutput OUT;

	//float3 P = IN.position.xyz;
	//float3 P = IN.position.xyz + (IN.normal * (FurDistance * (float)shellnumber));
	
	//float3 P = IN.position.xyz + (IN.normal * FurScale * 10.0f) + (IN.normal*FurLength);
	//float3 P = IN.position.xyz + (IN.normal * FurScale * 10.0f) + (IN.normal*FurLength);
	
	float3 P = IN.position.xyz + (IN.normal * FurLength);
	
	//OUT.T0 = IN.texCoordDiffuse * 2.0f;
	//OUT.T0 = IN.tex1 * FurScale;
	OUT.T0 = IN.texCoordDiffuse * UVScale;
	//OUT.T0 = IN.tex1 / 3.0f;
	OUT.HPOS = mul(float4(P, 1.0f), worldViewProj);
    //OUT.color = IN.color;
    OUT.normal = IN.normal;
    return OUT;
}


//------------------------------------
sampler TextureSampler = sampler_state 
{
    texture = <FurTexture>;
    AddressU  = WRAP;        
    AddressV  = WRAP;
    AddressW  = WRAP;
    MIPFILTER = LINEAR;
    MINFILTER = LINEAR;
    MAGFILTER = LINEAR;
};


//-----------------------------------
float4 PS_Textured( vertexOutput IN): COLOR
{
	float4 diffuseTexture = tex2D( TextureSampler, IN.T0 );
	//float4 diffuseTexture2 = tex2D( TextureSampler2, IN.T0 );
  
	//return (float4(furColor.xyz, FurStrength) * diffuseTexture);
	return diffuseTexture;
	//return float4(0.0f, 1.0f, 1.0f, 0.3f); //rrggbbaa
}

//-----------------------------------

technique Fur	        
{
    pass Shell
    <
    	string script="Draw=Geometry;";
    >
    {		
		VertexShader = compile vs_1_1 VS_TransformAndTexture();
		PixelShader  = compile ps_1_3 PS_Textured();
		AlphaBlendEnable = true;
		SrcBlend = srcalpha;
		//DestBlend = one;
		DestBlend = invsrcalpha;
		//DestBlend = srccolor;
		//DestBlend = invsrccolor;
		//DestBlend = srcalpha;
		//DestBlend = destalpha;
		//DestBlend = invdestalpha;
		//DestBlend = destcolor;
		//DestBlend = invdestcolor;    
		
		//CullMode = None;
		//CullMode = CCW;
    }
}