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

Go to the source code of this file.

Data Structures

struct  flat_specific
 

Macros

#define FLAT_MAGIC   0x464c4154 /* magic number is "FLAT" in hex */
 
#define CK_FLAT_SP(_p)   BU_CKMAG(_p, FLAT_MAGIC, "flat_specific")
 
#define SHDR_FLAT   ((struct flat_specific *)0)
 
#define SHDR_O(m)   bu_offsetof(struct flat_specific, m)
 

Functions

HIDDEN int flat_setup (register struct region *rp, struct bu_vls *matparm, void **dpp, const struct mfuncs *mfp, struct rt_i *rtip)
 
HIDDEN int flat_render (struct application *ap, const struct partition *pp, struct shadework *swp, void *dp)
 
HIDDEN void flat_print (register struct region *rp, void *dp)
 
HIDDEN void flat_free (void *cp)
 
void normalizedInput_hook (const struct bu_structparse *, const char *, void *, const char *, void *)
 
void singleNormalizedInput_hook (const struct bu_structparse *, const char *, void *, const char *, void *)
 

Variables

struct bu_structparse flat_parse_tab []
 
struct mfuncs flat_mfuncs []
 

Detailed Description

Notes - This is a basic flat shader. It will display an object with a set color without taking any effects such as curvature, emission, reflection, etc. into consideration. It simply shades an object constantly with either (in order of reverse priority) 1) the default flat color (white), 2) its set region color, 2) the specified flat shader color (given via the color attribute).

Optionally a transparency value may be shown as well. With transparency turned on, the background objects will blend through depending on the transparency attribute. Masking may be specified for each RGB color channel (e.g. perhaps only lets red light through). This is potentially useful to see background objects through foreground objects, as well as in certain signal analyses as a filter.

See the flat_parse_tab structure for details on the symantics of other attribute shorthands/alternatives.

Definition in file sh_flat.c.

Macro Definition Documentation

#define FLAT_MAGIC   0x464c4154 /* magic number is "FLAT" in hex */

Definition at line 73 of file sh_flat.c.

#define CK_FLAT_SP (   _p)    BU_CKMAG(_p, FLAT_MAGIC, "flat_specific")

Definition at line 74 of file sh_flat.c.

Referenced by flat_render().

#define SHDR_FLAT   ((struct flat_specific *)0)

Definition at line 85 of file sh_flat.c.

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

Definition at line 86 of file sh_flat.c.

Function Documentation

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

Definition at line 200 of file sh_flat.c.

References BU_CK_VLS, BU_GET, bu_log(), bu_struct_parse(), bu_struct_print(), flat_specific::color, mater_info::ma_color, mater_info::ma_color_valid, rdebug, RDEBUG_SHADE, region::reg_mater, region::reg_name, RT_CHECK_RTI, and RT_CK_REGION.

Here is the call graph for this function:

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

!! try to remove

Definition at line 256 of file sh_flat.c.

References bu_struct_print(), CK_FLAT_SP, flat_specific::color, rdebug, RDEBUG_SHADE, rr_render(), RT_AP_CHECK, RT_CHECK_PT, SMALL_FASTF, and flat_specific::transparency.

Here is the call graph for this function:

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

Definition at line 298 of file sh_flat.c.

References bu_struct_print(), and region::reg_name.

Here is the call graph for this function:

HIDDEN void flat_free ( void *  cp)

Definition at line 305 of file sh_flat.c.

References BU_PUT.

void normalizedInput_hook ( const struct bu_structparse sdp,
const char *  name,
void *  base,
const char *  value,
void *  data 
)

Definition at line 139 of file sh_flat.c.

References bu_log(), bu_structparse::sp_count, and bu_structparse::sp_offset.

Referenced by singleNormalizedInput_hook().

Here is the call graph for this function:

void singleNormalizedInput_hook ( const struct bu_structparse sdp,
const char *  name,
void *  base,
const char *  value,
void *  data 
)

Definition at line 177 of file sh_flat.c.

References normalizedInput_hook(), and bu_structparse::sp_offset.

Here is the call graph for this function:

Variable Documentation

struct bu_structparse flat_parse_tab[]
Initial value:
= {
{ "%f", 3, "color", SHDR_O(color), normalizedInput_hook, NULL, NULL },
{ "%f", 3, "rgb", SHDR_O(color), normalizedInput_hook, NULL, NULL },
{ "%f", 1, "bright", SHDR_O(color), singleNormalizedInput_hook, NULL, NULL },
{ "%f", 3, "transparency", SHDR_O(transparency), normalizedInput_hook, NULL, NULL },
{ "%f", 1, "alpha", SHDR_O(transparency), singleNormalizedInput_hook, NULL, NULL },
{ "", 0, (char *)0, 0, BU_STRUCTPARSE_FUNC_NULL, NULL, NULL }
}
void singleNormalizedInput_hook(const struct bu_structparse *, const char *, void *, const char *, void *)
Definition: sh_flat.c:177
#define SHDR_O(m)
Definition: sh_flat.c:86
#define BU_STRUCTPARSE_FUNC_NULL
Definition: parse.h:153
void normalizedInput_hook(const struct bu_structparse *, const char *, void *, const char *, void *)
Definition: sh_flat.c:139

Definition at line 103 of file sh_flat.c.

struct mfuncs flat_mfuncs[]
Initial value:
= {
{MF_MAGIC, "flat", 0, MFI_HIT, 0,
{0, (char *)0, 0, 0, 0,
0, 0, 0, 0 }
}
#define MF_MAGIC
Definition: magic.h:205
HIDDEN void flat_free(void *cp)
Definition: sh_flat.c:305
HIDDEN int flat_setup(register struct region *rp, struct bu_vls *matparm, void **dpp, const struct mfuncs *mfp, struct rt_i *rtip)
Definition: sh_flat.c:200
HIDDEN void flat_print(register struct region *rp, void *dp)
Definition: sh_flat.c:298
HIDDEN int flat_render(struct application *ap, const struct partition *pp, struct shadework *swp, void *dp)
Definition: sh_flat.c:256

Definition at line 121 of file sh_flat.c.

Referenced by optical_shader_init().