MCPcopy Create free account
hub / github.com/TheOrcDev/github-creature / ShaderPass

Class ShaderPass

components/liquid-ether.tsx:600–630  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

598 type Uniforms = Record<string, { value: any }>;
599
600 class ShaderPass {
601 props: any;
602 uniforms?: Uniforms;
603 scene: THREE.Scene | null = null;
604 camera: THREE.Camera | null = null;
605 material: THREE.RawShaderMaterial | null = null;
606 geometry: THREE.BufferGeometry | null = null;
607 plane: THREE.Mesh | null = null;
608 constructor(props: any) {
609 this.props = props || {};
610 this.uniforms = this.props.material?.uniforms;
611 }
612 init(..._args: any[]) {
613 void _args;
614 this.scene = new THREE.Scene();
615 this.camera = new THREE.Camera();
616 if (this.uniforms) {
617 this.material = new THREE.RawShaderMaterial(this.props.material);
618 this.geometry = new THREE.PlaneGeometry(2, 2);
619 this.plane = new THREE.Mesh(this.geometry, this.material);
620 this.scene.add(this.plane);
621 }
622 }
623 update(..._args: any[]) {
624 void _args;
625 if (!Common.renderer || !this.scene || !this.camera) return;
626 Common.renderer.setRenderTarget(this.props.output || null);
627 Common.renderer.render(this.scene, this.camera);
628 Common.renderer.setRenderTarget(null);
629 }
630 }
631
632 class Advection extends ShaderPass {
633 line!: THREE.LineSegments;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected