BRL-CAD
sh_gauss.c
Go to the documentation of this file.
1 /* S H _ G A U S S . 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_gauss.c
21  *
22  * To add a new shader to the "rt" program:
23  *
24  * 1) Copy this file to sh_shadername.c
25  * 2) edit sh_shadername.c:
26  * change "G A U S S" to "S H A D E R N A M E"
27  * change "gauss" to "shadername"
28  * Set a new number for the gauss_MAGIC define
29  * define shader specific structure and defaults
30  * edit/build parse table for bu_structparse from gauss_parse
31  * edit/build shader_mfuncs tables from gauss_mfuncs for
32  * each shader name being built.
33  * edit the gauss_setup function to do shader-specific setup
34  * edit the gauss_render function to do the actual rendering
35  * 3) Edit view.c to add extern for gauss_mfuncs and call to mlib_add
36  * to function view_init()
37  * 4) Edit CMakeLists.txt to add shader file to the compilation
38  * 5) replace this list with a description of the shader, its parameters
39  * and use.
40  *
41  */
42 
43 #include "common.h"
44 
45 #include <stddef.h>
46 #include <stdio.h>
47 #include <string.h>
48 #include <math.h>
49 
50 #include "vmath.h"
51 #include "raytrace.h"
52 #include "rtgeom.h"
53 #include "optical.h"
54 
55 
56 /* The internal representation of the solids must be stored so that we
57  * can access their parameters at shading time. This is done with
58  * a list of "struct reg_db_internals". Each struct holds the
59  * representation of one of the solids which make up the region.
60  */
61 #define DBINT_MAGIC 0xDECCA
63  struct bu_list l;
64  struct rt_db_internal ip; /* internal rep from rtgeom.h */
65  struct soltab *st_p;
66  vect_t one_sigma;
67  mat_t ell2model; /* maps ellipse coord to model coord */
68  mat_t model2ell; /* maps model coord to ellipse coord */
69 };
70 #define DBINT_MAGIC 0xDECCA
71 #define CK_DBINT(_p) BU_CKMAG(_p, DBINT_MAGIC, "struct reg_db_internals")
72 
73 struct tree_bark {
74  struct db_i *dbip;
75  struct bu_list *l; /* lists solids in region (built in setup) */
76  const char *name;
77  struct gauss_specific *gs;
78 };
79 
80 
81 #define gauss_MAGIC 0x6a05 /* make this a unique number for each shader */
82 #define CK_gauss_SP(_p) BU_CKMAG(_p, gauss_MAGIC, "gauss_specific")
83 
84 /*
85  * the shader specific structure contains all variables which are unique
86  * to any particular use of the shader.
87  */
89  uint32_t magic; /* magic # for memory validity check, must come 1st */
90  double gauss_sigma; /* # std dev represented by ell bounds */
91  point_t gauss_min;
92  point_t gauss_max;
93  mat_t gauss_m_to_sh; /* model to shader space matrix */
94  struct bu_list dbil;
95 };
96 
97 
98 /* The default values for the variables in the shader specific structure */
99 static const
100 struct gauss_specific gauss_defaults = {
101  gauss_MAGIC,
102  4.0,
103  VINIT_ZERO, /* min */
104  VINIT_ZERO, /* max */
105  MAT_INIT_ZERO, /* gauss_m_to_sh */
106  {0, NULL, NULL}
107 };
108 
109 
110 #define SHDR_NULL ((struct gauss_specific *)0)
111 #define SHDR_O(m) bu_offsetof(struct gauss_specific, m)
112 
113 /* description of how to parse/print the arguments to the shader
114  * There is at least one line here for each variable in the shader specific
115  * structure above
116  */
118  {"%g", 1, "sigma", SHDR_O(gauss_sigma), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
119  {"", 0, (char *)0, 0, BU_STRUCTPARSE_FUNC_NULL, NULL, NULL }
120 
121 };
123  {"%p", 1, "gauss_print_tab", bu_byteoffset(gauss_print_tab[0]), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
124  {"%g", 1, "s", SHDR_O(gauss_sigma), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
125  {"", 0, (char *)0, 0, BU_STRUCTPARSE_FUNC_NULL, NULL, NULL }
126 };
127 
128 
129 HIDDEN int gauss_setup(register struct region *rp, struct bu_vls *matparm, void **dpp, const struct mfuncs *mfp, struct rt_i *rtip);
130 HIDDEN int gauss_render(struct application *ap, const struct partition *pp, struct shadework *swp, void *dp);
131 HIDDEN void gauss_print(register struct region *rp, void *dp);
132 HIDDEN void gauss_free(void *cp);
133 
134 /* The "mfuncs" structure defines the external interface to the shader.
135  * Note that more than one shader "name" can be associated with a given
136  * shader by defining more than one mfuncs struct in this array.
137  * See sh_phong.c for an example of building more than one shader "name"
138  * from a set of source functions. There you will find that "glass" "mirror"
139  * and "plastic" are all names for the same shader with different default
140  * values for the parameters.
141  */
142 struct mfuncs gauss_mfuncs[] = {
143  {MF_MAGIC, "gauss", 0, MFI_NORMAL|MFI_HIT|MFI_UV, 0,
144  gauss_setup, gauss_render, gauss_print, gauss_free },
145 
146  {0, (char *)0, 0, 0, 0,
147  0, 0, 0, 0 }
148 };
149 
150 
151 static void
152 tree_solids(union tree *tp, struct tree_bark *tb, int op, struct resource *resp)
153 {
154  RT_CK_TREE(tp);
155 
156  switch (tp->tr_op) {
157  case OP_NOP:
158  return;
159 
160  case OP_SOLID: {
161  struct reg_db_internals *dbint;
162  matp_t mp;
163  long sol_id = 0;
164  struct rt_ell_internal *ell_p;
165  vect_t v;
166  int ret;
167 
168  BU_ALLOC(dbint, struct reg_db_internals);
169  BU_LIST_INIT_MAGIC(&(dbint->l), DBINT_MAGIC);
170 
171  if (tp->tr_a.tu_stp->st_matp)
172  mp = tp->tr_a.tu_stp->st_matp;
173  else
174  mp = (matp_t)bn_mat_identity;
175 
176  /* Get the internal form of this solid & add it to the list */
177  ret = rt_db_get_internal(&dbint->ip, tp->tr_a.tu_stp->st_dp, tb->dbip, mp, resp);
178  if (ret < 0) {
179  bu_log("Failure reading %s object from database.\n", OBJ[sol_id].ft_name);
180  return;
181  }
182 
183  RT_CK_DB_INTERNAL(&dbint->ip);
184  dbint->st_p = tp->tr_a.tu_stp;
185 
186  sol_id = dbint->ip.idb_type;
187 
188  if (sol_id < 0) {
189  bu_log("Primitive ID %ld out of bounds\n", sol_id);
190  bu_bomb("");
191  }
192 
193 
194  if (sol_id != ID_ELL) {
195 
196  if (op == OP_UNION)
197  bu_log("Non-ellipse \"union\" primitive of \"%s\" being ignored\n",
198  tb->name);
199 
200  if (rdebug&RDEBUG_SHADE)
201  bu_log(" got a primitive type %ld \"%s\". This primitive ain't no ellipse bucko!\n",
202  sol_id, OBJ[sol_id].ft_name);
203 
204  break;
205  }
206 
207 
208  ell_p = (struct rt_ell_internal *)dbint->ip.idb_ptr;
209 
211  bu_log(" got a primitive type %ld \"%s\"\n",
212  sol_id,
213  OBJ[sol_id].ft_name);
214 
215  RT_ELL_CK_MAGIC(ell_p);
216 
217  if (rdebug&RDEBUG_SHADE) {
218  VPRINT("point", ell_p->v);
219  VPRINT("a", ell_p->a);
220  VPRINT("b", ell_p->b);
221  VPRINT("c", ell_p->c);
222  }
223 
224  /* create the matrix that maps the coordinate system defined
225  * by the ellipse into model space, and get inverse for use
226  * in the _render() proc
227  */
228  MAT_IDN(mp);
229  VMOVE(v, ell_p->a); VUNITIZE(v);
230  mp[0] = v[0]; mp[4] = v[1]; mp[8] = v[2];
231 
232  VMOVE(v, ell_p->b); VUNITIZE(v);
233  mp[1] = v[0]; mp[5] = v[1]; mp[9] = v[2];
234 
235  VMOVE(v, ell_p->c); VUNITIZE(v);
236  mp[2] = v[0]; mp[6] = v[1]; mp[10] = v[2];
237 
238  MAT_DELTAS_VEC(mp, ell_p->v);
239 
240  MAT_COPY(dbint->ell2model, mp);
241  bn_mat_inv(dbint->model2ell, mp);
242 
243 
244  /* find scaling of gaussian puff in ellipsoid space */
245  VSET(dbint->one_sigma,
246  MAGNITUDE(ell_p->a) / tb->gs->gauss_sigma,
247  MAGNITUDE(ell_p->b) / tb->gs->gauss_sigma,
248  MAGNITUDE(ell_p->c) / tb->gs->gauss_sigma);
249 
250 
251  if (rdebug&RDEBUG_SHADE) {
252  VPRINT("sigma", dbint->one_sigma);
253  }
254  BU_LIST_APPEND(tb->l, &(dbint->l));
255 
256  break;
257  }
258  case OP_UNION:
259  tree_solids(tp->tr_b.tb_left, tb, tp->tr_op, resp);
260  tree_solids(tp->tr_b.tb_right, tb, tp->tr_op, resp);
261  break;
262 
263  case OP_NOT: bu_log("Warning: 'Not' region operator in %s\n", tb->name);
264  tree_solids(tp->tr_b.tb_left, tb, tp->tr_op, resp);
265  break;
266  case OP_GUARD:bu_log("Warning: 'Guard' region operator in %s\n", tb->name);
267  tree_solids(tp->tr_b.tb_left, tb, tp->tr_op, resp);
268  break;
269  case OP_XNOP:bu_log("Warning: 'XNOP' region operator in %s\n", tb->name);
270  tree_solids(tp->tr_b.tb_left, tb, tp->tr_op, resp);
271  break;
272 
273  case OP_INTERSECT:
274  case OP_SUBTRACT:
275  case OP_XOR:
276  /* XXX this can get us in trouble if 1 solid is subtracted
277  * from less than all the "union" solids of the region.
278  */
279  tree_solids(tp->tr_b.tb_left, tb, tp->tr_op, resp);
280  tree_solids(tp->tr_b.tb_right, tb, tp->tr_op, resp);
281  return;
282 
283  default:
284  bu_bomb("rt_tree_region_assign: bad op\n");
285  }
286 }
287 
288 
289 /*
290  * This routine is called (at prep time)
291  * once for each region which uses this shader.
292  * Any shader-specific initialization should be done here.
293  */
294 HIDDEN int
295 gauss_setup(register struct region *rp, struct bu_vls *matparm, void **dpp, const struct mfuncs *UNUSED(mfp), struct rt_i *rtip)
296 
297 
298 /* pointer to reg_udata in *rp */
299 
300 /* New since 4.4 release */
301 {
302  register struct gauss_specific *gauss_sp;
303  struct tree_bark tb;
304 
305  /* check the arguments */
306  RT_CHECK_RTI(rtip);
307  BU_CK_VLS(matparm);
308  RT_CK_REGION(rp);
309 
310 
311  if (rdebug&RDEBUG_SHADE)
312  bu_log("gauss_setup(%s)\n", rp->reg_name);
313 
314  if (! rtip->useair)
315  bu_bomb("gauss shader used and useair not set\n");
316 
317 
318  /* Get memory for the shader parameters and shader-specific data */
319  BU_GET(gauss_sp, struct gauss_specific);
320  *dpp = gauss_sp;
321 
322  /* initialize the default values for the shader */
323  memcpy(gauss_sp, &gauss_defaults, sizeof(struct gauss_specific));
324 
325  /* parse the user's arguments for this use of the shader. */
326  if (bu_struct_parse(matparm, gauss_parse_tab, (char *)gauss_sp, NULL) < 0)
327  return -1;
328 
329  /* We have to pick up the parameters for the gaussian puff now.
330  * They won't be available later. So what we do is sneak a peak
331  * inside the region, make sure the first item in it is an ellipsoid
332  * solid, and if it is go steal a peek at its balls ... er ... make
333  * that definition/parameters.
334  */
335 
336  BU_LIST_INIT(&gauss_sp->dbil);
337  tb.l = &gauss_sp->dbil;
338 
339  tb.dbip = rtip->rti_dbip;
340  tb.name = rp->reg_name;
341  tb.gs = gauss_sp;
342 
343  tree_solids (rp->reg_treetop, &tb, OP_UNION, &rt_uniresource);
344 
345 
346  /* XXX If this puppy isn't axis-aligned, we should come up with a
347  * matrix to rotate it into alignment. We're going to have to do
348  * computation in the space defined by this ellipsoid.
349  */
350 
351  if (rdebug&RDEBUG_SHADE) {
352  bu_struct_print(" Parameters:", gauss_print_tab, (char *)gauss_sp);
353  bn_mat_print("m_to_sh", gauss_sp->gauss_m_to_sh);
354  }
355 
356  return 1;
357 }
358 
359 
360  HIDDEN void
361 gauss_print(register struct region *rp, void *dp)
362 {
363  bu_struct_print(rp->reg_name, gauss_print_tab, (char *)dp);
364 }
365 
366 
367 HIDDEN void
368 gauss_free(void *cp)
369 {
370  register struct gauss_specific *gauss_sp =
371  (struct gauss_specific *)cp;
372  struct reg_db_internals *p;
373 
374  while (BU_LIST_WHILE(p, reg_db_internals, &gauss_sp->dbil)) {
375  BU_LIST_DEQUEUE(&(p->l));
376  bu_free(p->ip.idb_ptr, "internal ptr");
377  bu_free((void *)p, "gauss reg_db_internals");
378  }
379 
380  BU_PUT(cp, struct gauss_specific);
381 }
382 
383 
384 
385 /*
386  *
387  * Evaluate the 3-D gaussian "puff" function:
388  *
389  * 1.0 / ((2*PI)^(3/2) * sigmaX*sigmaY*sigmaZ)) *
390  * exp(-0.5 * ((x-ux)^2/sigmaX + (y-uy)^2/sigmaY + (z-uz)^2/sigmaZ))
391  *
392  * for a given point "pt" where the center of the puff is at {ux, uy, uz} and
393  * the size of 1 standard deviation is {sigmaX, sigmaY, sigmaZ}
394  */
395 static double
396 gauss_eval(fastf_t *pt, fastf_t *ell_center, fastf_t *sigma)
397 {
398  double term2;
399  point_t p;
400  double val;
401 
402  VSUB2(p, pt, ell_center);
403  p[X] *= p[X];
404  p[Y] *= p[Y];
405  p[Z] *= p[Z];
406 
407  term2 = (p[X]/sigma[X]) + (p[Y]/sigma[Y]) + (p[Z]/sigma[Z]);
408  term2 *= term2;
409 
410  val = exp(-0.5 * term2);
411 
412  if (rdebug&RDEBUG_SHADE)
413  bu_log("pt(%g %g %g) term2:%g val:%g\n",
414  V3ARGS(pt), term2, val);
415 
416  return val;
417 }
418 
419 
420 /*
421  * Given a seg which participates in the partition we are shading evaluate
422  * the transmission on the path
423  */
424 static double
425 eval_seg(struct application *ap, struct reg_db_internals *dbint, struct seg *seg_p)
426 {
427  double span;
428  point_t pt;
429  struct rt_ell_internal *ell_p = (struct rt_ell_internal *)dbint->ip.idb_ptr;
430  double optical_density = 0.0;
431  double step_dist;
432  double dist;
433  int steps;
434 
435 
436  /* XXX Should map the ray into the coordinate system of the ellipsoid
437  * here, so that all computations are done in an axis-aligned system
438  * with the axes being the gaussian dimensions
439  */
440 
441 
442  span = seg_p->seg_out.hit_dist - seg_p->seg_in.hit_dist;
443  steps = (int)(span / 100.0 + 0.5);
444  if (steps < 2) steps = 2;
445 
446  step_dist = span / (double)steps;
447 
448 
449  if (rdebug&RDEBUG_SHADE) {
450  bu_log("Evaluating Segment:\n");
451  bu_log("dist_in:%g dist_out:%g span:%g step_dist:%g steps:%d\n",
452  seg_p->seg_in.hit_dist,
453  seg_p->seg_out.hit_dist,
454  span, step_dist, steps);
455 
456  }
457 
458  for (dist=seg_p->seg_in.hit_dist; dist < seg_p->seg_out.hit_dist; dist += step_dist) {
459  VJOIN1(pt, ap->a_ray.r_pt, dist, ap->a_ray.r_dir);
460  optical_density += gauss_eval(pt, ell_p->v, dbint->one_sigma);
461  }
462 
463  return optical_density;
464 }
465 
466 
467 /*
468  * This is called (from viewshade() in shade.c) once for each hit point
469  * to be shaded. The purpose here is to fill in values in the shadework
470  * structure.
471  */
472 int
473 gauss_render(struct application *ap, const struct partition *pp, struct shadework *swp, void *dp)
474 
475 
476 /* defined in material.h */
477 /* ptr to the shader-specific struct */
478 {
479  register struct gauss_specific *gauss_sp =
480  (struct gauss_specific *)dp;
481  struct seg *seg_p;
482  struct reg_db_internals *dbint_p;
483  double optical_density = 0.0;
484 
485  /* check the validity of the arguments we got */
486  RT_AP_CHECK(ap);
487  RT_CHECK_PT(pp);
488  CK_gauss_SP(gauss_sp);
489 
490  if (rdebug&RDEBUG_SHADE) {
491  bu_struct_print("gauss_render Parameters:", gauss_print_tab, (char *)gauss_sp);
492 
493  bu_log("r_pt(%g %g %g) r_dir(%g %g %g)\n",
494  V3ARGS(ap->a_ray.r_pt),
495  V3ARGS(ap->a_ray.r_dir));
496  }
497 
498  BU_CK_LIST_HEAD(&swp->sw_segs->l);
499  BU_CK_LIST_HEAD(&gauss_sp->dbil);
500 
501 
502  /* look at each segment that participated in the ray partition(s) */
503  for (BU_LIST_FOR(seg_p, seg, &swp->sw_segs->l)) {
504 
505  if (rdebug&RDEBUG_SHADE) {
506  bu_log("seg %g -> %g\n",
507  seg_p->seg_in.hit_dist,
508  seg_p->seg_out.hit_dist);
509  }
510  RT_CK_SEG(seg_p);
511  RT_CK_SOLTAB(seg_p->seg_stp);
512 
513  /* check to see if the seg/solid is in this partition */
514  if (bu_ptbl_locate(&pp->pt_seglist, (long *)seg_p) != -1) {
515 
516  /* XXX You might use a bu_ptbl list of the solid pointers... */
517  /* check to see if the solid is from this region */
518  for (BU_LIST_FOR(dbint_p, reg_db_internals,
519  &gauss_sp->dbil)) {
520 
521  CK_DBINT(dbint_p);
522 
523  if (dbint_p->st_p == seg_p->seg_stp) {
524  /* The solid from the region is
525  * the solid from the segment
526  * from the partition
527  */
528  optical_density +=
529  eval_seg(ap, dbint_p, seg_p);
530  break;
531  }
532  }
533  } else {
534  if (rdebug&RDEBUG_SHADE)
535  bu_log("gauss_render() bittest failed\n");
536  }
537  }
538 
539 
540  if (rdebug&RDEBUG_SHADE)
541  bu_log("Optical Density %g\n", optical_density);
542 
543  /* get the path length right */
544 /* if (pp->pt_inhit->hit_dist < 0.0)
545  partition_dist = pp->pt_outhit->hit_dist;
546  else
547  partition_dist = (pp->pt_outhit->hit_dist - pp->pt_inhit->hit_dist);
548 
549  tau = optical_density * partition_dist;
550  swp->sw_transmit = exp(-tau); */
551 
552  swp->sw_transmit = 1.0 - optical_density;
553 
554 /* VMOVE(swp->sw_color, pt);*/
555 
556  /* shader must perform transmission/reflection calculations
557  *
558  * 0 < swp->sw_transmit <= 1 causes transmission computations
559  * 0 < swp->sw_reflect <= 1 causes reflection computations
560  */
561  if (swp->sw_reflect > 0 || swp->sw_transmit > 0)
562  (void)rr_render(ap, pp, swp);
563 
564  return 1;
565 }
566 
567 
568 /*
569  * Local Variables:
570  * mode: C
571  * tab-width: 8
572  * indent-tabs-mode: t
573  * c-file-style: "stroustrup"
574  * End:
575  * ex: shiftwidth=4 tabstop=8
576  */
Definition: db_flip.c:35
struct xray a_ray
Actual ray to be shot.
Definition: raytrace.h:1583
#define BU_LIST_FOR(p, structure, hp)
Definition: list.h:365
Definition: raytrace.h:800
void bu_log(const char *,...) _BU_ATTR_PRINTF12
Definition: log.c:176
int rt_db_get_internal(struct rt_db_internal *ip, const struct directory *dp, const struct db_i *dbip, const mat_t mat, struct resource *resp)
Definition: dir.c:76
#define bu_byteoffset(_i)
Definition: parse.h:81
struct hit seg_in
IN information.
Definition: raytrace.h:370
struct rt_db_internal ip
Definition: sh_gauss.c:64
Definition: list.h:118
const struct directory * st_dp
Directory entry of solid.
Definition: raytrace.h:436
#define CK_gauss_SP(_p)
Definition: sh_gauss.c:82
#define MF_MAGIC
Definition: magic.h:205
HIDDEN void gauss_print(register struct region *rp, void *dp)
Definition: sh_gauss.c:361
#define OP_NOP
Leaf with no effect.
Definition: raytrace.h:1132
const mat_t bn_mat_identity
Matrix and vector functionality.
Definition: mat.c:46
struct soltab * seg_stp
pointer back to soltab
Definition: raytrace.h:372
int useair
1="air" regions are retained while prepping
Definition: raytrace.h:1756
#define VSET(a, b, c, d)
Definition: color.c:53
#define OP_XOR
Binary: L xor R, not both.
Definition: raytrace.h:1130
mat_t ell2model
Definition: sh_gauss.c:67
#define RT_CK_SEG(_p)
Definition: raytrace.h:377
vect_t one_sigma
Definition: sh_gauss.c:66
Definition: raytrace.h:368
#define CK_DBINT(_p)
Definition: sh_gauss.c:71
struct bu_structparse gauss_parse_tab[]
Definition: sh_gauss.c:122
Header file for the BRL-CAD common definitions.
#define OP_XNOP
Unary: L, mark region.
Definition: raytrace.h:1136
matp_t st_matp
solid coords to model space, NULL=identity
Definition: raytrace.h:441
const char * reg_name
Identifying string.
Definition: raytrace.h:539
#define BU_LIST_APPEND(old, new)
Definition: list.h:197
#define gauss_MAGIC
Definition: sh_gauss.c:81
#define RT_CK_REGION(_p)
Definition: raytrace.h:559
#define HIDDEN
Definition: common.h:86
union tree * tb_left
Definition: raytrace.h:1149
struct bu_list l
Definition: raytrace.h:369
struct soltab * tu_stp
Definition: raytrace.h:1156
void bu_struct_print(const char *title, const struct bu_structparse *parsetab, const char *base)
Definition: parse.c:1221
struct gauss_specific * gs
Definition: sh_gauss.c:77
struct bu_list * l
Definition: sh_gauss.c:75
if(share_geom)
Definition: nmg_mod.c:3829
#define RT_AP_CHECK(_ap)
Definition: raytrace.h:1685
#define OP_SUBTRACT
Binary: L subtract R.
Definition: raytrace.h:1129
Definition: color.c:49
struct bu_ptbl pt_seglist
all segs in this partition
Definition: raytrace.h:584
#define BU_CK_VLS(_vp)
Definition: vls.h:69
struct resource rt_uniresource
default. Defined in librt/globals.c
Definition: globals.c:41
#define OP_INTERSECT
Binary: L intersect R.
Definition: raytrace.h:1128
mat_t model2ell
Definition: sh_gauss.c:68
void bn_mat_print(const char *title, const mat_t m)
Definition: mat.c:81
#define RT_CK_DB_INTERNAL(_p)
Definition: raytrace.h:207
#define BU_ALLOC(_ptr, _type)
Definition: malloc.h:223
#define RT_CHECK_RTI(_p)
Definition: raytrace.h:1832
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
#define DBINT_MAGIC
Definition: sh_gauss.c:70
#define BU_LIST_INIT_MAGIC(_hp, _magic)
Definition: list.h:156
struct hit seg_out
OUT information.
Definition: raytrace.h:371
struct tree::tree_node tr_b
#define UNUSED(parameter)
Definition: common.h:239
#define OP_GUARD
Unary: not L, or else!
Definition: raytrace.h:1135
point_t gauss_max
Definition: sh_gauss.c:92
#define BU_PUT(_ptr, _type)
Definition: malloc.h:215
#define BU_LIST_WHILE(p, structure, hp)
Definition: list.h:410
HIDDEN int gauss_setup(register struct region *rp, struct bu_vls *matparm, void **dpp, const struct mfuncs *mfp, struct rt_i *rtip)
Definition: sh_gauss.c:295
#define BU_STRUCTPARSE_FUNC_NULL
Definition: parse.h:153
vect_t r_dir
Direction of ray (UNIT Length)
Definition: raytrace.h:219
int bu_ptbl_locate(const struct bu_ptbl *b, const long *p)
uint32_t magic
Definition: sh_gauss.c:89
union tree * tb_right
Definition: raytrace.h:1150
struct mfuncs gauss_mfuncs[]
Definition: sh_gauss.c:142
#define BU_LIST_INIT(_hp)
Definition: list.h:148
void * idb_ptr
Definition: raytrace.h:195
point_t r_pt
Point at which ray starts.
Definition: raytrace.h:218
struct bu_list l
Definition: sh_gauss.c:63
const char * name
Definition: sh_gauss.c:76
const struct rt_functab OBJ[]
Definition: table.c:159
#define RDEBUG_SHADE
Definition: optical.h:130
HIDDEN void gauss_free(void *cp)
Definition: sh_gauss.c:368
struct db_i * rti_dbip
prt to Database instance struct
Definition: raytrace.h:1774
struct db_i * dbip
Definition: sh_gauss.c:74
int bu_struct_parse(const struct bu_vls *in_vls, const struct bu_structparse *desc, const char *base, void *data)
Definition: parse.c:878
HIDDEN int gauss_render(struct application *ap, const struct partition *pp, struct shadework *swp, void *dp)
Definition: sh_gauss.c:473
#define RT_CK_SOLTAB(_p)
Definition: raytrace.h:453
double gauss_sigma
Definition: sh_gauss.c:90
#define SHDR_O(m)
Definition: sh_gauss.c:111
union tree * reg_treetop
Pointer to boolean tree.
Definition: raytrace.h:540
struct bu_list dbil
Definition: sh_gauss.c:94
Definition: color.c:51
void bu_free(void *ptr, const char *str)
Definition: malloc.c:328
#define BU_CK_LIST_HEAD(_p)
Definition: list.h:142
#define RT_CK_TREE(_p)
Definition: raytrace.h:1182
point_t gauss_min
Definition: sh_gauss.c:91
int rr_render(struct application *app, const struct partition *pp, struct shadework *swp)
#define OP_SOLID
Leaf: tr_stp -> solid.
Definition: raytrace.h:1126
mat_t gauss_m_to_sh
Definition: sh_gauss.c:93
#define BU_LIST_DEQUEUE(cur)
Definition: list.h:209
struct bu_structparse gauss_print_tab[]
Definition: sh_gauss.c:117
#define RT_CHECK_PT(_p)
compat
Definition: raytrace.h:588
fastf_t hit_dist
dist from r_pt to hit_point
Definition: raytrace.h:250
Definition: vls.h:56
void bu_bomb(const char *str) _BU_ATTR_NORETURN
Definition: bomb.c:91
double fastf_t
Definition: defines.h:300
#define OP_UNION
Binary: L union R.
Definition: raytrace.h:1127
#define VPRINT(a, b)
Definition: raytrace.h:1881
Header file for the BRL-CAD Optical Library, LIBOPTICAL.
#define ID_ELL
Ellipsoid.
Definition: raytrace.h:461
struct soltab * st_p
Definition: sh_gauss.c:65
#define OP_NOT
Unary: not L.
Definition: raytrace.h:1134
struct tree::tree_leaf tr_a
int rdebug
Definition: init.c:39
Definition: color.c:50