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

Go to the source code of this file.

Data Structures

struct  txt_specific
 
struct  ckr_specific
 

Macros

#define TXT_NAME_LEN   128
 
#define TXT_SRC_FILE   'f'
 
#define TXT_SRC_OBJECT   'o'
 
#define TXT_SRC_AUTO   0
 
#define TX_NULL   ((struct txt_specific *)0)
 
#define TX_O(m)   bu_offsetof(struct txt_specific, m)
 
#define CKR_NULL   ((struct ckr_specific *)0)
 
#define CKR_O(m)   bu_offsetof(struct ckr_specific, m)
 

Functions

HIDDEN void txt_transp_hook (const struct bu_structparse *, const char *, void *, const char *, void *)
 
HIDDEN void txt_source_hook (const struct bu_structparse *, const char *, void *, const char *, void *)
 
HIDDEN int txt_load_datasource (struct txt_specific *texture, struct db_i *dbInstance, const long unsigned int size)
 
HIDDEN int txt_load_datasource (struct txt_specific *texture, struct db_i *dbInstance, const unsigned long int size)
 
HIDDEN int txt_render (struct application *ap, const struct partition *pp, struct shadework *swp, void *dp)
 
HIDDEN int bwtxt_render (struct application *ap, const struct partition *pp, struct shadework *swp, void *dp)
 
HIDDEN int txt_setup (register struct region *rp, struct bu_vls *matparm, void **dpp, const struct mfuncs *mfp, struct rt_i *rtip)
 
HIDDEN void txt_print (register struct region *rp, void *dp)
 
HIDDEN void txt_free (void *cp)
 
HIDDEN int ckr_render (struct application *ap, const struct partition *pp, register struct shadework *swp, void *dp)
 
HIDDEN int ckr_setup (register struct region *rp, struct bu_vls *matparm, void **dpp, const struct mfuncs *mfp, struct rt_i *rtip)
 
HIDDEN void ckr_print (register struct region *rp, void *dp)
 
HIDDEN void ckr_free (void *cp)
 
HIDDEN int tstm_render (struct application *ap, const struct partition *pp, register struct shadework *swp, void *dp)
 
HIDDEN int star_render (register struct application *ap, const struct partition *pp, struct shadework *swp, void *dp)
 
HIDDEN int bmp_render (struct application *ap, const struct partition *pp, struct shadework *swp, void *dp)
 
HIDDEN int envmap_setup (register struct region *rp, struct bu_vls *matparm, void **dpp, const struct mfuncs *mfp, struct rt_i *rtip)
 
int mlib_zero (struct application *a, const struct partition *b, struct shadework *c, void *d)
 
int mlib_one (struct region *a, struct bu_vls *b, void **c, const struct mfuncs *d, struct rt_i *e)
 
void mlib_void (struct region *a, void *b)
 

Variables

struct bu_structparse txt_parse []
 
struct bu_structparse ckr_parse []
 
struct mfuncs txt_mfuncs []
 

Detailed Description

Texture map lookup

Definition in file sh_text.c.

Macro Definition Documentation

#define TXT_NAME_LEN   128

Definition at line 38 of file sh_text.c.

#define TXT_SRC_FILE   'f'

Definition at line 48 of file sh_text.c.

Referenced by txt_load_datasource(), txt_setup(), and txt_source_hook().

#define TXT_SRC_OBJECT   'o'

Definition at line 49 of file sh_text.c.

Referenced by txt_load_datasource(), txt_setup(), and txt_source_hook().

#define TXT_SRC_AUTO   0

Definition at line 50 of file sh_text.c.

Referenced by txt_load_datasource(), txt_setup(), and txt_source_hook().

#define TX_NULL   ((struct txt_specific *)0)

Definition at line 55 of file sh_text.c.

#define TX_O (   m)    bu_offsetof(struct txt_specific, m)

Definition at line 56 of file sh_text.c.

#define CKR_NULL   ((struct ckr_specific *)0)

Definition at line 674 of file sh_text.c.

#define CKR_O (   m)    bu_offsetof(struct ckr_specific, m)

Definition at line 675 of file sh_text.c.

Function Documentation

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

Definition at line 110 of file sh_text.c.

References bu_log(), BU_STR_EQUAL, txt_specific::tx_trans_valid, and txt_parse.

Here is the call graph for this function:

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

Definition at line 89 of file sh_text.c.

References bu_strncmp(), txt_specific::tx_datasrc, TXT_SRC_AUTO, TXT_SRC_FILE, and TXT_SRC_OBJECT.

Here is the call graph for this function:

