TEXTURE.H 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /****************************************************************************
  2. * texture.h
  3. *
  4. * This file contains defines and variables for the txt*.c files
  5. *
  6. * from Persistence of Vision(tm) Ray Tracer
  7. * Copyright 1996,1999 Persistence of Vision Team
  8. *---------------------------------------------------------------------------
  9. * NOTICE: This source code file is provided so that users may experiment
  10. * with enhancements to POV-Ray and to port the software to platforms other
  11. * than those supported by the POV-Ray Team. There are strict rules under
  12. * which you are permitted to use this file. The rules are in the file
  13. * named POVLEGAL.DOC which should be distributed with this file.
  14. * If POVLEGAL.DOC is not available or for more info please contact the POV-Ray
  15. * Team Coordinator by email to team-coord@povray.org or visit us on the web at
  16. * http://www.povray.org. The latest version of POV-Ray may be found at this site.
  17. *
  18. * This program is based on the popular DKB raytracer version 2.12.
  19. * DKBTrace was originally written by David K. Buck.
  20. * DKBTrace Ver 2.0-2.12 were written by David K. Buck & Aaron A. Collins.
  21. *
  22. *****************************************************************************/
  23. /* NOTE: FRAME.H contains other texture stuff. */
  24. #ifndef TEXTURE_H
  25. #define TEXTURE_H
  26. #include "pattern.h"
  27. #include "warps.h"
  28. /*****************************************************************************
  29. * Global preprocessor defines
  30. ******************************************************************************/
  31. #define RNDMASK 0x7FFF
  32. #define RNDMULTIPLIER ((DBL)0.000030518509476)
  33. /*
  34. * Macro to create random number in the [0; 1] range.
  35. */
  36. #define FRAND() ((DBL)POV_RAND()*RNDMULTIPLIER)
  37. #define FLOOR(x) ((x) >= 0.0 ? floor(x) : (0.0 - floor(0.0 - (x)) - 1.0))
  38. #define Hash3d(a,b,c) \
  39. hashTable[(int)(hashTable[(int)(hashTable[(int)((a) & 0xfffL)] ^ ((b) & 0xfffL))] ^ ((c) & 0xfffL))]
  40. #define Hash2d(a,b) \
  41. hashTable[(int)(hashTable[(int)((a) & 0xfffL)] ^ ((b) & 0xfffL))]
  42. #define Hash1d(a,b) \
  43. hashTable[(int)(a) ^ ((b) & 0xfffL)]
  44. #define INCRSUM(m,s,x,y,z) \
  45. ((s)*(RTable[m]*0.5 + RTable[m+1]*(x) + RTable[m+2]*(y) + RTable[m+3]*(z)))
  46. #define INCRSUMP(mp,s,x,y,z) \
  47. ((s)*((mp[0])*0.5 + (mp[1])*(x) + (mp[2])*(y) + (mp[3])*(z)))
  48. /*****************************************************************************
  49. * Global typedefs
  50. ******************************************************************************/
  51. /*****************************************************************************
  52. * Global variables
  53. ******************************************************************************/
  54. extern short *hashTable;
  55. extern DBL *frequency; /* dmf */
  56. extern unsigned int Number_Of_Waves; /* dmf */
  57. extern VECTOR *Wave_Sources; /* dmf */
  58. /*****************************************************************************
  59. * Global functions
  60. ******************************************************************************/
  61. void Compute_Colour (COLOUR Colour,PIGMENT *Pigment, DBL value);
  62. void Initialize_Noise (void);
  63. void Free_Noise_Tables (void);
  64. DBL Noise (VECTOR EPoint);
  65. void DNoise (VECTOR result, VECTOR EPoint);
  66. DBL Turbulence (VECTOR EPoint, TURB *Turb);
  67. void DTurbulence (VECTOR result, VECTOR EPoint, TURB *Turb);
  68. DBL cycloidal (DBL value);
  69. DBL Triangle_Wave (DBL value);
  70. void Transform_Textures (TEXTURE *Textures, TRANSFORM *Trans);
  71. void Destroy_Textures (TEXTURE *Textures);
  72. void Post_Textures (TEXTURE *Textures);
  73. FINISH *Create_Finish (void);
  74. FINISH *Copy_Finish (FINISH *Old);
  75. TEXTURE *Create_PNF_Texture (void);
  76. TEXTURE *Copy_Texture_Pointer (TEXTURE *Texture);
  77. TEXTURE *Copy_Textures (TEXTURE *Textures);
  78. TEXTURE *Create_Texture (void);
  79. int Test_Opacity (TEXTURE *Texture);
  80. TURB *Create_Turb (void);
  81. int POV_RAND (void);
  82. void POV_SRAND (int seed);
  83. int POV_GET_OLD_RAND(void);
  84. #endif