summaryrefslogtreecommitdiff
path: root/workspaces/main
diff options
context:
space:
mode:
Diffstat (limited to 'workspaces/main')
-rw-r--r--workspaces/main/shaders/scene1.wgsl16
1 files changed, 4 insertions, 12 deletions
diff --git a/workspaces/main/shaders/scene1.wgsl b/workspaces/main/shaders/scene1.wgsl
index 2f1174a..ff21318 100644
--- a/workspaces/main/shaders/scene1.wgsl
+++ b/workspaces/main/shaders/scene1.wgsl
@@ -2,12 +2,14 @@
// Source: Saturday cubism experiment by skal
#include "sequence_uniforms"
+#include "camera_common"
#include "math/color"
#include "math/utils"
#include "math/sdf_shapes"
#include "render/raymarching"
@group(0) @binding(2) var<uniform> uniforms: UniformsSequenceParams;
+@group(0) @binding(3) var<uniform> camera: CameraParams;
const PI: f32 = 3.141592654;
const TAU: f32 = 6.283185307;
@@ -178,18 +180,8 @@ fn render1(ro: vec3<f32>, rd: vec3<f32>) -> vec3<f32> {
fn effect(p: vec2<f32>) -> vec3<f32> {
g_rot0 = rot(-0.2 * uniforms.time);
-
- let fov = tan(TAU / 6.0);
- let ro = vec3<f32>(0.0, 2.5, 5.0);
- let la = vec3<f32>(0.0, 0.0, 0.0);
- let up = vec3<f32>(0.1, 1.0, 0.0);
-
- let ww = normalize(la - ro);
- let uu = normalize(cross(up, ww));
- let vv = cross(ww, uu);
- let rd = normalize(-p.x * uu + p.y * vv + fov * ww);
-
- return render1(ro, rd);
+ let ray = getCameraRay(camera, p);
+ return render1(ray.origin, ray.direction);
}
#include "render/fullscreen_vs"