1
0

PUTFACE.H 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /******************************************************************************
  2. Plush Version 1.2
  3. putface.h
  4. Triangle Vertex Sorting Code for pf_*.c
  5. Copyright (c) 1996-2000, Justin Frankel
  6. ******************************************************************************/
  7. #ifndef _PUTFACE_H_
  8. #define _PUTFACE_H_
  9. #define PUTFACE_SORT() \
  10. i0 = 0; i1 = 1; i2 = 2; \
  11. if (TriFace->Scry[0] > TriFace->Scry[1]) { \
  12. i0 = 1; i1 = 0; \
  13. } \
  14. if (TriFace->Scry[i0] > TriFace->Scry[2]) { \
  15. i2 ^= i0; i0 ^= i2; i2 ^= i0; \
  16. } \
  17. if (TriFace->Scry[i1] > TriFace->Scry[i2]) { \
  18. i2 ^= i1; i1 ^= i2; i2 ^= i1; \
  19. }
  20. #define PUTFACE_SORT_ENV() \
  21. PUTFACE_SORT(); \
  22. MappingU1=TriFace->eMappingU[i0]*Texture->uScale*\
  23. TriFace->Material->EnvScaling;\
  24. MappingV1=TriFace->eMappingV[i0]*Texture->vScale*\
  25. TriFace->Material->EnvScaling;\
  26. MappingU2=TriFace->eMappingU[i1]*Texture->uScale*\
  27. TriFace->Material->EnvScaling;\
  28. MappingV2=TriFace->eMappingV[i1]*Texture->vScale*\
  29. TriFace->Material->EnvScaling;\
  30. MappingU3=TriFace->eMappingU[i2]*Texture->uScale*\
  31. TriFace->Material->EnvScaling;\
  32. MappingV3=TriFace->eMappingV[i2]*Texture->vScale*\
  33. TriFace->Material->EnvScaling;
  34. #define PUTFACE_SORT_TEX() \
  35. PUTFACE_SORT(); \
  36. MappingU1=TriFace->MappingU[i0]*Texture->uScale*\
  37. TriFace->Material->TexScaling;\
  38. MappingV1=TriFace->MappingV[i0]*Texture->vScale*\
  39. TriFace->Material->TexScaling;\
  40. MappingU2=TriFace->MappingU[i1]*Texture->uScale*\
  41. TriFace->Material->TexScaling;\
  42. MappingV2=TriFace->MappingV[i1]*Texture->vScale*\
  43. TriFace->Material->TexScaling;\
  44. MappingU3=TriFace->MappingU[i2]*Texture->uScale*\
  45. TriFace->Material->TexScaling;\
  46. MappingV3=TriFace->MappingV[i2]*Texture->vScale*\
  47. TriFace->Material->TexScaling;
  48. #endif /* !_PUTFACE_H_ */