@fjandin/react-shader 0.0.16 → 0.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ReactGpuShader.d.ts +18 -0
- package/dist/ReactGpuShader.d.ts.map +1 -0
- package/dist/example/examples/mandelbrot.d.ts +2 -0
- package/dist/example/examples/mandelbrot.d.ts.map +1 -0
- package/dist/example/examples/mandelbrot2.d.ts +2 -0
- package/dist/example/examples/mandelbrot2.d.ts.map +1 -0
- package/dist/example/examples/webgl.d.ts +2 -0
- package/dist/example/examples/webgl.d.ts.map +1 -0
- package/dist/example/examples/webgpu.d.ts +2 -0
- package/dist/example/examples/webgpu.d.ts.map +1 -0
- package/dist/example/frontend.d.ts.map +1 -1
- package/dist/hooks/useWebGPU.d.ts +20 -0
- package/dist/hooks/useWebGPU.d.ts.map +1 -0
- package/dist/index.cjs +882 -54
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +882 -54
- package/dist/shaders/color-palette-gpu.d.ts +2 -0
- package/dist/shaders/color-palette-gpu.d.ts.map +1 -0
- package/dist/shaders/distortion-ripple-gpu.d.ts +16 -0
- package/dist/shaders/distortion-ripple-gpu.d.ts.map +1 -0
- package/dist/shaders/scene-circles-gpu.d.ts +21 -0
- package/dist/shaders/scene-circles-gpu.d.ts.map +1 -0
- package/dist/shaders/simplex-noise-gpu.d.ts +2 -0
- package/dist/shaders/simplex-noise-gpu.d.ts.map +1 -0
- package/package.json +2 -1
- package/dist/example/glsl/cartesian-to-polar.glsl.d.ts +0 -2
- package/dist/example/glsl/cartesian-to-polar.glsl.d.ts.map +0 -1
- package/dist/example/glsl/circles.glsl.d.ts +0 -3
- package/dist/example/glsl/circles.glsl.d.ts.map +0 -1
- package/dist/example/glsl/noise.glsl.d.ts +0 -3
- package/dist/example/glsl/noise.glsl.d.ts.map +0 -1
- package/dist/example/glsl/palette.glsl.d.ts +0 -2
- package/dist/example/glsl/palette.glsl.d.ts.map +0 -1
- package/dist/example/glsl/texture-demo.glsl.d.ts +0 -2
- package/dist/example/glsl/texture-demo.glsl.d.ts.map +0 -1
- package/dist/example/lib/logger.d.ts +0 -2
- package/dist/example/lib/logger.d.ts.map +0 -1
- package/dist/example/shader.d.ts +0 -2
- package/dist/example/shader.d.ts.map +0 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { FrameInfo, Vec2, Vec3, Vec4, Vec4Array } from "./types";
|
|
2
|
+
type GpuUniformValue = number | Vec2 | Vec3 | Vec4 | Vec4Array;
|
|
3
|
+
export interface ReactGpuShaderProps {
|
|
4
|
+
className?: string;
|
|
5
|
+
fragment: string;
|
|
6
|
+
uniforms?: Record<string, GpuUniformValue>;
|
|
7
|
+
fullscreen?: boolean;
|
|
8
|
+
timeScale?: number;
|
|
9
|
+
onFrame?: (info: FrameInfo) => void;
|
|
10
|
+
onClick?: (info: FrameInfo) => void;
|
|
11
|
+
onMouseMove?: (info: FrameInfo) => void;
|
|
12
|
+
onMouseDown?: (info: FrameInfo) => void;
|
|
13
|
+
onMouseUp?: (info: FrameInfo) => void;
|
|
14
|
+
onMouseWheel?: (info: FrameInfo, wheelDelta: number) => void;
|
|
15
|
+
}
|
|
16
|
+
export declare function ReactGpuShader({ className, fragment, uniforms, fullscreen, timeScale, onFrame, onClick, onMouseMove, onMouseDown, onMouseUp, onMouseWheel, }: ReactGpuShaderProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=ReactGpuShader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReactGpuShader.d.ts","sourceRoot":"","sources":["../src/ReactGpuShader.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAGrE,KAAK,eAAe,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,SAAS,CAAA;AAE9D,MAAM,WAAW,mBAAmB;IAClC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;IAC1C,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAA;IACnC,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAA;IACnC,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAA;IACvC,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAA;IACvC,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAA;IACrC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,KAAK,IAAI,CAAA;CAC7D;AAuBD,wBAAgB,cAAc,CAAC,EAC7B,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,UAAkB,EAClB,SAAS,EACT,OAAO,EACP,OAAO,EACP,WAAW,EACX,WAAW,EACX,SAAS,EACT,YAAY,GACb,EAAE,mBAAmB,2CAyDrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mandelbrot.d.ts","sourceRoot":"","sources":["../../../src/example/examples/mandelbrot.tsx"],"names":[],"mappings":"AA8BA,wBAAgB,oBAAoB,4CAiFnC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mandelbrot2.d.ts","sourceRoot":"","sources":["../../../src/example/examples/mandelbrot2.tsx"],"names":[],"mappings":"AA4HA,wBAAgB,qBAAqB,4CAiGpC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webgl.d.ts","sourceRoot":"","sources":["../../../src/example/examples/webgl.tsx"],"names":[],"mappings":"AAiDA,wBAAgB,SAAS,4CA6BxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webgpu.d.ts","sourceRoot":"","sources":["../../../src/example/examples/webgpu.tsx"],"names":[],"mappings":"AAmDA,wBAAgB,UAAU,4CAgHzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frontend.d.ts","sourceRoot":"","sources":["../../src/example/frontend.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"frontend.d.ts","sourceRoot":"","sources":["../../src/example/frontend.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,aAAa,CAAA;AA0BpB,wBAAgB,GAAG,4CAyClB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { FrameInfo, Vec2, Vec3, Vec4, Vec4Array } from "../types";
|
|
2
|
+
type GpuUniformValue = number | Vec2 | Vec3 | Vec4 | Vec4Array;
|
|
3
|
+
interface UseWebGPUOptions {
|
|
4
|
+
fragment: string;
|
|
5
|
+
uniforms?: Record<string, GpuUniformValue>;
|
|
6
|
+
onError?: (error: Error) => void;
|
|
7
|
+
timeScale?: number;
|
|
8
|
+
onFrame?: (info: FrameInfo) => void;
|
|
9
|
+
onClick?: (info: FrameInfo) => void;
|
|
10
|
+
onMouseMove?: (info: FrameInfo) => void;
|
|
11
|
+
onMouseDown?: (info: FrameInfo) => void;
|
|
12
|
+
onMouseUp?: (info: FrameInfo) => void;
|
|
13
|
+
onMouseWheel?: (info: FrameInfo, wheelDelta: number) => void;
|
|
14
|
+
}
|
|
15
|
+
export declare function useWebGPU(options: UseWebGPUOptions): {
|
|
16
|
+
canvasRef: import("react").RefObject<HTMLCanvasElement>;
|
|
17
|
+
mouseRef: import("react").MutableRefObject<[number, number]>;
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=useWebGPU.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useWebGPU.d.ts","sourceRoot":"","sources":["../../src/hooks/useWebGPU.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAGtE,KAAK,eAAe,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,SAAS,CAAA;AAE9D,UAAU,gBAAgB;IACxB,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;IAC1C,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;IAChC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAA;IACnC,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAA;IACnC,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAA;IACvC,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAA;IACvC,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAA;IACrC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,KAAK,IAAI,CAAA;CAC7D;AA+WD,wBAAgB,SAAS,CAAC,OAAO,EAAE,gBAAgB;;;EA8QlD"}
|