Debian Codegraph @

lib/rend_d3d.h

raw symbols SCIP
1 /*
2 * Descent 3
3 * Copyright (C) 2024 Parallax Software
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 #ifndef REND_D3D_H
20 #define REND_D3D_H
21
22 #include "renderer.h"
23 #include "3d.h"
24
25 class oeApplication;
26
27 // Starts up glide
28 int d3d_Init(oeApplication *app, renderer_preferred_state *pref_state);
29
30 // Closes down glide
31 void d3d_Close();
32
33 // The main drawing function...draws a flat/textured/gouraud polygon
34 void d3d_DrawPolygon(int, g3Point **, int, int);
35
36 void d3d_SetFlatColor(ddgr_color color);
37
38 // Ends a frame
39 void d3d_EndFrame();
40
41 // Flips the screen
42 void d3d_Flip();
43
44 // Does setup for a new frame
45 void d3d_BeginFrame(int, int, int, int, int);
46
47 // Tells glide what kind of texturing (linear/perspective) we want
48 void d3d_SetTextureType(texture_type);
49
50 // Sets the lighting state of glide
51 void d3d_SetLightingState(light_state state);
52
53 // Sets the glide color model (either rgb or mono)
54 void d3d_SetColorModel(color_model state);
55
56 // Sets the state of bilinear filtering for our textures
57 void d3d_SetFiltering(int8_t state);
58
59 // Sets the state of zbuffering to on or off
60 void d3d_SetZBufferState(int8_t state);
61
62 // Sets the near/far z values for zbuffering
63 void d3d_SetZValues(float nearz, float farz);
64
65 // Sets a bitmap as a lightmap to rendered on top of the next texture map
66 // a -1 value indicates no lighting map
67 void d3d_SetLightingMap(int handle);
68
69 // Clears the display to a specified color
70 void d3d_ClearScreen(ddgr_color color);
71
72 // Fills a rectangle on the display
73 void d3d_FillRect(ddgr_color color, int x1, int y1, int x2, int y2);
74
75 // Sets a pixel on the display
76 void d3d_SetPixel(ddgr_color color, int x, int y);
77
78 // Sets the near and far plane of fog
79 void d3d_SetFogBorders(float nearz, float farz);
80
81 // Sets the fog state to on or off
82 void d3d_SetFogState(int8_t state);
83
84 // Draws a 2d line
85 void d3d_DrawLine(int x1, int y1, int x2, int y2);
86
87 // sets fog color
88 void d3d_SetFogColor(ddgr_color fogcolor);
89
90 // sets the alpha type
91 void d3d_SetAlphaType(int8_t);
92
93 // Sets the constant alpha value
94 void d3d_SetAlphaValue(uint8_t val);
95
96 // Sets the overall alpha scale factor (all alpha values are scaled by this value)
97 // usefull for motion blur effect
98 void d3d_SetAlphaFactor(float val);
99
100 // Returns the current Alpha factor
101 float d3d_GetAlphaFactor(void);
102
103 // Sets the glide wrapping type
104 void d3d_SetWrapType(wrap_type val);
105
106 // Takes a screenshot of the frontbuffer and puts it into the passed bitmap handle
107 void d3d_Screenshot(int bm_handle);
108
109 // Sets write mask for depth buffer
110 void d3d_SetZBufferWriteMask(int state);
111
112 // Locks the linear frame buffer for application access
113 void d3d_GetLFBLock(renderer_lfb *lfb);
114
115 // Releases the previous LFB lock
116 void d3d_ReleaseLFBLock(renderer_lfb *lfb);
117
118 void d3d_GetProjectionParameters(int *width, int *height);
119 float d3d_GetAspectRatio();
120
121 // Draws a line using the states set by the renderer lib
122 void d3d_DrawSpecialLine(g3Point *p0, g3Point *p1);
123
124 void d3d_SetMipState(int8_t);
125
126 // Sets up a some global preferences for glide
127 int d3d_SetPreferredState(renderer_preferred_state *pref_state);
128
129 // Sets the gamma correction value
130 void d3d_SetGammaValue(float val);
131
132 // Gets the current state of the renderer
133 void d3d_GetRenderState(rendering_state *rstate);
134
135 // Sets the resolution that glide uses
136 void d3d_SetResolution(int width, int height);
137
138 // Sets the coplanar z bias for rendered polygons
139 void d3d_SetCoplanarPolygonOffset(float factor);
140
141 // Creates a on the video card if needed
142 void d3d_PreUploadTextureToCard(int handle, int map_type);
143
144 // Evicts local texture memory
145 void d3d_FreePreUploadedTexture(int handle, int map_type);
146
147 // Returns a string describing the passed in error
148 const char *d3d_ErrorString(int error);
149
150 // Takes a screenshot of the frontbuffer and puts it into the passed bitmap handle
151 void d3d_Screenshot(int bm_handle);
152
153 // Returns 1 if the renderer supports bumpmapping
154 int d3d_SupportsBumpmapping();
155
156 // Clears the zbuffer
157 void d3d_ClearZBuffer();
158
159 // Clears the texture cache
160 void d3d_ResetCache();
161
162 // Creates or destroys a linear framebuffer lock
163 void d3d_GetLFBLock(renderer_lfb *lfb);
164 void d3d_ReleaseLFBLock(renderer_lfb *lfb);
165
166 // Takes a bitmap and blits it to the screen using linear frame buffer stuff
167 // X and Y are the destination X,Y
168 void d3d_CopyBitmapToFramebuffer(int bm_handle, int x, int y);
169
170 // Gets a renderer ready for a framebuffer copy, or stops a framebuffer copy
171 void d3d_SetFrameBufferCopyState(bool state);
172
173 #if defined(WIN32)
174 // returns directdraw object
175 void *d3d_DirectDrawObj(void **frontsurf, void **backsurf);
176 #endif
177
178 // returns rendering statistics for the frame
179 void d3d_GetStatistics(tRendererStats *stats);
180
181 #endif