BRL-CAD
sh_cook.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_cook.c:

Go to the source code of this file.

Data Structures

struct  cook_specific
 

Macros

#define CK_NULL   ((struct cook_specific *)0)
 
#define CL_O(m)   bu_offsetof(struct cook_specific, m)
 
#define RI_AIR   1.0 /* Refractive index of air. */
 

Functions

HIDDEN int cook_setup (register struct region *rp, struct bu_vls *matparm, void **dpp, const struct mfuncs *mfp, struct rt_i *rtip)
 
HIDDEN int cmirror_setup (register struct region *rp, struct bu_vls *matparm, void **dpp, const struct mfuncs *mfp, struct rt_i *rtip)
 
HIDDEN int cglass_setup (register struct region *rp, struct bu_vls *matparm, void **dpp, const struct mfuncs *mfp, struct rt_i *rtip)
 
HIDDEN int cook_render (register struct application *ap, const struct partition *pp, struct shadework *swp, void *dp)
 
HIDDEN void cook_print (register struct region *rp, void *dp)
 
HIDDEN void cook_free (void *cp)
 
HIDDEN double fresnel (double c, double n)
 
HIDDEN double beckmann (double a, double m2)
 
double cos4 (double a)
 
double tan2 (double a)
 

Variables

double AmbientIntensity
 
struct bu_structparse cook_parse []
 
struct mfuncs cook_mfuncs []
 

Detailed Description

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

Definition in file sh_cook.c.

Macro Definition Documentation

#define CK_NULL   ((struct cook_specific *)0)

Definition at line 58 of file sh_cook.c.

#define CL_O (   m)    bu_offsetof(struct cook_specific, m)

Definition at line 59 of file sh_cook.c.

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

Definition at line 102 of file sh_cook.c.

Referenced by cook_setup().

Function Documentation

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

Definition at line 153 of file sh_cook.c.

References BU_CK_VLS, BU_GET, bu_struct_parse(), cook_specific::extinction, fresnel(), cook_specific::m, cook_specific::m2, cook_specific::n, cook_specific::rd, cook_specific::reflect, cook_specific::refrac_index, region::reg_transmit, cook_specific::shine, cook_specific::transmit, cook_specific::wgt_diffuse, and cook_specific::wgt_specular.

Here is the call graph for this function:

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

Definition at line 191 of file sh_cook.c.

References BU_CK_VLS, BU_GET, bu_struct_parse(), cook_specific::extinction, fresnel(), cook_specific::m, cook_specific::m2, cook_specific::n, cook_specific::rd, cook_specific::reflect, cook_specific::refrac_index, region::reg_transmit, cook_specific::shine, cook_specific::transmit, cook_specific::wgt_diffuse, and cook_specific::wgt_specular.

Here is the call graph for this function:

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

Definition at line 229 of file sh_cook.c.

References bu_struct_print(), and region::reg_name.

Here is the call graph for this function:

HIDDEN void cook_free ( void *  cp)

Definition at line 236 of file sh_cook.c.

References BU_PUT.

HIDDEN double fresnel ( double  c,
double  n 
)

Definition at line 360 of file sh_cook.c.

Referenced by cglass_setup(), cmirror_setup(), cook_render(), and cook_setup().

HIDDEN double beckmann ( double  a,
double  m2 
)

Definition at line 410 of file sh_cook.c.

References cos4(), and tan2().

Referenced by cook_render().

Here is the call graph for this function:

double cos4 ( double  a)

Definition at line 383 of file sh_cook.c.

Referenced by beckmann().

double tan2 ( double  a)

Definition at line 390 of file sh_cook.c.

Referenced by beckmann().

Variable Documentation

struct bu_structparse cook_parse[]
Initial value:
= {
{"%g", 1, "m", CL_O(m), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
{"%g", 1, "specular", CL_O(wgt_specular), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
{"%g", 1, "sp", CL_O(wgt_specular), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
{"%g", 1, "diffuse", CL_O(wgt_diffuse), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
{"%g", 1, "di", CL_O(wgt_diffuse), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
{"%g", 1, "transmit", CL_O(transmit), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
{"%g", 1, "tr", CL_O(transmit), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
{"%g", 1, "reflect", CL_O(reflect), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
{"%g", 1, "re", CL_O(reflect), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
{"%g", 1, "ri", CL_O(refrac_index), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
{"%g", 1, "extinction", CL_O(extinction), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
{"%g", 1, "ex", CL_O(extinction), 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 CL_O(m)
Definition: sh_cook.c:59

Definition at line 61 of file sh_cook.c.

struct mfuncs cook_mfuncs[]
Initial value:
= {
{MF_MAGIC, "cook", 0, MFI_NORMAL|MFI_LIGHT, 0,
{MF_MAGIC, "cmirror", 0, MFI_NORMAL|MFI_LIGHT, 0,
{MF_MAGIC, "cglass", 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 cmirror_setup(register struct region *rp, struct bu_vls *matparm, void **dpp, const struct mfuncs *mfp, struct rt_i *rtip)
Definition: sh_cook.c:153
HIDDEN int cook_setup(register struct region *rp, struct bu_vls *matparm, void **dpp, const struct mfuncs *mfp, struct rt_i *rtip)
Definition: sh_cook.c:112
HIDDEN int cglass_setup(register struct region *rp, struct bu_vls *matparm, void **dpp, const struct mfuncs *mfp, struct rt_i *rtip)
Definition: sh_cook.c:191
HIDDEN int cook_render(register struct application *ap, const struct partition *pp, struct shadework *swp, void *dp)
Definition: sh_cook.c:254
HIDDEN void cook_print(register struct region *rp, void *dp)
Definition: sh_cook.c:229
HIDDEN void cook_free(void *cp)
Definition: sh_cook.c:236

Definition at line 87 of file sh_cook.c.

Referenced by optical_shader_init().