1 /****************************************************************************
2 * txttest.cpp
3 *
4 * This module implements "fill-in-the-blank" pre-programmed texture
5 * functions for easy modification and testing. Create new textures here.
6 *
7 * from Persistence of Vision(tm) Ray Tracer version 3.6.
8 * Copyright 1991-2003 Persistence of Vision Team
9 * Copyright 2003-2004 Persistence of Vision Raytracer Pty. Ltd.
10 *---------------------------------------------------------------------------
11 * NOTICE: This source code file is provided so that users may experiment
12 * with enhancements to POV-Ray and to port the software to platforms other
13 * than those supported by the POV-Ray developers. There are strict rules
14 * regarding how you are permitted to use this file. These rules are contained
15 * in the distribution and derivative versions licenses which should have been
16 * provided with this file.
17 *
18 * These licences may be found online, linked from the end-user license
19 * agreement that is located at http://www.povray.org/povlegal.html
20 *---------------------------------------------------------------------------
21 * This program is based on the popular DKB raytracer version 2.12.
22 * DKBTrace was originally written by David K. Buck.
23 * DKBTrace Ver 2.0-2.12 were written by David K. Buck & Aaron A. Collins.
24 *---------------------------------------------------------------------------
25 * $File: //depot/povray/3.6-release/source/txttest.cpp $
26 * $Revision: #3 $
27 * $Change: 3032 $
28 * $DateTime: 2004/08/02 18:43:41 $
29 * $Author: chrisc $
30 * $Log$
31 *****************************************************************************/
32
33 /*
34 * Some texture ideas garnered from SIGGRAPH '85 Volume 19 Number 3,
35 * "An Image Synthesizer" By Ken Perlin.
36 *
37 * Further Ideas Garnered from "The RenderMan Companion" (Addison Wesley)
38 */
39
40 #include "frame.h"
41 #include "vector.h"
42 #include "texture.h"
43 #include "povray.h" /* [DB 9/94] */
44 #include "txttest.h" /* [DB 9/94] */
45 #include "pattern.h" /* [CY 10/94] */
46
47 BEGIN_POV_NAMESPACE
48
49 /*****************************************************************************
50 * Local preprocessor defines
51 ******************************************************************************/
52
53
54
55 /*****************************************************************************
56 * Local typedefs
57 ******************************************************************************/
58
59
60
61 /*****************************************************************************
62 * Local variables
63 ******************************************************************************/
64
65
66
67 /*****************************************************************************
68 * Static functions
69 ******************************************************************************/
70
71
72
73 /*
74 * Test new textures in the routines that follow.
75 */
76
77 /*****************************************************************************
78 *
79 * FUNCTION
80 *
81 * pattern1
82 *
83 * INPUT
84 *
85 * OUTPUT
86 *
87 * RETURNS
88 *
89 * AUTHOR
90 *
91 * POV-Ray Team
92 *
93 * DESCRIPTION
94 *
95 * The pattern routines take an x,y,z point on an object and a pointer to
96 * the object's texture description and return the color at that point
97 * Similar routines are granite, agate, marble. See txtcolor.c for examples.
98 *
99 * CHANGES
100 *
101 ******************************************************************************/
102
pattern1(VECTOR EPoint,TPATTERN * TPat)103 DBL pattern1 (VECTOR EPoint, TPATTERN *TPat)
104 {
105 DBL value;
106 /* YOUR NAME HERE */
107
108 TPat=TPat;
109
110 value = Noise(EPoint, TPat);
111
112 return(value);
113
114 }
115
116
117
118 /*****************************************************************************
119 *
120 * FUNCTION
121 *
122 * pattern2
123 *
124 * INPUT
125 *
126 * OUTPUT
127 *
128 * RETURNS
129 *
130 * AUTHOR
131 *
132 * POV-Ray Team
133 *
134 * DESCRIPTION
135 *
136 * The pattern routines take an x,y,z point on an object and a pointer to
137 * the object's texture description and return the color at that point
138 * Similar routines are granite, agate, marble. See txtcolor.c for examples.
139 *
140 * CHANGES
141 *
142 ******************************************************************************/
143
pattern2(VECTOR EPoint,TPATTERN * TPat)144 DBL pattern2 (VECTOR EPoint, TPATTERN *TPat)
145 {
146 DBL value;
147 /* YOUR NAME HERE */
148 TPat=TPat;
149
150 value = Noise(EPoint, TPat);
151
152 return(value);
153
154 }
155
156
157
158
159 /*****************************************************************************
160 *
161 * FUNCTION
162 *
163 * pattern3
164 *
165 * INPUT
166 *
167 * OUTPUT
168 *
169 * RETURNS
170 *
171 * AUTHOR
172 *
173 * POV-Ray Team
174 *
175 * DESCRIPTION
176 *
177 * The pattern routines take an x,y,z point on an object and a pointer to
178 * the object's texture description and return the color at that point
179 * Similar routines are granite, agate, marble. See txtcolor.c for examples.
180 *
181 * CHANGES
182 *
183 ******************************************************************************/
184
pattern3(VECTOR EPoint,TPATTERN * TPat)185 DBL pattern3 (VECTOR EPoint, TPATTERN *TPat)
186 {
187 DBL value;
188 /* YOUR NAME HERE */
189 TPat=TPat;
190
191 value = Noise(EPoint, TPat);
192
193 return(value);
194
195 }
196
197
198
199 /*****************************************************************************
200 *
201 * FUNCTION
202 *
203 * bumpy1
204 *
205 * INPUT
206 *
207 * OUTPUT
208 *
209 * RETURNS
210 *
211 * AUTHOR
212 *
213 * POV-Ray Team
214 *
215 * DESCRIPTION
216 *
217 * The bumpy routines take a point on an object, a pointer to the
218 * object's texture description and the surface normal at that point and
219 * return a peturb surface normal to create the illusion that the surface
220 * has been displaced.
221 *
222 * Similar routines are ripples, dents, bumps. See txtbump.c for examples.
223 *
224 * CHANGES
225 *
226 ******************************************************************************/
227
bumpy1(VECTOR EPoint,TNORMAL * Tnormal,VECTOR normal)228 void bumpy1 (VECTOR EPoint, TNORMAL *Tnormal, VECTOR normal)
229 {
230 /* YOUR NAME HERE */
231 EPoint=EPoint;
232
233 Tnormal = Tnormal;
234
235 Assign_Vector(normal, normal);
236 }
237
238
239
240 /*****************************************************************************
241 *
242 * FUNCTION
243 *
244 * bumpy2
245 *
246 * INPUT
247 *
248 * OUTPUT
249 *
250 * RETURNS
251 *
252 * AUTHOR
253 *
254 * POV-Ray Team
255 *
256 * DESCRIPTION
257 *
258 * The bumpy routines take a point on an object, a pointer to the
259 * object's texture description and the surface normal at that point and
260 * return a peturb surface normal to create the illusion that the surface
261 * has been displaced.
262 *
263 * Similar routines are ripples, dents, bumps. See txtbump.c for examples.
264 *
265 * CHANGES
266 *
267 ******************************************************************************/
268
bumpy2(VECTOR EPoint,TNORMAL * Tnormal,VECTOR normal)269 void bumpy2 (VECTOR EPoint, TNORMAL *Tnormal, VECTOR normal)
270 {
271 /* YOUR NAME HERE */
272 EPoint=EPoint;
273
274 Tnormal = Tnormal;
275
276 Assign_Vector(normal, normal);
277 }
278
279
280
281 /*****************************************************************************
282 *
283 * FUNCTION
284 *
285 * bumpy3
286 *
287 * INPUT
288 *
289 * OUTPUT
290 *
291 * RETURNS
292 *
293 * AUTHOR
294 *
295 * POV-Ray Team
296 *
297 * DESCRIPTION
298 *
299 * The bumpy routines take a point on an object, a pointer to the
300 * object's texture description and the surface normal at that point and
301 * return a peturb surface normal to create the illusion that the surface
302 * has been displaced.
303 *
304 * Similar routines are ripples, dents, bumps. See txtbump.c for examples.
305 *
306 * CHANGES
307 *
308 ******************************************************************************/
309
bumpy3(VECTOR EPoint,TNORMAL * Tnormal,VECTOR normal)310 void bumpy3 (VECTOR EPoint, TNORMAL *Tnormal, VECTOR normal)
311 {
312 /* YOUR NAME HERE */
313 EPoint=EPoint;
314
315 Tnormal = Tnormal;
316
317 Assign_Vector(normal, normal);
318 }
319
320 END_POV_NAMESPACE
321