HIDDEN int txt_load_datasource ( struct txt_specific texture,
struct db_i dbInstance,
const long unsigned int  size 
)

Referenced by txt_setup().

HIDDEN int txt_load_datasource ( struct txt_specific texture,
struct db_i dbInstance,
const unsigned long int  size 
)
HIDDEN int bwtxt_render ( struct application ap,
const struct partition pp,
struct shadework *  swp,
void *  dp 
)
HIDDEN int txt_setup ( register struct region rp,
struct bu_vls matparm,
void **  dpp,
const struct mfuncs *  mfp,
struct rt_i rtip 
)
HIDDEN void txt_print ( register struct region rp,
void *  dp 
)

Definition at line 649 of file sh_text.c.

References bu_struct_print(), region::reg_name, and region::reg_udata.

Here is the call graph for this function:

HIDDEN void txt_free ( void *  cp)

Definition at line 656 of file sh_text.c.

References bu_close_mapped_file(), BU_PUT, bu_vls_free(), rt_binunif_free(), txt_specific::tx_binunifp, txt_specific::tx_mp, and txt_specific::tx_name.

Here is the call graph for this function:

HIDDEN int ckr_render ( struct application ap,
const struct partition pp,
register struct shadework *  swp,
void *  dp 
)

Definition at line 686 of file sh_text.c.

References ckr_specific::ckr_a, ckr_specific::ckr_b, ckr_specific::ckr_scale, rr_render(), OSL::Strings::u, OSL::Strings::v, and VSET.

Here is the call graph for this function:

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

Definition at line 715 of file sh_text.c.

References BU_GET, BU_PUT, bu_struct_parse(), ckr_specific::ckr_a, ckr_specific::ckr_b, and ckr_specific::ckr_scale.

Here is the call graph for this function:

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

Definition at line 741 of file sh_text.c.

References bu_struct_print(), region::reg_name, and region::reg_udata.

Here is the call graph for this function:

HIDDEN void ckr_free ( void *  cp)

Definition at line 748 of file sh_text.c.

References BU_PUT.

HIDDEN int tstm_render ( struct application ap,
const struct partition pp,
register struct shadework *  swp,
void *  dp 
)

Definition at line 759 of file sh_text.c.

References rr_render(), and VSET.

Here is the call graph for this function:

HIDDEN int star_render ( register struct application ap,
const struct partition pp,
struct shadework *  swp,
void *  dp 
)

Definition at line 784 of file sh_text.c.

References application::a_resource, bn_rand0to1, resource::re_randptr, rr_render(), and VSETALL.

Here is the call graph for this function:

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

Definition at line 820 of file sh_text.c.

References bu_bomb(), bu_log(), bu_vls_strlen(), bu_mapped_file::buf, partition::pt_inseg, rdebug, RDEBUG_LIGHT, rr_render(), seg::seg_stp, txt_specific::tx_binunifp, txt_specific::tx_mp, txt_specific::tx_n, txt_specific::tx_name, txt_specific::tx_w, rt_binunif_internal::u, OSL::Strings::u, rt_binunif_internal::uint8, OSL::Strings::v, VPRINT, and VSET.

Here is the call graph for this function:

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

Definition at line 896 of file sh_text.c.

References bu_list::back, BU_CK_VLS, BU_LIST_NULL, bu_log(), bu_strdup, bu_vls_strdup(), env_region, bu_list::forw, region::l, mater_info::ma_shader, mlib_setup(), optical_shader_init(), region::reg_mater, region::reg_mfuncs, region::reg_name, region::reg_treetop, RT_CK_RTI, and TREE_NULL.

Here is the call graph for this function:

Variable Documentation

