BRL-CAD
liboptical (optical)

Files

file  optical.h
 Header file for the BRL-CAD Optical Library, LIBOPTICAL.
 

Data Structures

struct  floatpixel
 

Macros

#define R_DEBUG   rdebug
 
#define RDEBUG_HITS   0x00000001 /* 1 Print hits used by view() */
 
#define RDEBUG_MATERIAL   0x00000002 /* 2 Material properties */
 
#define RDEBUG_SHOWERR   0x00000004 /* 3 Colorful markers on errors */
 
#define RDEBUG_RTMEM   0x00000008 /* 4 Debug librt mem after startup */
 
#define RDEBUG_SHADE   0x00000010 /* 5 Shading calculation */
 
#define RDEBUG_PARSE   0x00000020 /* 6 Command parsing */
 
#define RDEBUG_LIGHT   0x00000040 /* 7 Debug lighting */
 
#define RDEBUG_REFRACT   0x00000080 /* 8 Debug reflection & refraction */
 
#define RDEBUG_STATS   0x00000200 /* 10 Print more statistics */
 
#define RDEBUG_RTMEM_END   0x00000400 /* 11 Print librt mem use on 'clean' */
 
#define RDEBUG_MISSPLOT   0x20000000 /* 30 plot(5) missed rays to stdout */
 
#define RDEBUG_RAYWRITE   0x40000000 /* 31 Ray(5V) view rays to stdout */
 
#define RDEBUG_RAYPLOT   0x80000000 /* 32 plot(5) rays to stdout */
 
#define RDEBUG_FORMAT   "\020\040RAYPLOT\037RAYWRITE\036MISSPLOT\\013RTMEM_END\\012STATS\010REFRACT\\7LIGHT\6PARSE\5SHADE\4RTMEM\3SHOWERR\2MATERIAL\1HITS"
 
#define VERBOSE_LIBVERSIONS   0x00000001 /* Library version strings */
 
#define VERBOSE_MODELTITLE   0x00000002 /* model title */
 
#define VERBOSE_TOLERANCE   0x00000004 /* model tolerance */
 
#define VERBOSE_STATS   0x00000008 /* stats about rt_gettrees() */
 
#define VERBOSE_FRAMENUMBER   0x00000010 /* current frame number */
 
#define VERBOSE_VIEWDETAIL   0x00000020 /* view specifications */
 
#define VERBOSE_LIGHTINFO   0x00000040 /* scene lights */
 
#define VERBOSE_INCREMENTAL   0x00000080 /* progressive/incremental state */
 
#define VERBOSE_MULTICPU   0x00000100 /* # of CPU's to be used */
 
#define VERBOSE_OUTPUTFILE   0x00000200 /* name of output image */
 
#define VERBOSE_FORMAT   "\012OUTPUTFILE\011MULTICPU\010INCREMENTAL\7LIGHTINFO\6VIEWDETAIL\\5FRAMENUMBER\4STATS\3TOLERANCE\2MODELTITLE\1LIBVERSIONS"
 

Functions

void optical_shader_init (struct mfuncs **headp)
 
int mlib_zero (struct application *, const struct partition *, struct shadework *, void *)
 
int mlib_one (struct region *, struct bu_vls *, void **, const struct mfuncs *, struct rt_i *)
 
void mlib_void (struct region *, void *)
 
int rr_render (struct application *app, const struct partition *pp, struct shadework *swp)
 
void shade_inputs (struct application *app, const struct partition *pp, struct shadework *swp, int want)
 
void wray (struct partition *pp, struct application *app, FILE *fp, const vect_t inormal)
 
void wraypts (vect_t in, vect_t inorm, vect_t out, int id, struct application *app, FILE *fp)
 
void wraypaint (vect_t start, vect_t norm, int paint, struct application *app, FILE *fp)
 
int viewshade (struct application *app, const struct partition *pp, struct shadework *swp)
 
const char * optical_version (void)
 

Variables

struct mfuncs camo_mfuncs []
 
struct mfuncs light_mfuncs []
 
struct mfuncs stk_mfuncs []
 
struct mfuncs phg_mfuncs []
 
struct mfuncs noise_mfuncs []
 
struct bn_tablespectrum
 
int rdebug
 
int rt_verbosity
 
double AmbientIntensity
 
vect_t background
 
struct region env_region
 
int max_bounces
 
int max_ireflect
 

Detailed Description

Macro Definition Documentation

#define R_DEBUG   rdebug
#define RDEBUG_HITS   0x00000001 /* 1 Print hits used by view() */

Definition at line 126 of file optical.h.

#define RDEBUG_MATERIAL   0x00000002 /* 2 Material properties */

Definition at line 127 of file optical.h.

Referenced by sh_stk_dosetup(), and sh_stk_setup().

#define RDEBUG_SHOWERR   0x00000004 /* 3 Colorful markers on errors */

Definition at line 128 of file optical.h.

Referenced by rr_hit(), and rr_render().

#define RDEBUG_RTMEM   0x00000008 /* 4 Debug librt mem after startup */

