mirror of
https://github.com/HigherOrderCO/Bend.git
synced 2024-10-26 14:05:36 +03:00
Change shader example in the guide
Necessary due to the newly-implemented safety checking for HVM
This commit is contained in:
parent
c3b1a363b9
commit
e57a90ffc8
4
GUIDE.md
4
GUIDE.md
@ -747,13 +747,13 @@ compute-heavy, but less memory-hungry, computations. For example, consider:
|
|||||||
|
|
||||||
```python
|
```python
|
||||||
# given a shader, returns a square image
|
# given a shader, returns a square image
|
||||||
def render(depth, shader):
|
def render(depth):
|
||||||
bend d = 0, i = 0:
|
bend d = 0, i = 0:
|
||||||
when d < depth:
|
when d < depth:
|
||||||
color = (fork(d+1, i*2+0), fork(d+1, i*2+1))
|
color = (fork(d+1, i*2+0), fork(d+1, i*2+1))
|
||||||
else:
|
else:
|
||||||
width = depth / 2
|
width = depth / 2
|
||||||
color = shader(i % width, i / width)
|
color = demo_shader(i % width, i / width)
|
||||||
return color
|
return color
|
||||||
|
|
||||||
# given a position, returns a color
|
# given a position, returns a color
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
# given a shader, returns a square image
|
# given a shader, returns a square image
|
||||||
def render(depth, shader):
|
def render(depth):
|
||||||
bend d = 0, i = 0:
|
bend d = 0, i = 0:
|
||||||
when d < depth:
|
when d < depth:
|
||||||
color = (fork(d+1, i*2+0), fork(d+1, i*2+1))
|
color = (fork(d+1, i*2+0), fork(d+1, i*2+1))
|
||||||
else:
|
else:
|
||||||
width = depth / 2
|
width = depth / 2
|
||||||
color = shader(i % width, i / width)
|
color = demo_shader(i % width, i / width)
|
||||||
return color
|
return color
|
||||||
|
|
||||||
# given a position, returns a color
|
# given a position, returns a color
|
||||||
@ -20,4 +20,4 @@ def demo_shader(x, y):
|
|||||||
|
|
||||||
# renders a 256x256 image using demo_shader
|
# renders a 256x256 image using demo_shader
|
||||||
def main:
|
def main:
|
||||||
return render(5, demo_shader)
|
return render(5)
|
Loading…
Reference in New Issue
Block a user