BRL-CAD
mater.h
Go to the documentation of this file.
1 /* M A T E R . H
2  * BRL-CAD
3  *
4  * Copyright (c) 1993-2024 United States Government as represented by
5  * the U.S. Army Research Laboratory.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public License
9  * version 2.1 as published by the Free Software Foundation.
10  *
11  * This library is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this file; see the file named COPYING for more
18  * information.
19  */
20 /** @file mater.h
21  *
22  */
23 
24 #ifndef RT_MATER_H
25 #define RT_MATER_H
26 
27 #include "common.h"
28 #include "rt/defines.h"
29 #include "bu/vls.h"
30 
31 __BEGIN_DECLS
32 
33 struct region; /* forward declaration */
34 
35 /**
36  * Container for material information
37  */
38 struct mater_info {
39  float ma_color[3]; /**< @brief explicit color: 0..1 */
40  float ma_temperature; /**< @brief positive ==> degrees Kelvin */
41  char ma_color_valid; /**< @brief non-0 ==> ma_color is non-default */
42  char ma_cinherit; /**< @brief color: DB_INH_LOWER / DB_INH_HIGHER */
43  char ma_minherit; /**< @brief mater: DB_INH_LOWER / DB_INH_HIGHER */
44  char *ma_shader; /**< @brief shader name & parms */
45 };
46 #define RT_MATER_INFO_INIT_ZERO { VINIT_ZERO, 0.0, 0, 0, 0, NULL }
47 /* From MGED initial tree state */
48 #define RT_MATER_INFO_INIT_IDN { {1.0, 0.0, 0.0} , -1.0, 0, 0, 0, NULL }
49 
50 struct mater {
51  long mt_low; /**< @brief bounds of region IDs, inclusive */
52  long mt_high;
53  unsigned char mt_r; /**< @brief color */
54  unsigned char mt_g;
55  unsigned char mt_b;
56  b_off_t mt_daddr; /**< @brief db address, for updating */
57  struct mater *mt_forw; /**< @brief next in chain */
58 };
59 #define MATER_NULL ((struct mater *)0)
60 #define MATER_NO_ADDR ((b_off_t)0) /**< @brief invalid mt_daddr */
61 
62 
63 RT_EXPORT extern void rt_region_color_map(struct region *regp);
64 
65 /* process ID_COLORTAB record */
66 RT_EXPORT extern void rt_color_addrec(int low,
67  int hi,
68  int r,
69  int g,
70  int b,
71  b_off_t addr);
72 RT_EXPORT extern void rt_insert_color(struct mater *newp);
73 RT_EXPORT extern void rt_vls_color_map(struct bu_vls *str);
74 RT_EXPORT extern struct mater *rt_material_head(void);
75 RT_EXPORT extern void rt_new_material_head(struct mater *);
76 RT_EXPORT extern struct mater *rt_dup_material_head(void);
77 RT_EXPORT extern void rt_color_free(void);
78 
79 __END_DECLS
80 
81 #endif /* RT_MATER_H */
82 
83 /*
84  * Local Variables:
85  * tab-width: 8
86  * mode: C
87  * indent-tabs-mode: t
88  * c-file-style: "stroustrup"
89  * End:
90  * ex: shiftwidth=4 tabstop=8
91  */
Header file for the BRL-CAD common definitions.
#define b_off_t
Definition: common.h:223
struct mater * rt_dup_material_head(void)
void rt_insert_color(struct mater *newp)
void rt_new_material_head(struct mater *)
void rt_region_color_map(struct region *regp)
void rt_color_free(void)
void rt_vls_color_map(struct bu_vls *str)
void rt_color_addrec(int low, int hi, int r, int g, int b, b_off_t addr)
struct mater * rt_material_head(void)
Definition: vls.h:53
char * ma_shader
shader name & parms
Definition: mater.h:44
float ma_color[3]
explicit color: 0..1
Definition: mater.h:39
float ma_temperature
positive ==> degrees Kelvin
Definition: mater.h:40
char ma_cinherit
color: DB_INH_LOWER / DB_INH_HIGHER
Definition: mater.h:42
char ma_color_valid
non-0 ==> ma_color is non-default
Definition: mater.h:41
char ma_minherit
mater: DB_INH_LOWER / DB_INH_HIGHER
Definition: mater.h:43
Definition: mater.h:50
b_off_t mt_daddr
db address, for updating
Definition: mater.h:56
unsigned char mt_g
Definition: mater.h:54
unsigned char mt_b
Definition: mater.h:55
long mt_low
bounds of region IDs, inclusive
Definition: mater.h:51
struct mater * mt_forw
next in chain
Definition: mater.h:57
unsigned char mt_r
color
Definition: mater.h:53
long mt_high
Definition: mater.h:52
Definition: region.h:44