Definition at line 129 of file optical.h.

#define RDEBUG_PARSE   0x00000020 /* 6 Command parsing */

Definition at line 131 of file optical.h.

#define RDEBUG_LIGHT   0x00000040 /* 7 Debug lighting */
#define RDEBUG_REFRACT   0x00000080 /* 8 Debug reflection & refraction */

Definition at line 133 of file optical.h.

Referenced by rr_hit(), rr_refract(), and rr_render().

#define RDEBUG_STATS   0x00000200 /* 10 Print more statistics */

Definition at line 135 of file optical.h.

#define RDEBUG_RTMEM_END   0x00000400 /* 11 Print librt mem use on 'clean' */

Definition at line 136 of file optical.h.

#define RDEBUG_MISSPLOT   0x20000000 /* 30 plot(5) missed rays to stdout */

Definition at line 139 of file optical.h.

#define RDEBUG_RAYWRITE   0x40000000 /* 31 Ray(5V) view rays to stdout */

Definition at line 140 of file optical.h.

Referenced by rr_render().

#define RDEBUG_RAYPLOT   0x80000000 /* 32 plot(5) rays to stdout */

Definition at line 141 of file optical.h.

Referenced by background_light(), rr_render(), shade_inputs(), and toyota_render().

#define RDEBUG_FORMAT   "\020\040RAYPLOT\037RAYWRITE\036MISSPLOT\\013RTMEM_END\\012STATS\010REFRACT\\7LIGHT\6PARSE\5SHADE\4RTMEM\3SHOWERR\2MATERIAL\1HITS"

Definition at line 144 of file optical.h.

#define VERBOSE_LIBVERSIONS   0x00000001 /* Library version strings */

Definition at line 158 of file optical.h.

#define VERBOSE_MODELTITLE   0x00000002 /* model title */

Definition at line 159 of file optical.h.

#define VERBOSE_TOLERANCE   0x00000004 /* model tolerance */

Definition at line 160 of file optical.h.

#define VERBOSE_STATS   0x00000008 /* stats about rt_gettrees() */

Definition at line 161 of file optical.h.

#define VERBOSE_FRAMENUMBER   0x00000010 /* current frame number */

Definition at line 162 of file optical.h.

#define VERBOSE_VIEWDETAIL   0x00000020 /* view specifications */

Definition at line 163 of file optical.h.

#define VERBOSE_LIGHTINFO   0x00000040 /* scene lights */

Definition at line 164 of file optical.h.

#define VERBOSE_INCREMENTAL   0x00000080 /* progressive/incremental state */

Definition at line 165 of file optical.h.

#define VERBOSE_MULTICPU   0x00000100 /* # of CPU's to be used */

Definition at line 166 of file optical.h.

#define VERBOSE_OUTPUTFILE   0x00000200 /* name of output image */

Definition at line 167 of file optical.h.

#define VERBOSE_FORMAT   "\012OUTPUTFILE\011MULTICPU\010INCREMENTAL\7LIGHTINFO\6VIEWDETAIL\\5FRAMENUMBER\4STATS\3TOLERANCE\2MODELTITLE\1LIBVERSIONS"

Definition at line 169 of file optical.h.

Function Documentation

void optical_shader_init ( struct mfuncs **  headp)

this function sets the provided mfuncs head pointer to the list of available shaders. the provided mfuncs head pointer should point to MF_NULL prior to getting passed to optical_shader_init() so that the same shader list may be returned repeatably.

Definition at line 61 of file init.c.

References air_mfuncs, bbd_mfuncs, brdf_mfuncs, camo_mfuncs, cloud_mfuncs, cook_mfuncs, DMFUNCS, fire_mfuncs, flat_mfuncs, gauss_mfuncs, grass_mfuncs, light_mfuncs, MFUNCS, noise_mfuncs, null_mfuncs, osl_mfuncs, phg_mfuncs, points_mfuncs, prj_mfuncs, rtrans_mfuncs, scloud_mfuncs, spm_mfuncs, stk_mfuncs, stxt_mfuncs, toon_mfuncs, toyota_mfuncs, tthrm_mfuncs, txt_mfuncs, and wood_mfuncs.

Referenced by envmap_setup(), and sh_stk_dosetup().

int mlib_zero ( struct application ,
const struct partition ,
struct shadework *  ,
void *   
)

Definition at line 936 of file sh_text.c.

int mlib_one ( struct region ,
struct bu_vls ,
void **  ,
const struct mfuncs *  ,
struct rt_i  
)

Definition at line 948 of file sh_text.c.

void mlib_void ( struct region ,
void *   
)

Definition at line 956 of file sh_text.c.

void shade_inputs ( struct application ap,
const struct partition pp,
struct shadework *  swp,
int  want 
)

Compute the necessary fields in the shadework structure.

Note that only hit_dist is valid in pp_inhit. Must calculate it if hit_norm is needed, after which pt_inflip must be handled. RT_HIT_UVCOORD() must have hit_point computed in advance.

