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

Go to the source code of this file.

Data Structures

struct  toon_specific
 

Macros

#define TOON_MAGIC   0x746F6F6E /* make this a unique number for each shader */
 
#define CK_TOON_SP(_p)   BU_CKMAG(_p, TOON_MAGIC, "toon_specific")
 
#define SHDR_NULL   ((struct toon_specific *)0)
 
#define SHDR_O(m)   bu_offsetof(struct toon_specific, m)
 

Functions

HIDDEN int toon_setup (register struct region *rp, struct bu_vls *matparm, void **dpp, const struct mfuncs *mfp, struct rt_i *rtip)
 
HIDDEN int toon_render (struct application *ap, const struct partition *pp, struct shadework *swp, void *dp)
 
HIDDEN void toon_print (register struct region *rp, void *dp)
 
HIDDEN void toon_free (void *cp)
 

Variables

struct bu_structparse toon_print_tab []
 
struct bu_structparse toon_parse_tab []
 
struct mfuncs toon_mfuncs []
 

Detailed Description

uses simple binning based on the cosine between the ray and the vector from the hitpoint to the light. Might be improved by using hit location curvature and/or cosine between ray dir and hit point normal?

Definition in file sh_toon.c.

Macro Definition Documentation

#define TOON_MAGIC   0x746F6F6E /* make this a unique number for each shader */

Definition at line 42 of file sh_toon.c.

#define CK_TOON_SP (   _p)    BU_CKMAG(_p, TOON_MAGIC, "toon_specific")

Definition at line 43 of file sh_toon.c.

Referenced by toon_render().

#define SHDR_NULL   ((struct toon_specific *)0)

Definition at line 61 of file sh_toon.c.

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

Definition at line 62 of file sh_toon.c.

Function Documentation

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

Definition at line 111 of file sh_toon.c.

References BU_CK_VLS, BU_GET, bu_log(), bu_struct_parse(), bu_struct_print(), rdebug, RDEBUG_SHADE, region::reg_name, RT_CHECK_RTI, and RT_CK_REGION.

Here is the call graph for this function:

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

Definition at line 167 of file sh_toon.c.

References application::a_inv_dir, application::a_rt_i, bu_struct_print(), CK_TOON_SP, light_obs(), rdebug, RDEBUG_SHADE, rr_render(), RT_AP_CHECK, RT_CHECK_PT, rt_i::rti_nlights, and VSETALL.

Here is the call graph for this function:

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

Definition at line 148 of file sh_toon.c.

References bu_struct_print(), and region::reg_name.

Here is the call graph for this function:

HIDDEN void toon_free ( void *  cp)

Definition at line 155 of file sh_toon.c.

References BU_PUT.

Variable Documentation

struct bu_structparse toon_print_tab[]
Initial value:
= {
{"", 0, (char *)0, 0, BU_STRUCTPARSE_FUNC_NULL, NULL, NULL }
}
#define BU_STRUCTPARSE_FUNC_NULL
Definition: parse.h:153

Definition at line 68 of file sh_toon.c.

struct bu_structparse toon_parse_tab[]
Initial value:
= {
{"%p", 1, "toon_print_tab", bu_byteoffset(toon_print_tab[0]), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
{"", 0, (char *)0, 0, BU_STRUCTPARSE_FUNC_NULL, NULL, NULL }
}
struct bu_structparse toon_print_tab[]
Definition: sh_toon.c:68
#define bu_byteoffset(_i)
Definition: parse.h:81
#define BU_STRUCTPARSE_FUNC_NULL
Definition: parse.h:153

Definition at line 72 of file sh_toon.c.

struct mfuncs toon_mfuncs[]
Initial value:
= {
{MF_MAGIC, "toon", 0, MFI_NORMAL|MFI_HIT, 0,
{0, (char *)0, 0, 0, 0,
0, 0, 0, 0 }
}
#define MF_MAGIC
Definition: magic.h:205
HIDDEN int toon_render(struct application *ap, const struct partition *pp, struct shadework *swp, void *dp)
Definition: sh_toon.c:167
HIDDEN void toon_print(register struct region *rp, void *dp)
Definition: sh_toon.c:148
HIDDEN void toon_free(void *cp)
Definition: sh_toon.c:155
HIDDEN int toon_setup(register struct region *rp, struct bu_vls *matparm, void **dpp, const struct mfuncs *mfp, struct rt_i *rtip)
Definition: sh_toon.c:111

Definition at line 91 of file sh_toon.c.

Referenced by optical_shader_init().