Commit graph

40 commits

Author SHA1 Message Date
Ian Curtis edb11dc223 Performance improvements
The old texture code was being bottle necked by the texture reads. We mirrored the real3d texture memory directly, including the mipmaps in a single large texture. I *think* most h/w has some sort of texture cache for a 2x2 or 4x4 block of pixels for a texture. What we were doing was reading the base texture, then reading the mipmap data from a totally separate part of the same texture which I can only assume flushed this cache. What I did was to create mipmap chains for the texture sheet, then copy the mipmap data there. Doing this basically doubles performance.
2024-06-13 13:36:30 +01:00
Ian Curtis c039d08c03 Add supersampling anti-aliasing
Late christmas present. Due to the way alpha works on the model3 adding regular anti-aliasing doesn't really work. Supersampling is very much a brute force solution, render the scene at a higher resolution and mipmap it.

It's enabled via command line with the -ss option, for example -ss=4 for 4x supersampling or by adding Supersampling = 4 in the config file.

Note non power of two values work as well, so 3 gives a very good balance between speed and quality. 8 will make your GPU bleed, since it is essentially rendering 64 pixels for every visible pixel on the screen.
2023-12-26 18:25:03 +00:00
Ian Curtis acab274526 Set language standard to c++ 17 2023-10-30 14:04:48 +00:00
Ian Curtis 6595b9320e Rewrite the renderer a bit to spit out the finished graphics from the 3d chip on separate buffers. One buffer is for opaque pixels, and 2 more for translucent pixels. Before the frame was composited on the back buffer, which meant the tilegen had to have been drawn first. This way the images are now totally independant of the tilegen chip so can be drawn as soon as the register write 0xC is written to the tilegen.
Some games update the tilegen after the ping_ping bit has flipped at 66% of the frame, so we need to split the tilegen drawing up into two stages to get some effects to work. So having the tilegen draw independantly of the 3d chip can make this happen.
2023-10-14 20:05:00 +01:00
Ian Curtis c6ea81d996 Emulate the entire tilegen chip in a GLSL shader. (This is now possible with opengl 3+). The tilegen drawing was emulated on the CPU, but was one of the most expensive functions in the emulator according to a profiler. On a modern GPU it's pretty much free, because a GPU is a massive SIMD monster.
Tilegen shaders are mapped to uniforms, and the vram and palette are mapped to two textures.

TODO rip out the redundant code in the tilegen class. We don't need to pre-calculate palettes anymore. etc

The tilegen code supports has a start/end line so we can emulate as many lines as we want in a chunk, which will come in later as some games update the tilegen immediately after the ping_pong bit has flipped ~ 66% of the frame.

The scud rolling start tilegen bug is probably actually a bug in the original h/w implementation, that ends up looking correct on original h/w but not for us. Need hardware testing to confirm what it's actually doing.
2023-09-23 15:27:04 +01:00
CapitaineSheridan b19fdb6a77 Change Media folder to Assets folder.
Naming variable convention.
Command line change -crosshair-style = vector|bmp.
Config ini variable change CrosshairStyle = vector|bmp.
CCrosshair::DrawCrosshair optimisation.
Modifying UpdateCrosshairs() to eliminate global variable.
2023-03-13 20:18:51 -07:00
CapitaineSheridan 1b066fe4b3 Crosshair refactor
-add a new separate class for crosshair
-crosshair coordinates are calculated by matrix instead of recreating every object at correct coordinates
-add ability to scale crosshair by dpi
-add ability to use bitmap crosshair (located in ./Media/). 32bits bmp format + alpha
-cmd line "-bitmapcrosshair" or "-vectorcrosshair" and/or BitmapCrosshair=0|1 in config file
-these changes are only for lost world game with Crosshairs=1|2|3

don't forget to copy the 2 crosshair images in Supermodel/Media folder
2023-03-13 20:18:51 -07:00
gm-matthew 50d947deee Add FileSystemPath.cpp to Visual Studio project 2022-12-14 00:29:25 -08:00
Ian Curtis 40c8259130 Rewrite the whole project for GL4+. I figured if we removed the limitation of a legacy rendering API we could improve things a bit. With GL4+ we can do unsigned integer math in the shaders. This allows us to upload a direct copy of the real3d texture sheet, and texture directly from this memory given the x/y pos and type. This massively simplifies the binding and invalidation code. Also the crazy corner cases will work because it essentially works the same way as the original hardware.
The standard triangle render requires gl 4.1 core, so should work on mac. The quad renderer runs on 4.5 core. The legacy renderer should still work, and when enabled a regular opengl context will be created, which allows functions marked depreciated in the core profiles to still work. This will only work in windows/linux I think. Apple doesn't support this.

