Commit graph

239 commits

Author SHA1 Message Date
Christoph Oelckers
d348377bd8 - when drawing skies on walls where both sides are sky, use the backside's texture.
This fixes a sky anomaly in RR's E1L1.
2021-04-08 09:45:17 +02:00
Christoph Oelckers
7a03967ceb - fixed clipping info not properly reset when rendering the scene in two passes.
We need to reset the gotsector array for that, but since we also need the accumulate result of both passes there's now two such arrays.
2021-04-07 16:52:17 +02:00
Christoph Oelckers
caa8efd3d5 - fixed renderer to avoid bunches of walls that wrap around behind the camera's back. 2021-04-07 16:09:25 +02:00
Christoph Oelckers
4bd44f9d62 - flat sprites use different visibility rules.
Hooray, Build engine, yet another totally nonsensical magic factor with absolutely no reason why...
2021-04-07 12:58:45 +02:00
Christoph Oelckers
6ad0089524 - fixed flat sprites using the sector bit names for checking for being flipped.
Thank you, autocompletion... :(
2021-04-07 12:39:12 +02:00
Christoph Oelckers
59f18f5fa7 - ensure that all HWSprites are oriented with z1 > z2.
This is required by the sorting code to work as intended.
2021-04-07 12:31:47 +02:00
Christoph Oelckers
f9f1d591b3 - must set up fog before textures.
Otherwise the PickTexture callback won't get all needed info.
2021-04-07 10:30:49 +02:00
Christoph Oelckers
3d846f341a - fixed a major clipping issue with the new renderer.
* the bunch drawer can at most process an angular range of 180°. If this gets exceeded it can run into wraparound issues that may cause holes in the geometry.
* there was no clipping to the current field of view so it always checked the full 360°.
2021-04-07 00:02:36 +02:00
Christoph Oelckers
d823ae255e - fixed view clipping for portal sectors.
All lines within the portal must neither be added to the clipper nor checked for obstruction by other parts of the map.
2021-04-06 19:25:40 +02:00
Christoph Oelckers
d193e199f1 - reorganized hightile offset storage. 2021-04-06 15:55:33 +02:00
Christoph Oelckers
16ad5f0cc8 - fixed sky rendering in palette emulation mode.
The sky dome drawer cannot work with indexed textures, but since they are fullbright anyway we can just temporarily disable it.
2021-04-05 21:53:19 +02:00
Christoph Oelckers
7c4e9ea87e - moved palette manager for indexed textures out of glbackend 2021-04-05 20:00:21 +02:00
Christoph Oelckers
e30dc82676 - Cleanup of the voxel code.
* moving polymost_voxdraw into polymost.cpp.
* consolidated all remaining voxel code in hw_voxels.cpp. All original Build voxel code is completely gone now, except for polymost_voxdraw, so this got moved out of the build/ folder.
* integrate Blood's voxel init code into the main function.
* some further cleanup was allowed as a result of this, so engineInit is gone now because these parts can now be done outside the games' app_init functions.
2021-04-05 18:05:43 +02:00
Christoph Oelckers
87efc84c84 - enable palette emulation for the new renderer. 2021-04-05 13:05:31 +02:00
Christoph Oelckers
de2df926e1 - fixed render timing. 2021-04-05 11:54:28 +02:00
Mitchell Richters
172e3996bb - HWSprite::Process(): Added x-off-by-one-fix for sprites similar to yspans from b7bad558da. 2021-04-05 19:37:00 +10:00
Christoph Oelckers
ba41bb4c61 - fixed the viewport setup.
There were two problems here - the math for calculating the rect was wrong and the initial aspect ratio was also not correct.
2021-04-05 10:34:03 +02:00
Christoph Oelckers
c303884274 - better handling for Duke's scrolling cloudy skies.
* Using the Doom-style dome here because it looks better.
* this necessitated changes to the backend to allow both types of sky domes at the same time
* do not clamp panning fields for cloudy sky with the new renderer because this makes the texture jump.
2021-04-04 20:35:38 +02:00
Christoph Oelckers
39c457bbf2 - removed a few unused CVARs carried over from GZDoom. 2021-04-04 19:35:12 +02:00
Christoph Oelckers
ea91b5ba5d - added a map patch for SW:WT's 'skyline' map.
This contains a badly tagged sky sector that makes the new renderer glitch out.
2021-04-04 18:57:03 +02:00
Christoph Oelckers
1201cc71ef - fixed voxel rendering.
No, that 'while' was even pointless in Polymost, much more here where it runs within another loop.
2021-04-04 13:45:43 +02:00
Christoph Oelckers
d76c2ccc34 - voxel rotation. 2021-04-04 13:24:33 +02:00
Christoph Oelckers
d71ebace97 - fixed fog density of the new renderer.
The actual value needs to be a lot lower than for Polymost due to the different projection.
2021-04-03 22:51:31 +02:00
Christoph Oelckers
d7a13fc9f2 - same for the new renderer. 2021-04-03 21:40:32 +02:00
Christoph Oelckers
ab36b86a59 - sky tweaking
* Build skies need a different mesh for the dome - the one from GZDoom distorts them too much.
* made adjustment to the positioning math after redoing the mesh
* Exhumed abuses some strange effect of the original sky placement math which means the y-offsetting must be disabled for this game.
* RRRA sky initialization fixed. It must be done after setting up the tiles.
2021-04-03 21:06:02 +02:00
Christoph Oelckers
dc234ea72d - implemented RR's geometry effect.
The grossest of all gross render hack that were ever done with Build...
2021-04-02 22:52:46 +02:00
Christoph Oelckers
54eee347a6 - do y-flipping of wall textures correctly.
1.f - h is not correct for NPOT texures due to hpw they tile.
2021-04-02 22:50:53 +02:00
Christoph Oelckers
7446d0441b - use LGPLv2 for all Raze specific render code. 2021-04-02 18:22:54 +02:00
Christoph Oelckers
638f19172a - voxel rendering.
The stock voxels of Blood and SW seem to work so far, but not all edge cases have been tested.
2021-04-02 18:20:07 +02:00
Christoph Oelckers
c8a75a8664 - give each DrawInfo its own list of tsprites.
Since these do not fully get processed sequentially the contents need to be preserved until needed.
This required getting rid of the global tsprite array. Polymost still uses a static vatiable, though, but this is only accessed in polymost-exclusive code.
2021-04-02 10:28:40 +02:00
Christoph Oelckers
6afbb82e66 - fixed one-sided wall sprite checks. 2021-04-02 09:04:13 +02:00
Christoph Oelckers
80e5cd0dc5 - fixed some automap issues:
* Blood's automap was not drawn at all.
* SW's automap always showed all sectors
* SW's player sprite was not rendered.
* Non-automap: Forward gotsector to the game code because there's still a few places in Blood that need it.
2021-04-01 20:47:05 +02:00
Christoph Oelckers
85020b374a - use texture clamping on non-tiled walls. 2021-04-01 19:21:24 +02:00
Christoph Oelckers
e1df17964e - fixed handling of SW's shadows.
An out of range shade will only work without fog.
2021-04-01 19:10:43 +02:00
Christoph Oelckers
7bea8ad6ba - fixed texture overlays for SW's sector portals. 2021-03-30 23:27:11 +02:00
Christoph Oelckers
9cccd6f89b - store plane meshes without height information.
This avoids retriangulation when just the plane's z changes.
2021-03-30 20:30:35 +02:00
Christoph Oelckers
6239734bdc - always create geometry for flat sprites in the collection pass.
This still depends on Build's tsprite array which is global so its contents are too volatile for delayed geometry generation.
This needs to be refactored later but it can only be done when Polymost is gone.
2021-03-30 19:58:42 +02:00
Christoph Oelckers
4647a0b2bc - fixed cases of small textures being used for the sky.
Case in Point: DukeDC uses a 64x64 texture with palette remap for the sky.
2021-03-29 23:25:43 +02:00
Christoph Oelckers
6fcb6fa1d5 - sky positioning tweaks.
It does not use the panning info of the wall and needs a texture height relative adjustment.
2021-03-29 22:34:46 +02:00
Christoph Oelckers
92bb9c5319 - fixed display of player in mirrors. 2021-03-29 21:48:23 +02:00
Christoph Oelckers
ab9c7de147 - use texture clamping for all sprites. 2021-03-29 20:18:49 +02:00
Christoph Oelckers
2d0360fa55 - apply depth bias to translucent geometry.
This is necessary to handle wall and floor sprites placed on actual walls and floors work as intended.
2021-03-29 19:45:04 +02:00
Christoph Oelckers
389d61d086 - fixed texture selection for one-sided walls with the one-way flag set. 2021-03-29 09:11:38 +02:00
Christoph Oelckers
18cf208b7d - fixed SW shadows in new renderer.
shade clamping and full sprite sort was missing,
2021-03-28 22:29:13 +02:00
Christoph Oelckers
0ae93318e3 - flip camera textures to have the correct orientation. 2021-03-28 21:00:24 +02:00
Christoph Oelckers
e8edb32e0d - fixed camera texture setup.
They still are upside-down but aside from that work as expected.
2021-03-28 19:22:51 +02:00
Christoph Oelckers
d9ff2fd1e2 - used display size for all texture positioning. 2021-03-28 18:22:30 +02:00
Christoph Oelckers
83760d4974 - fixed a few wall sprite rendering issues.
* masked walls were inserted into the sprite render list, causing sorting issues and depth fighting (see Duke's cameras and the 'closed' sign in Route66/Carnival.map)
* vertical and horizontal wall sprites needed their sorting functions swapped.
* plane clipping for wall sprites used bad coordinates.
2021-03-28 13:09:26 +02:00
Christoph Oelckers
b7bad558da - added y-off-by-one-fix for y-centered sprites. 2021-03-28 12:05:29 +02:00
Mitchell Richters
ffb956749d - HWSprite::Process(): Fix yoff adjustment when spr->cstat & CSTAT_SPRITE_YCENTER. 2021-03-28 20:46:50 +11:00
Christoph Oelckers
9f48b36627 - redid sprite projection math. 2021-03-28 10:49:34 +02:00
Christoph Oelckers
fa44d75e98 - draw regular sprites.
Mostly functional, but the projected size is off.
2021-03-27 23:12:41 +01:00
Christoph Oelckers
7c991d59ac - fixed bad return in sprite processing code. 2021-03-27 15:52:20 +01:00
Christoph Oelckers
0da33096c6 - fixed some wall sprite flickering issues. 2021-03-27 15:24:09 +01:00
Christoph Oelckers
d1c23d1ad0 - fixed wall sprite rendering. 2021-03-27 14:18:33 +01:00
Christoph Oelckers
efe0d57fca - removed all the decal stubs.
Build has wall sprite for decals so this is redundant and ultimately not usable.
2021-03-27 13:26:11 +01:00
Christoph Oelckers
d0f38d7362 - wall sprite WIP. 2021-03-27 13:22:34 +01:00
Christoph Oelckers
1dfb2672a8 - flat sprite rendering! 2021-03-26 20:28:44 +01:00
Christoph Oelckers
fd0e9824b6 - call the game specific analyzesprites functions. 2021-03-26 15:06:14 +01:00
Christoph Oelckers
be7bca8e9e - expose animatesprite set of functions to new renderer as a callback. 2021-03-26 10:05:01 +01:00
Christoph Oelckers
0b1e81023f - added sprite collection loop to ProcessSector and did a bit of cleanup on the TSprite code. 2021-03-25 23:16:32 +01:00
Christoph Oelckers
f6568fee0c - rewrote SW portal setup to use static data instead of ad-hoc setup.
This was by far the messiest game, there's two reasons for this.
First, the portal links do not need to be in an actual portal sector, so they cannot be used to detect portal sectors.
Second, the game moves portals in place, so all offsets are (0,0,0) so that not even these can be used for detection.

The only working method is the super-complicated original way to look up portals at run time, just being done at map start.
Having static portal links should reduce the render glitches quite significantly because the renderer knows now which sectors belong to a portal and can use this information to ensure proper processing.
2021-03-25 21:21:48 +01:00
Christoph Oelckers
af54cf3a3c - made SW's sector portals operational.
Unlike the other games these are so poorly defined that the engine has to rely on the original fudging to pick the proper portal to link to. As a result they are just as limited as they always were.
In addition all the portal search code had to be reinstated.
2021-03-25 16:45:40 +01:00
Christoph Oelckers
168b0385cf - moved shadeToLight out of build.h. 2021-03-25 09:13:59 +01:00
Mitchell Richters
957f7e9487 - Accept binangle, fixedhoriz and lookangle classes in SetupViewpoint() vs. Q16.16 variables.
* Allows for more precision than Q16.16.
* Used as opportunity for `rollang` to be set using the `asdeg()` method, not `asbuildf()`.
2021-03-25 19:06:01 +11:00
Christoph Oelckers
dbbdfaa4ba - sector portals in Blood are working. 2021-03-24 23:11:06 +01:00
Christoph Oelckers
e47b4507e4 - serialize the sector portal offset table.
Due to where this happens, the init code for these portals cannot be run when loading a savegame so it has to be saved.
2021-03-24 18:42:00 +01:00
Christoph Oelckers
1297e4ed02 - SW's line to sprite portals are working now.
Also fixed a clipper issue with Blood's line to line portals.
2021-03-24 10:33:50 +01:00
Christoph Oelckers
9903b39cf5 - make Blood's line to line portal operational.
Note that these portals cannot be rotated, so to preserve bad setups this limitation needs to be replicated.
If we want proper line to line portals for all games they need to be made a different portal type.
2021-03-24 09:04:48 +01:00
Christoph Oelckers
087da46522 - finally got mirrors working. 2021-03-23 21:23:49 +01:00
Christoph Oelckers
c681fa6699 - use Build math for mirror transitions. 2021-03-23 20:30:19 +01:00
Christoph Oelckers
46e0b16370 - fixed ordering issues in drawer
* do not check the clipper in the collection pass to reduce number of bunches. Clipping here brings no performance gain.
* fixed the loop reset in FindClosestBunch to actually process the array's first element.
2021-03-23 19:20:06 +01:00
Christoph Oelckers
0c7f05a416 - let the clipper work exclusively on Build coordinates. 2021-03-22 23:40:25 +01:00
Christoph Oelckers
096ce5e025 - initial sky fixes. 2021-03-22 16:02:52 +01:00
Christoph Oelckers
e884a418f8 - portal WIP 2021-03-22 12:07:29 +01:00
Christoph Oelckers
63f057d93f - portal and sky WIP. 2021-03-21 22:48:01 +01:00
Christoph Oelckers
75159e06c0 - uncommented the portal code in hw_walls.cpp. 2021-03-21 19:36:55 +01:00
Christoph Oelckers
9fe462d358 - adapted GZDoom's portal framework.
Not tested yet and somewhat stripped down, as the portals this needs to support are a lot less complex - plus some of the issues in Doom do not apply here.
2021-03-21 18:41:23 +01:00
Christoph Oelckers
a36377111c - engine-side portal setup for Blood and RRRA. 2021-03-21 14:48:35 +01:00
Christoph Oelckers
b91441f849 - same render interface rework for Shadow Warrior. 2021-03-21 12:22:50 +01:00
Christoph Oelckers
d42ce0ee7e - WIP 2021-03-20 23:01:16 +01:00
Christoph Oelckers
fedfc2cfa4 - removed global variables that were only being used by the automap drawer plus a few other obsolete things. 2021-03-20 16:46:06 +01:00
Christoph Oelckers
88706e8e13 - added a cache for the sector geometry.
Now it only needs recreation if the sector changes.
2021-03-19 23:18:09 +01:00
Mitchell Richters
895b875453 - Invert rollang in hw_entrypoint.cpp:SetupView(). 2021-03-20 08:35:17 +11:00
Christoph Oelckers
93bb774573 - flat alignment.
This still gets redone each frame for each sector and needs to be buffered
2021-03-19 19:53:55 +01:00
Christoph Oelckers
dd15fc54c1 - top texture means RENDERWALL_TOP, not that it matters much at the moment... 2021-03-19 12:02:20 +01:00
Christoph Oelckers
ff8ca99e2b - fixed y alignment of bottom textures.
Despite other settings, they will always take the panning info from their backside.
2021-03-19 11:51:38 +01:00
Christoph Oelckers
f8de712b81 - fixed horizontal panning for bottom textures. 2021-03-19 11:22:24 +01:00
Christoph Oelckers
385cc8cbbd - NPOT texture alignment fixes.
The checks in CheckTexturePosition were not correct and caused unwanted texture shifting.
Also inlined GetYPanning into DoTexture because the pow2size value is needed there and the rest is a simple one-liner to scale the panning.
2021-03-19 10:29:38 +01:00
Christoph Oelckers
9406e6d2ad - fixed the biggest issues with flat rendering 2021-03-18 23:22:51 +01:00
Christoph Oelckers
7dd5b508c8 - flat rendering WIP.
Still buggy triangulation and no texture alignment, but it renders something.
2021-03-18 21:50:02 +01:00
Christoph Oelckers
0579368626 - removed render.cpp, now that everything is in its proper place. 2021-03-18 17:24:58 +01:00
Christoph Oelckers
547ed4e415 - route everything through the full backend, now completely bypassing the intermediate GLInstance layer. 2021-03-18 17:18:03 +01:00
Christoph Oelckers
4cf2493cfd set up the entry point for the renderer. 2021-03-18 14:49:36 +01:00
Christoph Oelckers
c4b3523f05 - moving utilities to more appropriate places. 2021-03-18 12:49:33 +01:00
Christoph Oelckers
6068427270 - port the bunch drawer to the backend's core. 2021-03-18 12:32:31 +01:00
Christoph Oelckers
af6c6c8ef0 - added the DrawInfo class. 2021-03-18 10:23:53 +01:00
Christoph Oelckers
e9dd1c104b - started adding the draw list code from GZDoom. 2021-03-18 10:19:13 +01:00
Christoph Oelckers
0f28069f96 - fixed NPOT shader parameters. RR E1L1's hedges render properly now.
- fixed a few places where wall[0] was accessed.
2021-03-18 09:20:38 +01:00
Christoph Oelckers
2d958745b4 - fixed: Polymost must set the viewpoint if renderers are switched.
- fixed coordinate order in renderSetViewpoint
- fixed backwall checks accidentally testing wall 0 instead of the current wall.
2021-03-18 00:28:38 +01:00
Christoph Oelckers
493294909b - fixed texture alignment
Most cases should be correct now.
2021-03-17 23:29:13 +01:00
Christoph Oelckers
47dce8de8c - partially fixed y-panning and removed the aspect factor.
y-panning is still not correct for all cases but better than before. The aspect factor is not needed, it looks like an artifact of both the software renderer and Polymost.
We get the same dimensions with proper matrices by setting this to 1.
2021-03-17 20:02:50 +01:00
Christoph Oelckers
65097c4098 - set proper visibility factor and viewport. 2021-03-17 19:07:00 +01:00
Christoph Oelckers
b492cbcebb - ported my old Build-style renderer for Doom from 2008 and the wall renderer from GZDoom to work with Build data.
It renders walls, but y-panning is still broken.
2021-03-17 16:54:36 +01:00
Christoph Oelckers
c6f83fa8bd - added GZDoom's clipper. 2021-03-15 19:11:18 +01:00
Christoph Oelckers
2841154683 - moved code around, got a few more utilities from GZDoom. 2020-05-31 10:37:19 +02:00
Christoph Oelckers
1d15fe63a6 - another backend update, pulling in the sky renderer. 2020-05-31 10:32:10 +02:00
Christoph Oelckers
efa1cd3048 - moved video files to 'common'.
# Conflicts:
#	source/blood/src/screen.cpp
2020-05-31 09:19:16 +02:00
Christoph Oelckers
1e2a3da5fd - video base code unified.
# Conflicts:
#	source/core/rendering/v_video.cpp
2020-05-31 09:18:43 +02:00
Christoph Oelckers
edb2cb31ee - backend update with GZDoom model code. 2020-05-31 08:55:00 +02:00
Christoph Oelckers
5728241c1c - updated backend from GZDoom. 2020-05-30 23:10:17 +02:00
Christoph Oelckers
ea08fa0a4e - updated common code.
Most of what got added is still unused.

# Conflicts:
#	source/build/src/palette.cpp

# Conflicts:
#	source/build/src/palette.cpp

# Conflicts:
#	source/common/engine/i_interface.h
2020-05-30 22:28:24 +02:00
Christoph Oelckers
423f758314 - texture code restructuring. 2020-05-30 21:42:35 +02:00
Christoph Oelckers
66809ca9f4 - fixed indexed display of 2D content. 2020-05-29 16:46:36 +02:00
Christoph Oelckers
87a87c155d - moved to GZDoom's gl_hwtexture.cpp. 2020-05-29 01:03:01 +02:00
Christoph Oelckers
72889540a5 - use GZDoom's gl_samplers.cpp 2020-05-28 23:48:50 +02:00
Christoph Oelckers
193b940eef - palette code cleanup. 2020-05-27 22:19:02 +02:00
Christoph Oelckers
d52600663d - backend sync with GZDoom to pull in a few bugfixes and formatting corrections. 2020-05-26 23:12:04 +02:00
Christoph Oelckers
b233cc2ea5 - cleaned out some unused code. 2020-05-26 00:10:44 +02:00
Christoph Oelckers
e0b2497a56 - backend update. 2020-05-26 00:10:21 +02:00
Christoph Oelckers
c4017de12f - updated to GZDoom's new texture management system. 2020-05-25 23:59:07 +02:00
Christoph Oelckers
7a1fda2cc2 - use the 2D drawer's coordinates in the console. 2020-05-25 17:13:26 +02:00
Christoph Oelckers
55a3c62b59 - use GZDoom's 2D drawer.
Console and menu font colors are not ok yet, aside from that it works.
2020-05-25 17:11:32 +02:00
Christoph Oelckers
6bffdf80a1 - finally managed to merge in the original texture system commit.
Game compiles and runs but transparency doesn't work yet.

# Conflicts:
#	source/CMakeLists.txt
#	source/core/menu/menu.cpp
#	source/core/textures/buildtiles.cpp
2020-05-24 22:53:14 +02:00
Christoph Oelckers
7a84887fc4 - transitioned FTexture.
Mostly working. Note: Brightmaps must be per-translation!
2020-05-24 19:12:22 +02:00
Christoph Oelckers
556eb44690 - moved gl_load to 'common'.
# Conflicts:
#	source/CMakeLists.txt
#	source/common/rendering/gl_load/gl_interface.cpp
2020-05-24 16:44:13 +02:00
Christoph Oelckers
d6786cf0eb - final cleanup of picanm code. 2020-05-24 13:53:27 +02:00
Christoph Oelckers
da26d1cec4 - more trivial adjustments. 2020-05-24 00:38:10 +02:00
Christoph Oelckers
00e7b2fa25 - simple stuff from the texture manager inclusion commit.
To get this out of the way first...
2020-05-24 00:27:24 +02:00
Christoph Oelckers
f929419a0a - refactoring of the lookup tables. 2020-05-23 22:43:04 +02:00
Christoph Oelckers
4d44682603 - integrated ZScript backend 2020-05-23 22:43:03 +02:00
Christoph Oelckers
b971bc2717 - avoid using global palette settings when drawing 2D content with a custom palette.
Instead pass the palette info with the render call to avoid stale global state.
2020-05-23 22:43:01 +02:00
Christoph Oelckers
d0406e27b6 - all base palette data has been transitioned to GPalette. 2020-05-23 12:31:05 +02:00
Christoph Oelckers
d46ea7481f - handle RRRA E1L2's fog in the shader instead of hacking the shade tables. 2020-04-12 08:30:43 +02:00
Christoph Oelckers
f1040fa699 - match with GZDoom's console code, move to 'common'. 2020-04-12 08:30:42 +02:00
Christoph Oelckers
8e87674d4c - backend code matching with GZDoom 2020-04-12 08:30:40 +02:00
Christoph Oelckers
2a9813eb5c - code matching with GZDoom. 2020-04-12 08:30:38 +02:00
Christoph Oelckers
6ef93ba514 - match cmdlib.cpp/.h with GZDoom. 2020-04-12 08:30:36 +02:00
Christoph Oelckers
e2f5e8fe34 - renamed 'common' to 'core'.
We'll need 'common' for something else.
2020-04-12 08:30:36 +02:00