BRL-CAD
sh_wood.c
Go to the documentation of this file.
1 /* S H _ W O O D . C
2  * BRL-CAD
3  *
4  * Copyright (c) 1994 Gull Island Consultants, Inc.
5  * All rights reserved.
6  *
7  * Permission is granted to freely distribute this software as part of
8  * the BRL-CAD package.
9  */
10 /** @file liboptical/sh_wood.c
11  *
12  * Simple wood-grain texture
13  *
14  * Author -
15  * Bill Laut, Gull Island Consultants, Inc.
16  *
17  * "Where Credit is Due" Authors -
18  * Tom DiGiacinto - For his linearly-interpolated noise function as
19  * found in the "sh_marble.c" routine.
20  *
21  * Description -
22  * This module implements a simple concentric ring abstraction that
23  * fairly simulates the ring pattern of wood. The placement of the
24  * rings within the combination is controlled through two MATPARM
25  * entries which centers the rings and specifies their direction. The
26  * actual rings themselves are formed on a plane perpendicular to the
27  * direction cosines, from the sine of the product of the outward
28  * distance and a MATPARM coefficient.
29  *
30  * The dithering mechanism is a slight enhancement upon the 3-D noise
31  * table which Tom DiGiacinto used in "sh_marble." In my case, the
32  * access is still limited to 10x10x10, but the table itself is
33  * expanded to 20x20x20. There is a MATPARM "dither" field which is
34  * used to "dither the dither." I.e., the "dither" parameter is a
35  * coefficient which is summed into Tom's interpolation routine,
36  * thereby allowing each wood-shaded combination to have a different
37  * noise pattern, and prevents all similar combinations from looking
38  * alike. The "dither" field is initialized with the "bn_rand0to1"
39  * routine before calling the parser, so default values can be used.
40  * However, (obviously) the user can override the defaults if desired.
41  *
42  * The MATPARM fields for this shader are:
43  *
44  * id = n Multi-region identification number
45  * o{verlay} = n # of dithered overlay rings to circumscribe
46  * lt{_rgb} = R/G/B The RGB color for the wood between the rings.
47  * dk{_rgb} = R/G/B The RGB color of the rings.
48  * s{pacing} = n Space in mm between rings
49  * p{hase} = n Controls thickness of the rings
50  * qd = n Degree of dithered "bleed" on edges of rings
51  * qp = n Degree of undithered "bleed" on ring edges
52  * dd = n Amount of 3-D dither applied to vertex
53  * dz = n Amount of Z-axis vertex dither
54  * di{ther} = a/b/c Starting point of dither within noise table
55  * de{pth} = f Amount of dither to add to sine
56  * r{otation} = a/b/c 3-D rotation of rings' vertex
57  * V = X/Y/Z Vertex of rings' center
58  * D = X/Y/Z XYZ of where rings' center is aimed at
59  *
60  * Source -
61  * Gull Island Consultants, Inc.
62  * P.O. Box 627
63  * Muskegon, MI 49440
64  */
65 
66 #include "common.h"
67 
68 #include <stddef.h>
69 #include <stdio.h>
70 #include <ctype.h>
71 #include <math.h>
72 
73 #include "vmath.h"
74 #include "raytrace.h"
75 #include "optical.h"
76 
77 
78 /*
79  * Sundry external references
80  */
81 extern fastf_t turb_table[20][20][20];
82 
83 /*
84  * Sundry routine declarations
85  */
86 
87 HIDDEN int wood_setup(register struct region *rp, struct bu_vls *matparm, void **dpp, const struct mfuncs *mfp, struct rt_i *rtip);
88 HIDDEN int wood_render(struct application *ap, const struct partition *partp, struct shadework *swp, void *dp);
89 HIDDEN void wood_print(register struct region *rp, void *dp);
90 HIDDEN void wood_free(void *cp);
91 
92 /* local sp_hook functions */
93 HIDDEN void wood_V_set(const struct bu_structparse *, const char *, void *, const char *, void *);
94 HIDDEN void wood_D_set(const struct bu_structparse *, const char *, void *, const char *, void *);
95 
96 /*
97  * functions block for the shader
98  */
99 
100 struct mfuncs wood_mfuncs[] = {
101  {MF_MAGIC, "wood", 0, MFI_HIT|MFI_UV|MFI_NORMAL, 0, wood_setup, wood_render, wood_print, wood_free},
102  {MF_MAGIC, "w", 0, MFI_HIT|MFI_UV|MFI_NORMAL, 0, wood_setup, wood_render, wood_print, wood_free},
103  {0, (char *)0, 0, 0, 0, 0, 0, 0, 0}
104 };
105 
106 /*
107  * Impure storage area for shader
108  */
109 
112  struct region *rp;
113  int ident;
114  int flags;
115  int overlay;
116  int ns;
129  vect_t vertex;
130  vect_t dir;
131  vect_t rot;
132  vect_t b_min;
133  vect_t b_max;
134  vect_t c_min;
135  vect_t c_max;
136  vect_t D;
137  vect_t V;
138 };
139 
140 
141 HIDDEN void wood_setup_2(struct wood_specific *);
142 
143 /*
144  * Flags and useful offset declarations
145  */
146 
147 #define WOOD_NULL ((struct wood_specific *)0)
148 #define WOOD_O(m) bu_offsetof(struct wood_specific, m)
149 
150 #define EXPLICIT_VERTEX 1
151 #define EXPLICIT_DIRECTION 2
152 
153 /*
154  * Listhead for multi-region wood combinations
155  */
156 
157 static struct wood_specific *Wood_Chain = WOOD_NULL;
158 
159 /*
160  * MATPARM parsing structure
161  */
162 
164  {"%d", 1, "ident", WOOD_O(ident), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
165  {"%d", 1, "id", WOOD_O(ident), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
166  {"%d", 1, "overlay", WOOD_O(overlay), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
167  {"%d", 1, "o", WOOD_O(overlay), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
168  {"%d", 1, "ns", WOOD_O(ns), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
169  {"%f", 1, "jitter", WOOD_O(jitter), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
170  {"%f", 1, "j", WOOD_O(jitter), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
171  {"%f", 3, "lt_rgb", WOOD_O(lt_rgb), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
172  {"%f", 3, "lt", WOOD_O(lt_rgb), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
173  {"%f", 3, "dk_rgb", WOOD_O(dk_rgb), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
174  {"%f", 3, "dk", WOOD_O(dk_rgb), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
175  {"%f", 1, "spacing", WOOD_O(spacing), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
176  {"%f", 1, "s", WOOD_O(spacing), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
177  {"%f", 1, "scale", WOOD_O(scale), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
178  {"%f", 1, "sc", WOOD_O(scale), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
179  {"%f", 1, "phase", WOOD_O(phase), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
180  {"%f", 1, "p", WOOD_O(phase), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
181  {"%f", 1, "qd", WOOD_O(qd), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
182  {"%f", 1, "qp", WOOD_O(qp), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
183  {"%f", 3, "dither", WOOD_O(dither), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
184  {"%f", 3, "di", WOOD_O(dither), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
185  {"%f", 1, "depth", WOOD_O(depth), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
186  {"%f", 1, "de", WOOD_O(depth), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
187  {"%f", 1, "dd", WOOD_O(dd), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
188  {"%f", 1, "dz", WOOD_O(dz), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
189  {"%f", 3, "rotation", WOOD_O(rot), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
190  {"%f", 3, "r", WOOD_O(rot), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
191  {"%f", 3, "D", WOOD_O(D), wood_D_set, NULL, NULL },
192  {"%f", 3, "V", WOOD_O(V), wood_V_set, NULL, NULL },
193  {"", 0, (char *)0, 0, BU_STRUCTPARSE_FUNC_NULL, NULL, NULL }
194 };
195 
196 
197 /*
198  * Noise Table. Based upon work by Tom DiGiacinto. This table gives us
199  * a linearly-interpolated noise function for dithering location of rings
200  * within the wood surface. It is approximately four times bigger than is
201  * actually needed, so that we can dither the starting position on a
202  * per-region basis, and thus make each region look unique.
203  */
204 
205 #define IPOINTS 10 /* undithered number of points */
206 #define TPOINTS 20 /* Dithering space */
207 
208 
209 /*
210  * The following are miscellaneous routines which are invoked by the parser
211  * to set flag bits, indicating the presence of actual parsed values.
212  */
213 
214 HIDDEN void
215 wood_V_set(const struct bu_structparse *UNUSED(sdp),
216  const char *UNUSED(name),
217  void *base,
218  const char *UNUSED(value),
219  void *UNUSED(data))
220 {
221  register struct wood_specific *wd =
222  (struct wood_specific *)base;
223 
224  wd->flags |= EXPLICIT_VERTEX;
225 }
226 
227 
228 HIDDEN void
229 wood_D_set(const struct bu_structparse *UNUSED(sdp),
230  const char *UNUSED(name),
231  void *base,
232  const char *UNUSED(value),
233  void *UNUSED(data))
234 {
235  register struct wood_specific *wd =
236  (struct wood_specific *)base;
237 
238  wd->flags |= EXPLICIT_DIRECTION;
239 }
240 
241 
242 HIDDEN int
243 wood_setup(register struct region *rp, struct bu_vls *matparm, void **dpp, const struct mfuncs *UNUSED(mfp), struct rt_i *UNUSED(rtip))
244 /* New since 4.4 release */
245 {
246  register int i;
247  register struct wood_specific *wd;
248 
249  register struct resource *resp = &rt_uniresource;
250 
251  /*
252  * Get the impure storage for the control block
253  */
254 
255  BU_CK_VLS(matparm);
256  BU_GET(wd, struct wood_specific);
257  *dpp = wd;
258 
259  /*
260  * Load the default values
261  */
262 
263  if (rp->reg_mater.ma_color_valid) {
264  VSCALE(wd->lt_rgb, rp->reg_mater.ma_color, 255);
265  } else {
266  wd->lt_rgb[0] = 255; /* Light yellow */
267  wd->lt_rgb[1] = 255;
268  wd->lt_rgb[2] = 224;
269  }
270 
271  wd->dk_rgb[0] = 191; /* Brownish-red */
272  wd->dk_rgb[1] = 97;
273  wd->dk_rgb[2] = 0;
274 
275  wd->ident = 0;
276  wd->forw = WOOD_NULL;
277  wd->rp = rp;
278  wd->flags = 0;
279  wd->overlay = 0; /* Draw only one ring */
280  wd->ns = 10;
281  wd->jitter = 0.0;
282  wd->scale = 1.0;
283  wd->spacing = 5; /* 5mm space between rings */
284  wd->dd = 0.0; /* no dither of vertex */
285  wd->dz = 0.0; /* nor of Z-axis */
286  wd->qd = 0;
287  wd->qp = 0;
288  wd->phase = 5;
289  wd->depth = 0;
290 
291  wd->dither[0] = bn_rand0to1(resp->re_randptr);
292  wd->dither[1] = bn_rand0to1(resp->re_randptr);
293  wd->dither[2] = bn_rand0to1(resp->re_randptr);
294 
295  VSETALL(wd->rot, 0);
296  VSETALL(wd->vertex, 0);
297  VSETALL(wd->D, 0);
298  VSETALL(wd->V, 0);
299 
300  /*
301  * Parse the MATPARM field
302  */
303 
304  if (bu_struct_parse(matparm, wood_parse, (char *)wd, NULL) < 0) {
305  BU_PUT(wd, struct wood_specific);
306  return -1;
307  }
308 
309  /*
310  * Do some sundry range and misc. checking
311  */
312 
313  for (i = 0; i < 3; i++) {
314  if (wd->dither[i] < 0 || wd->dither[i] > 1.0) {
315  bu_log("wood_setup(%s): dither is out of range.\n",
316  rp->reg_name);
317  return -1;
318  }
319  }
320 
321  if (wd->flags == EXPLICIT_VERTEX) {
322  bu_log("wood_setup(%s): Explicit vertex specified without direction\n", rp->reg_name);
323  return -1;
324  }
325 
326  if (wd->flags == EXPLICIT_DIRECTION) {
327  bu_log("wood_setup(%s): Explicit direction specified without vertex\n", rp->reg_name);
328  return -1;
329  }
330 
331  /*
332  * Get the bounding RPP
333  */
334 
335  if (rt_bound_tree(rp->reg_treetop, wd->b_min, wd->b_max) < 0) return -1;
336 
337  /*
338  * Add it to the wood chain
339  */
340 
341  wd->forw = Wood_Chain;
342  Wood_Chain = wd;
343 
344  /*
345  * See if the user has flagged this region as a member of a larger
346  * combination. If so, go ahead and process it
347  */
348 
349  if (wd->ident == 0)
350  wood_setup_2(wd);
351 
352  else {
353  register struct wood_specific *wc;
354  vect_t c_min, c_max;
355 
356  /*
357  * First, process the accumulated chain of wood regions and
358  * process all regions which have the specified ident field.
359  */
360 
361  VSETALL(c_min, 0);
362  VSETALL(c_max, 0);
363 
364  for (wc = Wood_Chain; wc != WOOD_NULL; wc = wc->forw) {
365  if (wc->ident == wd->ident) {
366  VMIN(c_min, wc->b_min);
367  VMAX(c_max, wc->b_max);
368  }
369  }
370 
371  /*
372  * Now, loop through the chain again this time updating the
373  * regions' min/max fields with the new values
374  */
375 
376  for (wc = Wood_Chain; wc != WOOD_NULL; wc = wc->forw) {
377  if (wc->ident == wd->ident) {
378  VMOVE(wc->b_min, c_min);
379  VMOVE(wc->b_max, c_max);
380  wood_setup_2(wc);
381  }
382  }
383 
384  /*
385  * End of multi-region processing loop
386  */
387 
388  }
389 
390  /*
391  * Normalize the RGB colors
392  */
393 
394  for (i = 0; i < 3; i++) {
395  wd->lt_rgb[i] /= 255.0;
396  wd->dk_rgb[i] /= 255.0;
397  }
398 
399  /*
400  * Return to the caller
401  */
402 
403  return 1;
404 }
405 
406 
407 /*
408  * Phase 2 setup routine
409  */
410 HIDDEN void
412 {
413  mat_t xlate;
414  int i;
415  vect_t a_vertex, a_dir;
416 
417  register struct resource *resp = &rt_uniresource;
418 
419  /*
420  * See if the user specified absolute coordinates for the vertex and
421  * direction. If so, use those instead of the RPP.
422  */
423 
424  bn_mat_angles(xlate, V3ARGS(wd->rot));
425 
426  if (wd->flags & EXPLICIT_VERTEX) {
427  MAT4X3PNT(wd->vertex, xlate, wd->V);
428  MAT4X3PNT(wd->dir, xlate, wd->D);
429  } else {
430  if (wd->dz > 0.0) {
431  for (i = 0; i < 2; i++) {
432  a_vertex[i] = wd->b_min[i];
433  a_dir[i] = wd->b_max[i];
434  }
435  /* Z component is [2] */
436  a_vertex[2] = ((wd->b_max[2] - wd->b_min[2]) *
437  (bn_rand0to1(resp->re_randptr) * wd->dz)) + wd->b_min[2];
438  a_dir[2] = ((wd->b_max[2] - wd->b_min[2]) *
439  (bn_rand0to1(resp->re_randptr) * wd->dz)) + wd->b_min[2];
440  } else {
441  for (i = 0; i < 3; i++) {
442  a_vertex[i] = ((wd->b_max[i] - wd->b_min[i]) *
443  (bn_rand0to1(resp->re_randptr) * wd->dd)) + wd->b_min[i];
444  a_dir[i] = ((wd->b_max[i] - wd->b_min[i]) *
445  (bn_rand0to1(resp->re_randptr) * wd->dd)) + wd->b_max[i];
446  }
447  }
448  MAT4X3PNT(wd->vertex, xlate, a_vertex);
449  MAT4X3PNT(wd->dir, xlate, a_dir);
450  }
451 
452  VSUB2(wd->dir, wd->dir, wd->vertex);
453  VUNITIZE(wd->dir);
454 }
455 
456 
457 HIDDEN void
458 wood_print(register struct region *rp, void *UNUSED(dp))
459 {
460  bu_struct_print(rp->reg_name, wood_parse, (char *)rp->reg_udata);
461 }
462 
463 
464 /*
465  * This routine is called to free up the user block at the end
466  * of a frame, as well as clean up any references to objects on
467  * the Wood_Chain list.
468  */
469 HIDDEN void
470 wood_free(void *cp)
471 {
472  register struct wood_specific *wd =
473  (struct wood_specific *)cp;
474 
475  register struct wood_specific *wc;
476 
477  if (Wood_Chain == wd) {
478 /* bu_log ("wood_free(%s): Releasing region (at head).\n", wd->rp->reg_name); */
479  Wood_Chain = wd->forw;
480  BU_PUT(wd, struct wood_specific);
481  return;
482  }
483 
484  for (wc = Wood_Chain; wc != WOOD_NULL; wc = wc->forw) {
485  if (wc->forw == wd) {
486 /* bu_log("wood_free(%s): Releasing region.\n", wd->rp->reg_name); */
487  wc->forw = wd->forw;
488  BU_PUT(wd, struct wood_specific);
489  return;
490  }
491  }
492 
493  BU_PUT(wd, struct wood_specific);
494 }
495 
496 
497 /*
498  * These are the noise and turbulence routines which the rendering routine
499  * uses to perturb the rings. They are lifted directly from the "sh_marble"
500  * routine. Eventually, they will be moved into a separate library for
501  * dealing with noise and turbulence.
502  */
503 
504 HIDDEN double
505 wood_noise(double x, double y, double z, struct wood_specific *wd)
506 {
507  int xi, yi, zi;
508  double xr, yr, zr;
509  double n1, n2, noise1, noise2, noise3, noise;
510 
511  xi = x * IPOINTS;
512  xr = (x * IPOINTS) - xi;
513  yi = y * IPOINTS;
514  yr = (y * IPOINTS) - yi;
515  zi = z * IPOINTS;
516  zr = (z * IPOINTS) - zi;
517 
518  n1 = (1 - xr) * turb_table[xi][yi][zi] +
519  xr * turb_table[xi + 1][yi][zi];
520  n2 = (1 - xr) * turb_table[xi][yi + 1][zi] +
521  xr * turb_table[xi + 1][yi + 1][zi];
522  noise1 = (1 - yr) * n1 + yr * n2;
523 
524  n1 = (1 - xr) * turb_table[xi][yi][zi + 1] +
525  xr * turb_table[xi + 1][yi][zi + 1];
526  n2 = (1 - xr) * turb_table[xi][yi + 1][zi + 1] +
527  xr * turb_table[xi + 1][yi + 1][zi + 1];
528  noise2 = (1 - yr) * n1 + yr * n2;
529 
530  noise3 = (1 - zr) * noise1 + zr * noise2;
531  noise = pow(noise3, wd->scale);
532 
533  return noise;
534 }
535 
536 
537 HIDDEN double
538 wood_turb(double x, double y, double z, struct wood_specific *wd)
539 {
540  register struct resource *resp = &rt_uniresource;
541 
542  int i;
543  fastf_t a, b, c, turb = 0.0, scale;
544 
545  for (i = 0; i < wd->ns; i++) {
546  scale = (double)i / (double)wd->ns;
547 
548  a = (x * scale) +
549  (bn_rand_half(resp->re_randptr) * wd->jitter) +
550  wd->dither[X];
551 
552  b = (y * scale) +
553  (bn_rand_half(resp->re_randptr) * wd->jitter) +
554  wd->dither[Y];
555 
556  c = (z * scale) +
557  (bn_rand_half(resp->re_randptr) * wd->jitter) +
558  wd->dither[Z];
559 
560  turb += wood_noise(a, b, c, wd);
561  }
562 
563  return turb;
564 }
565 
566 
567 /*
568  * Given an XYZ hit point, compute the concentric ring structure. We do
569  * this by computing the dot-product of the hit point vs. the ring vertex,
570  * which is then used to compute the distance from the ring center. This
571  * distance is then multiplied by a velocity coefficient that is signed.
572  */
573 HIDDEN int
574 wood_render(struct application *UNUSED(ap), const struct partition *UNUSED(partp), struct shadework *swp, void *dp)
575 {
576  register struct wood_specific *wd =
577  (struct wood_specific *)dp;
578 
579  vect_t g, h;
580  point_t dprod, lprod;
581  double c, A, B, C;
582  double x, y, z, xd, yd, zd;
583  double mixture, pp, pq, wt;
584 
585  /*
586  * Compute the normalized hit point
587  */
588 
589  xd = wd->b_max[0] - wd->b_min[0] + 1.0;
590  yd = wd->b_max[1] - wd->b_min[1] + 1.0;
591  zd = wd->b_max[2] - wd->b_min[2] + 1.0;
592 
593  x = wd->dither[X] + ((swp->sw_hit.hit_point[0] - wd->b_min[0]) / xd);
594  y = wd->dither[Y] + ((swp->sw_hit.hit_point[1] - wd->b_min[1]) / yd);
595  z = wd->dither[Z] + ((swp->sw_hit.hit_point[2] - wd->b_min[2]) / zd);
596 
597  /*
598  * Compute the distance from the ring center to the hit
599  * point by formulating a triangle between the hit point,
600  * the ring vertex, and ring's local X-axis.
601  */
602 
603  VSUB2(h, swp->sw_hit.hit_point, wd->vertex);
604  VMOVE(g, h);
605  VUNITIZE(g); /* xlate to ray */
606 
607  wt = wood_turb(x, y, z, wd) * wd->depth; /* used in two places */
608 
609  c = fabs(VDOT(g, wd->dir));
610  A = MAGNITUDE(h) + wt;
611  B = c * A; /* abscissa */
612  C = sqrt(pow(A, 2.0) - pow(B, 2.0)); /* ordinate */
613 
614  /*
615  * Divide the ordinate by the spacing coefficient, and
616  * compute the sine from that product.
617  */
618 
619  c = fabs(sin((C / wd->spacing) * M_PI));
620 
621  /*
622  * Dither the "q" control
623  */
624 
625  pq = cos(((wd->qd * wt) + wd->qp + wd->phase) * DEG2RAD);
626  pp = cos(wd->phase * DEG2RAD);
627 
628  /*
629  * Color the hit point based on the phase of the ring
630  */
631 
632  if (c < pq) {
633  VMOVE(swp->sw_color, wd->lt_rgb);
634  } else if (c >= pp) {
635  VMOVE(swp->sw_color, wd->dk_rgb);
636  } else {
637  mixture = (c - pq) / (pp - pq);
638  VSCALE(lprod, wd->lt_rgb, (1.0 - mixture));
639  VSCALE(dprod, wd->dk_rgb, mixture);
640  VADD2(swp->sw_color, lprod, dprod);
641  }
642 
643  /*
644  * All done. Return to the caller
645  */
646 
647  return 1;
648 }
649 
650 
651 /*
652  * Local Variables:
653  * mode: C
654  * tab-width: 8
655  * indent-tabs-mode: t
656  * c-file-style: "stroustrup"
657  * End:
658  * ex: shiftwidth=4 tabstop=8
659  */
fastf_t qd
Definition: sh_wood.c:124
void bu_log(const char *,...) _BU_ATTR_PRINTF12
Definition: log.c:176
#define WOOD_NULL
Definition: sh_wood.c:147
vect_t rot
Definition: sh_wood.c:131
HIDDEN double wood_noise(double x, double y, double z, struct wood_specific *wd)
Definition: sh_wood.c:505
HIDDEN void wood_print(register struct region *rp, void *dp)
Definition: sh_wood.c:458
fastf_t phase
Definition: sh_wood.c:122
#define bn_rand_half(_p)
Definition: rand.h:97
fastf_t C[2 *MAX_CNT+1][2 *MAX_CNT+1]
Definition: dsp_brep.cpp:38
fastf_t depth
Definition: sh_wood.c:120
#define MF_MAGIC
Definition: magic.h:205
vect_t D
Definition: sh_wood.c:136
Definition: clone.c:90
fastf_t jitter
Definition: sh_wood.c:117
int rt_bound_tree(const union tree *tp, vect_t tree_min, vect_t tree_max)
#define VSETALL(a, s)
Definition: color.c:54
vect_t vertex
Definition: sh_wood.c:129
#define M_PI
Definition: fft.h:35
#define EXPLICIT_DIRECTION
Definition: sh_wood.c:151
Header file for the BRL-CAD common definitions.
const char * reg_name
Identifying string.
Definition: raytrace.h:539
char ma_color_valid
non-0 ==> ma_color is non-default
Definition: raytrace.h:524
HIDDEN void wood_free(void *cp)
Definition: sh_wood.c:470
#define HIDDEN
Definition: common.h:86
vect_t b_max
Definition: sh_wood.c:133
void bu_struct_print(const char *title, const struct bu_structparse *parsetab, const char *base)
Definition: parse.c:1221
HIDDEN int wood_setup(register struct region *rp, struct bu_vls *matparm, void **dpp, const struct mfuncs *mfp, struct rt_i *rtip)
Definition: sh_wood.c:243
HIDDEN void wood_V_set(const struct bu_structparse *, const char *, void *, const char *, void *)
Definition: sh_wood.c:215
Definition: color.c:49
fastf_t dd
Definition: sh_wood.c:123
COMPLEX data[64]
Definition: fftest.c:34
#define BU_CK_VLS(_vp)
Definition: vls.h:69
struct resource rt_uniresource
default. Defined in librt/globals.c
Definition: globals.c:41
vect_t c_min
Definition: sh_wood.c:134
struct wood_specific * forw
Definition: sh_wood.c:111
#define V3ARGS(a)
Definition: color.c:56
#define BU_GET(_ptr, _type)
Definition: malloc.h:201
fastf_t dz
Definition: sh_wood.c:125
struct bu_structparse wood_parse[]
Definition: sh_wood.c:163
fastf_t spacing
Definition: sh_wood.c:121
#define UNUSED(parameter)
Definition: common.h:239
#define BU_PUT(_ptr, _type)
Definition: malloc.h:215
#define WOOD_O(m)
Definition: sh_wood.c:148
HIDDEN void wood_setup_2(struct wood_specific *)
Definition: sh_wood.c:411
fastf_t dither[3]
Definition: sh_wood.c:128
void bn_mat_angles(mat_t mat, double alpha, double beta, double ggamma)
fastf_t turb_table[20][20][20]
Definition: turb.c:21
#define BU_STRUCTPARSE_FUNC_NULL
Definition: parse.h:153
HIDDEN double wood_turb(double x, double y, double z, struct wood_specific *wd)
Definition: sh_wood.c:538
fastf_t qp
Definition: sh_wood.c:126
float ma_color[3]
explicit color: 0..1
Definition: raytrace.h:522
struct mater_info reg_mater
Real material information.
Definition: raytrace.h:546
#define bn_rand0to1(_q)
Definition: rand.h:123
struct mfuncs wood_mfuncs[]
Definition: sh_wood.c:100
int bu_struct_parse(const struct bu_vls *in_vls, const struct bu_structparse *desc, const char *base, void *data)
Definition: parse.c:878
fastf_t lt_rgb[3]
Definition: sh_wood.c:118
vect_t c_max
Definition: sh_wood.c:135
vect_t b_min
Definition: sh_wood.c:132
union tree * reg_treetop
Pointer to boolean tree.
Definition: raytrace.h:540
fastf_t scale
Definition: sh_wood.c:127
#define A
Definition: msr.c:51
#define IPOINTS
Definition: sh_wood.c:205
HIDDEN void wood_D_set(const struct bu_structparse *, const char *, void *, const char *, void *)
Definition: sh_wood.c:229
fastf_t dk_rgb[3]
Definition: sh_wood.c:119
Definition: color.c:51
vect_t dir
Definition: sh_wood.c:130
vect_t V
Definition: sh_wood.c:137
HIDDEN int wood_render(struct application *ap, const struct partition *partp, struct shadework *swp, void *dp)
Definition: sh_wood.c:574
#define EXPLICIT_VERTEX
Definition: sh_wood.c:150
void * reg_udata
User appl. data for material.
Definition: raytrace.h:548
struct region * rp
Definition: sh_wood.c:112
float * re_randptr
ptr into random number table
Definition: raytrace.h:1457
Definition: vls.h:56
double fastf_t
Definition: defines.h:300
Header file for the BRL-CAD Optical Library, LIBOPTICAL.
Definition: color.c:50