1 /****************************************************************************
4 * This module implements "fill-in-the-blank" pre-programmed texture
5 * functions for easy modification and testing. Create new textures here.
7 * from Persistence of Vision(tm) Ray Tracer
8 * Copyright 1996,1999 Persistence of Vision Team
9 *---------------------------------------------------------------------------
10 * NOTICE: This source code file is provided so that patterns may experiment
11 * with enhancements to POV-Ray and to port the software to platforms other
12 * than those supported by the POV-Ray Team. There are strict rules under
13 * which you are permitted to use this file. The rules are in the file
14 * named POVLEGAL.DOC which should be distributed with this file.
15 * If POVLEGAL.DOC is not available or for more info please contact the POV-Ray
16 * Team Coordinator by email to team-coord@povray.org or visit us on the web at
17 * http://www.povray.org. The latest version of POV-Ray may be found at this site.
19 * This program is based on the popular DKB raytracer version 2.12.
20 * DKBTrace was originally written by David K. Buck.
21 * DKBTrace Ver 2.0-2.12 were written by David K. Buck & Aaron A. Collins.
23 *****************************************************************************/
26 * Some texture ideas garnered from SIGGRAPH '85 Volume 19 Number 3,
27 * "An Image Synthesizer" By Ken Perlin.
29 * Further Ideas Garnered from "The RenderMan Companion" (Addison Wesley)
36 #include "povray.h" /* [DB 9/94] */
37 #include "txttest.h" /* [DB 9/94] */
38 #include "pattern.h" /* [CY 10/94] */
42 /*****************************************************************************
43 * Local preprocessor defines
44 ******************************************************************************/
48 /*****************************************************************************
50 ******************************************************************************/
54 /*****************************************************************************
56 ******************************************************************************/
60 /*****************************************************************************
62 ******************************************************************************/
67 * Test new textures in the routines that follow.
70 /*****************************************************************************
88 * The pattern routines take an x,y,z point on an object and a pointer to
89 * the object's texture description and return the color at that point
90 * Similar routines are granite, agate, marble. See txtcolor.c for examples.
94 ******************************************************************************/
96 DBL
pattern1 (VECTOR EPoint
, TPATTERN
*TPat
)
103 value
= Noise(EPoint
);
111 /*****************************************************************************
129 * The pattern routines take an x,y,z point on an object and a pointer to
130 * the object's texture description and return the color at that point
131 * Similar routines are granite, agate, marble. See txtcolor.c for examples.
135 ******************************************************************************/
137 DBL
pattern2 (VECTOR EPoint
, TPATTERN
*TPat
)
143 value
= Noise(EPoint
);
152 /*****************************************************************************
170 * The pattern routines take an x,y,z point on an object and a pointer to
171 * the object's texture description and return the color at that point
172 * Similar routines are granite, agate, marble. See txtcolor.c for examples.
176 ******************************************************************************/
178 DBL
pattern3 (VECTOR EPoint
, TPATTERN
*TPat
)
184 value
= Noise(EPoint
);
192 /*****************************************************************************
210 * The bumpy routines take a point on an object, a pointer to the
211 * object's texture description and the surface normal at that point and
212 * return a peturb surface normal to create the illusion that the surface
213 * has been displaced.
215 * Similar routines are ripples, dents, bumps. See txtbump.c for examples.
219 ******************************************************************************/
221 void bumpy1 (VECTOR EPoint
, TNORMAL
*Tnormal
, VECTOR normal
)
228 Assign_Vector(normal
, normal
);
233 /*****************************************************************************
251 * The bumpy routines take a point on an object, a pointer to the
252 * object's texture description and the surface normal at that point and
253 * return a peturb surface normal to create the illusion that the surface
254 * has been displaced.
256 * Similar routines are ripples, dents, bumps. See txtbump.c for examples.
260 ******************************************************************************/
262 void bumpy2 (VECTOR EPoint
, TNORMAL
*Tnormal
, VECTOR normal
)
269 Assign_Vector(normal
, normal
);
274 /*****************************************************************************
292 * The bumpy routines take a point on an object, a pointer to the
293 * object's texture description and the surface normal at that point and
294 * return a peturb surface normal to create the illusion that the surface
295 * has been displaced.
297 * Similar routines are ripples, dents, bumps. See txtbump.c for examples.
301 ******************************************************************************/
303 void bumpy3 (VECTOR EPoint
, TNORMAL
*Tnormal
, VECTOR normal
)
310 Assign_Vector(normal
, normal
);