BRL-CAD
sh_noise.c
Go to the documentation of this file.
1 /* S H _ N O I S E . C
2  * BRL-CAD
3  *
4  * Copyright (c) 1998-2014 United States Government as represented by
5  * the U.S. Army Research Laboratory.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public License
9  * version 2.1 as published by the Free Software Foundation.
10  *
11  * This library is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this file; see the file named COPYING for more
18  * information.
19  */
20 /** @file liboptical/sh_noise.c
21  *
22  * Shaders:
23  * gravel turbulence noise applied to color and surface normal
24  * turbump turbulence noise applied to surface normal
25  * turcolor turbulence noise applied to color
26  * fbmbump fbm noise applied to surface normal
27  * fbmcolor fbm noise applied to color
28  *
29  */
30 
31 #include "common.h"
32 
33 #include <stddef.h>
34 #include <stdio.h>
35 #include <string.h>
36 #include <math.h>
37 
38 #include "vmath.h"
39 #include "bu/units.h"
40 #include "bn.h"
41 #include "raytrace.h"
42 #include "optical.h"
43 
44 
45 #define noise_MAGIC 0x1847
46 #define CK_noise_SP(_p) BU_CKMAG(_p, noise_MAGIC, "noise_specific")
47 
48 void
49 noise_deg_to_rad(const struct bu_structparse *sdp,
50  const char *UNUSED(name),
51  void *base,
52  const char *UNUSED(value),
53  void *UNUSED(data))
54 /* structure description */
55 /* struct member name */
56 /* beginning of structure */
57 /* string containing value */
58 {
59  double *p = (double *)((char *)base + sdp->sp_offset);
60 
61  /* reconvert with optional units */
62  *p = *p * DEG2RAD;
63 }
64 
65 
66 /*
67  * the shader specific structure contains all variables which are unique
68  * to any particular use of the shader.
69  */
71  uint32_t magic; /* magic # for memory validity check, must come 1st */
72  double lacunarity;
73  double h_val;
74  double octaves;
75  double size;
76  double max_angle;
77  point_t vscale; /* size of noise coordinate space */
78  vect_t delta;
79  mat_t m_to_sh; /* model to shader space matrix */
80  mat_t sh_to_m; /* shader to model space matrix */
81  double max_delta;
82  double nsd;
83  double minval; /* don't use noise value less than this */
85 };
86 
87 
88 /* The default values for the variables in the shader specific structure */
89 static const
90 struct noise_specific noise_defaults = {
92  2.1753974, /* lacunarity */
93  1.0, /* h_val */
94  4.0, /* octaves */
95  1.0, /* size */
96  M_PI_2, /* max_angle */
97  VINITALL(1.0), /* vscale */
98  VINITALL(1000.0), /* delta into noise space */
99  MAT_INIT_ZERO, /* m_to_sh */
100  MAT_INIT_ZERO, /* sh_to_m */
101  0.0, /* max_delta */
102  0.0, /* nsd */
103  0.0, /* minval */
104  0 /* shader_number */
105 };
106 
107 
108 #define SHDR_NULL ((struct noise_specific *)0)
109 #define SHDR_O(m) bu_offsetof(struct noise_specific, m)
110 
111 
112 /* description of how to parse/print the arguments to the shader
113  * There is at least one line here for each variable in the shader specific
114  * structure above
115  */
117  {"%g", 1, "lacunarity", SHDR_O(lacunarity), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
118  {"%g", 1, "H", SHDR_O(h_val), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
119  {"%g", 1, "octaves", SHDR_O(octaves), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
120  {"%f", 3, "delta", SHDR_O(delta), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
121  {"%g", 1, "size", SHDR_O(size), bu_mm_cvt, NULL, NULL },
122  {"%g", 1, "angle", SHDR_O(max_angle), noise_deg_to_rad, NULL, NULL },
123  {"%f", 3, "vscale", SHDR_O(vscale), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
124  {"%g", 1, "min", SHDR_O(minval), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
125  {"", 0, (char *)0, 0, BU_STRUCTPARSE_FUNC_NULL, NULL, NULL }
126 };
127 
128 
130  {"%p", 1, "noise_print_tab", bu_byteoffset(noise_print_tab[0]), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
131  {"%g", 1, "lacunarity", SHDR_O(lacunarity), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
132  {"%g", 1, "l", SHDR_O(lacunarity), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
133  {"%g", 1, "H", SHDR_O(h_val), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
134  {"%g", 1, "octaves", SHDR_O(octaves), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
135  {"%g", 1, "o", SHDR_O(octaves), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
136  {"%f", 3, "delta", SHDR_O(delta), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
137  {"%f", 3, "d", SHDR_O(delta), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
138  {"%g", 1, "size", SHDR_O(size), bu_mm_cvt, NULL, NULL },
139  {"%g", 1, "s", SHDR_O(size), bu_mm_cvt, NULL, NULL },
140  {"%g", 1, "angle", SHDR_O(max_angle), noise_deg_to_rad, NULL, NULL },
141  {"%g", 1, "ang", SHDR_O(max_angle), noise_deg_to_rad, NULL, NULL },
142  {"%g", 1, "a", SHDR_O(max_angle), noise_deg_to_rad, NULL, NULL },
143  {"%f", 3, "vscale", SHDR_O(vscale), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
144  {"%f", 3, "vs", SHDR_O(vscale), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
145  {"%f", 3, "v", SHDR_O(vscale), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
146  {"%g", 1, "min", SHDR_O(minval), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
147  {"", 0, (char *)0, 0, BU_STRUCTPARSE_FUNC_NULL, NULL, NULL }
148 };
149 
150 
151 /*
152  * This routine is called (at prep time)
153  * once for each region which uses this shader.
154  * Any shader-specific initialization should be done here.
155  */
156 HIDDEN int
157 noise_setup(register struct region *rp, struct bu_vls *matparm, void **dpp, const struct mfuncs *mfp, struct rt_i *rtip)
158 /* pointer to reg_udata in *rp */
159 /* New since 4.4 release */
160 {
161  register struct noise_specific *noise_sp;
162  mat_t tmp;
163  mat_t model_to_region;
164  int i;
165 
166  /* check the arguments */
167  RT_CHECK_RTI(rtip);
168  BU_CK_VLS(matparm);
169  RT_CK_REGION(rp);
170 
171 
172  if (rdebug&RDEBUG_SHADE)
173  bu_log("noise_setup(%s, %s) (%s)\n",
174  rp->reg_name, bu_vls_addr(matparm),
175  rp->reg_mater.ma_shader);
176 
177  /* Get memory for the shader parameters and shader-specific data */
178  BU_GET(noise_sp, struct noise_specific);
179  *dpp = noise_sp;
180 
181  /* initialize the default values for the shader */
182  memcpy(noise_sp, &noise_defaults, sizeof(struct noise_specific));
183 
184  /* parse the user's arguments for this use of the shader. */
185  if (bu_struct_parse(matparm, noise_parse_tab, (char *)noise_sp, NULL) < 0)
186  return -1;
187 
188  /* figure out which shader is really being called */
189  for (i = 0; noise_mfuncs[i].mf_name; i++) {
190  if (BU_STR_EQUAL(noise_mfuncs[i].mf_name, mfp->mf_name))
191  goto found;
192  }
193  bu_log("shader name \"%s\" not recognized, assuming \"%s\"\n",
194  mfp->mf_name, noise_mfuncs[0].mf_name);
195  i = 0;
196 found:
197  noise_sp->shader_number = i;
198 
199  db_region_mat(model_to_region, rtip->rti_dbip, rp->reg_name, &rt_uniresource);
200 
201  MAT_IDN(tmp);
202  if (!EQUAL(noise_sp->size, 1.0)) {
203  /* the user sets "size" to the size of the biggest
204  * noise-space blob in model coordinates
205  */
206  tmp[0] = tmp[5] = tmp[10] = 1.0/noise_sp->size;
207  } else {
208  tmp[0] = 1.0/noise_sp->vscale[0];
209  tmp[5] = 1.0/noise_sp->vscale[1];
210  tmp[10] = 1.0/noise_sp->vscale[2];
211  }
212 
213  bn_mat_mul(noise_sp->m_to_sh, tmp, model_to_region);
214 
215  /* Add any translation within shader/region space */
216  MAT_IDN(tmp);
217  tmp[MDX] = noise_sp->delta[0];
218  tmp[MDY] = noise_sp->delta[1];
219  tmp[MDZ] = noise_sp->delta[2];
220  bn_mat_mul2(tmp, noise_sp->m_to_sh);
221 
222  bn_mat_inv(noise_sp->sh_to_m, noise_sp->m_to_sh);
223 
224  noise_sp->nsd = 1.0 /
225  pow(noise_sp->lacunarity, noise_sp->octaves);
226 
227  if (rdebug&RDEBUG_SHADE) {
228  bu_struct_print(" Parameters:", noise_print_tab, (char *)noise_sp);
229  bn_mat_print("m_to_sh", noise_sp->m_to_sh);
230  }
231 
232  return 1;
233 }
234 
235 
236 HIDDEN void
237 noise_print(register struct region *rp, void *dp)
238 {
239  bu_struct_print(rp->reg_name, noise_print_tab, (char *)dp);
240 }
241 
242 
243 HIDDEN void
244 noise_free(void *cp)
245 {
246  BU_PUT(cp, struct noise_specific);
247 }
248 #define RESCALE_NOISE(n) n += 1.0
249 
250 /*
251  * Apply a noise function to the surface normal
252  */
253 static void
254 norm_noise(fastf_t *pt, double val, struct noise_specific *noise_sp, double (*func) (/* ??? */), struct shadework *swp, int rescale)
255 /* defined in material.h */
256 {
257  vect_t N, tmp;
258  point_t u_pt, v_pt;
259  vect_t u_vec, v_vec;
260  double u_val, v_val;
261  mat_t u_mat, v_mat;
262 
263  /* dork the normal around
264  * Convert the normal to shader space, get u, v coordinate system
265  */
266 
267  if (rdebug&RDEBUG_SHADE) {
268  VPRINT("Model space Normal", swp->sw_hit.hit_normal);
269  }
270  MAT4X3VEC(N, noise_sp->m_to_sh, swp->sw_hit.hit_normal);
271  VUNITIZE(N);
272  if (rdebug&RDEBUG_SHADE) {
273  VPRINT("Shader space Normal", N);
274  }
275 
276  /* construct coordinate system from vectors perpendicular to normal */
277  bn_vec_perp(u_vec, N);
278  VCROSS(v_vec, N, u_vec);
279 
280  /* compute noise function at position slightly off pt in both
281  * U and V directions to get change in values
282  */
283  VJOIN1(u_pt, pt, noise_sp->nsd, u_vec);
284  u_val = func(u_pt, noise_sp->h_val, noise_sp->lacunarity,
285  noise_sp->octaves);
286 
287  if (rescale) RESCALE_NOISE(u_val);
288 
289  VJOIN1(v_pt, pt, noise_sp->nsd, v_vec);
290  v_val = func(v_pt, noise_sp->h_val, noise_sp->lacunarity,
291  noise_sp->octaves);
292 
293  if (rescale) RESCALE_NOISE(v_val);
294 
295  /* construct normal rotation about U and V vectors based upon
296  * variation in surface in each direction. Apply the result to
297  * the surface normal.
298  */
299  bn_mat_arb_rot(u_mat, pt, u_vec, (val - v_val) * noise_sp->max_angle);
300  MAT4X3VEC(tmp, u_mat, N);
301 
302  bn_mat_arb_rot(v_mat, pt, v_vec, (val - u_val) * noise_sp->max_angle);
303 
304  MAT4X3VEC(N, v_mat, tmp);
305 
306  if (rdebug&RDEBUG_SHADE) {
307  VPRINT("old normal", swp->sw_hit.hit_normal);
308  }
309 
310  MAT4X3VEC(swp->sw_hit.hit_normal, noise_sp->sh_to_m, N);
311  VUNITIZE(swp->sw_hit.hit_normal);
312  if (rdebug&RDEBUG_SHADE) {
313  VPRINT("new normal", swp->sw_hit.hit_normal);
314  }
315 }
316 
317 
318 /*
319  * This is called (from viewshade() in shade.c) once for each hit point
320  * to be shaded. The purpose here is to fill in values in the shadework
321  * structure.
322  */
323 int
324 fractal_render(struct application *ap, const struct partition *pp, struct shadework *swp, void *dp)
325 /* defined in material.h */
326 /* ptr to the shader-specific struct */
327 {
328  register struct noise_specific *noise_sp =
329  (struct noise_specific *)dp;
330  point_t pt;
331  double val;
332 
333  /* check the validity of the arguments we got */
334  RT_AP_CHECK(ap);
335  RT_CHECK_PT(pp);
336  CK_noise_SP(noise_sp);
337 
338  if (rdebug&RDEBUG_SHADE)
339  bu_struct_print("noise_render Parameters:", noise_print_tab, (char *)noise_sp);
340 
341  /* If we are performing the shading in "region" space, we must
342  * transform the hit point from "model" space to "region" space.
343  * See the call to db_region_mat in noise_setup().
344  */
345  MAT4X3PNT(pt, noise_sp->m_to_sh, swp->sw_hit.hit_point);
346 
347  if (rdebug&RDEBUG_SHADE) {
348  bu_log("%s:%d noise_render(%s) model:(%g %g %g) shader:(%g %g %g)\n",
349  __FILE__, __LINE__,
350  noise_mfuncs[noise_sp->shader_number].mf_name,
351  V3ARGS(swp->sw_hit.hit_point),
352  V3ARGS(pt));
353  }
354 
355  switch (noise_sp->shader_number) {
356  case 0: /* gravel */
357  case 6: /* turcombo */
358  val = bn_noise_turb(pt, noise_sp->h_val,
359  noise_sp->lacunarity, noise_sp->octaves);
360  if (val < noise_sp->minval) val = noise_sp->minval;
361 #ifdef RT_MULTISPECTRAL
362  swp->sw_temperature *= val;
363 #else
364  VSCALE(swp->sw_color, swp->sw_color, val);
365 #endif
366  norm_noise(pt, val, noise_sp, bn_noise_turb, swp, 0);
367  break;
368  case 1: /* fbmbump */
369  val = bn_noise_fbm(pt, noise_sp->h_val,
370  noise_sp->lacunarity, noise_sp->octaves);
371  RESCALE_NOISE(val);
372  norm_noise(pt, val, noise_sp, bn_noise_fbm, swp, 1);
373  break;
374  case 2: /* turbump */
375  val = bn_noise_turb(pt, noise_sp->h_val,
376  noise_sp->lacunarity, noise_sp->octaves);
377 
378  norm_noise(pt, val, noise_sp, bn_noise_turb, swp, 0);
379  break;
380  case 3: /* fbmcolor */
381  val = bn_noise_fbm(pt, noise_sp->h_val,
382  noise_sp->lacunarity, noise_sp->octaves);
383  RESCALE_NOISE(val);
384  if (val < noise_sp->minval) val = noise_sp->minval;
385 #ifdef RT_MULTISPECTRAL
386  swp->sw_temperature *= val;
387 #else
388  VSCALE(swp->sw_color, swp->sw_color, val);
389 #endif
390  break;
391  case 4: /* turcolor */
392  val = bn_noise_turb(pt, noise_sp->h_val,
393  noise_sp->lacunarity, noise_sp->octaves);
394  if (val < noise_sp->minval) val = noise_sp->minval;
395 #ifdef RT_MULTISPECTRAL
396  swp->sw_temperature *= val;
397 #else
398  VSCALE(swp->sw_color, swp->sw_color, val);
399 #endif
400  break;
401  case 5: /* grunge */
402  case 7: /* fbmcombo */
403  val = bn_noise_fbm(pt, noise_sp->h_val,
404  noise_sp->lacunarity, noise_sp->octaves);
405  RESCALE_NOISE(val);
406  if (val < noise_sp->minval) val = noise_sp->minval;
407 #ifdef RT_MULTISPECTRAL
408  swp->sw_temperature *= val;
409 #else
410  VSCALE(swp->sw_color, swp->sw_color, val);
411 #endif
412  norm_noise(pt, val, noise_sp, bn_noise_fbm, swp, 1);
413  break;
414 
415  case 8: /* flash */
416  val = bn_noise_fbm(pt, noise_sp->h_val,
417  noise_sp->lacunarity, noise_sp->octaves);
418 
419  val = 1.0 - val;
420  if (val < noise_sp->minval) val = noise_sp->minval;
421 
422 #ifdef RT_MULTISPECTRAL
423  swp->sw_temperature *= val;
424 #else
425  VSCALE(swp->sw_color, swp->sw_color, val);
426 #endif
427  swp->sw_temperature = val * 2000.0;
428  break;
429  }
430 
431 
432  /* shader must perform transmission/reflection calculations
433  *
434  * 0 < swp->sw_transmit <= 1 causes transmission computations
435  * 0 < swp->sw_reflect <= 1 causes reflection computations
436  */
437  if (swp->sw_reflect > 0 || swp->sw_transmit > 0)
438  (void)rr_render(ap, pp, swp);
439 
440  return 1;
441 }
442 
443 /* The "mfuncs" structure defines the external interface to the shader.
444  * Note that more than one shader "name" can be associated with a given
445  * shader by defining more than one mfuncs struct in this array.
446  * See sh_phong.c for an example of building more than one shader "name"
447  * from a set of source functions. There you will find that "glass" "mirror"
448  * and "plastic" are all names for the same shader with different default
449  * values for the parameters.
450  *
451  * WARNING: The order of this table is critical for these shaders.
452  */
453 struct mfuncs noise_mfuncs[] = {
454  {MF_MAGIC, "gravel", 0, MFI_NORMAL|MFI_HIT|MFI_UV, 0, noise_setup, fractal_render, noise_print, noise_free },
455  {MF_MAGIC, "fbmbump", 0, MFI_NORMAL|MFI_HIT|MFI_UV, 0, noise_setup, fractal_render, noise_print, noise_free },
456  {MF_MAGIC, "turbump", 0, MFI_NORMAL|MFI_HIT|MFI_UV, 0, noise_setup, fractal_render, noise_print, noise_free },
457  {MF_MAGIC, "fbmcolor", 0, MFI_NORMAL|MFI_HIT|MFI_UV, 0, noise_setup, fractal_render, noise_print, noise_free },
458  {MF_MAGIC, "turcolor", 0, MFI_NORMAL|MFI_HIT|MFI_UV, 0, noise_setup, fractal_render, noise_print, noise_free },
459  {MF_MAGIC, "grunge", 0, MFI_NORMAL|MFI_HIT|MFI_UV, 0, noise_setup, fractal_render, noise_print, noise_free },
460  {MF_MAGIC, "turcombo", 0, MFI_NORMAL|MFI_HIT|MFI_UV, 0, noise_setup, fractal_render, noise_print, noise_free },
461  {MF_MAGIC, "fbmcombo", 0, MFI_NORMAL|MFI_HIT|MFI_UV, 0, noise_setup, fractal_render, noise_print, noise_free },
462  {MF_MAGIC, "flash", 0, MFI_NORMAL|MFI_HIT|MFI_UV, 0, noise_setup, fractal_render, noise_print, noise_free },
463  { 0, NULL, 0, 0, 0, 0, 0, 0, 0 }
464 };
465 
466 
467 /*
468  * Local Variables:
469  * mode: C
470  * tab-width: 8
471  * indent-tabs-mode: t
472  * c-file-style: "stroustrup"
473  * End:
474  * ex: shiftwidth=4 tabstop=8
475  */
uint32_t magic
Definition: sh_noise.c:71
struct bu_structparse noise_print_tab[]
Definition: sh_noise.c:116
Definition: db_flip.c:35
int fractal_render(struct application *ap, const struct partition *pp, struct shadework *swp, void *dp)
Definition: sh_noise.c:324
void bu_log(const char *,...) _BU_ATTR_PRINTF12
Definition: log.c:176
#define bu_byteoffset(_i)
Definition: parse.h:81
#define MF_MAGIC
Definition: magic.h:205
struct bu_structparse noise_parse_tab[]
Definition: sh_noise.c:129
Definition: clone.c:90
#define noise_MAGIC
Definition: sh_noise.c:45
#define N
Definition: randmt.c:39
double bn_noise_turb(point_t point, double h_val, double lacunarity, double octaves)
Procedural turbulence evaluated at "point";.
double max_delta
Definition: sh_noise.c:81
double size
Definition: sh_noise.c:75
int shader_number
Definition: sh_noise.c:84
Header file for the BRL-CAD common definitions.
const char * reg_name
Identifying string.
Definition: raytrace.h:539
void bu_mm_cvt(const struct bu_structparse *sdp, const char *name, void *base, const char *value, void *data)
Definition: units.c:386
#define RT_CK_REGION(_p)
Definition: raytrace.h:559
#define HIDDEN
Definition: common.h:86
void bu_struct_print(const char *title, const struct bu_structparse *parsetab, const char *base)
Definition: parse.c:1221
void noise_deg_to_rad(const struct bu_structparse *sdp, const char *name, void *base, const char *value, void *data)
Definition: sh_noise.c:49
void bn_mat_mul2(const mat_t i, mat_t o)
#define RT_AP_CHECK(_ap)
Definition: raytrace.h:1685
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
void bn_mat_print(const char *title, const mat_t m)
Definition: mat.c:81
mat_t m_to_sh
Definition: sh_noise.c:79
double minval
Definition: sh_noise.c:83
#define RT_CHECK_RTI(_p)
Definition: raytrace.h:1832
double max_angle
Definition: sh_noise.c:76
double octaves
Definition: sh_noise.c:74
void bn_mat_inv(mat_t output, const mat_t input)
#define V3ARGS(a)
Definition: color.c:56
#define BU_GET(_ptr, _type)
Definition: malloc.h:201
char * ma_shader
shader name & parms
Definition: raytrace.h:527
#define UNUSED(parameter)
Definition: common.h:239
#define RESCALE_NOISE(n)
Definition: sh_noise.c:248
#define BU_PUT(_ptr, _type)
Definition: malloc.h:215
void bn_mat_mul(mat_t o, const mat_t a, const mat_t b)
size_t sp_offset
Definition: parse.h:141
char * bu_vls_addr(const struct bu_vls *vp)
Definition: vls.c:111
#define CK_noise_SP(_p)
Definition: sh_noise.c:46
mat_t sh_to_m
Definition: sh_noise.c:80
#define BU_STRUCTPARSE_FUNC_NULL
Definition: parse.h:153
vect_t delta
Definition: sh_noise.c:78
int db_region_mat(mat_t m, struct db_i *dbip, const char *name, struct resource *resp)
Definition: db_tree.c:2269
struct mater_info reg_mater
Real material information.
Definition: raytrace.h:546
#define SHDR_O(m)
Definition: sh_noise.c:109
struct mfuncs noise_mfuncs[]
Definition: sh_noise.c:453
#define RDEBUG_SHADE
Definition: optical.h:130
struct db_i * rti_dbip
prt to Database instance struct
Definition: raytrace.h:1774
double nsd
Definition: sh_noise.c:82
int bu_struct_parse(const struct bu_vls *in_vls, const struct bu_structparse *desc, const char *base, void *data)
Definition: parse.c:878
point_t vscale
Definition: sh_noise.c:77
double bn_noise_fbm(point_t point, double h_val, double lacunarity, double octaves)
Procedural fBm evaluated at "point"; returns value stored in "value".
void bn_vec_perp(vect_t new_vec, const vect_t old_vec)
Definition: mat.c:616
int rr_render(struct application *app, const struct partition *pp, struct shadework *swp)
HIDDEN int noise_setup(register struct region *rp, struct bu_vls *matparm, void **dpp, const struct mfuncs *mfp, struct rt_i *rtip)
Definition: sh_noise.c:157
#define RT_CHECK_PT(_p)
compat
Definition: raytrace.h:588
double lacunarity
Definition: sh_noise.c:72
Definition: vls.h:56
double h_val
Definition: sh_noise.c:73
HIDDEN const point_t delta
Definition: sh_prj.c:618
double fastf_t
Definition: defines.h:300
#define VPRINT(a, b)
Definition: raytrace.h:1881
Header file for the BRL-CAD Optical Library, LIBOPTICAL.
HIDDEN void noise_free(void *cp)
Definition: sh_noise.c:244
HIDDEN void noise_print(register struct region *rp, void *dp)
Definition: sh_noise.c:237
int rdebug
Definition: init.c:39
void bn_mat_arb_rot(mat_t m, const point_t pt, const vect_t dir, const fastf_t ang)
Definition: mat.c:987
#define BU_STR_EQUAL(s1, s2)
Definition: str.h:126