BRL-CAD
dm-osgl.h
Go to the documentation of this file.
1 /* D M - O S G . H
2  * BRL-CAD
3  *
4  * Copyright (c) 2014 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 /** @addtogroup libdm */
21 /** @{ */
22 /** @file dm-osgl.h
23  *
24  */
25 
26 #ifndef DM_OSGL_H
27 #define DM_OSGL_H
28 
29 #ifdef DM_OSGL
30 
31 #include "common.h"
32 
33 #include "bu/vls.h"
34 
35 #ifdef __cplusplus
36 #include <iostream>
37 
38 #include <osg/GraphicsContext>
39 #include <osg/Timer>
40 #endif /* __cplusplus */
41 
42 extern "C" {
43 /* For portable text in OpenGL, use fontstash */
44 #define FONTSTASH_IMPLEMENTATION
45 #include "./fontstash/fontstash.h"
46 
47 #define GLFONTSTASH_IMPLEMENTATION
49 }
50 
51 #define CMAP_BASE 40
52 
53 /* Map +/-2048 GED space into -1.0..+1.0 :: x/2048*/
54 #define GED2IRIS(x) (((float)(x))*0.00048828125)
55 
56 #define Osgl_MV_O(_m) offsetof(struct modifiable_osgl_vars, _m)
57 
58 struct modifiable_osgl_vars {
59  dm *this_dm;
60  int cueing_on;
61  int zclipping_on;
62  int zbuffer_on;
63  int lighting_on;
64  int transparency_on;
65  int fastfog;
66  double fogdensity;
67  int zbuf;
68  int rgb;
69  int doublebuffer;
70  int depth;
71  int debug;
72  struct bu_vls log;
73  double bound;
74  int boundFlag;
75  int text_shadow;
76 };
77 
78 struct osgl_vars {
79 #ifdef __cplusplus
80  GLdouble faceplate_mat[16];
81 #endif
82  int face_flag;
83  int *perspective_mode;
84  struct FONScontext *fs;
85  int fontNormal;
86  int ovec; /* Old color map entry number */
87 #ifdef __cplusplus
88  GLclampf r, g, b;
89 #endif
90  struct modifiable_osgl_vars mvars;
91 #if defined(_WIN32)
92  HGLRC glxc; /* Need to figure out what OSGL needs on Win32 */
93 #endif
94 #ifdef __cplusplus
95  osg::ref_ptr<osg::GraphicsContext> graphicsContext;
96  osg::ref_ptr<osg::GraphicsContext::Traits> traits;
97  osg::Timer *timer;
98  int last_update_time;
99  osgViewer::Viewer *testviewer;
100  osg::Group *osg_root;
101 #endif
102 };
103 
105 
106 #ifdef __cplusplus
107 extern "C" {
108 #endif
109 void osgl_fogHint(dm *dmp, int fastfog);
110 #ifdef __cplusplus
111 }
112 #endif
113 
115 
116 #endif /* DM_OSGL */
117 #endif /* DM_OSGL_H */
118 
119 /** @} */
120 /*
121  * Local Variables:
122  * mode: C++
123  * tab-width: 8
124  * indent-tabs-mode: t
125  * c-file-style: "stroustrup"
126  * End:
127  * ex: shiftwidth=4 tabstop=8
128  */
Header file for the BRL-CAD common definitions.
#define __BEGIN_DECLS
Definition: common.h:73
struct FONScontext FONScontext
Definition: fontstash.h:89
#define __END_DECLS
Definition: common.h:74
Definition: vls.h:56