BRL-CAD
global.h
Go to the documentation of this file.
1 /* G L O B A L . 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 rt/global.h
21  *
22  */
23 
24 #ifndef RT_GLOBAL_H
25 #define RT_GLOBAL_H
26 
27 #include "common.h"
28 
29 #include "rt/wdb.h"
30 #include "vmath.h"
31 
32 __BEGIN_DECLS
33 
34 
35 /**
36  * Definitions for librt.a which are global to the library regardless
37  * of how many different models are being worked on
38  */
39 struct rt_g {
40  /* DEPRECATED: rtg_parallel is not used by LIBRT any longer (and will be removed) */
41  int8_t rtg_parallel; /**< @brief !0 = trying to use multi CPUs */
42  struct bu_list rtg_vlfree; /**< @brief head of bv_vlist freelist */
43  struct rt_wdb rtg_headwdb; /**< @brief head of database object list */
44 };
45 #define RT_G_INIT_ZERO { 0, BU_LIST_INIT_ZERO, RT_WDB_INIT_ZERO }
46 
47 /**
48  * global ray-trace geometry state
49  */
50 RT_EXPORT extern struct rt_g RTG;
51 
52 /**
53  * Applications that are going to use RT_ADD_VLIST and RT_GET_VLIST
54  * are required to execute this macro once, first:
55  *
56  * BU_LIST_INIT(&RTG.rtg_vlfree);
57  *
58  * Note that RT_GET_VLIST and RT_FREE_VLIST are non-PARALLEL.
59  */
60 #define RT_GET_VLIST(p) BV_GET_VLIST(&RTG.rtg_vlfree, p)
61 
62 /** Place an entire chain of bv_vlist structs on the freelist */
63 #define RT_FREE_VLIST(hd) BV_FREE_VLIST(&RTG.rtg_vlfree, hd)
64 
65 #define RT_ADD_VLIST(hd, pnt, draw) BV_ADD_VLIST(&RTG.rtg_vlfree, hd, pnt, draw)
66 
67 /** set the transformation matrix to display matrix */
68 #define RT_VLIST_SET_DISP_MAT(_dest_hd, _ref_pt) BV_VLIST_SET_DISP_MAT(&RTG.rtg_vlfree, _dest_hd, _ref_pt)
69 
70 /** set the transformation matrix to model matrix */
71 #define RT_VLIST_SET_MODEL_MAT(_dest_hd) BV_VLIST_SET_MODEL_MAT(&RTG.rtg_vlfree, _dest_hd)
72 
73 /** Set a point size to apply to the vlist elements that follow. */
74 #define RT_VLIST_SET_POINT_SIZE(hd, size) BV_VLIST_SET_POINT_SIZE(&RTG.rtg_vlfree, hd, size)
75 
76 /** Set a line width to apply to the vlist elements that follow. */
77 #define RT_VLIST_SET_LINE_WIDTH(hd, width) BV_VLIST_SET_LINE_WIDTH(&RTG.rtg_vlfree, hd, width)
78 
79 
80 __END_DECLS
81 
82 #endif /* RT_GLOBAL_H */
83 
84 /*
85  * Local Variables:
86  * tab-width: 8
87  * mode: C
88  * indent-tabs-mode: t
89  * c-file-style: "stroustrup"
90  * End:
91  * ex: shiftwidth=4 tabstop=8
92  */
Header file for the BRL-CAD common definitions.
struct rt_g RTG
Definition: list.h:132
Definition: global.h:39
struct rt_wdb rtg_headwdb
head of database object list
Definition: global.h:43
int8_t rtg_parallel
!0 = trying to use multi CPUs
Definition: global.h:41
struct bu_list rtg_vlfree
head of bv_vlist freelist
Definition: global.h:42
Definition: wdb.h:62
fundamental vector, matrix, quaternion math macros