struct bu_structparse txt_parse[]
Initial value:
= {
{"%d", 1, "transp", TX_O(tx_transp), txt_transp_hook, NULL, NULL },
{"%V", 1, "file", TX_O(tx_name), txt_source_hook, NULL, NULL },
{"%V", 1, "obj", TX_O(tx_name), txt_source_hook, NULL, NULL },
{"%V", 1, "object", TX_O(tx_name), txt_source_hook, NULL, NULL },
{"%V", 1, "texture", TX_O(tx_name), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
{"%d", 1, "w", TX_O(tx_w), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
{"%d", 1, "n", TX_O(tx_n), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
{"%d", 1, "l", TX_O(tx_n), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
{"%d", 1, "trans_valid", TX_O(tx_trans_valid), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
{"%d", 1, "t", TX_O(tx_trans_valid), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
{"%f", 2, "uv", TX_O(tx_scale), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
{"%d", 1, "m", TX_O(tx_mirror), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
{"", 0, (char *)0, 0, BU_STRUCTPARSE_FUNC_NULL, NULL, NULL }
}
HIDDEN void txt_source_hook(const struct bu_structparse *, const char *, void *, const char *, void *)
Definition: sh_text.c:89
#define BU_STRUCTPARSE_FUNC_NULL
Definition: parse.h:153
HIDDEN void txt_transp_hook(const struct bu_structparse *, const char *, void *, const char *, void *)
Definition: sh_text.c:110
#define TX_O(m)
Definition: sh_text.c:56

Definition at line 65 of file sh_text.c.

Referenced by txt_transp_hook().

struct bu_structparse ckr_parse[]
Initial value:
= {
{"%d", 3, "a", CKR_O(ckr_a), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
{"%d", 3, "b", CKR_O(ckr_b), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
{"%g", 1, "s", CKR_O(ckr_scale), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
{"", 0, (char *)0, 0, BU_STRUCTPARSE_FUNC_NULL, NULL, NULL }
}
#define CKR_O(m)
Definition: sh_text.c:675
#define BU_STRUCTPARSE_FUNC_NULL
Definition: parse.h:153

Definition at line 677 of file sh_text.c.

struct mfuncs txt_mfuncs[]
Initial value:
= {
{MF_MAGIC, "texture", 0, MFI_UV, 0, txt_setup, txt_render, txt_print, txt_free },
{MF_MAGIC, "bwtexture", 0, MFI_UV, 0, txt_setup, bwtxt_render, txt_print, txt_free },
{MF_MAGIC, "checker", 0, MFI_UV, 0, ckr_setup, ckr_render, ckr_print, ckr_free },
{MF_MAGIC, "testmap", 0, MFI_UV, 0, mlib_one, tstm_render, mlib_void, mlib_void2 },
{MF_MAGIC, "fakestar", 0, 0, 0, mlib_one, star_render, mlib_void, mlib_void2 },
{MF_MAGIC, "bump", 0, MFI_UV|MFI_NORMAL, 0, txt_setup, bmp_render, txt_print, txt_free },
{MF_MAGIC, "envmap", 0, 0, 0, envmap_setup, mlib_zero, mlib_void, mlib_void2 },
{0, (char *)0, 0, 0, 0, 0, 0, 0, 0 }
}
HIDDEN int star_render(register struct application *ap, const struct partition *pp, struct shadework *swp, void *dp)
Definition: sh_text.c:784
void mlib_void(struct region *a, void *b)
Definition: sh_text.c:956
HIDDEN int ckr_setup(register struct region *rp, struct bu_vls *matparm, void **dpp, const struct mfuncs *mfp, struct rt_i *rtip)
Definition: sh_text.c:715
#define MF_MAGIC
Definition: magic.h:205
HIDDEN void txt_free(void *cp)
Definition: sh_text.c:656
HIDDEN int ckr_render(struct application *ap, const struct partition *pp, register struct shadework *swp, void *dp)
Definition: sh_text.c:686
int mlib_zero(struct application *a, const struct partition *b, struct shadework *c, void *d)
Definition: sh_text.c:936
HIDDEN int txt_render(struct application *ap, const struct partition *pp, struct shadework *swp, void *dp)
Definition: sh_text.c:222
HIDDEN void txt_print(register struct region *rp, void *dp)
Definition: sh_text.c:649
HIDDEN int bwtxt_render(struct application *ap, const struct partition *pp, struct shadework *swp, void *dp)
Definition: sh_text.c:478
HIDDEN int txt_setup(register struct region *rp, struct bu_vls *matparm, void **dpp, const struct mfuncs *mfp, struct rt_i *rtip)
Definition: sh_text.c:595
int mlib_one(struct region *a, struct bu_vls *b, void **c, const struct mfuncs *d, struct rt_i *e)
Definition: sh_text.c:948
HIDDEN void ckr_print(register struct region *rp, void *dp)
Definition: sh_text.c:741
HIDDEN void ckr_free(void *cp)
Definition: sh_text.c:748
HIDDEN int envmap_setup(register struct region *rp, struct bu_vls *matparm, void **dpp, const struct mfuncs *mfp, struct rt_i *rtip)
Definition: sh_text.c:896
HIDDEN int bmp_render(struct application *ap, const struct partition *pp, struct shadework *swp, void *dp)
Definition: sh_text.c:820
HIDDEN int tstm_render(struct application *ap, const struct partition *pp, register struct shadework *swp, void *dp)
Definition: sh_text.c:759

Definition at line 965 of file sh_text.c.

Referenced by optical_shader_init().