feat: add NetShader and UnicolorShader with a debug component for visual testing in the world scene

This commit is contained in:
math-pixel
2026-05-19 22:54:29 +02:00
parent ae34dc38ed
commit 8b619bfc28
4 changed files with 127 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
import { useRef } from "react";
import { useFrame } from "@react-three/fiber";
import * as THREE from "three";
import { createNetShader } from "@/shaders/NetShader";
export function NetTest(): React.JSX.Element {
const materialRef = useRef<THREE.ShaderMaterial>(null);
useFrame((_, delta) => {
if (materialRef.current) {
materialRef.current.uniforms.uTime.value += delta;
}
});
return (
<mesh position={[0, 2, -3]} rotation={[0, 0, 0]}>
<planeGeometry args={[2, 2, 1, 1]} />
<primitive
object={createNetShader()}
ref={materialRef}
attach="material"
/>
</mesh>
);
}