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

Go to the source code of this file.

Data Structures

struct  brdf_specific
 

Macros

#define BRDF_MAGIC   0xbeef00d
 
#define BRDF_NULL   ((struct brdf_specific *)0)
 
#define BRDF_O(m)   bu_offsetof(struct brdf_specific, m)
 
#define RI_AIR   1.0 /* Refractive index of air. */
 

Functions

HIDDEN int brdf_setup (register struct region *rp, struct bu_vls *matparm, void **dpp, const struct mfuncs *mfp, struct rt_i *rtip)
 
HIDDEN int brdf_render (register struct application *ap, const struct partition *pp, struct shadework *swp, void *dp)
 
HIDDEN void brdf_print (register struct region *rp, void *dp)
 
HIDDEN void brdf_free (void *cp)
 

Variables

double AmbientIntensity
 
struct bu_structparse brdf_parse []
 
struct mfuncs brdf_mfuncs []
 

Detailed Description

Simple Isotropic Gaussian model with just one parameter (RMS slope).

Notes - The normals on all surfaces point OUT of the solid. The incoming light rays point IN.

Implementation is based on the simple Isotropic Gaussian Model presented by Gregory Ward in "Measuring and Modeling Anisotropic Reflection" (Which also references earlier work by Beckmann, Torrance, and Cook).

Definition in file sh_brdf.c.

Macro Definition Documentation

#define BRDF_MAGIC   0xbeef00d

Definition at line 62 of file sh_brdf.c.

Referenced by brdf_render(), and brdf_setup().

#define BRDF_NULL   ((struct brdf_specific *)0)

Definition at line 63 of file sh_brdf.c.

#define BRDF_O (   m)    bu_offsetof(struct brdf_specific, m)

Definition at line 64 of file sh_brdf.c.

#define RI_AIR   1.0 /* Refractive index of air. */

Definition at line 99 of file sh_brdf.c.

Referenced by brdf_setup().

Function Documentation

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

Definition at line 102 of file sh_brdf.c.

References BRDF_MAGIC, BU_CK_VLS, BU_GET, BU_PUT, bu_struct_parse(), brdf_specific::denom, brdf_specific::diffuse_refl, brdf_specific::extinction, M_PI, brdf_specific::magic, brdf_specific::reflect, brdf_specific::refrac_index, RI_AIR, brdf_specific::rms_slope, brdf_specific::rms_sq, brdf_specific::specular_refl, and brdf_specific::transmit.

Here is the call graph for this function:

HIDDEN int brdf_render ( register struct application ap,
const struct partition pp,
struct shadework *  swp,
void *  dp 
)
HIDDEN void brdf_print ( register struct region rp,
void *  dp 
)

Definition at line 130 of file sh_brdf.c.

References bu_struct_print(), and region::reg_name.

Here is the call graph for this function:

HIDDEN void brdf_free ( void *  cp)

Definition at line 137 of file sh_brdf.c.

References BU_PUT.

Variable Documentation

struct bu_structparse brdf_parse[]
Initial value:
= {
{"%g", 1, "specular", BRDF_O(specular_refl), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
{"%g", 1, "sp", BRDF_O(specular_refl), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
{"%g", 1, "diffuse", BRDF_O(diffuse_refl), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
{"%g", 1, "di", BRDF_O(diffuse_refl), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
{"%g", 1, "rough", BRDF_O(rms_slope), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
{"%g", 1, "rms", BRDF_O(rms_slope), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
{"%g", 1, "transmit", BRDF_O(transmit), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
{"%g", 1, "tr", BRDF_O(transmit), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
{"%g", 1, "reflect", BRDF_O(reflect), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
{"%g", 1, "re", BRDF_O(reflect), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
{"%g", 1, "ri", BRDF_O(refrac_index), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
{"%g", 1, "extinction_per_meter", BRDF_O(extinction), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
{"%g", 1, "extinction", BRDF_O(extinction), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
{"%g", 1, "ex", BRDF_O(extinction), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
{"", 0, (char *)0, 0, BU_STRUCTPARSE_FUNC_NULL, NULL, NULL }
}
#define BRDF_O(m)
Definition: sh_brdf.c:64
#define BU_STRUCTPARSE_FUNC_NULL
Definition: parse.h:153

Definition at line 66 of file sh_brdf.c.

struct mfuncs brdf_mfuncs[]
Initial value:
= {
{MF_MAGIC, "brdf", 0, MFI_NORMAL|MFI_LIGHT, 0,
{0, (char *)0, 0, 0, 0,
0, 0, 0, 0 }
}
#define MF_MAGIC
Definition: magic.h:205
HIDDEN int brdf_setup(register struct region *rp, struct bu_vls *matparm, void **dpp, const struct mfuncs *mfp, struct rt_i *rtip)
Definition: sh_brdf.c:102
HIDDEN int brdf_render(register struct application *ap, const struct partition *pp, struct shadework *swp, void *dp)
Definition: sh_brdf.c:185
HIDDEN void brdf_free(void *cp)
Definition: sh_brdf.c:137
HIDDEN void brdf_print(register struct region *rp, void *dp)
Definition: sh_brdf.c:130

Definition at line 90 of file sh_brdf.c.

Referenced by optical_shader_init().