9
9
////////////////////////////////////////////////////////////////////////////////
10
10
11
11
#define CCW_BOUNDARY_BIAS 0.00001
12
- #define CW_BOUNDARY_BIAS -0.00001
12
+ #define CW_BOUNDARY_BIAS -0.00001
13
13
14
14
float4x4 viewMatrix;
15
15
float4x4 projMatrix;
@@ -25,20 +25,20 @@ typedef Vertex Pixel;
25
25
Vertex boundaryVertexShader ( float3 vertex : POSITION0 )
26
26
{
27
27
Vertex result = (Vertex)0 ;
28
-
28
+
29
29
float3 position = boxExtent * vertex + boxCenter;
30
30
result.position = mul (float4 (position,1 ),mul (viewMatrix,projMatrix));
31
-
31
+
32
32
return result;
33
33
}
34
34
35
35
Vertex visionVertexShader ( float3 vertex : POSITION0, float2 position : POSITION1, float radius : TEXCOORD0 )
36
36
{
37
37
Vertex result = (Vertex)0 ;
38
-
38
+
39
39
vertex.xz = radius.xx * vertex.xz + position.xy;
40
40
result.position = mul (float4 (vertex,1 ),mul (viewMatrix,projMatrix));
41
-
41
+
42
42
return result;
43
43
}
44
44
@@ -49,53 +49,34 @@ float4 pixelShader( Pixel pixel) : COLOR0
49
49
50
50
technique CastVision
51
51
{
52
- pass FrontFace
52
+ pass P0
53
53
{
54
- CullMode = CCW ;
55
-
54
+ CullMode = none ;
55
+
56
56
AlphaBlendEnable = false ;
57
57
AlphaTestEnable = false ;
58
-
59
- ColorWriteEnable = 0x00 ;
58
+
59
+ ColorWriteEnable = 0x00 ;
60
60
61
61
ZWriteEnable = false ;
62
62
ZEnable = true ;
63
63
ZFunc = less ;
64
-
64
+
65
65
StencilEnable = true ;
66
66
StencilWriteMask = 0xFF ;
67
67
StencilMask = 0xFF ;
68
68
StencilRef = 0x00 ;
69
- StencilFunc = always ;
69
+
70
+ TwoSidedStencilMode = true ;
70
71
StencilFail = keep ;
71
72
StencilZFail = incr ;
72
73
StencilPass = keep ;
73
-
74
- VertexShader = compile vs_2_0 visionVertexShader ();
75
- PixelShader = compile ps_2_0 pixelShader ();
76
- }
77
- pass BackFace
78
- {
79
- CullMode = CW;
80
-
81
- AlphaBlendEnable = false ;
82
- AlphaTestEnable = false ;
83
-
84
- ColorWriteEnable = 0x00 ;
85
-
86
- ZWriteEnable = false ;
87
- ZEnable = true ;
88
- ZFunc = less ;
89
-
90
- StencilEnable = true ;
91
- StencilWriteMask = 0xFF ;
92
- StencilMask = 0xFF ;
93
- StencilRef = 0x00 ;
94
74
StencilFunc = always ;
95
- StencilFail = keep ;
96
- StencilZFail = decr ;
97
- StencilPass = keep ;
98
-
75
+ CCW_StencilFail = keep ;
76
+ CCW_StencilZFail = decr ;
77
+ CCW_StencilPass = keep ;
78
+ CCW_StencilFunc = always ;
79
+
99
80
VertexShader = compile vs_2_0 visionVertexShader ();
100
81
PixelShader = compile ps_2_0 pixelShader ();
101
82
}
@@ -106,10 +87,10 @@ technique CastBoundaryCCW
106
87
pass FrontFace
107
88
{
108
89
CullMode = CCW;
109
-
90
+
110
91
ColorWriteEnable = 0x00 ;
111
92
DepthBias = CCW_BOUNDARY_BIAS;
112
-
93
+
113
94
ZWriteEnable = false ;
114
95
ZEnable = true ;
115
96
ZFunc = less ;
@@ -129,7 +110,7 @@ technique CastBoundaryCCW
129
110
pass BackFace
130
111
{
131
112
CullMode = CW;
132
-
113
+
133
114
ColorWriteEnable = 0x00 ;
134
115
DepthBias = CW_BOUNDARY_BIAS;
135
116
@@ -156,7 +137,7 @@ technique CastBoundaryCW
156
137
pass FrontFace
157
138
{
158
139
CullMode = CW;
159
-
140
+
160
141
ColorWriteEnable = 0x00 ;
161
142
DepthBias = CW_BOUNDARY_BIAS;
162
143
@@ -179,7 +160,7 @@ technique CastBoundaryCW
179
160
pass BackFace
180
161
{
181
162
CullMode = CCW;
182
-
163
+
183
164
ColorWriteEnable = 0x00 ;
184
165
DepthBias = CCW_BOUNDARY_BIAS;
185
166
0 commit comments