Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Converts a _good_ rgb format into
- -- 15-bit color for computronics lamps.
- -- specifically takes values 0.0-1.0 for red, green, blue
- -- this isn't specific to the minecraft mod it's written for
- -- but it's what annoyed me into doing this
- function rgb2x (r, g, b)
- local rx = math.floor(31*r)
- local gx = math.floor(31*g)
- local bx = math.floor(31*b)
- return bit32.lshift(rx,10) + bit32.lshift(gx,5) + bx
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement