Changeset 3598 for trunk/src/opengl/mesa/3dfx/fxcliptmp.h
- Timestamp:
- May 23, 2000, 10:41:28 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/opengl/mesa/3dfx/fxcliptmp.h
r2938 r3598 3 3 /* 4 4 * Mesa 3-D graphics library 5 * Version: 3. 15 * Version: 3.3 6 6 * 7 7 * Copyright (C) 1999 Brian Paul All Rights Reserved. … … 96 96 #define SETUP S4 97 97 98 99 static void TAG(fx_tri_view_clip)( struct vertex_buffer *VB, 100 GLuint v[], 101 GLubyte mask ) 98 #define DRAW_LINE(tmp0, tmp1, width) \ 99 do { \ 100 GrVertex verts[4]; \ 101 float dx, dy, ix, iy; \ 102 \ 103 dx = tmp0->x - tmp1->x; \ 104 dy = tmp0->y - tmp1->y; \ 105 \ 106 if (dx * dx > dy * dy) { \ 107 iy = width * .5; \ 108 ix = 0; \ 109 } else { \ 110 iy = 0; \ 111 ix = width * .5; \ 112 } \ 113 \ 114 verts[0] = *tmp0; \ 115 verts[1] = *tmp0; \ 116 verts[2] = *tmp1; \ 117 verts[3] = *tmp1; \ 118 \ 119 verts[0].x = tmp0->x - ix; \ 120 verts[0].y = tmp0->y - iy; \ 121 \ 122 verts[1].x = tmp0->x + ix; \ 123 verts[1].y = tmp0->y + iy; \ 124 \ 125 verts[2].x = tmp1->x + ix; \ 126 verts[2].y = tmp1->y + iy; \ 127 \ 128 verts[3].x = tmp1->x - ix; \ 129 verts[3].y = tmp1->y - iy; \ 130 \ 131 FX_grDrawPolygonVertexList(4, verts); \ 132 } while (0) 133 134 static void TAG(fx_tri_view_clip)( struct vertex_buffer *VB, 135 GLuint v[], 136 GLubyte mask ) 102 137 { 103 138 GLcontext *ctx = VB->ctx; … … 112 147 GLubyte *clipmask = VB->ClipMask; 113 148 114 GLuint tmu0_source = fxMesa->tmu_source[0]; 115 GLuint tmu1_source = fxMesa->tmu_source[1]; 149 GLuint tmu0_source = fxMesa->tmu_source[0]; 150 GLuint tmu1_source = fxMesa->tmu_source[1]; 116 151 GLvector4f *tc0_vec = VB->TexCoordPtr[tmu0_source]; 117 152 GLvector4f *tc1_vec = VB->TexCoordPtr[tmu1_source]; … … 124 159 GLuint e = v[i]; 125 160 verts[i] = 0; 126 if (!clipmask[e]) verts[i] = (GrVertex *)gWin[e].f; 127 vlist[i] = out; 161 if (!clipmask[e]) verts[i] = (GrVertex *)gWin[e].f; 162 vlist[i] = out; 128 163 COPY_STRIDE; 129 164 out += SIZE; … … 135 170 GrVertex *v = tmp, *v2, *v3; 136 171 VARS; 137 172 138 173 for (i = 0 ; i < n ; i++) 139 140 141 142 143 144 174 if (!verts[i]) { 175 GLfloat *data = vlist[i]; 176 SETUP; 177 verts[i] = v++; 178 } 179 145 180 v = verts[0]; 146 181 v2 = verts[1]; … … 148 183 149 184 for (i = 2 ; i < n ; v2 = v3, v3=verts[++i]) 150 185 FX_grDrawTriangle(v, v2, v3); 151 186 } 152 187 } … … 156 191 157 192 158 static void TAG(fx_tri_clip_stride)( struct vertex_buffer *VB, 159 160 193 static void TAG(fx_tri_clip_stride)( struct vertex_buffer *VB, 194 GLuint v[], 195 GLuint mask ) 161 196 { 162 197 GLcontext *ctx = VB->ctx; … … 171 206 GLubyte *clipmask = VB->ClipMask; 172 207 173 GLuint tmu0_source = fxMesa->tmu_source[0]; 174 GLuint tmu1_source = fxMesa->tmu_source[1]; 208 GLuint tmu0_source = fxMesa->tmu_source[0]; 209 GLuint tmu1_source = fxMesa->tmu_source[1]; 175 210 GLvector4f *tc0_vec = VB->TexCoordPtr[tmu0_source]; 176 211 GLvector4f *tc1_vec = VB->TexCoordPtr[tmu1_source]; … … 183 218 GLuint e = v[i]; 184 219 verts[i] = 0; 185 if (!clipmask[e]) verts[i] = (GrVertex *)gWin[e].f; 186 vlist[i] = out; 220 if (!clipmask[e]) verts[i] = (GrVertex *)gWin[e].f; 221 vlist[i] = out; 187 222 COPY_STRIDE; 188 223 out += SIZE; … … 191 226 if (VB->ClipPtr->size < 4) { 192 227 vlist[0][3] = vlist[1][3] = vlist[2][3] = 1.0; 193 if (VB->ClipPtr->size == 2) 194 195 } 196 228 if (VB->ClipPtr->size == 2) 229 vlist[0][2] = vlist[1][2] = vlist[2][2] = 0.0; 230 } 231 197 232 if ((n = fx_clip_triangle( ctx, vlist, verts, SIZE, mask )) >= 3) 198 233 { … … 200 235 GrVertex *v = tmp, *v2, *v3; 201 236 VARS; 202 237 203 238 for (i = 0 ; i < n ; i++) 204 205 206 207 208 209 239 if (!verts[i]) { 240 GLfloat *data = vlist[i]; 241 SETUP; 242 verts[i] = v++; 243 } 244 210 245 v = verts[0]; 211 246 v2 = verts[1]; … … 213 248 214 249 for (i = 2 ; i < n ; v2 = v3, v3=verts[++i]) 215 250 FX_grDrawTriangle(v, v2, v3); 216 251 } 217 252 } … … 219 254 220 255 221 static void TAG(fx_line_clip)( struct vertex_buffer *VB, 222 223 256 static void TAG(fx_line_clip)( struct vertex_buffer *VB, 257 GLuint v1, GLuint v2, 258 GLubyte mask ) 224 259 { 225 260 GLcontext *ctx = VB->ctx; … … 229 264 GLfloat *out = data; 230 265 GLfloat *mat = ctx->Viewport.WindowMap.m; 266 GLfloat w = ctx->Line.Width*.5; 231 267 GLuint e, n; 232 268 233 GLuint tmu0_source = fxMesa->tmu_source[0]; 234 GLuint tmu1_source = fxMesa->tmu_source[1]; 269 GLuint tmu0_source = fxMesa->tmu_source[0]; 270 GLuint tmu1_source = fxMesa->tmu_source[1]; 235 271 GLvector4f *tc0_vec = VB->TexCoordPtr[tmu0_source]; 236 272 GLvector4f *tc1_vec = VB->TexCoordPtr[tmu1_source]; … … 242 278 (void) tmu1_source; (void) tc1_vec; 243 279 244 vlist[0] = out; 280 vlist[0] = out; 245 281 e = v1; 246 282 COPY_STRIDE; 247 283 out += SIZE; 248 284 249 vlist[1] = out; 285 vlist[1] = out; 250 286 e = v2; 251 287 COPY_STRIDE; … … 254 290 if (VB->ClipPtr->size < 4) { 255 291 vlist[0][3] = vlist[1][3] = 1.0; 256 if (VB->ClipPtr->size == 2) 257 258 } 259 292 if (VB->ClipPtr->size == 2) 293 vlist[0][2] = vlist[1][2] = 0.0; 294 } 295 260 296 if ((n = fx_clip_line( ctx, vlist, SIZE, mask )) != 0) 261 297 { … … 272 308 SETUP; 273 309 274 FX_grDrawLine(gWin, v);310 DRAW_LINE(gWin, v, w); 275 311 } 276 312 } … … 278 314 279 315 280 #undef V1 281 #undef S1 282 #undef C1 283 #undef Z1 316 #undef V1 317 #undef S1 318 #undef C1 319 #undef Z1 284 320 #undef T1 285 321 286 #undef V2 287 #undef S2 288 #undef C2 289 #undef Z2 322 #undef V2 323 #undef S2 324 #undef C2 325 #undef Z2 290 326 #undef T2 291 327 292 #undef V3 293 #undef S3 294 #undef C3 295 #undef Z3 328 #undef V3 329 #undef S3 330 #undef C3 331 #undef Z3 296 332 #undef T3 297 333 298 #undef V4 299 #undef S4 300 #undef C4 301 #undef Z4 334 #undef V4 335 #undef S4 336 #undef C4 337 #undef Z4 302 338 #undef T4 303 339 304 #undef VARS 305 #undef SETUP 306 #undef COPY 340 #undef VARS 341 #undef SETUP 342 #undef COPY 307 343 #undef COPY_STRIDE 308 344 #undef SIZE
Note:
See TracChangeset
for help on using the changeset viewer.