Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/Media/materials/programs/StdQuad_vp.cg @ 5161

Last change on this file since 5161 was 5120, checked in by janise, 17 years ago

sweet shader programs

File size: 2.8 KB
Line 
1void StdQuad_vp
2(
3    in float4 inPos : POSITION,
4
5    out float4 pos : POSITION,
6    out float2 uv0 : TEXCOORD0,
7
8    uniform float4x4 worldViewProj
9)
10{
11    // Use standardise transform, so work accord with render system specific (RS depth, requires texture flipping, etc)
12    pos = mul(worldViewProj, inPos);
13
14    // The input positions adjusted by texel offsets, so clean up inaccuracies
15    inPos.xy = sign(inPos.xy);
16
17    // Convert to image-space
18    uv0 = (float2(inPos.x, -inPos.y) + 1.0f) * 0.5f;
19}
20
21void StdQuad_Tex2_vp
22(
23    in float4 inPos : POSITION,
24
25    out float4 pos : POSITION,
26    out float2 uv0 : TEXCOORD0,
27    out float2 uv1 : TEXCOORD1,
28
29    uniform float4x4 worldViewProj
30)
31{
32    // Use standardise transform, so work accord with render system specific (RS depth, requires texture flipping, etc)
33    pos = mul(worldViewProj, inPos);
34
35    // The input positions adjusted by texel offsets, so clean up inaccuracies
36    inPos.xy = sign(inPos.xy);
37
38    // Convert to image-space
39    uv0 = (float2(inPos.x, -inPos.y) + 1.0f) * 0.5f;
40    uv1 = uv0;
41}
42
43void StdQuad_Tex2a_vp
44(
45    in float4 inPos : POSITION,
46
47    out float4 pos : POSITION,
48    out float2 uv0 : TEXCOORD0,
49    out float2 uv1 : TEXCOORD1,
50
51    uniform float4x4 worldViewProj
52)
53{
54    // Use standardise transform, so work accord with render system specific (RS depth, requires texture flipping, etc)
55    pos = mul(worldViewProj, inPos);
56
57    // The input positions adjusted by texel offsets, so clean up inaccuracies
58    inPos.xy = sign(inPos.xy);
59
60    // Convert to image-space
61    uv0 = (float2(inPos.x, -inPos.y) + 1.0f) * 0.5f;
62    uv1 = inPos.xy;
63}
64
65void StdQuad_Tex3_vp
66(
67    in float4 inPos : POSITION,
68
69    out float4 pos : POSITION,
70    out float2 uv0 : TEXCOORD0,
71    out float2 uv1 : TEXCOORD1,
72    out float2 uv2 : TEXCOORD2,
73
74    uniform float4x4 worldViewProj
75)
76{
77    // Use standardise transform, so work accord with render system specific (RS depth, requires texture flipping, etc)
78    pos = mul(worldViewProj, inPos);
79
80    // The input positions adjusted by texel offsets, so clean up inaccuracies
81    inPos.xy = sign(inPos.xy);
82
83    // Convert to image-space
84    uv0 = (float2(inPos.x, -inPos.y) + 1.0f) * 0.5f;
85    uv1 = uv0;
86    uv2 = uv0;
87}
88
89void StdQuad_Tex4_vp
90(
91    in float4 inPos : POSITION,
92
93    out float4 pos : POSITION,
94    out float2 uv0 : TEXCOORD0,
95    out float2 uv1 : TEXCOORD1,
96    out float2 uv2 : TEXCOORD2,
97    out float2 uv3 : TEXCOORD3,
98
99    uniform float4x4 worldViewProj
100)
101{
102    // Use standardise transform, so work accord with render system specific (RS depth, requires texture flipping, etc)
103    pos = mul(worldViewProj, inPos);
104
105    // The input positions adjusted by texel offsets, so clean up inaccuracies
106    inPos.xy = sign(inPos.xy);
107
108    // Convert to image-space
109    uv0 = (float2(inPos.x, -inPos.y) + 1.0f) * 0.5f;
110    uv1 = uv0;
111    uv2 = uv0;
112    uv3 = uv0;
113}
Note: See TracBrowser for help on using the repository browser.