A GL 4.1 GPU is now the min required spec. Sorry if you have an OLDER gpu. GL 4.1 is over 12 years old now.

This is a big update so I apologise in advance if I accidently broke something :]
2022-11-07 21:33:01 +00:00
toxieainc 519d695f57 address review and move bit casts to new header 2022-10-03 17:59:59 -07:00
Ian Curtis 83e7b5f45d njz3: Proper quadrophonic audio support. Need 4+ speakers to take advantage otherwise down mixed to stereo. 2022-06-09 21:10:39 +00:00
Matthew Daniels 5a570ce7fe Adding simulated netboard; all linked games except Sega Rally 2 working at full speed. 2021-04-14 01:20:45 +00:00
Ian Curtis 0bfc2aea31 Fix project file 2021-02-19 11:03:48 +00:00
Ian Curtis ba917aca6d Update glew version 2020-07-31 19:18:51 +00:00
Ian Curtis daef27be37 Replace network code with new tcp implementation 2020-06-16 11:55:38 +00:00
Ian Curtis 8071efbf79 Add SDLnetworking + some basic tcp classes 2020-06-13 19:46:12 +00:00
Ian Curtis 90df4afbad update vs project files 2020-06-08 14:27:37 +00:00
Ian Curtis 8aa476aeeb Previous mpeg audio code worked for me in debug mode, but the release build had some serious corruption issues when being built in visual studio. Replaced the old spaghetti code with a more modern implementation. 2019-02-21 14:56:25 +00:00
Ian Curtis b5f9ad9651 Quad rendering engine. Set QuadRendering = 1 in the ini file to use, or -quad-rendering at the end of the command line to use. 2018-09-13 12:50:34 +00:00
Ian Curtis c7ffd0a808 Draw transparent polys to separate layers and composite at the end. This solves a tonne of transparency errors we had been battling with for a long time. The model3 is strange in the fact it only supports a max of two translucent overlapped polys. They are not blended into the frame normally. Doing this means the topmost translucent polys only are visible in the scene, the equivalent of doing a depth pass first, but without the added cost. 2018-06-16 21:31:29 +00:00
Ian Curtis 04758e38b6 Update make files and fix build for the various options (Harry Tuttle) 2018-01-22 21:01:35 +00:00
Ian Curtis 6efa03112e Rewrite projection maths based upon previously unknown viewport values. The previous values used roughly worked as the normals for frustum planes. Perhaps they were only used for culling and not actually rendering, as sometimes the values don't work correctly. 2018-01-08 18:35:42 +00:00
Ian Curtis 0b6da91cc0 add the rest of the network board code (Spindizzi) 2018-01-07 14:07:59 +00:00
Ian Curtis 78ae00faf1 Add basic networking files to supermodel. Currently these are win32 specific but can port to SDL or whatever later. 2017-12-29 11:42:03 +00:00
Ian Curtis 7c84bc6aeb update visual studio project 2017-10-05 18:54:36 +00:00
Ian Curtis 18f460db6f 2017-09-24 22:49:20 +00:00
Ian Curtis da1342b5d9 update project files 2017-09-24 22:39:53 +00:00
Ian Curtis 06cb5708e3 add missing include 2017-04-08 21:01:11 +00:00
Ian Curtis edfb521a9b Daytona seems to use this completely undocumented feature of the real3d pro-1000, the ability to invert texture colours. This patch fixes the colours on the cars, and the signs which should flash by alternating their colours. 2017-04-05 17:57:38 +00:00
Ian Curtis f320af2049 fix project files 2017-03-27 22:01:31 +00:00
Ian Curtis f0a15febd1 implement scroll fog, fixes a tonne of missing fx 2016-10-09 16:34:12 +00:00
Ian Curtis f4311a0ab2 update visual studio project 2016-07-10 13:11:51 +00:00
Ian Curtis 85c4d85562 refactor 2016-06-19 21:43:09 +00:00
Ian Curtis c2b1db11f8 Cull geometry based on the culling distances in the nodes. Should give some sort of speedup on lower end pcs where the CPU is predominantly the bottle neck. 2016-06-16 20:05:29 +00:00
Ian Curtis 6d1aa4d527 fix compilation 2016-05-03 18:38:06 +00:00
Ian Curtis 09e27e3082 color flag 2016-04-27 16:42:31 +00:00
Ian Curtis 74e7ff3d7d update project 2016-04-27 11:17:28 +00:00
Ian Curtis f09dd457c5 Update vs project for encryption code 2016-04-02 22:14:39 +00:00
Ian Curtis c398cab1b1 update project 2016-03-29 15:29:15 +00:00
Ian Curtis 44ea902181 add missing project file 2016-03-22 22:00:17 +00:00