TXTTEST.C 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. /****************************************************************************
  2. * txttest.c
  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
  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.
  18. *
  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.
  22. *
  23. *****************************************************************************/
  24. /*
  25. * Some texture ideas garnered from SIGGRAPH '85 Volume 19 Number 3,
  26. * "An Image Synthesizer" By Ken Perlin.
  27. *
  28. * Further Ideas Garnered from "The RenderMan Companion" (Addison Wesley)
  29. */
  30. #include "frame.h"
  31. #include "vector.h"
  32. #include "povproto.h"
  33. #include "texture.h"
  34. #include "povray.h" /* [DB 9/94] */
  35. #include "txttest.h" /* [DB 9/94] */
  36. #include "pattern.h" /* [CY 10/94] */
  37. /*****************************************************************************
  38. * Local preprocessor defines
  39. ******************************************************************************/
  40. /*****************************************************************************
  41. * Local typedefs
  42. ******************************************************************************/
  43. /*****************************************************************************
  44. * Local variables
  45. ******************************************************************************/
  46. /*****************************************************************************
  47. * Static functions
  48. ******************************************************************************/
  49. /*
  50. * Test new textures in the routines that follow.
  51. */
  52. /*****************************************************************************
  53. *
  54. * FUNCTION
  55. *
  56. * pattern1
  57. *
  58. * INPUT
  59. *
  60. * OUTPUT
  61. *
  62. * RETURNS
  63. *
  64. * AUTHOR
  65. *
  66. * POV-Ray Team
  67. *
  68. * DESCRIPTION
  69. *
  70. * The pattern routines take an x,y,z point on an object and a pointer to
  71. * the object's texture description and return the color at that point
  72. * Similar routines are granite, agate, marble. See txtcolor.c for examples.
  73. *
  74. * CHANGES
  75. *
  76. ******************************************************************************/
  77. DBL pattern1 (VECTOR EPoint, TPATTERN *TPat)
  78. {
  79. DBL value;
  80. /* YOUR NAME HERE */
  81. TPat=TPat;
  82. value = Noise(EPoint);
  83. return(value);
  84. }
  85. /*****************************************************************************
  86. *
  87. * FUNCTION
  88. *
  89. * pattern2
  90. *
  91. * INPUT
  92. *
  93. * OUTPUT
  94. *
  95. * RETURNS
  96. *
  97. * AUTHOR
  98. *
  99. * POV-Ray Team
  100. *
  101. * DESCRIPTION
  102. *
  103. * The pattern routines take an x,y,z point on an object and a pointer to
  104. * the object's texture description and return the color at that point
  105. * Similar routines are granite, agate, marble. See txtcolor.c for examples.
  106. *
  107. * CHANGES
  108. *
  109. ******************************************************************************/
  110. DBL pattern2 (VECTOR EPoint, TPATTERN *TPat)
  111. {
  112. DBL value;
  113. /* YOUR NAME HERE */
  114. TPat=TPat;
  115. value = Noise(EPoint);
  116. return(value);
  117. }
  118. /*****************************************************************************
  119. *
  120. * FUNCTION
  121. *
  122. * pattern3
  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. DBL pattern3 (VECTOR EPoint, TPATTERN *TPat)
  144. {
  145. DBL value;
  146. /* YOUR NAME HERE */
  147. TPat=TPat;
  148. value = Noise(EPoint);
  149. return(value);
  150. }
  151. /*****************************************************************************
  152. *
  153. * FUNCTION
  154. *
  155. * bumpy1
  156. *
  157. * INPUT
  158. *
  159. * OUTPUT
  160. *
  161. * RETURNS
  162. *
  163. * AUTHOR
  164. *
  165. * POV-Ray Team
  166. *
  167. * DESCRIPTION
  168. *
  169. * The bumpy routines take a point on an object, a pointer to the
  170. * object's texture description and the surface normal at that point and
  171. * return a peturb surface normal to create the illusion that the surface
  172. * has been displaced.
  173. *
  174. * Similar routines are ripples, dents, bumps. See txtbump.c for examples.
  175. *
  176. * CHANGES
  177. *
  178. ******************************************************************************/
  179. void bumpy1 (VECTOR EPoint, TNORMAL *Tnormal, VECTOR normal)
  180. {
  181. /* YOUR NAME HERE */
  182. EPoint=EPoint;
  183. Tnormal = Tnormal;
  184. Assign_Vector(normal, normal);
  185. }
  186. /*****************************************************************************
  187. *
  188. * FUNCTION
  189. *
  190. * bumpy2
  191. *
  192. * INPUT
  193. *
  194. * OUTPUT
  195. *
  196. * RETURNS
  197. *
  198. * AUTHOR
  199. *
  200. * POV-Ray Team
  201. *
  202. * DESCRIPTION
  203. *
  204. * The bumpy routines take a point on an object, a pointer to the
  205. * object's texture description and the surface normal at that point and
  206. * return a peturb surface normal to create the illusion that the surface
  207. * has been displaced.
  208. *
  209. * Similar routines are ripples, dents, bumps. See txtbump.c for examples.
  210. *
  211. * CHANGES
  212. *
  213. ******************************************************************************/
  214. void bumpy2 (VECTOR EPoint, TNORMAL *Tnormal, VECTOR normal)
  215. {
  216. /* YOUR NAME HERE */
  217. EPoint=EPoint;
  218. Tnormal = Tnormal;
  219. Assign_Vector(normal, normal);
  220. }
  221. /*****************************************************************************
  222. *
  223. * FUNCTION
  224. *
  225. * bumpy3
  226. *
  227. * INPUT
  228. *
  229. * OUTPUT
  230. *
  231. * RETURNS
  232. *
  233. * AUTHOR
  234. *
  235. * POV-Ray Team
  236. *
  237. * DESCRIPTION
  238. *
  239. * The bumpy routines take a point on an object, a pointer to the
  240. * object's texture description and the surface normal at that point and
  241. * return a peturb surface normal to create the illusion that the surface
  242. * has been displaced.
  243. *
  244. * Similar routines are ripples, dents, bumps. See txtbump.c for examples.
  245. *
  246. * CHANGES
  247. *
  248. ******************************************************************************/
  249. void bumpy3 (VECTOR EPoint, TNORMAL *Tnormal, VECTOR normal)
  250. {
  251. /* YOUR NAME HERE */
  252. EPoint=EPoint;
  253. Tnormal = Tnormal;
  254. Assign_Vector(normal, normal);
  255. }