| 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/3d.h $ |
| 21 | * $Revision: 36 $ |
| 22 | * $Date: 10/21/99 9:27p $ |
| 23 | * $Author: Jeff $ |
| 24 | * |
| 25 | * Header file for Descent 3 3d library |
| 26 | * |
| 27 | * $Log: /DescentIII/Main/Lib/3d.h $ |
| 28 | * |
| 29 | * 36 10/21/99 9:27p Jeff |
| 30 | * B.A. Macintosh code merge |
| 31 | * |
| 32 | * 35 5/13/99 10:57p Jason |
| 33 | * added extra parameter to g3_DrawPoly |
| 34 | * |
| 35 | * 34 4/22/99 5:14p Matt |
| 36 | * Changed the and & or fields in the grCodes struct to cc_and & cc_or, |
| 37 | * since the former names didn't work with some compilers. |
| 38 | * |
| 39 | * 33 3/26/99 3:53p Jason |
| 40 | * returned clip codes to their original order |
| 41 | * |
| 42 | * 32 3/26/99 3:25p Jason |
| 43 | * fixed remaining mirror problems |
| 44 | * |
| 45 | * 31 2/19/99 4:26p Jason |
| 46 | * more work on Katmai support |
| 47 | * |
| 48 | * 30 2/18/99 5:45p Jason |
| 49 | * added custom clip plane |
| 50 | * |
| 51 | * 29 1/26/99 6:39p Jason |
| 52 | * added wall effects code |
| 53 | * |
| 54 | * 28 5/25/98 3:45p Jason |
| 55 | * made g3_DrawPoly return 1 if it drew |
| 56 | * |
| 57 | * 27 5/20/98 5:43p Jason |
| 58 | * incremental checkin for bumpmapping |
| 59 | * |
| 60 | * 26 5/19/98 12:27p Jason |
| 61 | * cleaned up some 3d stuff |
| 62 | * |
| 63 | * 25 5/14/98 12:56p Jason |
| 64 | * changes to help lower memory usage |
| 65 | * |
| 66 | * 24 4/01/98 12:02p Jason |
| 67 | * incremental checkin for rendering changes |
| 68 | * |
| 69 | * 23 2/05/98 11:14a Jason |
| 70 | * added g3_DrawPlanarRotatedBitmap function |
| 71 | * |
| 72 | * 22 1/28/98 5:36p Jason |
| 73 | * added streamer weapons |
| 74 | * |
| 75 | * 21 1/07/98 3:57p Jason |
| 76 | * fixed spelling of triangulation (doh!) |
| 77 | * |
| 78 | * 20 1/07/98 3:55p Jason |
| 79 | * made Triangulate test a user callable function |
| 80 | * |
| 81 | * |
| 82 | * 19 12/29/97 5:49p Samir |
| 83 | * 3d.h doesn't include gr.h anymore. |
| 84 | * |
| 85 | * 18 12/23/97 10:59a Samir |
| 86 | * Temporarily put gr.h back in. |
| 87 | * |
| 88 | * 17 12/22/97 7:21p Samir |
| 89 | * replaced ddvid.h with grdefs.h |
| 90 | * |
| 91 | * 16 12/22/97 6:57p Samir |
| 92 | * Removed instances of gr.h |
| 93 | * |
| 94 | * 15 12/19/97 12:20p Jason |
| 95 | * changes for better 2d/3d system integration |
| 96 | * |
| 97 | * 14 11/10/97 12:10p Jason |
| 98 | * implemented g3_GetMatrixScale |
| 99 | * |
| 100 | * 13 10/22/97 4:18p Jason |
| 101 | * added g3_DrawRotatedBitmap |
| 102 | * |
| 103 | * 12 10/17/97 5:09p Jason |
| 104 | * added more fireball stuff |
| 105 | * |
| 106 | * 11 10/15/97 2:27p Jason |
| 107 | * changes for prelim fireball stuff |
| 108 | * |
| 109 | * 10 10/13/97 3:56p Jason |
| 110 | * made a better 3d bitmap system |
| 111 | * |
| 112 | * 9 9/16/97 4:23p Matt |
| 113 | * Made ClipPolygon() a public function (g3_ClipPolygon()), and added |
| 114 | * g3_FreeTempPoints(). |
| 115 | * |
| 116 | * 8 9/10/97 3:50p Jason |
| 117 | * added code for instancing the unscaled view matrix |
| 118 | * |
| 119 | * 7 9/04/97 11:59a Matt |
| 120 | * Added new function g3_ResetFarClipZ() |
| 121 | * |
| 122 | * 6 9/03/97 2:20p Samir |
| 123 | * Added function to get viewer matrix. |
| 124 | * |
| 125 | * 5 9/02/97 11:07a Jason |
| 126 | * added alpha component to uvl struct |
| 127 | * |
| 128 | * 4 8/20/97 4:17p Matt |
| 129 | * Added g3_GetViewPosition() |
| 130 | * |
| 131 | * 3 8/04/97 6:40p Jason |
| 132 | * added 2nd level UV floats for lightmaps |
| 133 | * |
| 134 | * 2 7/16/97 4:12p Matt |
| 135 | * Changed and cleaned up a bunch of stuff: |
| 136 | * |
| 137 | * 1. Modified clipper to not change the order of the vertices |
| 138 | * 2. Cleaned up drawer/clipper integration |
| 139 | * 3. Renamed internal functions to conform to nameing standards |
| 140 | * 4. Changed tmap drawer to not take list of uvls. UVL values must now |
| 141 | * be added to the points by the caller |
| 142 | * 5. Renamed g3_DrawTmap() to g3_DrawPoly(), and killed the old |
| 143 | * g3_DrawPoly() |
| 144 | * 6. Made line always do 3d clip if they go offscreen |
| 145 | * |
| 146 | * 14 6/25/97 5:45p Matt |
| 147 | * Made 3D draw functions void, to get rid of warnings about bool return |
| 148 | * values that were never used anyway. |
| 149 | * |
| 150 | * 13 5/08/97 8:11p Matt |
| 151 | * Added code to create subwindows that show a subsection of the 3d view |
| 152 | * |
| 153 | * 12 4/10/97 2:24p Jason |
| 154 | * added the existance of a far clip plane. |
| 155 | * |
| 156 | * 11 4/01/97 5:17p Matt |
| 157 | * Got g3_DrawSphere() working |
| 158 | * |
| 159 | * 10 2/28/97 10:43a Matt |
| 160 | * Added g3_DrawBox() to draw a wireframe box (used to show the current |
| 161 | * object in the editor). |
| 162 | * |
| 163 | * 9 2/27/97 5:01p Jason |
| 164 | * added 3d model functionality and created model library |
| 165 | * |
| 166 | * 8 2/26/97 6:00p Matt |
| 167 | * Renamed 3d lib structs for D3 naming convention |
| 168 | * |
| 169 | * 7 2/21/97 7:29p Matt |
| 170 | * Added rgb fields to g3s_uvl struct |
| 171 | * |
| 172 | * 6 2/19/97 3:32p Matt |
| 173 | * gr_DrawPoly() now takes the color |
| 174 | * |
| 175 | * 5 2/07/97 5:58p Matt |
| 176 | * Took out now-obsolete jason_point struct |
| 177 | * Renamed vector.h to vecmat.h |
| 178 | * |
| 179 | * $NoKeywords: $ |
| 180 | */ |
| 181 | |
| 182 | #ifndef _3D_H |
| 183 | #define _3D_Hcxx . . $ `lib/3d.h:183:9`! |
| 184 | |
| 185 | #include "pstypes.h"cxx . . $ `<file>/lib/pstypes.h`/ |
| 186 | #include "vecmat.h"cxx . . $ `<file>/lib/vecmat.h`/ //the vector/matrix library |
| 187 | #include "grdefs.h"cxx . . $ `<file>/lib/grdefs.h`/ |
| 188 | #include "float.h" |
| 189 | |
| 190 | extern int g3d_interp_outlinecxx . . $ g3d_interp_outline.; // if on, polygon models outlined in white |
| 191 | |
| 192 | extern vectorcxx . . $ vector# Matrix_scalecxx . . $ Matrix_scale.; // how the matrix is currently scaled |
| 193 | |
| 194 | // Structure for storing u,v,light values. This structure doesn't have a |
| 195 | // prefix because it was defined somewhere else before it was moved here |
| 196 | struct g3UVLcxx . . $ g3UVL# { |
| 197 | // texture coordinates |
| 198 | float ucxx . . $ g3UVL#u., vcxx . . $ g3UVL#v.; |
| 199 | float u2cxx . . $ g3UVL#u2., v2cxx . . $ g3UVL#v2.; |
| 200 | |
| 201 | unioncxx . . $ g3UVL#$anonymous_type_0# { |
| 202 | float lcxx . . $ g3UVL#$anonymous_type_0#l.; // intensity lighting |
| 203 | float rcxx . . $ g3UVL#$anonymous_type_0#r.; |
| 204 | }; |
| 205 | float gcxx . . $ g3UVL#g., bcxx . . $ g3UVL#b., acxx . . $ g3UVL#a.; // rgba lighting |
| 206 | }; |
| 207 | |
| 208 | // Structure to store clipping codes in a word |
| 209 | struct g3Codescxx . . $ g3Codes# { |
| 210 | uint8_tcxx . . $ uint8_t# cc_orcxx . . $ g3Codes#cc_or., cc_andcxx . . $ g3Codes#cc_and.; |
| 211 | }; |
| 212 | |
| 213 | // flags for point structure |
| 214 | #define PF_PROJECTEDcxx . . $ `lib/3d.h:214:9`! 1 // has been projected, so sx,sy valid |
| 215 | #define PF_FAR_ALPHAcxx . . $ `lib/3d.h:215:9`! 2 // past fog zone |
| 216 | #define PF_TEMP_POINTcxx . . $ `lib/3d.h:216:9`! 4 // created during clip |
| 217 | #define PF_UVcxx . . $ `lib/3d.h:217:9`! 8 // has uv values set |
| 218 | #define PF_Lcxx . . $ `lib/3d.h:218:9`! 16 // has lighting values set |
| 219 | #define PF_RGBAcxx . . $ `lib/3d.h:219:9`! 32 // has RGBA lighting values set |
| 220 | #define PF_UV2cxx . . $ `lib/3d.h:220:9`! 64 // has lightmap uvs as well |
| 221 | #define PF_ORIGPOINTcxx . . $ `lib/3d.h:221:9`! 128 |
| 222 | |
| 223 | // clipping codes flags |
| 224 | #define CC_OFF_LEFTcxx . . $ `lib/3d.h:224:9`! 1 |
| 225 | #define CC_OFF_RIGHTcxx . . $ `lib/3d.h:225:9`! 2 |
| 226 | #define CC_OFF_BOTcxx . . $ `lib/3d.h:226:9`! 4 |
| 227 | #define CC_OFF_TOPcxx . . $ `lib/3d.h:227:9`! 8 |
| 228 | #define CC_OFF_FARcxx . . $ `lib/3d.h:228:9`! 16 |
| 229 | #define CC_OFF_CUSTOMcxx . . $ `lib/3d.h:229:9`! 32 |
| 230 | #define CC_BEHINDcxx . . $ `lib/3d.h:230:9`! 128 |
| 231 | |
| 232 | // Used to store rotated points for mines. Has frame count to indicate |
| 233 | // if rotated, and flag to indicate if projected. |
| 234 | struct g3Pointcxx . . $ g3Point# { |
| 235 | float p3_sxcxx . . $ g3Point#p3_sx., p3_sycxx . . $ g3Point#p3_sy.; // screen x&y |
| 236 | uint8_tcxx . . $ uint8_t# p3_codescxx . . $ g3Point#p3_codes.; // clipping codes |
| 237 | uint8_tcxx . . $ uint8_t# p3_flagscxx . . $ g3Point#p3_flags.; // projected? |
| 238 | int16_tcxx . . $ int16_t# p3_padcxx . . $ g3Point#p3_pad.; // keep structure longword aligned |
| 239 | vectorcxx . . $ vector# p3_veccxx . . $ g3Point#p3_vec.; // x,y,z of rotated point |
| 240 | vectorcxx . . $ vector# p3_vecPreRotcxx . . $ g3Point#p3_vecPreRot.; // original XYZ of the point |
| 241 | g3UVLcxx . . $ g3UVL# p3_uvlcxx . . $ g3Point#p3_uvl.; // uv & lighting values |
| 242 | }; |
| 243 | |
| 244 | // macros to reference x,y,z elements of a 3d point |
| 245 | #define p3_xcxx . . $ `lib/3d.h:245:9`! p3_vec.x |
| 246 | #define p3_ycxx . . $ `lib/3d.h:246:9`! p3_vec.y |
| 247 | #define p3_zcxx . . $ `lib/3d.h:247:9`! p3_vec.z |
| 248 | |
| 249 | // macros to reference individual elements of the uvls struct |
| 250 | #define p3_ucxx . . $ `lib/3d.h:250:9`! p3_uvl.u |
| 251 | #define p3_vcxx . . $ `lib/3d.h:251:9`! p3_uvl.v |
| 252 | #define p3_lcxx . . $ `lib/3d.h:252:9`! p3_uvl.l |
| 253 | #define p3_rcxx . . $ `lib/3d.h:253:9`! p3_uvl.r |
| 254 | #define p3_gcxx . . $ `lib/3d.h:254:9`! p3_uvl.g |
| 255 | #define p3_bcxx . . $ `lib/3d.h:255:9`! p3_uvl.b |
| 256 | #define p3_acxx . . $ `lib/3d.h:256:9`! p3_uvl.a |
| 257 | #define p3_u2cxx . . $ `lib/3d.h:257:9`! p3_uvl.u2 |
| 258 | #define p3_v2cxx . . $ `lib/3d.h:258:9`! p3_uvl.v2 |
| 259 | |
| 260 | // Functions in library |
| 261 | |
| 262 | // 3d system startup and shutdown: |
| 263 | |
| 264 | // initialize the 3d system |
| 265 | void g3_Initcxx . . $ g3_Init(49f6e7a06ebc5aa8).(void); |
| 266 | |
| 267 | // close down the 3d system |
| 268 | void g3_Closecxx . . $ g3_Close(49f6e7a06ebc5aa8).(void); |
| 269 | |
| 270 | // Frame setup functions: |
| 271 | |
| 272 | // start the frame, specifying view position, matrix, & zoom |
| 273 | void g3_StartFramecxx . . $ g3_StartFrame(e35d136ceab5c8a2).(vectorcxx . . $ vector# *view_pos, matrixcxx . . $ matrix# *view_matrix, float zoom); |
| 274 | |
| 275 | // end the frame |
| 276 | void g3_EndFramecxx . . $ g3_EndFrame(49f6e7a06ebc5aa8).(void); |
| 277 | |
| 278 | // get the current view position |
| 279 | void g3_GetViewPositioncxx . . $ g3_GetViewPosition(ec8cf6451c36d470).(vectorcxx . . $ vector# *vp); |
| 280 | |
| 281 | // returns the current view matrix |
| 282 | void g3_GetViewMatrixcxx . . $ g3_GetViewMatrix(dca75c48c9ab5b54).(matrixcxx . . $ matrix# *mat); |
| 283 | |
| 284 | // returns the current unscaled view matrix |
| 285 | void g3_GetUnscaledMatrixcxx . . $ g3_GetUnscaledMatrix(dca75c48c9ab5b54).(matrixcxx . . $ matrix# *mat); |
| 286 | |
| 287 | // allows the user to specify an aspect ratio that overrides the renderer's |
| 288 | void g3_SetAspectRatiocxx . . $ g3_SetAspectRatio(9364e6e7bff7660).(float); |
| 289 | // returns the user-specified aspect ratio used to override the renderer's |
| 290 | float g3_GetAspectRatiocxx . . $ g3_GetAspectRatio(9b8c9e39889c762c).(); |
| 291 | |
| 292 | // Instancing |
| 293 | |
| 294 | // instance at specified point with specified orientation |
| 295 | void g3_StartInstanceMatrixcxx . . $ g3_StartInstanceMatrix(bc315f98e1febb02).(vectorcxx . . $ vector# *pos, matrixcxx . . $ matrix# *orient); |
| 296 | |
| 297 | // instance at specified point with specified orientation |
| 298 | void g3_StartInstanceAnglescxx . . $ g3_StartInstanceAngles(5a7036e8e0f776d8).(vectorcxx . . $ vector# *pos, angveccxx . . $ angvec# *angles); |
| 299 | |
| 300 | // pops the old context |
| 301 | void g3_DoneInstancecxx . . $ g3_DoneInstance(49f6e7a06ebc5aa8).(); |
| 302 | |
| 303 | // Misc utility functions: |
| 304 | |
| 305 | // get current field of view. Fills in angle for x & y |
| 306 | void g3_GetFOVcxx . . $ g3_GetFOV(abb9d6b01b35f6ff).(float *fov_x, float *fov_y); |
| 307 | |
| 308 | // get zoom. For a given window size, return the zoom which will achieve |
| 309 | // the given FOV along the given axis. |
| 310 | float g3_GetZoomcxx . . $ g3_GetZoom(9e9256aa1545a920).(char axis, float fov, int16_tcxx . . $ int16_t# window_width, int16_tcxx . . $ int16_t# window_height); |
| 311 | |
| 312 | // returns the normalized, unscaled view vectors |
| 313 | void g3_GetViewVectorscxx . . $ g3_GetViewVectors(af83aca25ba5b41c).(vectorcxx . . $ vector# *forward, vectorcxx . . $ vector# *up, vectorcxx . . $ vector# *right); |
| 314 | |
| 315 | // returns true if a plane is facing the viewer. takes the unrotated surface |
| 316 | // normal of the plane, and a point on it. The normal need not be normalized |
| 317 | bool g3_CheckNormalFacingcxx . . $ g3_CheckNormalFacing(73e76fc48bf5de61).(vectorcxx . . $ vector# *v, vectorcxx . . $ vector# *norm); |
| 318 | |
| 319 | // Point definition and rotation functions: |
| 320 | |
| 321 | // returns codes_and & codes_or of a list of points numbers |
| 322 | g3Codescxx . . $ g3Codes# g3_CheckCodescxx . . $ g3_CheckCodes(3a3d5e0f7a67be17).(int nv, g3Pointcxx . . $ g3Point# **pointlist); |
| 323 | |
| 324 | // rotates a point. returns codes. does not check if already rotated |
| 325 | uint8_tcxx . . $ uint8_t# g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(g3Pointcxx . . $ g3Point# *dest, vectorcxx . . $ vector# *src); |
| 326 | |
| 327 | // projects a point |
| 328 | void g3_ProjectPointcxx . . $ g3_ProjectPoint(4c7ad40c64d4fb9c).(g3Pointcxx . . $ g3Point# *point); |
| 329 | |
| 330 | // calculate the depth of a point - returns the z coord of the rotated point |
| 331 | float g3_CalcPointDepthcxx . . $ g3_CalcPointDepth(4939a7e530383cd4).(vectorcxx . . $ vector# *pnt); |
| 332 | |
| 333 | // from a 2d point, compute the vector through that point |
| 334 | void g3_Point2Veccxx . . $ g3_Point2Vec(a09ee21f9967de10).(vectorcxx . . $ vector# *v, int16_tcxx . . $ int16_t# sx, int16_tcxx . . $ int16_t# sy); |
| 335 | |
| 336 | // code a point. fills in the p3_codes field of the point, and returns the codes |
| 337 | uint8_tcxx . . $ uint8_t# g3_CodePointcxx . . $ g3_CodePoint(1c2cda054d3314c5).(g3Pointcxx . . $ g3Point# *point); |
| 338 | |
| 339 | // delta rotation functions |
| 340 | vectorcxx . . $ vector# *g3_RotateDeltaXcxx . . $ g3_RotateDeltaX(d723b5782943e8b1).(vectorcxx . . $ vector# *dest, float dx); |
| 341 | vectorcxx . . $ vector# *g3_RotateDeltaYcxx . . $ g3_RotateDeltaY(d723b5782943e8b1).(vectorcxx . . $ vector# *dest, float dy); |
| 342 | vectorcxx . . $ vector# *g3_RotateDeltaZcxx . . $ g3_RotateDeltaZ(d723b5782943e8b1).(vectorcxx . . $ vector# *dest, float dz); |
| 343 | vectorcxx . . $ vector# *g3_RotateDeltaVeccxx . . $ g3_RotateDeltaVec(b4974fe36fbbef6).(vectorcxx . . $ vector# *dest, vectorcxx . . $ vector# *src); |
| 344 | uint8_tcxx . . $ uint8_t# g3_AddDeltaVeccxx . . $ g3_AddDeltaVec(cfbaf9beee45bcf5).(g3Pointcxx . . $ g3Point# *dest, g3Pointcxx . . $ g3Point# *src, vectorcxx . . $ vector# *deltav); |
| 345 | |
| 346 | // Drawing functions: |
| 347 | // draw a polygon |
| 348 | // Parameters: nv - the number of verts in the poly |
| 349 | // pointlist - a pointer to a list of pointers to points |
| 350 | // bm - the bitmap handle if texturing. ignored if flat shading |
| 351 | int g3_DrawPolycxx . . $ g3_DrawPoly(eaf0a58e8bd7fbdc).(int nv, g3Pointcxx . . $ g3Point# **pointlist, int bm, int map_type = 0, g3Codescxx . . $ g3Codes# *clip_codes = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!); |
| 352 | |
| 353 | // draw a sortof sphere - i.e., the 2d radius is proportional to the 3d |
| 354 | // radius, but not to the distance from the eye |
| 355 | void g3_DrawSpherecxx . . $ g3_DrawSphere(d67578e9a982745b).(ddgr_colorcxx . . $ ddgr_color# color, g3Pointcxx . . $ g3Point# *pnt, float rad); |
| 356 | |
| 357 | // like g3_DrawPoly(), but checks to see if facing. If surface normal is |
| 358 | // NULL, this routine must compute it, which will be slow. It is better to |
| 359 | // pre-compute the normal, and pass it to this function. When the normal |
| 360 | // is passed, this function works like g3_CheckNormalFacing() plus |
| 361 | // g3_DrawPoly(). |
| 362 | void g3_CheckAndDrawPolycxx . . $ g3_CheckAndDrawPoly(685a53fd3174869).(int nv, g3Pointcxx . . $ g3Point# **pointlist, int bm, vectorcxx . . $ vector# *norm, vectorcxx . . $ vector# *pnt); |
| 363 | |
| 364 | // draws a line. takes two points. |
| 365 | void g3_DrawLinecxx . . $ g3_DrawLine(79482445f52a1992).(ddgr_colorcxx . . $ ddgr_color# color, g3Pointcxx . . $ g3Point# *p0, g3Pointcxx . . $ g3Point# *p1); |
| 366 | |
| 367 | // draws a bitmap with the specified 3d width & height |
| 368 | // returns 1 if off screen, 0 if drew |
| 369 | void g3_DrawBitmapcxx . . $ g3_DrawBitmap(8d67c7afa700cf9).(vectorcxx . . $ vector# *pos, float width, float height, int bm, int color = -1); |
| 370 | |
| 371 | // Draws a bitmap that has been rotated about its center. Angle of rotation is passed as 'rot_angle' |
| 372 | void g3_DrawRotatedBitmapcxx . . $ g3_DrawRotatedBitmap(b3c51db2a67f6227).(vectorcxx . . $ vector# *pos, anglecxx . . $ angle# rot_angle, float width, float height, int bm, int color = -1); |
| 373 | |
| 374 | // specifies 2d drawing routines to use instead of defaults. Passing |
| 375 | // NULL for either or both restores defaults |
| 376 | void g3_SetSpecialRendercxx . . $ g3_SetSpecialRender(dc80dba7d3dae528).(void (*tmap_drawer)(), void (*flat_drawer)(), int (*line_drawer)()); |
| 377 | |
| 378 | // Object functions: |
| 379 | |
| 380 | // init code for bitmap models |
| 381 | void g3_InitPolygonModelcxx . . $ g3_InitPolygonModel(5d22bdacc48458e8).(void *model_ptr); |
| 382 | |
| 383 | // un-initialize, i.e., convert color entries back to RGB15 |
| 384 | void g3_UninitPolygonModelcxx . . $ g3_UninitPolygonModel(5d22bdacc48458e8).(void *model_ptr); |
| 385 | |
| 386 | // alternate interpreter for morphing object |
| 387 | void g3_DrawMorphingModelcxx . . $ g3_DrawMorphingModel(3fd00686304f14c6).(void *model_ptr, int *model_bitmaps, angveccxx . . $ angvec# *anim_angles, float light, vectorcxx . . $ vector# *new_points); |
| 388 | |
| 389 | // this remaps the 15bpp colors for the models into a new palette. It should |
| 390 | // be called whenever the palette changes |
| 391 | void g3_RemapInterpColorscxx . . $ g3_RemapInterpColors(49f6e7a06ebc5aa8).(void); |
| 392 | |
| 393 | // Draw a wireframe box aligned with the screen. Used for the editor. |
| 394 | // Parameters: color - the color to draw the lines |
| 395 | // pnt - the center point |
| 396 | // rad - specifies the width/2 & height/2 of the box |
| 397 | void g3_DrawBoxcxx . . $ g3_DrawBox(d67578e9a982745b).(ddgr_colorcxx . . $ ddgr_color# color, g3Pointcxx . . $ g3Point# *pnt, float rad); |
| 398 | |
| 399 | // Sets up a custom clipping plane - g3_StartFrame must be called before this is called |
| 400 | void g3_SetCustomClipPlanecxx . . $ g3_SetCustomClipPlane(212e55486d77b625).(uint8_tcxx . . $ uint8_t# state, vectorcxx . . $ vector# *pnt, vectorcxx . . $ vector# *normal); |
| 401 | |
| 402 | // sets the z distance of the far clipping plane |
| 403 | void g3_SetFarClipZcxx . . $ g3_SetFarClipZ(9364e6e7bff7660).(float z); |
| 404 | |
| 405 | // Disables the far clip plane |
| 406 | static inline void g3_ResetFarClipZcxx . . $ g3_ResetFarClipZ(49f6e7a06ebc5aa8).() { g3_SetFarClipZcxx . . $ g3_SetFarClipZ(9364e6e7bff7660).(FLT_MAXcxx . . $ `<external>/18143172452841944454/float.h:104:9`!); } |
| 407 | |
| 408 | // Clips a polygon |
| 409 | // Parameters: pointlist - pointer to a list of pointers to points |
| 410 | // nv - the number of points in the polygon |
| 411 | // cc - the clip codes for this polygon |
| 412 | // Returns: a pointer to a list of pointer of points in the clipped polygon |
| 413 | // NOTE: You MUST call g3_FreeTempPoints() when you're done with the clipped polygon |
| 414 | g3Pointcxx . . $ g3Point# **g3_ClipPolygoncxx . . $ g3_ClipPolygon(729f60102f660017).(g3Pointcxx . . $ g3Point# **pointlist, int *nv, g3Codescxx . . $ g3Codes# *cc); |
| 415 | |
| 416 | // Free up any temp points (created by the clipper) in the given pointlist |
| 417 | // Parameters: pointlist - pointer to list of pointers to points, returned by g3_ClipPolygon() |
| 418 | // nv - the number of points in pointlist |
| 419 | void g3_FreeTempPointscxx . . $ g3_FreeTempPoints(3ae387dc3696f211).(g3Pointcxx . . $ g3Point# **pointlist, int nv); |
| 420 | |
| 421 | // Gets the matrix scale vector |
| 422 | void g3_GetMatrixScalecxx . . $ g3_GetMatrixScale(ec8cf6451c36d470).(vectorcxx . . $ vector# *matrix_scale); |
| 423 | |
| 424 | // Sets the triangulation test to on or off |
| 425 | void g3_SetTriangulationTestcxx . . $ g3_SetTriangulationTest(d4f767463ce0a6b3).(int state); |
| 426 | |
| 427 | // draws a line based on the current setting of render states. takes two points. returns true if drew |
| 428 | void g3_DrawSpecialLinecxx . . $ g3_DrawSpecialLine(1b637e6b3e24914d).(g3Pointcxx . . $ g3Point# *p0, g3Pointcxx . . $ g3Point# *p1); |
| 429 | |
| 430 | // Draws a bitmap on a specific plane. Also does rotation. Angle of rotation is passed as 'rot_angle' |
| 431 | void g3_DrawPlanarRotatedBitmapcxx . . $ g3_DrawPlanarRotatedBitmap(71c6e0d12bc5318b).(vectorcxx . . $ vector# *pos, vectorcxx . . $ vector# *norm, anglecxx . . $ angle# rot_angle, float width, float height, int bm); |
| 432 | |
| 433 | void g3_TransformVertcxx . . $ g3_TransformVert(f8d5765aeee8bc35).(float res[4], float pt[4], float a[4][4]); |
| 434 | void g3_TransformMultcxx . . $ g3_TransformMult(893694c8b8ecb2b3).(float res[4][4], float a[4][4], float b[4][4]); |
| 435 | void g3_TransformTranscxx . . $ g3_TransformTrans(c276010c1ec1d768).(float res[4][4], float t[4][4]); |
| 436 | void g3_GetModelViewMatrixcxx . . $ g3_GetModelViewMatrix(f698744c99c0df38).(const vectorcxx . . $ vector# *viewPos, const matrixcxx . . $ matrix# *viewMatrix, float *mvMat); |
| 437 | extern float gTransformViewPortcxx . . $ gTransformViewPort.[4][4]; |
| 438 | extern float gTransformProjectioncxx . . $ gTransformProjection.[4][4]; |
| 439 | extern float gTransformModelViewcxx . . $ gTransformModelView.[4][4]; |
| 440 | extern float gTransformFullcxx . . $ gTransformFull.[4][4]; |
| 441 | |
| 442 | void g3_RefreshTransformscxx . . $ g3_RefreshTransforms(b45ddcbc8423892c).(bool usePassthru); |
| 443 | |
| 444 | #endif |