0005: noe mouse follow, tighten hide glow
This commit is contained in:
parent
6dda23829c
commit
bdacfc0f5f
3 changed files with 25 additions and 10 deletions
|
@ -5,19 +5,34 @@ import { Transform, etoq, v3 } from "../renderer/transform";
|
|||
import plane from "../meshes/plane";
|
||||
import { outer } from "./shaders/outer";
|
||||
import { noe } from "./shaders/noe";
|
||||
import { createGizmo } from "../renderer/gizmo";
|
||||
|
||||
const useDebug = location.search.includes("alt1");
|
||||
|
||||
const app = new WebGLApp({ fov: 45 });
|
||||
|
||||
const camera = new Transform([0, 0, 2], etoq([0, 0, 0]));
|
||||
|
||||
const light = new Transform([1, -1, 0], etoq([0, 0, 0]));
|
||||
|
||||
const transformPlane = new Transform(v3(0), etoq([0, 180, 0]), v3(1.8));
|
||||
const transformSphere = new Transform(v3(0), etoq([0, 180, 180]), v3(0.6));
|
||||
|
||||
// app.onUpdate((time, app) => {
|
||||
// // const wiggle = 40 * (Math.sin(time) * 0.001);
|
||||
// // camera.position = [wiggle, 2, 4 - wiggle];
|
||||
// });
|
||||
document.body.addEventListener("mousemove", (event) => {
|
||||
const { clientX, clientY } = event;
|
||||
const { clientWidth, clientHeight } = document.body;
|
||||
|
||||
const screenX = clientX / clientWidth;
|
||||
const screenY = clientY / clientHeight;
|
||||
|
||||
const centeredX = screenX * 2 - 1;
|
||||
const centeredY = screenY * 2 - 1;
|
||||
|
||||
light.position[1] = centeredX;
|
||||
light.position[0] = centeredY;
|
||||
});
|
||||
|
||||
app.onUpdate((time, app) => {});
|
||||
|
||||
new Renderable(
|
||||
app,
|
||||
|
@ -28,7 +43,7 @@ new Renderable(
|
|||
new Renderable(
|
||||
app,
|
||||
transformSphere,
|
||||
new MeshRenderer(app, plane, noe(app, useDebug), camera).configure({})
|
||||
new MeshRenderer(app, plane, noe(app, useDebug), camera, light).configure({})
|
||||
);
|
||||
|
||||
// createGizmo(app, camera, light);
|
||||
|
|
|
@ -37,7 +37,7 @@ void main() {
|
|||
vec2 outerNoise = (mandelbrot) * (1.0 - uvMirror * 0.5);
|
||||
fragColor.gb += (1.0 - mandelbrot) * outerNoise;
|
||||
|
||||
fragColor.r += pow(1.0 - length(uvMirror), 5.0);
|
||||
fragColor.r += pow(1.0 - length(uvMirror), 8.0);
|
||||
|
||||
fragColor.a = 1.0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue