BRL-CAD
nongeom.h
Go to the documentation of this file.
1/* N O N G E O M . H
2 * BRL-CAD
3 *
4 * Copyright (c) 1993-2023 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 rt/nongeom.h
21 *
22 * In memory format for non-geometry objects in BRL-CAD databases.
23 */
24
25#ifndef RT_NONGEOM_H
26#define RT_NONGEOM_H
27
28#include "common.h"
29#include "vmath.h"
30#include "bu/vls.h"
31
32__BEGIN_DECLS
33
34union tree; /* forward declaration */
35
36/**
37 * In-memory format for database "combination" record (non-leaf node).
38 * (Regions and Groups are both a kind of Combination). Perhaps move
39 * to wdb.h or rtgeom.h?
40 */
42 uint32_t magic;
43 union tree * tree; /**< @brief Leading to tree_db_leaf leaves */
44 char region_flag; /**< @brief !0 ==> this COMB is a REGION */
45 char is_fastgen; /**< @brief REGION_NON_FASTGEN/_PLATE/_VOLUME */
46 /* Begin GIFT compatibility */
47 long region_id; /* DEPRECATED, use attribute */
48 long aircode; /* DEPRECATED, use attribute */
49 long GIFTmater; /* DEPRECATED, use attribute */
50 long los; /* DEPRECATED, use attribute */
51 /* End GIFT compatibility */
52 char rgb_valid; /**< @brief !0 ==> rgb[] has valid color */
53 unsigned char rgb[3];
54 float temperature; /**< @brief > 0 ==> region temperature */
55 struct bu_vls shader;
57 char inherit;
58};
59#define RT_CHECK_COMB(_p) BU_CKMAG(_p, RT_COMB_MAGIC, "rt_comb_internal")
60#define RT_CK_COMB(_p) RT_CHECK_COMB(_p)
61
62/**
63 * initialize an rt_comb_internal to empty.
64 */
65#define RT_COMB_INTERNAL_INIT(_p) { \
66 (_p)->magic = RT_COMB_MAGIC; \
67 (_p)->tree = TREE_NULL; \
68 (_p)->region_flag = 0; \
69 (_p)->is_fastgen = REGION_NON_FASTGEN; \
70 (_p)->region_id = 0; \
71 (_p)->aircode = 0; \
72 (_p)->GIFTmater = 0; \
73 (_p)->los = 0; \
74 (_p)->rgb_valid = 0; \
75 (_p)->rgb[0] = 0; \
76 (_p)->rgb[1] = 0; \
77 (_p)->rgb[2] = 0; \
78 (_p)->temperature = 0.0; \
79 BU_VLS_INIT(&(_p)->shader); \
80 BU_VLS_INIT(&(_p)->material); \
81 (_p)->inherit = 0; \
82 }
83
84/**
85 * deinitialize an rt_comb_internal. the tree pointer is not released
86 * so callers will need to call BU_PUT() or db_free_tree()
87 * directly if a tree is set. the shader and material strings are
88 * released. the comb itself will need to be released with bu_free()
89 * unless it resides on the stack.
90 */
91#define RT_FREE_COMB_INTERNAL(_p) { \
92 bu_vls_free(&(_p)->shader); \
93 bu_vls_free(&(_p)->material); \
94 (_p)->tree = TREE_NULL; \
95 (_p)->magic = 0; \
96 }
97
98
99/**
100 * In-memory format for database uniform-array binary object. Perhaps
101 * move to wdb.h or rtgeom.h?
102 */
104 uint32_t magic;
105 int type;
106 size_t count;
107 union {
108 float *flt;
109 double *dbl;
110 char *int8;
111 short *int16;
112 int *int32;
113 long *int64;
114 unsigned char *uint8;
115 unsigned short *uint16;
116 unsigned int *uint32;
117 unsigned long *uint64;
118 } u;
119};
120#define RT_CHECK_BINUNIF(_p) BU_CKMAG(_p, RT_BINUNIF_INTERNAL_MAGIC, "rt_binunif_internal")
121#define RT_CK_BINUNIF(_p) RT_CHECK_BINUNIF(_p)
122
123
124/**
125 * In-memory format for database "constraint" record
126 */
128 uint32_t magic;
129 int id;
130 int type;
132};
133
134#define RT_CHECK_CONSTRAINT(_p) BU_CKMAG(_p, RT_CONSTRAINT_MAGIC, "rt_constraint_internal")
135#define RT_CK_CONSTRAINT(_p) RT_CHECK_CONSTRAINT(_p)
136
137/**
138 * In-memory format for database "material" record
139 */
141 uint32_t magic;
142 struct bu_vls name;
145
150};
151
152#define RT_CHECK_MATERIAL(_p) BU_CKMAG(_p, RT_MATERIAL_MAGIC, "rt_material_internal")
153#define RT_CK_MATERIAL(_p) RT_CHECK_MATERIAL(_p)
154
155__END_DECLS
156
157#endif /* RT_NONGEOM_H */
158
159/*
160 * Local Variables:
161 * tab-width: 8
162 * mode: C
163 * indent-tabs-mode: t
164 * c-file-style: "stroustrup"
165 * End:
166 * ex: shiftwidth=4 tabstop=8
167 */
Header file for the BRL-CAD common definitions.
Definition: vls.h:53
unsigned long * uint64
Definition: nongeom.h:117
uint32_t magic
Definition: nongeom.h:104
union rt_binunif_internal::@12 u
unsigned short * uint16
Definition: nongeom.h:115
unsigned int * uint32
Definition: nongeom.h:116
unsigned char * uint8
Definition: nongeom.h:114
long GIFTmater
Definition: nongeom.h:49
char rgb_valid
!0 ==> rgb[] has valid color
Definition: nongeom.h:52
uint32_t magic
Definition: nongeom.h:42
unsigned char rgb[3]
Definition: nongeom.h:53
char region_flag
!0 ==> this COMB is a REGION
Definition: nongeom.h:44
struct bu_vls shader
Definition: nongeom.h:55
char is_fastgen
REGION_NON_FASTGEN/_PLATE/_VOLUME.
Definition: nongeom.h:45
long region_id
Definition: nongeom.h:47
struct bu_vls material
Definition: nongeom.h:56
float temperature
> 0 ==> region temperature
Definition: nongeom.h:54
union tree * tree
Leading to tree_db_leaf leaves.
Definition: nongeom.h:43
struct bu_vls expression
Definition: nongeom.h:131
struct bu_attribute_value_set mechanicalProperties
Definition: nongeom.h:147
struct bu_vls name
Definition: nongeom.h:142
struct bu_attribute_value_set opticalProperties
Definition: nongeom.h:148
struct bu_attribute_value_set thermalProperties
Definition: nongeom.h:149
struct bu_vls parent
Definition: nongeom.h:143
struct bu_vls source
Definition: nongeom.h:144
struct bu_attribute_value_set physicalProperties
Definition: nongeom.h:146
Definition: tree.h:147
fundamental vector, matrix, quaternion math macros