| 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 | --- HISTORICAL COMMENTS FOLLOW --- |
| 19 | |
| 20 | * $Logfile: /DescentIII/Main/lib/renderer.h $ |
| 21 | * $Revision: 80 $ |
| 22 | * $Date: 4/19/00 5:22p $ |
| 23 | * $Author: Matt $ |
| 24 | * |
| 25 | * Header for renderer library |
| 26 | * |
| 27 | * $Log: /DescentIII/Main/lib/renderer.h $ |
| 28 | * |
| 29 | * 80 4/19/00 5:22p Matt |
| 30 | * From Duane for 1.4 |
| 31 | * Added extern |
| 32 | * |
| 33 | * 79 10/21/99 1:43p Kevin |
| 34 | * Mac Merge |
| 35 | * |
| 36 | * 78 9/18/99 9:22p Jeff |
| 37 | * Get/Set Alpha factor functions |
| 38 | * |
| 39 | * 77 8/10/99 10:51p Duane |
| 40 | * Added UseMipmap global |
| 41 | * |
| 42 | * 76 7/22/99 8:37p Jeff |
| 43 | * added texture upload to renderstats |
| 44 | * |
| 45 | * 75 7/15/99 6:38p Jeff |
| 46 | * created function to get rendering stats |
| 47 | * |
| 48 | * 74 4/01/99 10:56a Jason |
| 49 | * added better support for movie rendering |
| 50 | * |
| 51 | * 73 3/31/99 3:48p Jason |
| 52 | * changes for cinematics |
| 53 | * |
| 54 | * 72 3/29/99 7:29p Jason |
| 55 | * made renderer handle default resolution more gracefully |
| 56 | * |
| 57 | * 71 3/24/99 11:55a Jason |
| 58 | * added S3 texture compression |
| 59 | * |
| 60 | * 70 3/22/99 5:51p Jason |
| 61 | * enhancements to mirrors |
| 62 | * |
| 63 | * 69 1/29/99 6:29p Jason |
| 64 | * first pass at adding bumpmaps |
| 65 | * |
| 66 | * 68 1/22/99 1:09a Jason |
| 67 | * added vid mem checking |
| 68 | * |
| 69 | * 67 1/18/99 10:45a Samir |
| 70 | * added function to get DirectDraw object from Win32 apps. |
| 71 | * |
| 72 | * 66 12/23/98 5:35p Jason |
| 73 | * added saturated lightmap blending |
| 74 | * |
| 75 | * 65 12/18/98 5:25p Jason |
| 76 | * added specularity to mine walls |
| 77 | * |
| 78 | * 64 12/09/98 5:28p Jason |
| 79 | * added more options |
| 80 | * |
| 81 | * 63 12/08/98 2:29p Jason |
| 82 | * fog rendering changes for patch |
| 83 | * |
| 84 | * 62 10/21/98 9:28p Jason |
| 85 | * Made no lightmaps work globally |
| 86 | * |
| 87 | * 61 10/21/98 12:05p Jason |
| 88 | * changes for data paging |
| 89 | * |
| 90 | * 60 10/17/98 3:10p Jason |
| 91 | * added Set/Get error message stuff |
| 92 | * |
| 93 | * 59 10/08/98 3:36p Jason |
| 94 | * fixes for the demo |
| 95 | * |
| 96 | * 58 9/25/98 1:17a Jason |
| 97 | * added rend_SetCoplanarPolygonOffset functions |
| 98 | * |
| 99 | * 57 9/18/98 1:28p Jason |
| 100 | * cleaned up renderer initting |
| 101 | * |
| 102 | * 56 9/11/98 4:03p Jason |
| 103 | * added better multitexture support |
| 104 | * |
| 105 | * 55 6/11/98 3:38p Jason |
| 106 | * added a general StateLimit render boolean for APIs that are state |
| 107 | * limited (like OpenGL or D3D) |
| 108 | * |
| 109 | * 54 6/09/98 4:47p Jason |
| 110 | * added windowed openGL mode |
| 111 | * |
| 112 | * 53 5/26/98 3:59p Jason |
| 113 | * added LIGHTMAP_BLEND_CONSTANT alpha type |
| 114 | * |
| 115 | * 52 5/20/98 5:44p Jason |
| 116 | * incremental checkin for bumpmapping |
| 117 | * |
| 118 | * 51 5/19/98 12:27p Jason |
| 119 | * cleaned up some 3d stuff |
| 120 | * |
| 121 | * 50 5/06/98 1:39p Jason |
| 122 | * added rend_SetResolution |
| 123 | * |
| 124 | * 49 5/06/98 10:51a Jeff |
| 125 | * put rend_DrawScaledChunkBitmap back in the header |
| 126 | * |
| 127 | * 48 5/05/98 3:02p Jason |
| 128 | * attempting to add different screen resolutions |
| 129 | * |
| 130 | * 46 4/23/98 6:38p Jason |
| 131 | * made bitmaps use 1555 format |
| 132 | * |
| 133 | * 45 4/17/98 4:27p Jason |
| 134 | * added alpha per vertex stuff to drawscaledbitmap |
| 135 | * |
| 136 | * 44 4/08/98 12:27p Jason |
| 137 | * added rend_drawsimplebitmap |
| 138 | * |
| 139 | * 43 4/01/98 12:02p Jason |
| 140 | * incremental checkin for rendering changes |
| 141 | * |
| 142 | * 42 3/13/98 1:22p Jason |
| 143 | * Moved UseHardware flag to the renderer lib where it belongs |
| 144 | * |
| 145 | * 41 3/03/98 6:50p Jason |
| 146 | * added gamma stuff in preferred state |
| 147 | * |
| 148 | * 40 3/02/98 5:53p Jason |
| 149 | * added gamma functionality |
| 150 | * |
| 151 | * 39 2/14/98 10:48p Jason |
| 152 | * got preferred rendering working |
| 153 | * |
| 154 | * 38 2/12/98 1:32p Jason |
| 155 | * got mipmapping working |
| 156 | * |
| 157 | * 37 2/05/98 6:53p Jason |
| 158 | * added new weapon slot |
| 159 | * |
| 160 | * 36 2/03/98 3:16p Jason |
| 161 | * added the ability to specify saturation textures for models |
| 162 | * |
| 163 | * 35 1/28/98 5:37p Jason |
| 164 | * added streamer weapons |
| 165 | * |
| 166 | * 34 1/19/98 2:32p Jason |
| 167 | * added the ability to set clear flags on rend_StartFrame |
| 168 | * |
| 169 | * 33 1/16/98 11:54a Samir |
| 170 | * Added support for rendering chunked bitmaps. |
| 171 | * |
| 172 | * 32 1/15/98 6:32p Jason |
| 173 | * added v wrapping for sky textures |
| 174 | * |
| 175 | * 31 12/22/97 7:23p Samir |
| 176 | * took out transparent colors again. |
| 177 | * |
| 178 | * 30 12/22/97 7:15p Samir |
| 179 | * removed references of ddgr and gr.h. replace with grdefs.h |
| 180 | * |
| 181 | * 29 12/19/97 5:22p Samir |
| 182 | * Added more drawing primatives for software. |
| 183 | * |
| 184 | * 28 12/19/97 2:18p Jason |
| 185 | * fixed some more 2d/3d integration |
| 186 | * |
| 187 | * 27 12/19/97 12:20p Jason |
| 188 | * changes for better 2d/3d system integration |
| 189 | * |
| 190 | * 26 11/25/97 12:33p Jason |
| 191 | * added antialiasing mode |
| 192 | * |
| 193 | * 25 11/19/97 5:25p Jason |
| 194 | * added new alpha mode - AT_FLAT_BLEND |
| 195 | * |
| 196 | * 24 11/13/97 4:06p Jason |
| 197 | * added rend_DrawLFBBitmap |
| 198 | * |
| 199 | * 23 11/13/97 3:52p Jason |
| 200 | * added lfb stuff for renderer |
| 201 | * |
| 202 | * 22 10/29/97 12:36p Jason |
| 203 | * remove byte/bool conflicts in the renderer lib |
| 204 | * |
| 205 | * 21 10/24/97 4:39p Jason |
| 206 | * added support to not write into the zbuffer |
| 207 | * |
| 208 | * 20 10/24/97 2:29p Jason |
| 209 | * added alpha saturation type |
| 210 | * |
| 211 | * 19 10/22/97 4:19p Jason |
| 212 | * added smoke trail effects |
| 213 | * |
| 214 | * 18 10/15/97 5:20p Jason |
| 215 | * did a HUGE overhaul of the bitmap system |
| 216 | * |
| 217 | * 17 10/13/97 3:56p Jason |
| 218 | * made a better 3d bitmap system |
| 219 | * |
| 220 | * 16 9/16/97 4:09p Jason |
| 221 | * implemented software zbuffer |
| 222 | * |
| 223 | * 15 9/09/97 12:09p Jason |
| 224 | * took transparency out of texture_types |
| 225 | * |
| 226 | * 14 9/09/97 11:44a Jason |
| 227 | * changed the way alpha works with the renderer |
| 228 | * |
| 229 | * 13 9/04/97 5:52p Matt |
| 230 | * Took out include of 3d.h |
| 231 | * |
| 232 | * 12 8/29/97 11:59a Jason |
| 233 | * implemented screenshot functions |
| 234 | * |
| 235 | * 11 8/24/97 2:45p Jason |
| 236 | * implemented texture wrapping |
| 237 | * |
| 238 | * 10 8/07/97 11:46a Jason |
| 239 | * implemented tmap overlay system |
| 240 | * |
| 241 | * 9 8/06/97 11:43a Jason |
| 242 | * made lightmaps work correctly in the terrain |
| 243 | * |
| 244 | * 8 8/04/97 6:46p Jason |
| 245 | * added code for a lightmap system |
| 246 | * |
| 247 | * 7 8/04/97 3:28p Jason |
| 248 | * added alpha blending per texture |
| 249 | * |
| 250 | * 6 7/20/97 7:36p Jason |
| 251 | * added support for colored fog |
| 252 | * |
| 253 | * 2 6/24/97 7:45p Matt |
| 254 | * Removed include of manage.h |
| 255 | * |
| 256 | * 1 6/23/97 9:25p Samir |
| 257 | * added because source safe sucks |
| 258 | * |
| 259 | * 11 6/16/97 5:02p Jason |
| 260 | * added flip function |
| 261 | * |
| 262 | * 10 6/16/97 3:44p Jason |
| 263 | * added line drawing |
| 264 | * |
| 265 | * 9 6/16/97 2:54p Jason |
| 266 | * added rend_DrawFontCharacter function for drawing fonts |
| 267 | * |
| 268 | * 8 6/16/97 2:34p Jason |
| 269 | * added 3dfx support |
| 270 | * |
| 271 | * 7 6/06/97 11:35a Jason |
| 272 | * added missing functions for pixel primitives |
| 273 | * |
| 274 | * 6 6/03/97 12:19p Jason |
| 275 | * more functions added for opengl |
| 276 | * |
| 277 | * 5 5/27/97 4:39p Jason |
| 278 | * changes to support OpenGL |
| 279 | * |
| 280 | * 4 5/22/97 11:59a Jason |
| 281 | * add a ScaleBitmap function to the abstracted render library |
| 282 | * |
| 283 | * 3 5/21/97 12:30p Jason |
| 284 | * calls rend_start and rend_end when frames begin/end |
| 285 | * |
| 286 | * 2 5/19/97 5:10p Jason |
| 287 | * changes for our new abstracted renderer code |
| 288 | * |
| 289 | * 1 5/19/97 3:23p Jason |
| 290 | * |
| 291 | * $NoKeywords: $ |
| 292 | */ |
| 293 | |
| 294 | #ifndef RENDERER_H |
| 295 | #define RENDERER_Hcxx . . $ `lib/renderer.h:295:9`! |
| 296 | |
| 297 | #include <memory> |
| 298 | #include "pstypes.h"cxx . . $ `<file>/lib/pstypes.h`/ |
| 299 | #include "grdefs.h"cxx . . $ `<file>/lib/grdefs.h`/ |
| 300 | |
| 301 | // Declare this here so we don't need to include 3d.h |
| 302 | typedef struct g3Pointcxx . . $ g3Point# g3Pointcxx . . $ g3Point#; |
| 303 | typedef struct chunked_bitmapcxx . . $ chunked_bitmap# chunked_bitmapcxx . . $ chunked_bitmap#; |
| 304 | |
| 305 | // for rend_Init prototype |
| 306 | class oeApplicationcxx . . $ oeApplication#; |
| 307 | |
| 308 | #define TEXTURE_WIDTHcxx . . $ `lib/renderer.h:308:9`! 128 |
| 309 | #define TEXTURE_HEIGHTcxx . . $ `lib/renderer.h:309:9`! 128 |
| 310 | #define TEXTURE_BPPcxx . . $ `lib/renderer.h:310:9`! 2 |
| 311 | |
| 312 | #define FLAT_SHADE_COLORcxx . . $ `lib/renderer.h:312:9`! 0x7C01 |
| 313 | // If an incoming texture has the above color in it, change that color to this color |
| 314 | #define REPLACEMENT_COLORcxx . . $ `lib/renderer.h:314:9`! 0x07C0 |
| 315 | |
| 316 | extern int Triangles_drawncxx . . $ Triangles_drawn.; |
| 317 | |
| 318 | // Is this hardware or software rendered? |
| 319 | enum renderer_typecxx . . $ renderer_type# { |
| 320 | RENDERER_OPENGLcxx . . $ RENDERER_OPENGL. = 2, |
| 321 | RENDERER_DIRECT3Dcxx . . $ RENDERER_DIRECT3D. = 3, |
| 322 | RENDERER_GLIDEcxx . . $ RENDERER_GLIDE. = 4, // Unused |
| 323 | RENDERER_NONEcxx . . $ RENDERER_NONE. = 5, |
| 324 | }; |
| 325 | |
| 326 | extern renderer_typecxx . . $ renderer_type# Renderer_typecxx . . $ Renderer_type.; |
| 327 | |
| 328 | // renderer clear flags |
| 329 | #define RF_CLEAR_ZBUFFERcxx . . $ `lib/renderer.h:329:9`! 1 |
| 330 | #define RF_CLEAR_COLORcxx . . $ `lib/renderer.h:330:9`! 2 |
| 331 | |
| 332 | // Overlay texture settings |
| 333 | #define OT_NONEcxx . . $ `lib/renderer.h:333:9`! 0 // No overlay |
| 334 | #define OT_BLENDcxx . . $ `lib/renderer.h:334:9`! 1 // Draw a lightmap texture afterwards |
| 335 | #define OT_REPLACEcxx . . $ `lib/renderer.h:335:9`! 2 // Draw a tmap2 style texture afterwards |
| 336 | #define OT_FLAT_BLENDcxx . . $ `lib/renderer.h:336:9`! 3 // Draw a gouraud shaded polygon afterwards |
| 337 | #define OT_BLEND_VERTEXcxx . . $ `lib/renderer.h:337:9`! 4 // Like OT_BLEND, but take constant alpha into account |
| 338 | #define OT_BUMPMAPcxx . . $ `lib/renderer.h:338:9`! 5 // Draw a saturated bumpmap afterwards |
| 339 | #define OT_BLEND_SATURATEcxx . . $ `lib/renderer.h:339:9`! 6 // Add a lightmap in |
| 340 | |
| 341 | extern uint8_tcxx . . $ uint8_t# Overlay_typecxx . . $ Overlay_type.; |
| 342 | extern int Overlay_mapcxx . . $ Overlay_map.; |
| 343 | extern int Bumpmap_readycxx . . $ Bumpmap_ready., Bump_mapcxx . . $ Bump_map.; |
| 344 | extern float Z_biascxx . . $ Z_bias.; |
| 345 | extern bool UseHardwarecxx . . $ UseHardware.; |
| 346 | extern bool StateLimitedcxx . . $ StateLimited.; |
| 347 | extern bool NoLightmapscxx . . $ NoLightmaps.; |
| 348 | extern bool UseMultitexturecxx . . $ UseMultitexture.; |
| 349 | extern bool UseWBuffercxx . . $ UseWBuffer.; |
| 350 | extern bool UseMipmapcxx . . $ UseMipmap.; // DAJ |
| 351 | extern bool ATIRageProcxx . . $ ATIRagePro.; // DAJ |
| 352 | extern bool Formaccxx . . $ Formac.; // DAJ |
| 353 | |
| 354 | class NewBitmapcxx . . $ NewBitmap#; |
| 355 | |
| 356 | // various state setting functions |
| 357 | //------------------------------------ |
| 358 | |
| 359 | // Sets our renderer |
| 360 | void rend_SetRendererTypecxx . . $ rend_SetRendererType(dddea4430b800401).(renderer_typecxx . . $ renderer_type# state); |
| 361 | |
| 362 | #define MAP_TYPE_BITMAPcxx . . $ `lib/renderer.h:362:9`! 0 |
| 363 | #define MAP_TYPE_LIGHTMAPcxx . . $ `lib/renderer.h:363:9`! 1 |
| 364 | #define MAP_TYPE_BUMPMAPcxx . . $ `lib/renderer.h:364:9`! 2 |
| 365 | #define MAP_TYPE_UNKNOWNcxx . . $ `lib/renderer.h:365:9`! 3 |
| 366 | |
| 367 | // lighting state |
| 368 | enum light_statecxx . . $ light_state# { |
| 369 | LS_NONEcxx . . $ LS_NONE., // no lighting, fully lit rendering |
| 370 | LS_GOURAUDcxx . . $ LS_GOURAUD., // Gouraud shading |
| 371 | LS_PHONGcxx . . $ LS_PHONG., // Phong shading |
| 372 | LS_FLAT_GOURAUDcxx . . $ LS_FLAT_GOURAUD. // Take color from flat color |
| 373 | }; |
| 374 | |
| 375 | void rend_SetLightingcxx . . $ rend_SetLighting(e55526c9d3dd1656).(light_statecxx . . $ light_state#); |
| 376 | |
| 377 | enum color_modelcxx . . $ color_model# { |
| 378 | CM_MONOcxx . . $ CM_MONO., // monochromatic (intensity) model - default |
| 379 | CM_RGBcxx . . $ CM_RGB., // RGB model |
| 380 | }; |
| 381 | |
| 382 | // color model |
| 383 | void rend_SetColorModelcxx . . $ rend_SetColorModel(e3c5062d5af601c7).(color_modelcxx . . $ color_model#); |
| 384 | |
| 385 | enum texture_typecxx . . $ texture_type# { |
| 386 | TT_FLATcxx . . $ TT_FLAT., // solid color |
| 387 | TT_LINEARcxx . . $ TT_LINEAR., // textured linearly |
| 388 | TT_PERSPECTIVEcxx . . $ TT_PERSPECTIVE., // texture perspectively |
| 389 | TT_LINEAR_SPECIALcxx . . $ TT_LINEAR_SPECIAL., // A textured polygon drawn as a flat color |
| 390 | TT_PERSPECTIVE_SPECIALcxx . . $ TT_PERSPECTIVE_SPECIAL., // A textured polygon drawn as a flat color |
| 391 | }; |
| 392 | |
| 393 | // Alpha type flags - used to decide what type of alpha blending to use |
| 394 | #define ATF_CONSTANTcxx . . $ `lib/renderer.h:394:9`! 1 // Take constant alpha into account |
| 395 | #define ATF_TEXTUREcxx . . $ `lib/renderer.h:395:9`! 2 // Take texture alpha into account |
| 396 | #define ATF_VERTEXcxx . . $ `lib/renderer.h:396:9`! 4 // Take vertex alpha into account |
| 397 | |
| 398 | // Alpha types |
| 399 | #define AT_ALWAYScxx . . $ `lib/renderer.h:399:9`! 0 // Alpha is always 255 (1.0) |
| 400 | #define AT_CONSTANTcxx . . $ `lib/renderer.h:400:9`! 1 // constant alpha across the whole image |
| 401 | #define AT_TEXTUREcxx . . $ `lib/renderer.h:401:9`! 2 // Only uses texture alpha |
| 402 | #define AT_CONSTANT_TEXTUREcxx . . $ `lib/renderer.h:402:9`! 3 // Use texture * constant alpha |
| 403 | #define AT_VERTEXcxx . . $ `lib/renderer.h:403:9`! 4 // Use vertex alpha only |
| 404 | #define AT_CONSTANT_VERTEXcxx . . $ `lib/renderer.h:404:9`! 5 // Use vertex * constant alpha |
| 405 | #define AT_TEXTURE_VERTEXcxx . . $ `lib/renderer.h:405:9`! 6 // Use texture * vertex alpha |
| 406 | #define AT_CONSTANT_TEXTURE_VERTEXcxx . . $ `lib/renderer.h:406:9`! 7 // Use all three (texture constant vertex) |
| 407 | #define AT_LIGHTMAP_BLENDcxx . . $ `lib/renderer.h:407:9`! 8 // dest*src colors |
| 408 | #define AT_SATURATE_TEXTUREcxx . . $ `lib/renderer.h:408:9`! 9 // Saturate up to white when blending |
| 409 | #define AT_FLAT_BLENDcxx . . $ `lib/renderer.h:409:9`! 10 // Like lightmap blend, but uses gouraud shaded flat polygon |
| 410 | #define AT_ANTIALIAScxx . . $ `lib/renderer.h:410:9`! 11 // Draws an antialiased polygon |
| 411 | #define AT_SATURATE_VERTEXcxx . . $ `lib/renderer.h:411:9`! 12 // Saturation with vertices |
| 412 | #define AT_SATURATE_CONSTANT_VERTEXcxx . . $ `lib/renderer.h:412:9`! 13 // Constant*vertex saturation |
| 413 | #define AT_SATURATE_TEXTURE_VERTEXcxx . . $ `lib/renderer.h:413:9`! 14 // Texture * vertex saturation |
| 414 | #define AT_LIGHTMAP_BLEND_VERTEXcxx . . $ `lib/renderer.h:414:9`! 15 // Like AT_LIGHTMAP_BLEND, but take vertex alpha into account |
| 415 | #define AT_LIGHTMAP_BLEND_CONSTANTcxx . . $ `lib/renderer.h:415:9`! 16 // Like AT_LIGHTMAP_BLEND, but take constant alpha into account |
| 416 | #define AT_SPECULARcxx . . $ `lib/renderer.h:416:9`! 32 |
| 417 | #define AT_LIGHTMAP_BLEND_SATURATEcxx . . $ `lib/renderer.h:417:9`! 33 // Light lightmap blend, but add instead of multiply |
| 418 | |
| 419 | #define LFB_LOCK_READcxx . . $ `lib/renderer.h:419:9`! 0 |
| 420 | #define LFB_LOCK_WRITEcxx . . $ `lib/renderer.h:420:9`! 1 |
| 421 | |
| 422 | enum wrap_typecxx . . $ wrap_type# { |
| 423 | WT_WRAPcxx . . $ WT_WRAP., // Texture repeats |
| 424 | WT_CLAMPcxx . . $ WT_CLAMP., // Texture clamps |
| 425 | WT_WRAP_Vcxx . . $ WT_WRAP_V. // Texture wraps in v |
| 426 | }; |
| 427 | |
| 428 | struct rendering_statecxx . . $ rendering_state# { |
| 429 | int8_t inittedcxx . . $ rendering_state#initted.; |
| 430 | |
| 431 | int8_t cur_bilinear_statecxx . . $ rendering_state#cur_bilinear_state.; |
| 432 | int8_t cur_zbuffer_statecxx . . $ rendering_state#cur_zbuffer_state.; |
| 433 | int8_t cur_fog_statecxx . . $ rendering_state#cur_fog_state.; |
| 434 | int8_t cur_mip_statecxx . . $ rendering_state#cur_mip_state.; |
| 435 | |
| 436 | texture_typecxx . . $ texture_type# cur_texture_typecxx . . $ rendering_state#cur_texture_type.; |
| 437 | color_modelcxx . . $ color_model# cur_color_modelcxx . . $ rendering_state#cur_color_model.; |
| 438 | light_statecxx . . $ light_state# cur_light_statecxx . . $ rendering_state#cur_light_state.; |
| 439 | int8_t cur_alpha_typecxx . . $ rendering_state#cur_alpha_type.; |
| 440 | |
| 441 | wrap_typecxx . . $ wrap_type# cur_wrap_typecxx . . $ rendering_state#cur_wrap_type.; |
| 442 | |
| 443 | float cur_fog_startcxx . . $ rendering_state#cur_fog_start., cur_fog_endcxx . . $ rendering_state#cur_fog_end.; |
| 444 | float cur_near_zcxx . . $ rendering_state#cur_near_z., cur_far_zcxx . . $ rendering_state#cur_far_z.; |
| 445 | float gamma_valuecxx . . $ rendering_state#gamma_value.; |
| 446 | |
| 447 | int cur_alphacxx . . $ rendering_state#cur_alpha.; |
| 448 | ddgr_colorcxx . . $ ddgr_color# cur_colorcxx . . $ rendering_state#cur_color.; |
| 449 | ddgr_colorcxx . . $ ddgr_color# cur_fog_colorcxx . . $ rendering_state#cur_fog_color.; |
| 450 | |
| 451 | int8_t cur_texture_qualitycxx . . $ rendering_state#cur_texture_quality.; // 0-none, 1-linear, 2-perspective |
| 452 | |
| 453 | int clip_x1cxx . . $ rendering_state#clip_x1., clip_x2cxx . . $ rendering_state#clip_x2., clip_y1cxx . . $ rendering_state#clip_y1., clip_y2cxx . . $ rendering_state#clip_y2.; |
| 454 | int screen_widthcxx . . $ rendering_state#screen_width., screen_heightcxx . . $ rendering_state#screen_height.; |
| 455 | |
| 456 | }; |
| 457 | |
| 458 | struct renderer_preferred_statecxx . . $ renderer_preferred_state# { |
| 459 | uint8_tcxx . . $ uint8_t# mippingcxx . . $ renderer_preferred_state#mipping.; |
| 460 | uint8_tcxx . . $ uint8_t# filteringcxx . . $ renderer_preferred_state#filtering.; |
| 461 | float gammacxx . . $ renderer_preferred_state#gamma.; |
| 462 | uint8_tcxx . . $ uint8_t# bit_depthcxx . . $ renderer_preferred_state#bit_depth.; |
| 463 | int widthcxx . . $ renderer_preferred_state#width., heightcxx . . $ renderer_preferred_state#height.; |
| 464 | uint8_tcxx . . $ uint8_t# vsync_oncxx . . $ renderer_preferred_state#vsync_on.; |
| 465 | }; |
| 466 | |
| 467 | struct renderer_lfbcxx . . $ renderer_lfb# { |
| 468 | int typecxx . . $ renderer_lfb#type.; |
| 469 | uint16_tcxx . . $ uint16_t# *datacxx . . $ renderer_lfb#data.; |
| 470 | int bytes_per_rowcxx . . $ renderer_lfb#bytes_per_row.; |
| 471 | }; |
| 472 | |
| 473 | struct tRendererStatscxx . . $ tRendererStats# { |
| 474 | int poly_countcxx . . $ tRendererStats#poly_count.; |
| 475 | int vert_countcxx . . $ tRendererStats#vert_count.; |
| 476 | int texture_uploadscxx . . $ tRendererStats#texture_uploads.; |
| 477 | }; |
| 478 | |
| 479 | // returns rendering statistics for the frame |
| 480 | void rend_GetStatisticscxx . . $ rend_GetStatistics(65752c52ae58fada).(tRendererStatscxx . . $ tRendererStats# *stats); |
| 481 | |
| 482 | void rend_SetTextureTypecxx . . $ rend_SetTextureType(cccd9781d96f97ff).(texture_typecxx . . $ texture_type#); |
| 483 | |
| 484 | // Given a handle to a bitmap and nv point vertices, draws a 3D polygon |
| 485 | void rend_DrawPolygon3Dcxx . . $ rend_DrawPolygon3D(3928f75259b907be).(int handle, g3Pointcxx . . $ g3Point# **p, int nv, int map_type = MAP_TYPE_BITMAPcxx . . $ `lib/renderer.h:362:9`!); |
| 486 | |
| 487 | // Given a handle to a bitmap and nv point vertices, draws a 2D polygon |
| 488 | void rend_DrawPolygon2Dcxx . . $ rend_DrawPolygon2D(1464bdba6025a51).(int handle, g3Pointcxx . . $ g3Point# **p, int nv); |
| 489 | |
| 490 | // Tells the software renderer whether or not to use mipping |
| 491 | void rend_SetMipStatecxx . . $ rend_SetMipState(4af4fd0e2b26c4ac).(int8_t); |
| 492 | |
| 493 | // Sets the fog state to TRUE or FALSE |
| 494 | void rend_SetFogStatecxx . . $ rend_SetFogState(4af4fd0e2b26c4ac).(int8_t on); |
| 495 | |
| 496 | // Sets the near and far plane of fog |
| 497 | void rend_SetFogBorderscxx . . $ rend_SetFogBorders(5102ef758adc0ae7).(float fog_near, float fog_far); |
| 498 | |
| 499 | // Sets the color for fill based primitives; |
| 500 | void rend_SetFlatColorcxx . . $ rend_SetFlatColor(cb2f890c2fdad230).(ddgr_colorcxx . . $ ddgr_color# color); |
| 501 | |
| 502 | // Tells the renderer we're starting a frame. Clear flags tells the renderer |
| 503 | // what buffer (if any) to clear |
| 504 | void rend_StartFramecxx . . $ rend_StartFrame(1559a299834bcdd5).(int x1, int y1, int x2, int y2, int clear_flags = RF_CLEAR_ZBUFFERcxx . . $ `lib/renderer.h:329:9`!); |
| 505 | |
| 506 | // Tells the renderer the frame is over |
| 507 | void rend_EndFramecxx . . $ rend_EndFrame(49f6e7a06ebc5aa8).(); |
| 508 | |
| 509 | // Init our renderer, pass the application object also. |
| 510 | int rend_Initcxx . . $ rend_Init(ae0da8e3769500f1).(renderer_typecxx . . $ renderer_type# state, oeApplicationcxx . . $ oeApplication# *app, renderer_preferred_statecxx . . $ renderer_preferred_state# *pref_state); |
| 511 | |
| 512 | // de-init the renderer |
| 513 | void rend_Closecxx . . $ rend_Close(49f6e7a06ebc5aa8).(); |
| 514 | |
| 515 | // Draws a scaled 2d bitmap to our buffer |
| 516 | // NOTE: scripts are expecting the old prototype that has a zvalue (which is ignored) before color |
| 517 | void rend_DrawScaledBitmapcxx . . $ rend_DrawScaledBitmap(bffd21ce5f93b71b).(int x1, int y1, int x2, int y2, int bm, float u0, float v0, float u1, float v1, |
| 518 | int color = -1, float *alphas = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 519 | |
| 520 | // Sets the state of bilinear filtering for our textures |
| 521 | void rend_SetFilteringcxx . . $ rend_SetFiltering(4af4fd0e2b26c4ac).(int8_t state); |
| 522 | |
| 523 | // Sets the state of zbuffering to on or off |
| 524 | void rend_SetZBufferStatecxx . . $ rend_SetZBufferState(4af4fd0e2b26c4ac).(int8_t state); |
| 525 | |
| 526 | // Sets the near and far planes for z buffer |
| 527 | void rend_SetZValuescxx . . $ rend_SetZValues(5102ef758adc0ae7).(float nearz, float farz); |
| 528 | |
| 529 | // Sets a bitmap as an overlay to rendered on top of the next texture map |
| 530 | void rend_SetOverlayMapcxx . . $ rend_SetOverlayMap(d4f767463ce0a6b3).(int handle); |
| 531 | |
| 532 | // Sets the type of overlay operation |
| 533 | void rend_SetOverlayTypecxx . . $ rend_SetOverlayType(ac50b47256ae7414).(uint8_tcxx . . $ uint8_t# type); |
| 534 | |
| 535 | // Clears the display to a specified color |
| 536 | void rend_ClearScreencxx . . $ rend_ClearScreen(cb2f890c2fdad230).(ddgr_colorcxx . . $ ddgr_color# color); |
| 537 | |
| 538 | // Fills a rectangle on the display |
| 539 | void rend_FillRectcxx . . $ rend_FillRect(fe09a4b73d8d396f).(ddgr_colorcxx . . $ ddgr_color# color, int x1, int y1, int x2, int y2); |
| 540 | |
| 541 | // Sets a pixel on the display |
| 542 | void rend_SetPixelcxx . . $ rend_SetPixel(8c880916ccadf15d).(ddgr_colorcxx . . $ ddgr_color# color, int x, int y); |
| 543 | |
| 544 | // Sets a pixel on the display |
| 545 | ddgr_colorcxx . . $ ddgr_color# rend_GetPixelcxx . . $ rend_GetPixel(58c590d1186ea715).(int x, int y); |
| 546 | |
| 547 | // Sets up a font character to draw. We draw our fonts as pieces of textures |
| 548 | void rend_DrawFontCharactercxx . . $ rend_DrawFontCharacter(d3f982e0313c7b8c).(int bm_handle, int x1, int y1, int x2, int y2, float u, float v, float w, float h); |
| 549 | |
| 550 | // Draws a line |
| 551 | void rend_DrawLinecxx . . $ rend_DrawLine(748afa4755bc9595).(int x1, int y1, int x2, int y2); |
| 552 | |
| 553 | // Draws spheres |
| 554 | void rend_FillCirclecxx . . $ rend_FillCircle(10de3014ec658f6e).(ddgr_colorcxx . . $ ddgr_color# col, int x, int y, int rad); |
| 555 | |
| 556 | // draws circles |
| 557 | void rend_DrawCirclecxx . . $ rend_DrawCircle(b1146eedae1e1d0b).(int x, int y, int rad); |
| 558 | |
| 559 | // Flips the surface |
| 560 | void rend_Flipcxx . . $ rend_Flip(49f6e7a06ebc5aa8).(); |
| 561 | |
| 562 | // Sets the argb characteristics of the font characters. color1 is the upper left and proceeds clockwise |
| 563 | void rend_SetCharacterParameterscxx . . $ rend_SetCharacterParameters(eda338842932bf2b).(ddgr_colorcxx . . $ ddgr_color# color1, ddgr_colorcxx . . $ ddgr_color# color2, ddgr_colorcxx . . $ ddgr_color# color3, ddgr_colorcxx . . $ ddgr_color# color4); |
| 564 | |
| 565 | // Sets the color of fog |
| 566 | void rend_SetFogColorcxx . . $ rend_SetFogColor(cb2f890c2fdad230).(ddgr_colorcxx . . $ ddgr_color# fogcolor); |
| 567 | |
| 568 | // sets the alpha type |
| 569 | void rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(int8_t); |
| 570 | |
| 571 | // Sets the constant alpha value |
| 572 | void rend_SetAlphaValuecxx . . $ rend_SetAlphaValue(ac50b47256ae7414).(uint8_tcxx . . $ uint8_t# val); |
| 573 | |
| 574 | // Sets the overall alpha scale factor (all alpha values are scaled by this value) |
| 575 | // usefull for motion blur effect |
| 576 | void rend_SetAlphaFactorcxx . . $ rend_SetAlphaFactor(9364e6e7bff7660).(float val); |
| 577 | |
| 578 | // Returns the current Alpha factor |
| 579 | float rend_GetAlphaFactorcxx . . $ rend_GetAlphaFactor(9b8c9e39889c762c).(void); |
| 580 | |
| 581 | // Sets the wrap parameter |
| 582 | void rend_SetWrapTypecxx . . $ rend_SetWrapType(da524b148887c0e7).(wrap_typecxx . . $ wrap_type# val); |
| 583 | |
| 584 | /// Takes a screenshot of the current frame and returns a NewBitmap |
| 585 | stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<NewBitmapcxx . . $ NewBitmap#> rend_Screenshotcxx . . $ rend_Screenshot(9a644bd298f70b13).(); |
| 586 | |
| 587 | // Takes a screenshot of the current frame and puts it into the handle passed |
| 588 | void rend_Screenshotcxx . . $ rend_Screenshot(d4f767463ce0a6b3).(int bm_handle); |
| 589 | |
| 590 | // Adds a bias to each coordinates z value. This is useful for making 2d bitmaps |
| 591 | // get drawn without being clipped by the zbuffer |
| 592 | void rend_SetZBiascxx . . $ rend_SetZBias(9364e6e7bff7660).(float z_bias); |
| 593 | |
| 594 | // Enables/disables writes the depth buffer |
| 595 | void rend_SetZBufferWriteMaskcxx . . $ rend_SetZBufferWriteMask(d4f767463ce0a6b3).(int state); |
| 596 | |
| 597 | // Sets where the software renderer should write to |
| 598 | void rend_SetSoftwareParameterscxx . . $ rend_SetSoftwareParameters(d26b1bbbc1a6742).(float aspect, int width, int height, int pitch, uint8_tcxx . . $ uint8_t# *framebuffer); |
| 599 | |
| 600 | // Fills in some variables so the 3d math routines know how to project |
| 601 | void rend_GetProjectionParameterscxx . . $ rend_GetProjectionParameters(ce8f7825f8908cfa).(int *width, int *height); |
| 602 | void rend_GetProjectionScreenParameterscxx . . $ rend_GetProjectionScreenParameters(a90a5d8ba88c22b1).(int &screenLX, int &screenTY, int &screenW, int &screenH); |
| 603 | |
| 604 | // Returns the aspect ratio of the physical screen |
| 605 | float rend_GetAspectRatiocxx . . $ rend_GetAspectRatio(9b8c9e39889c762c).(); |
| 606 | |
| 607 | // Gets a pointer to a linear frame buffer |
| 608 | void rend_GetLFBLockcxx . . $ rend_GetLFBLock(419d9eae029ed3ee).(renderer_lfbcxx . . $ renderer_lfb# *lfb); |
| 609 | |
| 610 | // Releases an lfb lock |
| 611 | void rend_ReleaseLFBLockcxx . . $ rend_ReleaseLFBLock(419d9eae029ed3ee).(renderer_lfbcxx . . $ renderer_lfb# *lfb); |
| 612 | |
| 613 | // Given a source x,y and width,height, draws any sized bitmap into the renderer lfb |
| 614 | void rend_DrawLFBBitmapcxx . . $ rend_DrawLFBBitmap(5d6120966b2638b4).(int sx, int sy, int w, int h, int dx, int dy, uint16_tcxx . . $ uint16_t# *data, int rowsize); |
| 615 | |
| 616 | // given a chunked bitmap, renders it. |
| 617 | void rend_DrawChunkedBitmapcxx . . $ rend_DrawChunkedBitmap(529c7906ea1e7bf7).(chunked_bitmapcxx . . $ chunked_bitmap# *chunk, int x, int y, uint8_tcxx . . $ uint8_t# alpha); |
| 618 | |
| 619 | // given a chunked bitmap, renders it.scaled |
| 620 | void rend_DrawScaledChunkedBitmapcxx . . $ rend_DrawScaledChunkedBitmap(a8bf607edbcedb63).(chunked_bitmapcxx . . $ chunked_bitmap# *chunk, int x, int y, int neww, int newh, uint8_tcxx . . $ uint8_t# alpha); |
| 621 | |
| 622 | // Draws a line using the states of the renderer |
| 623 | void rend_DrawSpecialLinecxx . . $ rend_DrawSpecialLine(1b637e6b3e24914d).(g3Pointcxx . . $ g3Point# *p0, g3Pointcxx . . $ g3Point# *p1); |
| 624 | |
| 625 | // Sets some global preferences for the renderer |
| 626 | // Returns -1 if it had to use the default resolution/bitdepth |
| 627 | int rend_SetPreferredStatecxx . . $ rend_SetPreferredState(9d6d139eb250c11d).(renderer_preferred_statecxx . . $ renderer_preferred_state# *pref_state); |
| 628 | |
| 629 | // Sets the gamma value |
| 630 | void rend_SetGammaValuecxx . . $ rend_SetGammaValue(9364e6e7bff7660).(float val); |
| 631 | |
| 632 | // Fills in the passed in pointer with the current rendering state |
| 633 | void rend_GetRenderStatecxx . . $ rend_GetRenderState(2ca0d60fb0cb1bea).(rendering_statecxx . . $ rendering_state# *rstate); |
| 634 | |
| 635 | // Draws a simple bitmap at the specified x,y location |
| 636 | void rend_DrawSimpleBitmapcxx . . $ rend_DrawSimpleBitmap(b1146eedae1e1d0b).(int bm_handle, int x, int y); |
| 637 | |
| 638 | // Gets OpenGL ready to work in a window |
| 639 | int rend_InitOpenGLWindowcxx . . $ rend_InitOpenGLWindow(5803d2fe7a27ef5).(oeApplicationcxx . . $ oeApplication# *app, renderer_preferred_statecxx . . $ renderer_preferred_state# *pref_state); |
| 640 | |
| 641 | // Shuts down OpenGL in a window |
| 642 | void rend_CloseOpenGLWindowcxx . . $ rend_CloseOpenGLWindow(49f6e7a06ebc5aa8).(); |
| 643 | |
| 644 | // Sets the state of the OpenGLWindow to on or off |
| 645 | void rend_SetOpenGLWindowStatecxx . . $ rend_SetOpenGLWindowState(393f53130da0eddf).(int state, oeApplicationcxx . . $ oeApplication# *app, renderer_preferred_statecxx . . $ renderer_preferred_state# *pref_state); |
| 646 | |
| 647 | // Sets the hardware bias level for coplanar polygons |
| 648 | // This helps reduce z buffer artifaces |
| 649 | void rend_SetCoplanarPolygonOffsetcxx . . $ rend_SetCoplanarPolygonOffset(9364e6e7bff7660).(float factor); |
| 650 | |
| 651 | // Gets the error message string |
| 652 | const char *rend_GetErrorMessagecxx . . $ rend_GetErrorMessage(33a1f659e94feb42).(); |
| 653 | |
| 654 | // Sets the error message string |
| 655 | void rend_SetErrorMessagecxx . . $ rend_SetErrorMessage(85c52e162fed56f9).(const char *str); |
| 656 | |
| 657 | // Preuploads a bitmap to the card |
| 658 | void rend_PreUploadTextureToCardcxx . . $ rend_PreUploadTextureToCard(3e454b8ccf442868).(int, int); |
| 659 | void rend_FreePreUploadedTexturecxx . . $ rend_FreePreUploadedTexture(3e454b8ccf442868).(int, int); |
| 660 | |
| 661 | // Returns 1 if there is mid video memory, 2 if there is low vid memory, or 0 if there is large vid memory |
| 662 | int rend_LowVidMemcxx . . $ rend_LowVidMem(b126dc7c1de90089).(); |
| 663 | |
| 664 | // Returns 1 if the renderer supports bumpmapping |
| 665 | int rend_SupportsBumpmappingcxx . . $ rend_SupportsBumpmapping(b126dc7c1de90089).(); |
| 666 | |
| 667 | // Gets a bumpmap ready for drawing, or turns off bumpmapping |
| 668 | void rend_SetBumpmapReadyStatecxx . . $ rend_SetBumpmapReadyState(3e454b8ccf442868).(int state, int map); |
| 669 | |
| 670 | // Clears the zbuffer |
| 671 | void rend_ClearZBuffercxx . . $ rend_ClearZBuffer(49f6e7a06ebc5aa8).(); |
| 672 | |
| 673 | // Clears the texture cache |
| 674 | void rend_ResetCachecxx . . $ rend_ResetCache(49f6e7a06ebc5aa8).(); |
| 675 | |
| 676 | // Takes a bitmap and blits it to the screen using linear frame buffer stuff |
| 677 | // X and Y are the destination X,Y. |
| 678 | void rend_CopyBitmapToFramebuffercxx . . $ rend_CopyBitmapToFramebuffer(b1146eedae1e1d0b).(int bm_handle, int x, int y); |
| 679 | |
| 680 | // Gets a renderer ready for a framebuffer copy, or stops a framebuffer copy |
| 681 | void rend_SetFrameBufferCopyStatecxx . . $ rend_SetFrameBufferCopyState(b45ddcbc8423892c).(bool state); |
| 682 | |
| 683 | #if defined(WIN32) |
| 684 | // returns the direct draw object |
| 685 | void *rend_RetrieveDirectDrawObj(void **frontsurf, void **backsurf); |
| 686 | #endif |
| 687 | |
| 688 | #endif |