home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: Graphics / Graphics.zip / povsrc31.zip / texture.h < prev    next >
C/C++ Source or Header  |  2001-01-07  |  4KB  |  120 lines

  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.  
  24. /* NOTE: FRAME.H contains other texture stuff. */
  25.  
  26. #ifndef TEXTURE_H
  27. #define TEXTURE_H
  28.  
  29. #include "pattern.h"
  30. #include "warps.h"
  31.  
  32. /*****************************************************************************
  33. * Global preprocessor defines
  34. ******************************************************************************/
  35.  
  36. #define RNDMASK       0x7FFF
  37. /* FRAND range bugfix by Matthew Brown */
  38. #define RNDMULTIPLIER ((DBL)0.000030518509475)
  39.  
  40. /*
  41.  * Macro to create random number in the [0; 1] range.
  42.  */
  43.  
  44. #define FRAND() ((DBL)POV_RAND()*RNDMULTIPLIER)
  45.  
  46. #define FLOOR(x)  ((x) >= 0.0 ? floor(x) : (0.0 - floor(0.0 - (x)) - 1.0))
  47. #ifdef NoiseTranslateFixPatch
  48. #define Hash3d(a,b,c) \
  49.   hashTable[(hashTable[(hashTable[(a)] ^ (b))] ^ (c))]
  50.  
  51. #define Hash2d(a,b)   \
  52.   hashTable[(hashTable[(a)] ^ (b))]
  53.  
  54. #define Hash1d(a,b)   \
  55.   hashTable[(a) ^ (b)]
  56. #else
  57. #define Hash3d(a,b,c) \
  58.   hashTable[(int)(hashTable[(int)(hashTable[(int)((a) & 0xfffL)] ^ ((b) & 0xfffL))] ^ ((c) & 0xfffL))]
  59.  
  60. #define Hash2d(a,b)   \
  61.   hashTable[(int)(hashTable[(int)((a) & 0xfffL)] ^ ((b) & 0xfffL))]
  62.  
  63. #define Hash1d(a,b)   \
  64.   hashTable[(int)(a) ^ ((b) & 0xfffL)]
  65. #endif
  66. #define INCRSUM(m,s,x,y,z)  \
  67.   ((s)*(RTable[m]*0.5 + RTable[m+1]*(x) + RTable[m+2]*(y) + RTable[m+3]*(z)))
  68.  
  69. #define INCRSUMP(mp,s,x,y,z) \
  70.   ((s)*((mp[0])*0.5 + (mp[1])*(x) + (mp[2])*(y) + (mp[3])*(z)))
  71.  
  72.  
  73. /*****************************************************************************
  74. * Global typedefs
  75. ******************************************************************************/
  76.  
  77.  
  78.  
  79. /*****************************************************************************
  80. * Global variables
  81. ******************************************************************************/
  82.  
  83. extern short *hashTable;
  84. extern DBL *frequency;               /* dmf */
  85. extern unsigned int Number_Of_Waves; /* dmf */
  86. extern VECTOR *Wave_Sources;         /* dmf */
  87.  
  88.  
  89.  
  90. /*****************************************************************************
  91. * Global functions
  92. ******************************************************************************/
  93.  
  94. void Compute_Colour (COLOUR Colour,PIGMENT *Pigment, DBL value);
  95. void Initialize_Noise (void);
  96. void Free_Noise_Tables (void);
  97. DBL Noise (VECTOR EPoint);
  98. void DNoise (VECTOR result, VECTOR EPoint);
  99. DBL Turbulence (VECTOR EPoint, TURB *Turb);
  100. void DTurbulence (VECTOR result, VECTOR EPoint, TURB *Turb);
  101. DBL cycloidal (DBL value);
  102. DBL Triangle_Wave (DBL value);
  103. void Transform_Textures (TEXTURE *Textures, TRANSFORM *Trans);
  104. void Destroy_Textures (TEXTURE *Textures);
  105. void Post_Textures (TEXTURE *Textures);
  106. FINISH *Create_Finish (void);
  107. FINISH *Copy_Finish (FINISH *Old);
  108. TEXTURE *Create_PNF_Texture (void);
  109. TEXTURE *Copy_Texture_Pointer (TEXTURE *Texture);
  110. TEXTURE *Copy_Textures (TEXTURE *Textures);
  111. TEXTURE *Create_Texture (void);
  112. int Test_Opacity (TEXTURE *Texture);
  113. TURB *Create_Turb (void);
  114. int POV_RAND (void);
  115. void POV_SRAND (int seed);
  116. int POV_GET_OLD_RAND(void);
  117.  
  118.  
  119. #endif
  120.