SmallChange  1.0.0
A collection of extensions to Coin3D
Loading...
Searching...
No Matches
SceneryGL.h
1#ifndef SS_SCENERYGL_H
2#define SS_SCENERYGL_H
3
4class SoState;
5class SoAction;
6
7#ifdef __cplusplus
8extern "C" {
9#endif /* __cplusplus */
10
11/* ********************************************************************** */
12
13typedef struct ss_render_block_cb_info ss_render_block_cb_info;
14typedef struct RenderState RenderState;
15
16/*
17 * The below RenderState structure is arbitrary - one we have chosen
18 * to use, common for all the callback implementations in
19 * SceneryGL.cpp. There are no ties between this structure and the
20 * Scenery library.
21 */
22
24 /* local block info */
25 float blocksize;
26 double vspacing[2];
27 double voffset[2];
28 float * elevdata;
29 signed char * normaldata;
30
31 /* global info */
32 double bbmin[3];
33 double bbmax[3];
34 int dotex;
35 int renderpass;
36
37 /* culling */
38 float * clipplanes;
39 int numclipplanes;
40 float raypos[3], raydir[3];
41
42 /* elevation texture */
43 float etexscale;
44 float etexoffset;
45
46 /* temporary */
47 unsigned int activescenerytexid; /* FIXME: it is ridiculous design
48 to keep this public. AFAICS,
49 this is done only for the
50 purpose of resetting its value
51 between renderings. 20040602
52 mortene. */
53
54 struct RenderStateP * pimpl;
55};
56
57/* ********************************************************************** */
58/* GL setup */
59
60#ifndef APIENTRY
61/* for non-win32 builds */
62#define APIENTRY
63#endif /* !APIENTRY */
64
65typedef void (APIENTRY * sc_msghandler_fp)(const char * msg);
66void sc_probe_gl(const unsigned int ctxid, sc_msghandler_fp msghandler); /* automatic setup of the below features */
67
68/* used to set the current OpenGL context id from client code,
69 necessary for e.g. making sure texture allocation and destruction
70 is done in the correct context */
71void sc_set_current_context_id(RenderState * state, unsigned int context);
72void sc_unset_current_context(RenderState * state);
73
74/* ********************************************************************** */
75
76/* don't use the following methods unless completely necessary */
77
78void sc_set_use_bytenormals(unsigned int ctxid, int enable); /* for buggy GL drivers (3Dlabs) */
79int sc_get_use_bytenormals(unsigned int ctxid); /* for buggy GL drivers (3Dlabs) */
80void sc_set_have_clamp_to_edge(unsigned int ctxid, int enable); /* GL 1.x feature */
81int sc_get_have_clamp_to_edge(unsigned int ctxid); /* GL 1.x feature */
82void sc_set_use_occlusion_test(unsigned int ctxid, int enable);
83int sc_get_use_occlusion_test(unsigned int ctxid);
84
85/* ask about features */
86int sc_found_multitexturing(unsigned int ctxid);
87int sc_found_vertexarrays(unsigned int ctxid);
88int sc_suggest_vertexarrays(unsigned int ctxid);
89int sc_suggest_bytenormals(unsigned int ctxid);
90
91/* ********************************************************************** */
92
93void sc_renderstate_construct(RenderState * state);
94void sc_renderstate_destruct(RenderState * state);
95
96/* ********************************************************************** */
97/* texture management */
98
99void sc_mark_unused_textures(RenderState * state);
100void sc_delete_unused_textures(RenderState * state);
101void sc_delete_all_textures(RenderState * state);
102
103/* ********************************************************************** */
104/* rendering callbacks */
105
106/* direct rendering with triangle fans */
107void sc_render_pre_cb(void * closure, ss_render_block_cb_info * info);
108void sc_render_post_cb(void * closure, ss_render_block_cb_info * info);
109
110void sc_render_cb(void * closure, const int x, const int y, const int len,
111 const unsigned int bitmask);
112void sc_undefrender_cb(void * closure, const int x, const int y, const int len,
113 const unsigned int bitmask_org);
114
115/* delayed rendering with vertex arrays */
116void sc_va_render_pre_cb(void * closure, ss_render_block_cb_info * info);
117void sc_va_render_post_cb(void * closure, ss_render_block_cb_info * info);
118
119void sc_va_render_cb(void * closure, const int x, const int y, const int len,
120 const unsigned int bitmask);
121void sc_va_undefrender_cb(void * closure, const int x, const int y, const int len,
122 const unsigned int bitmask_org);
123
124/* ********************************************************************** */
125/* raypick callbacks */
126
127#if 0 /* FIXME: These used to be public, but it doesn't seem like they
128 have to be? I've marked them as "static" inside
129 SceneryGL.cpp. 20040602 mortene. */
130void sc_raypick_pre_cb(void * closure, ss_render_block_cb_info * info);
131void sc_raypick_post_cb(void * closure, ss_render_block_cb_info * info);
132
133void sc_raypick_cb(void * closure, const int x, const int y, const int len,
134 const unsigned int bitmask);
135void sc_undefraypick_cb(void * closure, const int x, const int y, const int len,
136 const unsigned int bitmask_org);
137#endif
138
139/* ********************************************************************** */
140/* culling callbacks */
141
142int sc_plane_culling_pre_cb(void * closure, const double * bmin, const double * bmax);
143void sc_plane_culling_post_cb(void * closure);
144
145#if 0 /* FIXME: These used to be public, but it doesn't seem like they
146 have to be? I've marked them as "static" inside
147 SceneryGL.cpp. 20040602 mortene. */
148int sc_ray_culling_pre_cb(void * closure, const double * bmin, const double * bmax);
149void sc_ray_culling_post_cb(void * closure);
150#endif
151
152/* ********************************************************************** */
153/* misc utilitites */
154
155void sc_generate_elevation_line_texture(float distance, float offset, float thickness, int emphasis, unsigned char * buffer, int components, int texturesize, float * texcoordscale, float * texcoordoffset);
156
157void sc_init_debug_info(RenderState * state);
158void sc_display_debug_info(RenderState * state, float * campos, short * vpsize);
159
160/* ********************************************************************** */
161
162#ifdef __cplusplus
163} /* extern "C" */
164#endif /* __cplusplus */
165
166#endif
Definition misc/SbList.h:69
Definition SceneryGL.h:23