1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-06-24 06:03:28 +00:00
CC-Tweaked/src/main/java/dan200/computercraft
Jonathan Coates 11bf601db9
Backport 1.15's terminal rendering code (#412)
This is a backport of 1.15's terminal rendering code with some further
improvements. This duplicates a fair bit of code, and is much more
efficient.

I expect the work done in #409 will supersede this, but that's unlikely
to make its way into the next release so it's worth getting this in for
now.

 - Refactor a lot of common terminal code into
   `FixedWithFontRenderer`. This shouldn't change any behaviour, but
   makes a lot of our terminal renderers (printed pages, terminals,
   monitors) a lot cleaner.

 - Terminal rendering is done using a single mode/vertex format. Rather
   than drawing an untextured quad for the background colours, we use an
   entirely white piece of the terminal font. This allows us to batch
   draws together more elegantly.

 - Some minor optimisations:
   - Skip rendering `"\0"` and `" "` characters. These characters occur
     pretty often, especially on blank monitors and, as the font is empty
     here, it is safe to skip them.
   - Batch together adjacent background cells of the same colour. Again,
     most terminals will have large runs of the same colour, so this is a
     worthwhile optimisation.

   These optimisations do mean that terminal performance is no longer
   consistent as "noisy" terminals will have worse performance. This is
   annoying, but still worthwhile.

 - Switch monitor rendering over to use VBOs.

   We also add a config option to switch between rendering backends. By
   default we'll choose the best one compatible with your GPU, but there
   is a config option to switch between VBOS (reasonable performance) and
   display lists (bad).

When benchmarking 30 full-sized monitors rendering a static image, this
improves my FPS[^1] from 7 to 95. This is obviously an extreme case -
monitor updates are still slow, and so more frequently updating screens
will still be less than stellar.

[^1]: My graphics card is an Intel HD Graphics 520. Obviously numbers
      will vary.
2020-04-21 10:43:26 +01:00
..
api Add fs.getCapacity and fs.attributes (#365) 2020-02-08 21:04:58 +00:00
client Backport 1.15's terminal rendering code (#412) 2020-04-21 10:43:26 +01:00
core Increase the maximum limit for websocket messages 2020-04-19 21:29:39 +01:00
shared Backport 1.15's terminal rendering code (#412) 2020-04-21 10:43:26 +01:00
CCTweaked.java Happy new year 2020-01-01 00:09:18 +00:00
ComputerCraft.java Backport 1.15's terminal rendering code (#412) 2020-04-21 10:43:26 +01:00