If MFI_LIGHT is not on, the presumption is that the sw_visible[] array is not needed, or has been handled elsewhere.

Definition at line 118 of file shade.c.

References application::a_ray, application::a_rt_i, application::a_x, application::a_y, BN_VECT_ARE_PERP, bu_log(), BU_SEM_SYSCALL, bu_semaphore_acquire(), bu_semaphore_release(), rt_functab::ft_name, hit::hit_dist, hit::hit_surfno, light_obs(), OBJ, pdv_3line(), pl_color(), partition::pt_inflip, partition::pt_inhit, partition::pt_inseg, R_DEBUG, xray::r_dir, xray::r_pt, RDEBUG_RAYPLOT, RDEBUG_SHADE, RT_CK_RAY, RT_HIT_NORMAL, RT_HIT_UVCOORD, rt_spect_reflectance_rgb(), rt_i::rti_radius, rt_i::rti_tol, seg::seg_stp, soltab::st_id, V3ARGS, VPRINT, VSET, X, Y, and Z.

Referenced by rr_render(), and viewshade().

Here is the call graph for this function:

void wray ( struct partition pp,
struct application app,
FILE *  fp,
const vect_t  inormal 
)

Definition at line 117 of file wray.c.

References bu_bomb(), hit::hit_point, vldray::ob, vldray::ox, vldray::pa, vldray::pc, vldray::pe, partition::pt_inhit, partition::pt_outhit, partition::pt_regionp, region::reg_aircode, region::reg_regionid, vldray::rx, vldray::sc, WRAY_NORMAL, and WRAY_TAG.

Here is the call graph for this function:

void wraypts ( vect_t  in,
vect_t  inorm,
vect_t  out,
int  id,
struct application app,
FILE *  fp 
)

Definition at line 154 of file wray.c.

References bu_log(), vldray::ob, vldray::ox, vldray::pa, vldray::pc, vldray::pe, vldray::rx, vldray::sc, WRAY_NORMAL, and WRAY_TAG.

Referenced by rr_render().

Here is the call graph for this function:

void wraypaint ( vect_t  start,
vect_t  norm,
int  paint,
struct application app,
FILE *  fp 
)

Definition at line 182 of file wray.c.

References bu_log(), vldray::ob, vldray::ox, vldray::pa, vldray::pc, vldray::pe, vldray::rx, vldray::sc, VSETALL, WRAY_NORMAL, and WRAY_TAG.

Here is the call graph for this function:

int viewshade ( struct application ap,
const struct partition pp,
struct shadework *  swp 
)

Call the material-specific shading function, after making certain that all shadework fields desired have been provided.

Returns - 0 on failure 1 on success

But of course, nobody cares what this returns. Everyone calls us as (void)viewshade()

Definition at line 259 of file shade.c.

References application::a_cumlen, application::a_ray, application::a_rt_i, BN_CK_TABDATA, bn_tabdata_copy(), BU_LIST_FOR, bu_log(), bu_printb(), hit::hit_rayp, LightHead, mater_info::ma_color, mater_info::ma_color_valid, pr_shadework(), partition::pt_inhit, partition::pt_regionp, R_DEBUG, xray::r_dir, xray::r_pt, RDEBUG_SHADE, region::reg_mater, region::reg_mfuncs, region::reg_name, region::reg_udata, RT_AP_CHECK, RT_CK_HIT, RT_CK_PT, RT_CK_RAY, RT_CK_REGION, RT_CK_RTI, rt_spect_reflectance_rgb(), and shade_inputs().

Referenced by light_hit().

Here is the call graph for this function:

const char* optical_version ( void  )

returns the compile-time version of liboptical

Definition at line 32 of file vers.c.

Variable Documentation

struct mfuncs camo_mfuncs[]

Definition at line 157 of file sh_camo.c.

Referenced by optical_shader_init().

struct mfuncs light_mfuncs[]

callback registration table for this shader in optical_shader_init()

Definition at line 65 of file sh_light.c.

Referenced by optical_shader_init().

struct mfuncs stk_mfuncs[]

Definition at line 43 of file sh_stack.c.

Referenced by optical_shader_init().

struct mfuncs phg_mfuncs[]

Definition at line 83 of file sh_plastic.c.

Referenced by optical_shader_init().

struct mfuncs noise_mfuncs[]

Definition at line 453 of file sh_noise.c.

Referenced by fractal_render(), noise_setup(), and optical_shader_init().

struct bn_table* spectrum

Definition at line 41 of file init.c.

Referenced by light_hit(), light_maker(), light_setup(), marble_render(), phong_render(), rr_hit(), and rr_render().

int rt_verbosity

Definition at line 38 of file init.c.

double AmbientIntensity

Definition at line 40 of file init.c.

Referenced by light_init().

vect_t background

Definition at line 46 of file init.c.

struct region env_region

Definition at line 50 of file init.c.

Referenced by envmap_setup().

int max_bounces

Definition at line 45 of file refract.c.

Referenced by rr_render().

int max_ireflect

Definition at line 44 of file refract.c.

Referenced by rr_render().