1 /****************************************************************************
4 * This file contains defines and variables for the txt*.c files
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.
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.
22 *****************************************************************************/
24 /* NOTE: FRAME.H contains other texture stuff. */
32 /*****************************************************************************
33 * Global preprocessor defines
34 ******************************************************************************/
36 #define RNDMASK 0x7FFF
37 #define RNDMULTIPLIER ((DBL)0.000030518509476)
40 * Macro to create random number in the [0; 1] range.
43 #define FRAND() ((DBL)POV_RAND()*RNDMULTIPLIER)
45 #define FLOOR(x) ((x) >= 0.0 ? floor(x) : (0.0 - floor(0.0 - (x)) - 1.0))
47 #define Hash3d(a,b,c) \
48 hashTable[(int)(hashTable[(int)(hashTable[(int)((a) & 0xfffL)] ^ ((b) & 0xfffL))] ^ ((c) & 0xfffL))]
51 hashTable[(int)(hashTable[(int)((a) & 0xfffL)] ^ ((b) & 0xfffL))]
54 hashTable[(int)(a) ^ ((b) & 0xfffL)]
56 #define INCRSUM(m,s,x,y,z) \
57 ((s)*(RTable[m]*0.5 + RTable[m+1]*(x) + RTable[m+2]*(y) + RTable[m+3]*(z)))
59 #define INCRSUMP(mp,s,x,y,z) \
60 ((s)*((mp[0])*0.5 + (mp[1])*(x) + (mp[2])*(y) + (mp[3])*(z)))
63 /*****************************************************************************
65 ******************************************************************************/
69 /*****************************************************************************
71 ******************************************************************************/
73 extern short *hashTable
;
74 extern DBL
*frequency
; /* dmf */
75 extern unsigned int Number_Of_Waves
; /* dmf */
76 extern VECTOR
*Wave_Sources
; /* dmf */
80 /*****************************************************************************
82 ******************************************************************************/
84 void Compute_Colour (COLOUR Colour
,PIGMENT
*Pigment
, DBL value
);
85 void Initialize_Noise (void);
86 void Free_Noise_Tables (void);
87 DBL
Noise (VECTOR EPoint
);
88 void DNoise (VECTOR result
, VECTOR EPoint
);
89 DBL
Turbulence (VECTOR EPoint
, TURB
*Turb
);
90 void DTurbulence (VECTOR result
, VECTOR EPoint
, TURB
*Turb
);
91 DBL
cycloidal (DBL value
);
92 DBL
Triangle_Wave (DBL value
);
93 void Transform_Textures (TEXTURE
*Textures
, TRANSFORM
*Trans
);
94 void Destroy_Textures (TEXTURE
*Textures
);
95 void Post_Textures (TEXTURE
*Textures
);
96 FINISH
*Create_Finish (void);
97 FINISH
*Copy_Finish (FINISH
*Old
);
98 TEXTURE
*Create_PNF_Texture (void);
99 TEXTURE
*Copy_Texture_Pointer (TEXTURE
*Texture
);
100 TEXTURE
*Copy_Textures (TEXTURE
*Textures
);
101 TEXTURE
*Create_Texture (void);
102 int Test_Opacity (TEXTURE
*Texture
);
103 TURB
*Create_Turb (void);
105 void POV_SRAND (int seed
);
106 int POV_GET_OLD_RAND(void);