Skip to content

Commit 8afb45c

Browse files
committed
Update shader.frag
1 parent 2836a71 commit 8afb45c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

sketches/shaders/box-space/shader.frag

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,14 @@ void main() {
8282

8383
vec2 uv = ( coord * 2.0 - 1.0 ) * iResolution.xy / iResolution.y;
8484

85+
vec2 mousePrevious = vec2(0.0, 0.0);
8586
vec2 m = (iMouse.xy * 2. - iResolution.xy) / iResolution.y;
8687

88+
mousePrevious = m;
8789
// Default circular motion if mouse not clicked
88-
if(!iView) m = vec2(-1.0, 0.0);
90+
if(!iView) {
91+
m = mousePrevious;
92+
}
8993

9094
vec3 ro = vec3(0.0, 0.0, -3.0); // ray origin
9195
vec3 rd = normalize(vec3(uv, 1.0)); // ray direction

0 commit comments

Comments
 (0)