stevensona/shader-toy

[BUG] wrong value is displayed in the GUI panel

Closed this issue · 6 comments

image

it seems the value has range in 0-255.
i know i can use in { 0.0, 5.0 } for float, but for vec3/vec4 i don't know how to limit the range, or simply just use the original value the vec3/vec4 have and don't multiply by 255?

Back when we added this feature it was a restriction in dat.gui which we use to draw the gui. I will check if this has changed, but don't get your hopes up.

ok, thanks anyway~ :)

hi, @Malacath-92
1, can we have a new option to specify the value is a color type? and by default it will be the type as how vec4 does?
for example vec3 hslAdjust = vec3(0.0, 2.1, 1.0) on the dat.GUI it will have hslAdjust.x, hslAdjust.y, hslAdjust.z
and if you specify something like vec3 hslAdjust = vec3(0.0, 2.1, 1.0) as color then it will be a color option on the GUI?

2, can we add step support for the iUniform?
then for the dat.GUI we call .step(0.05);
for example
#iUniform float myScalar = 1.0 in { 0.0, 5.0 } step .05
#iUniform vec3 hslAdjust = vec3(0.0, 2.1, 1.0) step .1 // invalid for as color

what do you think?

That'd both be possible:

  1. not sure if it's a good idea to introduce a new keyword for this, but rather a new type. So it'd look like this
#iUniform color3 hslAdjust = color3(0.0, 2.1, 1.0)
  1. was something I wanted to do. Implicitly that's what we're forced to do for integer types, so only need to add a parsing for it. It's unclear how we would handle that though when the underlying types are integers.

1, actually not sure what will people think, vec3 is native type, but you have to learn as xxx new keyword, color3 is good way but don't know if people don't like it. (i like this way)

2, for this situation I think ceil(step) or round(step) for integer?

  1. I am heavily leaning towards introducing a type for this. It's clear that color3 has similar semantics to vec3, so this isn't an issue. And it is clear that only color3 is supported, as opposed to introducing as color, which doesn't make it clear that only vec3 is supported.

  2. I think it's better to only allow signed integers in that case and present the user with an error otherwise