Open 6r1d opened 4 years ago
I like it. Though recipe like digiline button but instead of button a new_glass.
Essentials are done, digiline branch is here. :-)
Btw, "unifieddyes.on_dig" is there, the "this makes sure that if the player digs a neutral node" part is not. :/
Item display issue was fixed by removing not_in_creative_inventory
group.
Who would have thought it is not quite related to the creative mode?
Maybe it's time to scrape frames for RGB glass. The property of glass frame alignment and the glass color seem to be interlinked for any type of framed glass.
There are my examples of color interfering with framed pattern. While it can be cool for some interactive art and patterns, mostly it'll be useless or slightly silly.
looks exactly like the non digiline version. Depending on colour the connection works differently.
I did a little experiment with LuaController to determine frame states based on param2
, which I am using to set color, since VanessaE's Unified Dyes mod does that.
if event.type == "program" then
-- Initial configuration
mem.color = 0
interrupt(0.5)
elseif event.type == "interrupt" then
-- Update color
digiline_send(
'rgb', {switch = 1, color = mem.color}
)
-- Show a color on LCD
digiline_send('lcd', mem.color)
-- Increment color value
if mem.color < 255 then
mem.color = mem.color + 1
interrupt(0.5)
end
end
Results:
param2 range |
Frame state |
---|---|
0 - 63 | Ideal, transparent besides the outside borders |
64 - 127 | Horizontal stripes |
128 - 191 | Vertical stripes |
192 - 255 | Cubes |
Test setup:
yay, thanks :) now we have something to reference :)
I found something you'll like to hear, the frame bug has been fixed: https://github.com/minetest/minetest/commit/9bff154cba14686f5a3b56f4cba405824b88c402
Is it intentional to have digiline rules for checking 12 positions around single rgb glass node? https://github.com/6r1d/minetest_new_glass/blob/87d0c94a2e51570828051dc9907ee59cd2532042/rgb.lua#L3-L16
Or should it be digimese style connection with 6 positions?
local digiline_rules = {
{x = 1, y = 0,z = 0,},
{x = -1, y = 0,z = 0,},
{x = 0, y = 1,z = 0,},
{x = 0, y = -1,z = 0,},
{x = 0, y = 0,z = 1,},
{x = 0, y = 0,z = -1,},
}
Thanks, @S-S-X, you are right, I'd better fix that!
We were talking about using hexadecimal colors like #ffffff
before and I'm thinking about the speed of conversion between RGB colors and 0-255 HSV palette of unifieddyes.
For now, I've scanned the available colors from the airbrush tool menu using Pillow module. The "fun" thing is that some squares on the screenshot have duplicate colors. The full list of colors using a hexadecimal format with a JS renderer is available here.
Which algorithm do I use to convert HEX colors, though?
If I simply convert RGB to a number and look for three nearest ones, I can fully expect some wrong shades on RGB glass. I don't want that, people will definitely ask me for a fix and the fix will change the palette for others, so others will ask me for a fix.
I looked at StackOverflow and it gives some insight: represent color we are looking for as a 3D vector, represent 255 colors as a set of 255 3D vectors on a cube, find the closest one:
SO recommends nearest neighboor search on a K-D tree, and I'm already wondering how sane it is for a tiny cube, controlled by digilines. Yes, it is fast, but I am not sure it is the best way. But there's more! Jeremy Day was solving a similar task, adapting a palette. He tells: "euclidean distance in RGB space does not mean what it does in, say, real 3D space. If I were repeating this experiment, I would first convert to HSV". Back to the wrong shades issue, but at the very least, there seems to be a solution.
Before I forget! If each color segment is equal to two others in RGB format, we can ignore the H part in HSV search and look the color up in the last row. This will improve the speed a bit.
Would be nice to add Digiline mod support to enable and disable the glow. Color change might be really useful. Recipe then should be something like a
LuaC
,group:new_glass
,digiline
.