| 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_OPENGL_H |
| 20 | #define REND_OPENGL_Hcxx . . $ `lib/rend_opengl.h:20:9`! |
| 21 | |
| 22 | #include "renderer.h"cxx . . $ `<file>/lib/renderer.h`/ |
| 23 | #include "3d.h"cxx . . $ `<file>/lib/3d.h`/ |
| 24 | |
| 25 | class oeApplicationcxx . . $ oeApplication#; |
| 26 | |
| 27 | // Starts up opengl |
| 28 | int opengl_Initcxx . . $ opengl_Init(5803d2fe7a27ef5).(oeApplicationcxx . . $ oeApplication# *app, renderer_preferred_statecxx . . $ renderer_preferred_state# *pref_state); |
| 29 | |
| 30 | // Closes down opengl |
| 31 | void opengl_Closecxx . . $ opengl_Close(b45ddcbc8423892c).(const bool just_resizing=false); |
| 32 | void opengl_Shutdowncxx . . $ opengl_Shutdown(49f6e7a06ebc5aa8).(); |
| 33 | |
| 34 | // The main drawing function...draws a flat/textured/gouraud polygon |
| 35 | void opengl_DrawPolygoncxx . . $ opengl_DrawPolygon(3928f75259b907be).(int, g3Pointcxx . . $ g3Point# **, int, int); |
| 36 | |
| 37 | void opengl_SetFlatColorcxx . . $ opengl_SetFlatColor(cb2f890c2fdad230).(ddgr_colorcxx . . $ ddgr_color# color); |
| 38 | |
| 39 | // Ends a frame |
| 40 | void opengl_EndFramecxx . . $ opengl_EndFrame(49f6e7a06ebc5aa8).(); |
| 41 | |
| 42 | // Flips the screen |
| 43 | void opengl_Flipcxx . . $ opengl_Flip(49f6e7a06ebc5aa8).(); |
| 44 | |
| 45 | // Does setup for a new frame |
| 46 | void opengl_BeginFramecxx . . $ opengl_BeginFrame(1559a299834bcdd5).(int, int, int, int, int); |
| 47 | |
| 48 | // Tells opengl what kind of texturing (linear/perspective) we want |
| 49 | void opengl_SetTextureTypecxx . . $ opengl_SetTextureType(cccd9781d96f97ff).(texture_typecxx . . $ texture_type#); |
| 50 | |
| 51 | // Sets the lighting state of opengl |
| 52 | void opengl_SetLightingStatecxx . . $ opengl_SetLightingState(e55526c9d3dd1656).(light_statecxx . . $ light_state# state); |
| 53 | |
| 54 | // Sets the opengl color model (either rgb or mono) |
| 55 | void opengl_SetColorModelcxx . . $ opengl_SetColorModel(e3c5062d5af601c7).(color_modelcxx . . $ color_model# state); |
| 56 | |
| 57 | // Sets the state of bilinear filtering for our textures |
| 58 | void opengl_SetFilteringcxx . . $ opengl_SetFiltering(4af4fd0e2b26c4ac).(int8_t state); |
| 59 | |
| 60 | // Sets the state of zbuffering to on or off |
| 61 | void opengl_SetZBufferStatecxx . . $ opengl_SetZBufferState(4af4fd0e2b26c4ac).(int8_t state); |
| 62 | |
| 63 | // Sets the near/far z values for zbuffering |
| 64 | void opengl_SetZValuescxx . . $ opengl_SetZValues(5102ef758adc0ae7).(float nearz, float farz); |
| 65 | |
| 66 | // Sets a bitmap as a lightmap to rendered on top of the next texture map |
| 67 | // a -1 value indicates no lighting map |
| 68 | void opengl_SetLightingMapcxx . . $ opengl_SetLightingMap(d4f767463ce0a6b3).(int handle); |
| 69 | |
| 70 | // Clears the display to a specified color |
| 71 | void opengl_ClearScreencxx . . $ opengl_ClearScreen(cb2f890c2fdad230).(ddgr_colorcxx . . $ ddgr_color# color); |
| 72 | |
| 73 | // Fills a rectangle on the display |
| 74 | void opengl_FillRectcxx . . $ opengl_FillRect(fe09a4b73d8d396f).(ddgr_colorcxx . . $ ddgr_color# color, int x1, int y1, int x2, int y2); |
| 75 | |
| 76 | // Sets a pixel on the display |
| 77 | void opengl_SetPixelcxx . . $ opengl_SetPixel(8c880916ccadf15d).(ddgr_colorcxx . . $ ddgr_color# color, int x, int y); |
| 78 | |
| 79 | // Sets the near and far plane of fog |
| 80 | void opengl_SetFogBorderscxx . . $ opengl_SetFogBorders(5102ef758adc0ae7).(float nearz, float farz); |
| 81 | |
| 82 | // Sets the fog state to on or off |
| 83 | void opengl_SetFogStatecxx . . $ opengl_SetFogState(4af4fd0e2b26c4ac).(int8_t state); |
| 84 | |
| 85 | // Fills in projection variables |
| 86 | void opengl_GetProjectionParameterscxx . . $ opengl_GetProjectionParameters(ce8f7825f8908cfa).(int *width, int *height); |
| 87 | void opengl_GetProjectionScreenParameterscxx . . $ opengl_GetProjectionScreenParameters(a90a5d8ba88c22b1).(int &screenLX, int &screenTY, int &screenW, int &screenH); |
| 88 | |
| 89 | // Returns the aspect ratio of the physical screen |
| 90 | float opengl_GetAspectRatiocxx . . $ opengl_GetAspectRatio(9b8c9e39889c762c).(); |
| 91 | |
| 92 | // Sets texture wrapping type |
| 93 | void opengl_SetWrapTypecxx . . $ opengl_SetWrapType(da524b148887c0e7).(wrap_typecxx . . $ wrap_type# val); |
| 94 | |
| 95 | // Sets the constant alpha value |
| 96 | void opengl_SetAlphaValuecxx . . $ opengl_SetAlphaValue(ac50b47256ae7414).(uint8_tcxx . . $ uint8_t# val); |
| 97 | |
| 98 | // Sets the overall alpha scale factor (all alpha values are scaled by this value) |
| 99 | // usefull for motion blur effect |
| 100 | void opengl_SetAlphaFactorcxx . . $ opengl_SetAlphaFactor(9364e6e7bff7660).(float val); |
| 101 | |
| 102 | // Returns the current Alpha factor |
| 103 | float opengl_GetAlphaFactorcxx . . $ opengl_GetAlphaFactor(9b8c9e39889c762c).(void); |
| 104 | |
| 105 | // Sets the type of alpha blending you want |
| 106 | void opengl_SetAlphaTypecxx . . $ opengl_SetAlphaType(4af4fd0e2b26c4ac).(int8_t atype); |
| 107 | |
| 108 | // Sets whether or not to write into the zbuffer |
| 109 | void opengl_SetZBufferWriteMaskcxx . . $ opengl_SetZBufferWriteMask(d4f767463ce0a6b3).(int state); |
| 110 | |
| 111 | // Gets the current state of the renderer |
| 112 | void opengl_GetRenderStatecxx . . $ opengl_GetRenderState(2ca0d60fb0cb1bea).(rendering_statecxx . . $ rendering_state# *rstate); |
| 113 | |
| 114 | // draws a line |
| 115 | void opengl_DrawLinecxx . . $ opengl_DrawLine(748afa4755bc9595).(int x1, int y1, int x2, int y2); |
| 116 | |
| 117 | // draws a line |
| 118 | void opengl_DrawSpecialLinecxx . . $ opengl_DrawSpecialLine(1b637e6b3e24914d).(g3Pointcxx . . $ g3Point# *p0, g3Pointcxx . . $ g3Point# *p1); |
| 119 | |
| 120 | // Sets the color that opengl uses for fog |
| 121 | void opengl_SetFogColorcxx . . $ opengl_SetFogColor(cb2f890c2fdad230).(ddgr_colorcxx . . $ ddgr_color# color); |
| 122 | |
| 123 | // Sets the coplanar z bias for rendered polygons |
| 124 | void opengl_SetCoplanarPolygonOffsetcxx . . $ opengl_SetCoplanarPolygonOffset(9364e6e7bff7660).(float factor); |
| 125 | |
| 126 | // Sets up a some global preferences for openGL |
| 127 | int opengl_SetPreferredStatecxx . . $ opengl_SetPreferredState(9d6d139eb250c11d).(renderer_preferred_statecxx . . $ renderer_preferred_state# *pref_state); |
| 128 | |
| 129 | // Sets the gamma correction value |
| 130 | void opengl_SetGammaValuecxx . . $ opengl_SetGammaValue(9364e6e7bff7660).(float val); |
| 131 | |
| 132 | // Takes a screenshot of the frontbuffer and puts it into the passed bitmap handle |
| 133 | void opengl_Screenshotcxx . . $ opengl_Screenshot(d4f767463ce0a6b3).(int bm_handle); |
| 134 | |
| 135 | // Returns the pixel color at x,y |
| 136 | ddgr_colorcxx . . $ ddgr_color# opengl_GetPixelcxx . . $ opengl_GetPixel(58c590d1186ea715).(int, int); |
| 137 | |
| 138 | // Clears the zbuffer |
| 139 | void opengl_ClearZBuffercxx . . $ opengl_ClearZBuffer(49f6e7a06ebc5aa8).(); |
| 140 | |
| 141 | // Clears the texture cache |
| 142 | void opengl_ResetCachecxx . . $ opengl_ResetCache(49f6e7a06ebc5aa8).(); |
| 143 | |
| 144 | // Takes a bitmap and blits it to the screen using linear frame buffer stuff |
| 145 | // X and Y are the destination X,Y |
| 146 | void opengl_CopyBitmapToFramebuffercxx . . $ opengl_CopyBitmapToFramebuffer(b1146eedae1e1d0b).(int bm_handle, int x, int y); |
| 147 | |
| 148 | // Gets a renderer ready for a framebuffer copy, or stops a framebuffer copy |
| 149 | void opengl_SetFrameBufferCopyStatecxx . . $ opengl_SetFrameBufferCopyState(b45ddcbc8423892c).(bool state); |
| 150 | |
| 151 | #if defined(WIN32) |
| 152 | // returns directdraw object |
| 153 | void *opengl_DirectDrawObj(); |
| 154 | #endif |
| 155 | |
| 156 | // returns rendering statistics for the frame |
| 157 | void opengl_GetStatisticscxx . . $ opengl_GetStatistics(65752c52ae58fada).(tRendererStatscxx . . $ tRendererStats# *stats); |
| 158 | |
| 159 | |
| 160 | #endif |