[37] | 1 | /* |
---|
| 2 | |
---|
| 3 | Homan Igehy |
---|
| 4 | |
---|
| 5 | Computer Graphics Laboratory |
---|
| 6 | Stanford University |
---|
| 7 | |
---|
| 8 | --------------------------------------------------------------------- |
---|
| 9 | |
---|
| 10 | Copyright (1997) The Board of Trustees of the Leland Stanford Junior |
---|
| 11 | University. Except for commercial resale, lease, license or other |
---|
| 12 | commercial transactions, permission is hereby given to use, copy, |
---|
| 13 | modify this software for academic purposes only. No part of this |
---|
| 14 | software or any derivatives thereof may be used in the production of |
---|
| 15 | computer models for resale or for use in a commercial |
---|
| 16 | product. STANFORD MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND |
---|
| 17 | CONCERNING THIS SOFTWARE. No support is implied or provided. |
---|
| 18 | |
---|
| 19 | */ |
---|
| 20 | |
---|
| 21 | |
---|
| 22 | /* |
---|
| 23 | * sl_hack.H |
---|
| 24 | * |
---|
| 25 | */ |
---|
| 26 | |
---|
| 27 | #ifndef SL_HACK_H |
---|
| 28 | #define SL_HACK_H |
---|
| 29 | |
---|
| 30 | |
---|
| 31 | |
---|
| 32 | |
---|
| 33 | #ifdef Constant_None |
---|
| 34 | |
---|
| 35 | #define IS_CAttr IS_CAttr_None |
---|
| 36 | |
---|
| 37 | #define CA_ListArgs(a) |
---|
| 38 | #define CA_FormalArgs(a) |
---|
| 39 | #define CA_FormalConstArgs(a) |
---|
| 40 | #define CA_DeclareArgs(a) |
---|
| 41 | |
---|
| 42 | #endif |
---|
| 43 | |
---|
| 44 | |
---|
| 45 | |
---|
| 46 | |
---|
| 47 | #ifdef Constant_C |
---|
| 48 | |
---|
| 49 | #define Constant_PackedColor |
---|
| 50 | |
---|
| 51 | #define IS_CAttr IS_CAttr_C |
---|
| 52 | |
---|
| 53 | #define CA_ListArgs(a) a##C, |
---|
| 54 | #define CA_FormalArgs(a) Integer a##C, |
---|
| 55 | #define CA_FormalConstArgs(a) const Integer a##C, |
---|
| 56 | #define CA_DeclareArgs(a) Integer a##C; |
---|
| 57 | |
---|
| 58 | |
---|
| 59 | #endif |
---|
| 60 | |
---|
| 61 | |
---|
| 62 | |
---|
| 63 | #ifdef Constant_A |
---|
| 64 | |
---|
| 65 | #define Alpha |
---|
| 66 | |
---|
| 67 | #define IS_CAttr IS_CAttr_A |
---|
| 68 | |
---|
| 69 | #define CA_ListArgs(a) a##A, |
---|
| 70 | #define CA_FormalArgs(a) Real a##A, |
---|
| 71 | #define CA_FormalConstArgs(a) const Real a##A, |
---|
| 72 | #define CA_DeclareArgs(a) Real a##A; |
---|
| 73 | |
---|
| 74 | |
---|
| 75 | #endif |
---|
| 76 | |
---|
| 77 | |
---|
| 78 | |
---|
| 79 | |
---|
| 80 | #ifdef Constant_T |
---|
| 81 | |
---|
| 82 | #define PointSampleTexture |
---|
| 83 | #define LevelOfDetail |
---|
| 84 | |
---|
| 85 | #define IS_CAttr IS_CAttr_T |
---|
| 86 | |
---|
| 87 | #define CA_ListArgs(a) a##T, |
---|
| 88 | #define CA_FormalArgs(a) TextureMap a##T, |
---|
| 89 | #define CA_FormalConstArgs(a) const TextureMap a##T, |
---|
| 90 | #define CA_DeclareArgs(a) TextureMap a##T; |
---|
| 91 | |
---|
| 92 | |
---|
| 93 | #endif |
---|
| 94 | |
---|
| 95 | |
---|
| 96 | |
---|
| 97 | |
---|
| 98 | |
---|
| 99 | |
---|
| 100 | #ifdef Interpolate_None |
---|
| 101 | |
---|
| 102 | #define IS_Vertex IS_Vertex_None |
---|
| 103 | |
---|
| 104 | #define SL_FullEdge SL_FullEdge_None |
---|
| 105 | #define SL_SlopeEdge SL_SlopeEdge_None |
---|
| 106 | #define SL_MinEdge SL_MinEdge_None |
---|
| 107 | |
---|
| 108 | #define IN_Index(a,i) a##i |
---|
| 109 | #define IN_IndexP(a,i) a->i |
---|
| 110 | #define IN_DoForEach(f) |
---|
| 111 | #define IN_ListArgs(a) |
---|
| 112 | #define IN_FormalConstArgs(a) |
---|
| 113 | #define IN_FormalRefArgs(a) |
---|
| 114 | #define IN_FormalArgs(a) |
---|
| 115 | #define IN_DeclareArgs(a) |
---|
| 116 | |
---|
| 117 | #define IN_DeclareArgs(a) |
---|
| 118 | |
---|
| 119 | #endif |
---|
| 120 | |
---|
| 121 | |
---|
| 122 | |
---|
| 123 | |
---|
| 124 | |
---|
| 125 | #ifdef Interpolate_Z |
---|
| 126 | |
---|
| 127 | #define ZBuffer |
---|
| 128 | |
---|
| 129 | #define IS_Vertex IS_Vertex_Z |
---|
| 130 | |
---|
| 131 | #define SL_FullEdge SL_FullEdge_Z |
---|
| 132 | #define SL_SlopeEdge SL_SlopeEdge_Z |
---|
| 133 | #define SL_MinEdge SL_MinEdge_Z |
---|
| 134 | |
---|
| 135 | #define IN_Index(a,i) a##i |
---|
| 136 | #define IN_IndexP(a,i) a->i |
---|
| 137 | #define IN_DoForEach(f) f(Z); |
---|
| 138 | #define IN_ListArgs(a) a##Z, |
---|
| 139 | #define IN_FormalArgs(a) Real a##Z, |
---|
| 140 | #define IN_FormalConstArgs(a) const Real a##Z, |
---|
| 141 | #define IN_FormalRefArgs(a) Real &a##Z, |
---|
| 142 | #define IN_DeclareArgs(a) Real a##Z; |
---|
| 143 | |
---|
| 144 | #endif |
---|
| 145 | |
---|
| 146 | |
---|
| 147 | |
---|
| 148 | |
---|
| 149 | #ifdef Interpolate_ZI |
---|
| 150 | |
---|
| 151 | #define ZBuffer |
---|
| 152 | #define Interpolate_Intensity |
---|
| 153 | |
---|
| 154 | #define IS_Vertex IS_Vertex_ZI |
---|
| 155 | |
---|
| 156 | #define IN_Index(a,i) a##i |
---|
| 157 | #define IN_IndexP(a,i) a->i |
---|
| 158 | #define IN_DoForEach(f) f(Z); f(I); |
---|
| 159 | #define IN_ListArgs(a) a##Z, a##I, |
---|
| 160 | #define IN_FormalArgs(a) Real a##Z, Real a##I, |
---|
| 161 | #define IN_FormalConstArgs(a) const Real a##Z, const Real a##I, |
---|
| 162 | #define IN_FormalRefArgs(a) Real &a##Z, Real &a##I, |
---|
| 163 | #define IN_DeclareArgs(a) Real a##Z, a##I; |
---|
| 164 | |
---|
| 165 | #endif |
---|
| 166 | |
---|
| 167 | |
---|
| 168 | |
---|
| 169 | |
---|
| 170 | #ifdef Interpolate_ZRGB |
---|
| 171 | |
---|
| 172 | #define ZBuffer |
---|
| 173 | #define Interpolate_Color |
---|
| 174 | |
---|
| 175 | #define IS_Vertex IS_Vertex_ZRGB |
---|
| 176 | |
---|
| 177 | #define SL_FullEdge SL_FullEdge_ZRGB |
---|
| 178 | #define SL_SlopeEdge SL_SlopeEdge_ZRGB |
---|
| 179 | #define SL_MinEdge SL_MinEdge_ZRGB |
---|
| 180 | |
---|
| 181 | #define IN_Index(a,i) a##i |
---|
| 182 | #define IN_IndexP(a,i) a->i |
---|
| 183 | #define IN_DoForEach(f) f(Z) ; f(R); f(G); f(B); |
---|
| 184 | #define IN_ListArgs(a) a##Z, a##R, a##G, a##B, |
---|
| 185 | #define IN_FormalArgs(a) Real a##Z, Real a##R, Real a##G, Real a##B, |
---|
| 186 | #define IN_FormalConstArgs(a) const Real a##Z, const Real a##R,\ |
---|
| 187 | const Real a##G, const Real a##B, |
---|
| 188 | #define IN_FormalRefArgs(a) Real &a##Z, Real &a##R, Real &a##G, Real &a##B, |
---|
| 189 | #define IN_DeclareArgs(a) Real a##Z, a##R, a##G, a##B; |
---|
| 190 | |
---|
| 191 | |
---|
| 192 | #endif |
---|
| 193 | |
---|
| 194 | |
---|
| 195 | |
---|
| 196 | |
---|
| 197 | |
---|
| 198 | |
---|
| 199 | #ifdef Interpolate_ZRGBUVW |
---|
| 200 | |
---|
| 201 | #define ZBuffer |
---|
| 202 | #define Interpolate_Color |
---|
| 203 | #define TextureCoord |
---|
| 204 | |
---|
| 205 | #define IS_Vertex IS_Vertex_ZRGBUVW |
---|
| 206 | |
---|
| 207 | #define SL_FullEdge SL_FullEdge_ZRGBUVW |
---|
| 208 | #define SL_SlopeEdge SL_SlopeEdge_ZRGBUVW |
---|
| 209 | #define SL_MinEdge SL_MinEdge_ZRGBUVW |
---|
| 210 | |
---|
| 211 | #define IN_Index(a,i) a##i |
---|
| 212 | #define IN_DoForEach(f) f(Z); f(R); f(G); f(B); \ |
---|
| 213 | f(U); f(V); f(W); |
---|
| 214 | #define IN_ListArgs(a) a##Z, a##R, a##G, a##B, a##U, a##V, a##W, |
---|
| 215 | #define IN_FormalArgs(a) Real a##Z, Real a##R, Real a##G, Real a##B, \ |
---|
| 216 | Real a##U, Real a##V, Real a##W, |
---|
| 217 | #define IN_FormalConstArgs(a) const Real a##Z, const Real a##R,\ |
---|
| 218 | const Real a##G, const Real a##B,\ |
---|
| 219 | const Real a##U,\ |
---|
| 220 | const Real a##V, const Real a##W, |
---|
| 221 | #define IN_FormalRefArgs(a) Real &a##Z, Real &a##R, Real &a##G, Real &a##B,\ |
---|
| 222 | Real &a##U, Real &a##V, Real &a##W, |
---|
| 223 | #define IN_DeclareArgs(a) Real a##Z, a##R, a##G, a##B, \ |
---|
| 224 | a##U, a##V, a##W; |
---|
| 225 | |
---|
| 226 | |
---|
| 227 | #endif |
---|
| 228 | |
---|
| 229 | |
---|
| 230 | |
---|
| 231 | |
---|
| 232 | |
---|
| 233 | |
---|
| 234 | |
---|
| 235 | |
---|
| 236 | #ifdef FrameBuffer_Split |
---|
| 237 | |
---|
| 238 | #define FB_Buffer FB_SplitBuffer |
---|
| 239 | |
---|
| 240 | #define FB_Index(a, i) a##i |
---|
| 241 | #define FB_FirstIndex(a) a##Z |
---|
| 242 | #define FB_DoForFirst(f) f(Z) |
---|
| 243 | #define FB_DoForEach(f) f(Z); f(RGBA); |
---|
| 244 | |
---|
| 245 | #define FB_ListArgs(a) a##Z, a##RGBA |
---|
| 246 | #define FB_FormalArgs(a) FB_SampleZ a##Z, FB_SampleRGBA a##RGBA |
---|
| 247 | |
---|
| 248 | #define FB_Z(a) a##Z->Z |
---|
| 249 | #define FB_R(a) a##RGBA->R |
---|
| 250 | #define FB_G(a) a##RGBA->G |
---|
| 251 | #define FB_B(a) a##RGBA->B |
---|
| 252 | #define FB_A(a) a##RGBA->A |
---|
| 253 | #define FB_C(a) *((Integer *) &(a##RGBA->R)) |
---|
| 254 | |
---|
| 255 | #define FB_InterpToSample(x) ((Integer8) ((Integer) (x))) |
---|
| 256 | #define FB_SampleToInterp(x) ((Real) (x)) |
---|
| 257 | |
---|
| 258 | #endif |
---|
| 259 | |
---|
| 260 | |
---|
| 261 | #ifdef FrameBuffer_Unified |
---|
| 262 | |
---|
| 263 | #define FB_Buffer FB_UnifiedBuffer |
---|
| 264 | |
---|
| 265 | #define FB_Index(a, i) a##i |
---|
| 266 | #define FB_FirstIndex(a) a##ZRGBA |
---|
| 267 | #define FB_DoForFirst(f) f(ZRGBA); |
---|
| 268 | #define FB_DoForEach(f) f(ZRGBA); |
---|
| 269 | |
---|
| 270 | #define FB_ListArgs(a) a##ZRGBA |
---|
| 271 | #define FB_FormalArgs(a) FB_SampleZRGBA a##ZRGBA |
---|
| 272 | |
---|
| 273 | #define FB_Z(a) a##ZRGBA->Z |
---|
| 274 | #define FB_R(a) a##ZRGBA->R |
---|
| 275 | #define FB_G(a) a##ZRGBA->G |
---|
| 276 | #define FB_B(a) a##ZRGBA->B |
---|
| 277 | #define FB_A(a) a##ZRGBA->A |
---|
| 278 | #define FB_C(a) *((Integer *) &(a##ZRGBA->R)) |
---|
| 279 | |
---|
| 280 | #define FB_InterpToSample(x) ((Integer8) ((Integer) (x))) |
---|
| 281 | #define FB_SampleToInterp(x) ((Real) (x)) |
---|
| 282 | |
---|
| 283 | #endif |
---|
| 284 | |
---|
| 285 | |
---|
| 286 | |
---|
| 287 | |
---|
| 288 | |
---|
| 289 | #ifdef FrameBuffer_Intensity |
---|
| 290 | |
---|
| 291 | #define FB_Buffer FB_IntensityBuffer |
---|
| 292 | |
---|
| 293 | #define FB_Index(a, i) a##i |
---|
| 294 | #define FB_FirstIndex(a) a##ZI |
---|
| 295 | #define FB_DoForFirst(f) f(ZI); |
---|
| 296 | #define FB_DoForEach(f) f(ZI); |
---|
| 297 | |
---|
| 298 | #define FB_ListArgs(a) a##ZI |
---|
| 299 | #define FB_FormalArgs(a) FB_SampleZI a##ZI |
---|
| 300 | |
---|
| 301 | #define FB_Z(a) a##ZI->Z |
---|
| 302 | #define FB_I(a) a##ZI->I |
---|
| 303 | |
---|
| 304 | #define FB_InterpToSample(x) ((Real) (x)) |
---|
| 305 | #define FB_SampleToInterp(x) ((Real) (x)) |
---|
| 306 | |
---|
| 307 | #endif |
---|
| 308 | |
---|
| 309 | |
---|
| 310 | |
---|
| 311 | |
---|
| 312 | |
---|
| 313 | #ifdef FrameBuffer_FloatSplit |
---|
| 314 | |
---|
| 315 | #define FB_Buffer FB_FloatSplitBuffer |
---|
| 316 | |
---|
| 317 | #define FB_Index(a, i) a##i |
---|
| 318 | #define FB_FirstIndex(a) a##Z |
---|
| 319 | #define FB_DoForFirst(f) f(Z); |
---|
| 320 | #define FB_DoForEach(f) f(Z); f(FloatRGBA); |
---|
| 321 | |
---|
| 322 | #define FB_ListArgs(a) a##Z, a##FloatRGBA |
---|
| 323 | #define FB_FormalArgs(a) FB_SampleZ a##Z, FB_SampleFloatRGBA a##FloatRGBA |
---|
| 324 | |
---|
| 325 | #define FB_Z(a) a##Z->Z |
---|
| 326 | #define FB_R(a) a##FloatRGBA->R |
---|
| 327 | #define FB_G(a) a##FloatRGBA->G |
---|
| 328 | #define FB_B(a) a##FloatRGBA->B |
---|
| 329 | #define FB_A(a) a##FloatRGBA->A |
---|
| 330 | #define FB_C(a) *((Integer *) &(a##FloatRGBA->R)) |
---|
| 331 | |
---|
| 332 | #define FB_InterpToSample(x) (x) |
---|
| 333 | #define FB_SampleToInterp(x) (x) |
---|
| 334 | |
---|
| 335 | #endif |
---|
| 336 | |
---|
| 337 | |
---|
| 338 | #ifdef FrameBuffer_FloatUnified |
---|
| 339 | |
---|
| 340 | #define FB_Buffer FB_FloatUnifiedBuffer |
---|
| 341 | |
---|
| 342 | #define FB_Index(a, i) a##i |
---|
| 343 | #define FB_FirstIndex(a) a##FloatZRGBA |
---|
| 344 | #define FB_DoForFirst(f) f(FloatZRGBA); |
---|
| 345 | #define FB_DoForEach(f) f(FloatZRGBA); |
---|
| 346 | |
---|
| 347 | #define FB_ListArgs(a) a##FloatZRGBA |
---|
| 348 | #define FB_FormalArgs(a) FB_SampleFloatZRGBA a##FloatZRGBA |
---|
| 349 | |
---|
| 350 | #define FB_Z(a) a##FloatZRGBA->Z |
---|
| 351 | #define FB_R(a) a##FloatZRGBA->R |
---|
| 352 | #define FB_G(a) a##FloatZRGBA->G |
---|
| 353 | #define FB_B(a) a##FloatZRGBA->B |
---|
| 354 | #define FB_A(a) a##FloatZRGBA->A |
---|
| 355 | #define FB_C(a) *((Integer *) &(a##FloatZRGBA->R)) |
---|
| 356 | |
---|
| 357 | #define FB_InterpToSample(x) (x) |
---|
| 358 | #define FB_SampleToInterp(x) (x) |
---|
| 359 | |
---|
| 360 | #endif |
---|
| 361 | |
---|
| 362 | |
---|
| 363 | |
---|
| 364 | |
---|
| 365 | #endif /* SL_HACK_H */ |
---|