@react-three/drei 9.92.5 → 9.92.6

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.
@@ -1,4 +1,4 @@
1
- import { MeshPhysicalMaterial, MeshPhysicalMaterialParameters, Shader } from 'three';
1
+ import { IUniform, MeshPhysicalMaterial, MeshPhysicalMaterialParameters } from 'three';
2
2
  import { ForwardRefComponent } from '../helpers/ts-utils';
3
3
  type DistortMaterialType = JSX.IntrinsicElements['meshPhysicalMaterial'] & {
4
4
  time?: number;
@@ -24,7 +24,12 @@ declare class DistortMaterialImpl extends MeshPhysicalMaterial {
24
24
  _distort: Uniform<number>;
25
25
  _radius: Uniform<number>;
26
26
  constructor(parameters?: MeshPhysicalMaterialParameters);
27
- onBeforeCompile(shader: Shader): void;
27
+ onBeforeCompile(shader: {
28
+ vertexShader: string;
29
+ uniforms: {
30
+ [uniform: string]: IUniform;
31
+ };
32
+ }): void;
28
33
  get time(): number;
29
34
  set time(v: number);
30
35
  get distort(): number;
@@ -18,6 +18,8 @@ class DistortMaterialImpl extends MeshPhysicalMaterial {
18
18
  value: 1
19
19
  };
20
20
  }
21
+
22
+ // FIXME Use `THREE.WebGLProgramParametersWithUniforms` type when able to target @types/three@0.160.0
21
23
  onBeforeCompile(shader) {
22
24
  shader.uniforms.time = this._time;
23
25
  shader.uniforms.radius = this._radius;
@@ -1,4 +1,4 @@
1
- import { MeshStandardMaterial, MeshStandardMaterialParameters, Shader } from 'three';
1
+ import { IUniform, MeshStandardMaterial, MeshStandardMaterialParameters } from 'three';
2
2
  import { ForwardRefComponent } from '../helpers/ts-utils';
3
3
  type WobbleMaterialType = JSX.IntrinsicElements['meshStandardMaterial'] & {
4
4
  time?: number;
@@ -23,7 +23,12 @@ declare class WobbleMaterialImpl extends MeshStandardMaterial {
23
23
  _time: Uniform<number>;
24
24
  _factor: Uniform<number>;
25
25
  constructor(parameters?: MeshStandardMaterialParameters);
26
- onBeforeCompile(shader: Shader): void;
26
+ onBeforeCompile(shader: {
27
+ vertexShader: string;
28
+ uniforms: {
29
+ [uniform: string]: IUniform;
30
+ };
31
+ }): void;
27
32
  get time(): number;
28
33
  set time(v: number);
29
34
  get factor(): number;
@@ -14,6 +14,8 @@ class WobbleMaterialImpl extends MeshStandardMaterial {
14
14
  value: 1
15
15
  };
16
16
  }
17
+
18
+ // FIXME Use `THREE.WebGLProgramParametersWithUniforms` type when able to target @types/three@0.160.0
17
19
  onBeforeCompile(shader) {
18
20
  shader.uniforms.time = this._time;
19
21
  shader.uniforms.factor = this._factor;
@@ -1,8 +1,19 @@
1
1
  import * as THREE from 'three';
2
2
  import * as React from 'react';
3
3
  import { ReactThreeFiber } from '@react-three/fiber';
4
+ interface MaterialShader {
5
+ vertexShader: string;
6
+ fragmentShader: string;
7
+ defines: {
8
+ [define: string]: string | number | boolean;
9
+ } | undefined;
10
+ uniforms: {
11
+ [uniform: string]: THREE.IUniform;
12
+ };
13
+ }
4
14
  export declare function useBoxProjectedEnv(position?: ReactThreeFiber.Vector3, size?: ReactThreeFiber.Vector3): {
5
15
  ref: React.MutableRefObject<THREE.Material>;
6
- onBeforeCompile: (shader: THREE.Shader) => void;
16
+ onBeforeCompile: (shader: MaterialShader) => void;
7
17
  customProgramCacheKey: () => string;
8
18
  };
19
+ export {};
@@ -47,7 +47,11 @@ const getIBLRadiance_patch = /* glsl */`
47
47
  reflectVec = parallaxCorrectNormal( reflectVec, envMapSize, envMapPosition );
48
48
  #endif
49
49
  `;
50
+
51
+ // FIXME Replace with `THREE.WebGLProgramParametersWithUniforms` type when able to target @types/three@0.160.0
52
+
50
53
  function boxProjectedEnvMap(shader, envMapPosition, envMapSize) {
54
+ // defines
51
55
  shader.defines.BOX_PROJECTED_ENV_MAP = true;
52
56
  // uniforms
53
57
  shader.uniforms.envMapPosition = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-three/drei",
3
- "version": "9.92.5",
3
+ "version": "9.92.6",
4
4
  "private": false,
5
5
  "description": "useful add-ons for react-three-fiber",
6
6
  "keywords": [