Lines Matching refs:Polygon
17 #include "Polygon.hpp"
43 bool Clipper::clip(Polygon &polygon, int clipFlagsOr, const DrawCall &draw)
47 if(clipFlagsOr & CLIP_NEAR) clipNear(polygon);
48 if(polygon.n >= 3) {
49 if(clipFlagsOr & CLIP_FAR) clipFar(polygon);
50 if(polygon.n >= 3) {
51 if(clipFlagsOr & CLIP_LEFT) clipLeft(polygon);
52 if(polygon.n >= 3) {
53 if(clipFlagsOr & CLIP_RIGHT) clipRight(polygon);
54 if(polygon.n >= 3) {
55 if(clipFlagsOr & CLIP_TOP) clipTop(polygon);
56 if(polygon.n >= 3) {
57 if(clipFlagsOr & CLIP_BOTTOM) clipBottom(polygon);
65 if(polygon.n >= 3) {
66 if(draw.clipFlags & CLIP_PLANE0) clipPlane(polygon, data.clipPlane[0]);
67 if(polygon.n >= 3) {
68 if(draw.clipFlags & CLIP_PLANE1) clipPlane(polygon, data.clipPlane[1]);
69 if(polygon.n >= 3) {
70 if(draw.clipFlags & CLIP_PLANE2) clipPlane(polygon, data.clipPlane[2]);
71 if(polygon.n >= 3) {
72 if(draw.clipFlags & CLIP_PLANE3) clipPlane(polygon, data.clipPlane[3]);
73 if(polygon.n >= 3) {
74 if(draw.clipFlags & CLIP_PLANE4) clipPlane(polygon, data.clipPlane[4]);
75 if(polygon.n >= 3) {
76 if(draw.clipFlags & CLIP_PLANE5) clipPlane(polygon, data.clipPlane[5]);
80 return polygon.n >= 3;
83 void Clipper::clipNear(Polygon &polygon)
85 const float4 **V = polygon.P[polygon.i];
86 const float4 **T = polygon.P[polygon.i + 1];
90 for(int i = 0; i < polygon.n; i++)
92 int j = i == polygon.n - 1 ? 0 : i + 1;
103 clipEdge(polygon.B[polygon.b], *V[i], *V[j], di, dj);
104 T[t++] = &polygon.B[polygon.b++];
111 clipEdge(polygon.B[polygon.b], *V[j], *V[i], dj, di);
112 T[t++] = &polygon.B[polygon.b++];
117 polygon.n = t;
118 polygon.i += 1;
121 void Clipper::clipFar(Polygon &polygon)
123 const float4 **V = polygon.P[polygon.i];
124 const float4 **T = polygon.P[polygon.i + 1];
128 for(int i = 0; i < polygon.n; i++)
130 int j = i == polygon.n - 1 ? 0 : i + 1;
141 clipEdge(polygon.B[polygon.b], *V[i], *V[j], di, dj);
142 T[t++] = &polygon.B[polygon.b++];
149 clipEdge(polygon.B[polygon.b], *V[j], *V[i], dj, di);
150 T[t++] = &polygon.B[polygon.b++];
155 polygon.n = t;
156 polygon.i += 1;
159 void Clipper::clipLeft(Polygon &polygon)
161 const float4 **V = polygon.P[polygon.i];
162 const float4 **T = polygon.P[polygon.i + 1];
166 for(int i = 0; i < polygon.n; i++)
168 int j = i == polygon.n - 1 ? 0 : i + 1;
179 clipEdge(polygon.B[polygon.b], *V[i], *V[j], di, dj);
180 T[t++] = &polygon.B[polygon.b++];
187 clipEdge(polygon.B[polygon.b], *V[j], *V[i], dj, di);
188 T[t++] = &polygon.B[polygon.b++];
193 polygon.n = t;
194 polygon.i += 1;
197 void Clipper::clipRight(Polygon &polygon)
199 const float4 **V = polygon.P[polygon.i];
200 const float4 **T = polygon.P[polygon.i + 1];
204 for(int i = 0; i < polygon.n; i++)
206 int j = i == polygon.n - 1 ? 0 : i + 1;
217 clipEdge(polygon.B[polygon.b], *V[i], *V[j], di, dj);
218 T[t++] = &polygon.B[polygon.b++];
225 clipEdge(polygon.B[polygon.b], *V[j], *V[i], dj, di);
226 T[t++] = &polygon.B[polygon.b++];
231 polygon.n = t;
232 polygon.i += 1;
235 void Clipper::clipTop(Polygon &polygon)
237 const float4 **V = polygon.P[polygon.i];
238 const float4 **T = polygon.P[polygon.i + 1];
242 for(int i = 0; i < polygon.n; i++)
244 int j = i == polygon.n - 1 ? 0 : i + 1;
255 clipEdge(polygon.B[polygon.b], *V[i], *V[j], di, dj);
256 T[t++] = &polygon.B[polygon.b++];
263 clipEdge(polygon.B[polygon.b], *V[j], *V[i], dj, di);
264 T[t++] = &polygon.B[polygon.b++];
269 polygon.n = t;
270 polygon.i += 1;
273 void Clipper::clipBottom(Polygon &polygon)
275 const float4 **V = polygon.P[polygon.i];
276 const float4 **T = polygon.P[polygon.i + 1];
280 for(int i = 0; i < polygon.n; i++)
282 int j = i == polygon.n - 1 ? 0 : i + 1;
293 clipEdge(polygon.B[polygon.b], *V[i], *V[j], di, dj);
294 T[t++] = &polygon.B[polygon.b++];
301 clipEdge(polygon.B[polygon.b], *V[j], *V[i], dj, di);
302 T[t++] = &polygon.B[polygon.b++];
307 polygon.n = t;
308 polygon.i += 1;
311 void Clipper::clipPlane(Polygon &polygon, const Plane &p)
313 const float4 **V = polygon.P[polygon.i];
314 const float4 **T = polygon.P[polygon.i + 1];
318 for(int i = 0; i < polygon.n; i++)
320 int j = i == polygon.n - 1 ? 0 : i + 1;
331 clipEdge(polygon.B[polygon.b], *V[i], *V[j], di, dj);
332 T[t++] = &polygon.B[polygon.b++];
339 clipEdge(polygon.B[polygon.b], *V[j], *V[i], dj, di);
340 T[t++] = &polygon.B[polygon.b++];
345 polygon.n = t;
346 polygon.i += 1;