| 37 |
|
if (mp != curmat && domats) { |
| 38 |
|
NOPOLY(); |
| 39 |
|
domatobj(curmat = mp, cent); |
| 40 |
< |
} else if (!ispoly) |
| 40 |
> |
} else if (!ispoly) { |
| 41 |
|
NOPOLY(); |
| 42 |
+ |
} |
| 43 |
|
} |
| 44 |
|
|
| 45 |
|
|
| 107 |
|
} |
| 108 |
|
|
| 109 |
|
|
| 110 |
< |
static |
| 110 |
> |
static void |
| 111 |
|
newtess() /* allocate GLU tessellation object */ |
| 112 |
|
{ |
| 113 |
|
if ((gluto = gluNewTess()) == NULL) |
| 121 |
|
} |
| 122 |
|
|
| 123 |
|
|
| 124 |
< |
static |
| 124 |
> |
static void |
| 125 |
|
newquadric() /* allocate GLU quadric structure */ |
| 126 |
|
{ |
| 127 |
|
if ((gluqo = gluNewQuadric()) == NULL) |
| 139 |
|
FVECT norm, cent; |
| 140 |
|
register int i; |
| 141 |
|
|
| 142 |
< |
if (o->oargs.nfargs < 9 | o->oargs.nfargs % 3) |
| 142 |
> |
if ((o->oargs.nfargs < 9) | (o->oargs.nfargs % 3)) |
| 143 |
|
objerror(o, USER, "bad # real arguments"); |
| 144 |
|
area = polyarea(cent, norm, o->oargs.nfargs/3, (FVECT *)o->oargs.farg); |
| 145 |
|
if (area <= FTINY) |
| 237 |
|
FVECT cent; |
| 238 |
|
register int iscyl; |
| 239 |
|
|
| 240 |
< |
iscyl = o->otype==OBJ_CYLINDER | o->otype==OBJ_TUBE; |
| 240 |
> |
iscyl = (o->otype==OBJ_CYLINDER) | (o->otype==OBJ_TUBE); |
| 241 |
|
if (o->oargs.nfargs != (iscyl ? 7 : 8)) |
| 242 |
|
objerror(o, USER, "bad # real arguments"); |
| 243 |
|
if (o->oargs.farg[6] < -FTINY) { |
| 253 |
|
} else if (!iscyl && o->oargs.farg[7] < -FTINY) |
| 254 |
|
objerror(o, USER, "illegal radii"); |
| 255 |
|
if (o->oargs.farg[6] <= FTINY && (iscyl || o->oargs.farg[7] <= FTINY)) |
| 256 |
< |
return; |
| 256 |
> |
return(0); |
| 257 |
|
if (!iscyl) { |
| 258 |
|
if (o->oargs.farg[6] < 0.) /* complains for tiny neg's */ |
| 259 |
|
o->oargs.farg[6] = 0.; |
| 260 |
|
if (o->oargs.farg[7] < 0.) |
| 261 |
|
o->oargs.farg[7] = 0.; |
| 262 |
|
} |
| 263 |
+ |
h = sqrt(dist2(o->oargs.farg,o->oargs.farg+3)); |
| 264 |
+ |
if (h <= FTINY) |
| 265 |
+ |
return(0); |
| 266 |
|
cent[0] = .5*(o->oargs.farg[0] + o->oargs.farg[3]); |
| 267 |
|
cent[1] = .5*(o->oargs.farg[1] + o->oargs.farg[4]); |
| 268 |
|
cent[2] = .5*(o->oargs.farg[2] + o->oargs.farg[5]); |
| 269 |
|
setmaterial((MATREC *)o->os, cent, 0); |
| 270 |
|
if (gluqo == NULL) newquadric(); |
| 271 |
|
glu_rout = "making cylinder"; |
| 272 |
< |
gluQuadricOrientation(gluqo, o->otype==OBJ_CUP | o->otype==OBJ_TUBE ? |
| 272 |
> |
gluQuadricOrientation(gluqo, (o->otype==OBJ_CUP) | (o->otype==OBJ_TUBE) ? |
| 273 |
|
GLU_INSIDE : GLU_OUTSIDE); |
| 274 |
|
gluQuadricNormals(gluqo, GLU_SMOOTH); |
| 275 |
|
glMatrixMode(GL_MODELVIEW); |
| 278 |
|
glTranslated((GLdouble)o->oargs.farg[0], (GLdouble)o->oargs.farg[1], |
| 279 |
|
(GLdouble)o->oargs.farg[2]); |
| 280 |
|
/* compute height & rotation angle */ |
| 277 |
– |
h = sqrt(dist2(o->oargs.farg,o->oargs.farg+3)); |
| 278 |
– |
if (h <= FTINY) |
| 279 |
– |
return; |
| 281 |
|
x1 = o->oargs.farg[1] - o->oargs.farg[4]; |
| 282 |
|
y1 = o->oargs.farg[3] - o->oargs.farg[0]; |
| 283 |
|
/* z1 = 0; */ |
| 315 |
|
if (o->oargs.farg[6] < 0.) /* complains for tiny neg's */ |
| 316 |
|
o->oargs.farg[6] = 0.; |
| 317 |
|
if (o->oargs.farg[7] - o->oargs.farg[6] <= FTINY) |
| 318 |
< |
return; |
| 318 |
> |
return(0); |
| 319 |
> |
h = VLEN(o->oargs.farg+3); |
| 320 |
> |
if (h <= FTINY) |
| 321 |
> |
return(0); |
| 322 |
|
if (dolights) |
| 323 |
|
doflatsrc((MATREC *)o->os, o->oargs.farg, o->oargs.farg+3, |
| 324 |
|
PI*(o->oargs.farg[7]*o->oargs.farg[7] - |
| 333 |
|
glTranslated((GLdouble)o->oargs.farg[0], (GLdouble)o->oargs.farg[1], |
| 334 |
|
(GLdouble)o->oargs.farg[2]); |
| 335 |
|
/* compute rotation angle */ |
| 332 |
– |
h = VLEN(o->oargs.farg+3); |
| 333 |
– |
if (h <= FTINY) |
| 334 |
– |
return; |
| 336 |
|
x1 = -o->oargs.farg[4]; |
| 337 |
|
y1 = o->oargs.farg[3]; |
| 338 |
|
/* z1 = 0; */ |