-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Filtering all glsl functions #15
Comments
Yes we could probably add them. I just did not find a complete list. I do also want a nim implementation of them for the GLSL on the CPU path. But that can wait. |
I've implemented just 4 (bitops like) function so far. Surely implementing them all seems a large job |
I think I am facing an issue related to this. I got the error:
Reading this issue, I though about adding Besides, I would like to know what is the appropriate way to add the CPU version. I bet it will be something like: proc step(edge, x: float): float =
if x <= edge:
result = 0.0
else:
result = 1.0 |
So it looks like, I have to include the name of the function in import chroma, shady, shady/demo, vmath
proc step(edge, x: float): float =
if x <= edge:
result = 0.0
else:
result = 1.0
proc step[T:Vec4|Vec3|Vec2](edge, x: T): T =
var len:int = if x is Vec2:
2
elif x is Vec3:
3
else:
4
for i in 0 ..< len:
if x[i] <= edge[i]:
result[i] = 0.0
else:
result[i] = 1.0
proc main(gl_FragColor: var Vec4, uv: Vec2, time: Uniform[float32]) =
if step(vec2(50.0, 80.0), uv) == vec2(0.0,0.0):
gl_FragColor = vec4(1, 1, 1, 1)
else:
gl_FragColor = vec4(0, 0, 0, 1)
# CPU test
echo step(vec2(200.0,200.0), vec2(300.0,100.0) ) == vec2(1.0,0.0)
# compile to a GPU shader:
var shader = toGLSL(main)
echo shader
run("Tutorial", shader) |
Yes that is how its meant to be. More GLSL functions need to be added. |
I'm finding myself editing
const glslFunctions
quite a lot, so I've added them allNot sure if this beneficial or not, but I'll share it here for your consideration
how about making it a set for performance reason?
The text was updated successfully, but these errors were encountered: