Differences From Artifact [8875dffa42]:
- File
src/rendergl.m
— part of check-in
[75e920ae30]
at
2025-03-29 14:25:43
on branch trunk
— Switch from clang-format to manual formatting
clang-format does too many weird things. (user: js, size: 11657) [annotate] [blame] [check-ins using]
To Artifact [e10c3367c9]:
- File src/rendergl.m — part of check-in [c634a689e7] at 2025-03-29 17:13:40 on branch trunk — More style fixes (user: js, size: 11576) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
54 55 56 57 58 59 60 | char *exts = (char *)glGetString(GL_EXTENSIONS); if (strstr(exts, "GL_EXT_texture_env_combine")) hasoverbright = true; else conoutf(@"WARNING: cannot use overbright lighting, using old " | | | 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | char *exts = (char *)glGetString(GL_EXTENSIONS); if (strstr(exts, "GL_EXT_texture_env_combine")) hasoverbright = true; else conoutf(@"WARNING: cannot use overbright lighting, using old " @"lighting model!"); glGetIntegerv(GL_MAX_TEXTURE_SIZE, &glmaxtexsize); purgetextures(); if (!(qsphere = gluNewQuadric())) fatal(@"glu sphere"); |
︙ | ︙ | |||
100 101 102 103 104 105 106 | } @try { SDL_Surface *converted = SDL_ConvertSurface(s, format, 0); if (converted == NULL) { conoutf(@"texture cannot be converted " | | < | 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | } @try { SDL_Surface *converted = SDL_ConvertSurface(s, format, 0); if (converted == NULL) { conoutf(@"texture cannot be converted " @"to 24bpp: %@", IRI.string); return false; } SDL_FreeSurface(s); s = converted; } @finally { SDL_FreeFormat(format); |
︙ | ︙ | |||
147 148 149 150 151 152 153 | IRI.string); // for voodoo cards under linux scaledimg = OFAllocMemory(1, *xs * *ys * 3); gluScaleImage(GL_RGB, s->w, s->h, GL_UNSIGNED_BYTE, s->pixels, *xs, *ys, GL_UNSIGNED_BYTE, scaledimg); } if (gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGB, *xs, *ys, GL_RGB, | | | 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | IRI.string); // for voodoo cards under linux scaledimg = OFAllocMemory(1, *xs * *ys * 3); gluScaleImage(GL_RGB, s->w, s->h, GL_UNSIGNED_BYTE, s->pixels, *xs, *ys, GL_UNSIGNED_BYTE, scaledimg); } if (gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGB, *xs, *ys, GL_RGB, GL_UNSIGNED_BYTE, scaledimg)) fatal(@"could not build mipmaps"); if (*xs != s->w) free(scaledimg); SDL_FreeSurface(s); |
︙ | ︙ | |||
198 199 200 201 202 203 204 | int num = curtexnum++, frame = aframe.cube_intValue; if (num < 0 || num >= 256 || frame < 0 || frame >= MAXFRAMES) return; mapping[num][frame] = 1; mapname[num][frame] = [name stringByReplacingOccurrencesOfString: @"\\" | | | 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | int num = curtexnum++, frame = aframe.cube_intValue; if (num < 0 || num >= 256 || frame < 0 || frame >= MAXFRAMES) return; mapping[num][frame] = 1; mapname[num][frame] = [name stringByReplacingOccurrencesOfString: @"\\" withString: @"/"]; })) int lookuptexture(int tex, int *xs, int *ys) { int frame = 0; // other frames? int tid = mapping[tex][frame]; |
︙ | ︙ | |||
330 331 332 333 334 335 336 | VARFP(gamma, 30, 100, 300, { float f = gamma / 100.0f; Uint16 ramp[256]; SDL_CalculateGammaRamp(f, ramp); | | | | < | < | > | 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 | VARFP(gamma, 30, 100, 300, { float f = gamma / 100.0f; Uint16 ramp[256]; SDL_CalculateGammaRamp(f, ramp); if (SDL_SetWindowGammaRamp(Cube.sharedInstance.window, ramp, ramp, ramp) == -1) { conoutf( @"Could not set gamma (card/driver doesn't support it?)"); conoutf(@"sdl: %s", SDL_GetError()); } }) void transplayer() { Player *player1 = Player.player1; glLoadIdentity(); glRotated(player1.roll, 0.0, 0.0, 1.0); glRotated(player1.pitch, -1.0, 0.0, 0.0); glRotated(player1.yaw, 0.0, 1.0, 0.0); glTranslated(-player1.origin.x, (player1.state == CS_DEAD ? player1.eyeHeight - 0.2f : 0) - player1.origin.z, -player1.origin.y); } VARP(fov, 10, 105, 120); int xtraverts; VAR(fog, 64, 180, 1024); VAR(fogcolour, 0, 0x8099B3, 0xFFFFFF); VARP(hudgun, 0, 1, 1); OFString *hudgunnames[] = { @"hudguns/fist", @"hudguns/shotg", @"hudguns/chaing", @"hudguns/rocket", @"hudguns/rifle" }; void drawhudmodel(int start, int end, float speed, int base) { Player *player1 = Player.player1; rendermodel(hudgunnames[player1.gunSelect], start, end, 0, 1.0f, OFMakeVector3D(player1.origin.x, player1.origin.z, player1.origin.y), player1.yaw + 90, player1.pitch, false, 1.0f, speed, 0, base); } void drawhudgun(float fovy, float aspect, int farplane) { Player *player1 = Player.player1; |
︙ | ︙ |