This LCD display shader takes a number as a uniform parameter,
and displays it similar to a seven-segment LCD display.
It is an interesting shader, not only because it is a little
different from other shaders, but because it makes use of Sh's
long tuple support to represent the seven-segment state in
seven-tuples, uses C++ arrays to store variables, and uses simple
C++ metaprogramming (trivial in Sh) to allow a variety of different
shaders to be generated from the same function. For example, handling
negative numbers, a grid, and fractional digits can be turned on
or off at construction time.
Source files:
[LCD.cpp]
[LCD.hpp]
Written by:
Stefanus Du Toit
|