Change shader example in the guide

Necessary due to the newly-implemented safety checking for HVM
This commit is contained in:
Eduardo Sandalo Porto 2024-06-10 18:27:25 -03:00
parent c3b1a363b9
commit e57a90ffc8
2 changed files with 5 additions and 5 deletions

View File

@ -747,13 +747,13 @@ compute-heavy, but less memory-hungry, computations. For example, consider:
```python
# given a shader, returns a square image
def render(depth, shader):
def render(depth):
bend d = 0, i = 0:
when d < depth:
color = (fork(d+1, i*2+0), fork(d+1, i*2+1))
else:
width = depth / 2
color = shader(i % width, i / width)
color = demo_shader(i % width, i / width)
return color
# given a position, returns a color

View File

@ -1,11 +1,11 @@
# given a shader, returns a square image
def render(depth, shader):
def render(depth):
bend d = 0, i = 0:
when d < depth:
color = (fork(d+1, i*2+0), fork(d+1, i*2+1))
else:
width = depth / 2
color = shader(i % width, i / width)
color = demo_shader(i % width, i / width)
return color
# given a position, returns a color
@ -20,4 +20,4 @@ def demo_shader(x, y):
# renders a 256x256 image using demo_shader
def main:
return render(5, demo_shader)
return render(5)