Skip to content

Commit

Permalink
refactor(shader-ast-stdlib): update raymarchScene/AO loops
Browse files Browse the repository at this point in the history
- use post-increment for counter to be compatible w/ WebGL1
  • Loading branch information
postspectacular committed Jun 29, 2019
1 parent 8073edd commit 8a4bd89
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/shader-ast-stdlib/src/raymarch/ao.ts
Expand Up @@ -39,7 +39,7 @@ export const raymarchAO = (scene: RaymarchScene, numSamples = 5) =>
forLoop(
sym("float", float(1)),
(i) => lte(i, float(numSamples)),
(i) => assign(i, inc(i)),
(i) => inc(i),
(i) => [
(d0 = sym(mul(i, float(1 / numSamples)))),
assign(
Expand Down
2 changes: 1 addition & 1 deletion packages/shader-ast-stdlib/src/raymarch/scene.ts
Expand Up @@ -60,7 +60,7 @@ export const raymarchScene = (
forLoop(
sym("int", int(0)),
(i) => lt(i, int(opts.steps)),
(i) => assign(i, inc(i)),
(i) => inc(i),
() => [
assign(res, scene(add(pos, mul(dir, total)))),
ifThen(lt($x(res), float(opts.eps)), [
Expand Down

0 comments on commit 8a4bd89

Please sign in to comment.