Skip to content

FFederi/text-based-shader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

TBS - Text Based Shader

Outputs a terminal fullscreen rendering of simple ruby scripts, designed to mimic fragment shader code.

How to use

Run one of the examples:

$ ./bin/tbs examples/italy.rb

To write your own shader follow this template, then run /bin/tbs with the path to the ruby file:

# u, v are normalized x and y coords, go from 0.0 to 1.0
# t is time
# aspect is width/height, it can be used to adjust for window size changes
# output is a ruby Vector initiliazed to [0, 0, 0, 0]

def fragment(u, v, t, aspect, output)
  # your code here

  # you should return a modified output
  # r is color red component
  # g is color green component
  # b is color blue component
  # alpha is used to decide which character to render (smaller number -> smaller character), 0.0 is whitespace
  output += Vector[r, g, b, alpha]
end

About

Text based shader that outputs colored characters to the terminal

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages