BRL-CAD
sh_gauss.c File Reference
#include "common.h"
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include "vmath.h"
#include "raytrace.h"
#include "rtgeom.h"
#include "optical.h"
Include dependency graph for sh_gauss.c:

Go to the source code of this file.

Data Structures

struct  reg_db_internals
 
struct  tree_bark
 
struct  gauss_specific
 

Macros

#define DBINT_MAGIC   0xDECCA
 
#define DBINT_MAGIC   0xDECCA
 
#define CK_DBINT(_p)   BU_CKMAG(_p, DBINT_MAGIC, "struct reg_db_internals")
 
#define gauss_MAGIC   0x6a05 /* make this a unique number for each shader */
 
#define CK_gauss_SP(_p)   BU_CKMAG(_p, gauss_MAGIC, "gauss_specific")
 
#define SHDR_NULL   ((struct gauss_specific *)0)
 
#define SHDR_O(m)   bu_offsetof(struct gauss_specific, m)
 

Functions

HIDDEN int gauss_setup (register struct region *rp, struct bu_vls *matparm, void **dpp, const struct mfuncs *mfp, struct rt_i *rtip)
 
HIDDEN int gauss_render (struct application *ap, const struct partition *pp, struct shadework *swp, void *dp)
 
HIDDEN void gauss_print (register struct region *rp, void *dp)
 
HIDDEN void gauss_free (void *cp)
 

Variables

struct bu_structparse gauss_print_tab []
 
struct bu_structparse gauss_parse_tab []
 
struct mfuncs gauss_mfuncs []
 

Detailed Description

To add a new shader to the "rt" program:

 1) Copy this file to sh_shadername.c
 2) edit sh_shadername.c:
    change "G A U S S" to "S H A D E R N A M E"
    change "gauss" to "shadername"
    Set a new number for the gauss_MAGIC define
    define shader specific structure and defaults
    edit/build parse table for bu_structparse from gauss_parse
    edit/build shader_mfuncs tables from gauss_mfuncs for
            each shader name being built.
    edit the gauss_setup function to do shader-specific setup
    edit the gauss_render function to do the actual rendering
 3) Edit view.c to add extern for gauss_mfuncs and call to mlib_add
    to function view_init()
 4) Edit CMakeLists.txt to add shader file to the compilation
 5) replace this list with a description of the shader, its parameters
    and use.

Definition in file sh_gauss.c.

Macro Definition Documentation

#define DBINT_MAGIC   0xDECCA

Definition at line 70 of file sh_gauss.c.

#define DBINT_MAGIC   0xDECCA

Definition at line 70 of file sh_gauss.c.

#define CK_DBINT (   _p)    BU_CKMAG(_p, DBINT_MAGIC, "struct reg_db_internals")

Definition at line 71 of file sh_gauss.c.

Referenced by gauss_render().

#define gauss_MAGIC   0x6a05 /* make this a unique number for each shader */

Definition at line 81 of file sh_gauss.c.

#define CK_gauss_SP (   _p)    BU_CKMAG(_p, gauss_MAGIC, "gauss_specific")

Definition at line 82 of file sh_gauss.c.

Referenced by gauss_render().

#define SHDR_NULL   ((struct gauss_specific *)0)

Definition at line 110 of file sh_gauss.c.

#define SHDR_O (   m)    bu_offsetof(struct gauss_specific, m)

Definition at line 111 of file sh_gauss.c.

Function Documentation

HIDDEN int gauss_setup ( register struct region rp,
struct bu_vls matparm,
void **  dpp,
const struct mfuncs *  mfp,
struct rt_i rtip 
)

Definition at line 295 of file sh_gauss.c.

References bn_mat_print(), bu_bomb(), BU_CK_VLS, BU_GET, BU_LIST_INIT, bu_log(), bu_struct_parse(), bu_struct_print(), gauss_specific::dbil, tree_bark::dbip, gauss_specific::gauss_m_to_sh, tree_bark::gs, tree_bark::l, tree_bark::name, OP_UNION, rdebug, RDEBUG_SHADE, region::reg_name, region::reg_treetop, RT_CHECK_RTI, RT_CK_REGION, rt_uniresource, rt_i::rti_dbip, and rt_i::useair.

Here is the call graph for this function:

int gauss_render ( struct application ap,
const struct partition pp,
struct shadework *  swp,
void *  dp 
)

Definition at line 473 of file sh_gauss.c.

References application::a_ray, BU_CK_LIST_HEAD, BU_LIST_FOR, bu_log(), bu_ptbl_locate(), bu_struct_print(), CK_DBINT, CK_gauss_SP, gauss_specific::dbil, hit::hit_dist, seg::l, partition::pt_seglist, xray::r_dir, xray::r_pt, rdebug, rr_render(), RT_AP_CHECK, RT_CHECK_PT, RT_CK_SEG, RT_CK_SOLTAB, seg::seg_in, seg::seg_out, seg::seg_stp, reg_db_internals::st_p, and V3ARGS.

Here is the call graph for this function:

HIDDEN void gauss_print ( register struct region rp,
void *  dp 
)

Definition at line 361 of file sh_gauss.c.

References bu_struct_print(), and region::reg_name.

Here is the call graph for this function:

HIDDEN void gauss_free ( void *  cp)

Definition at line 368 of file sh_gauss.c.

References bu_free(), BU_LIST_DEQUEUE, BU_LIST_WHILE, BU_PUT, gauss_specific::dbil, rt_db_internal::idb_ptr, reg_db_internals::ip, and reg_db_internals::l.

Here is the call graph for this function:

Variable Documentation

struct bu_structparse gauss_print_tab[]
Initial value:
= {
{"%g", 1, "sigma", SHDR_O(gauss_sigma), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
{"", 0, (char *)0, 0, BU_STRUCTPARSE_FUNC_NULL, NULL, NULL }
}
#define BU_STRUCTPARSE_FUNC_NULL
Definition: parse.h:153
#define SHDR_O(m)
Definition: sh_gauss.c:111

Definition at line 117 of file sh_gauss.c.

struct bu_structparse gauss_parse_tab[]
Initial value:
= {
{"%p", 1, "gauss_print_tab", bu_byteoffset(gauss_print_tab[0]), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
{"%g", 1, "s", SHDR_O(gauss_sigma), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
{"", 0, (char *)0, 0, BU_STRUCTPARSE_FUNC_NULL, NULL, NULL }
}
#define bu_byteoffset(_i)
Definition: parse.h:81
#define BU_STRUCTPARSE_FUNC_NULL
Definition: parse.h:153
#define SHDR_O(m)
Definition: sh_gauss.c:111
struct bu_structparse gauss_print_tab[]
Definition: sh_gauss.c:117

Definition at line 122 of file sh_gauss.c.

struct mfuncs gauss_mfuncs[]
Initial value:
= {
{MF_MAGIC, "gauss", 0, MFI_NORMAL|MFI_HIT|MFI_UV, 0,
{0, (char *)0, 0, 0, 0,
0, 0, 0, 0 }
}
#define MF_MAGIC
Definition: magic.h:205
HIDDEN void gauss_print(register struct region *rp, void *dp)
Definition: sh_gauss.c:361
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
HIDDEN void gauss_free(void *cp)
Definition: sh_gauss.c:368
HIDDEN int gauss_render(struct application *ap, const struct partition *pp, struct shadework *swp, void *dp)
Definition: sh_gauss.c:473

Definition at line 142 of file sh_gauss.c.

Referenced by optical_shader_init().