@react-three/drei 9.40.5 → 9.41.1
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/README.md +60 -7
- package/core/AccumulativeShadows.d.ts +14 -13
- package/core/Clone.cjs.js +1 -1
- package/core/Clone.d.ts +3 -1
- package/core/Clone.js +30 -20
- package/core/ContactShadows.d.ts +14 -13
- package/core/Instances.cjs.js +1 -1
- package/core/Instances.js +3 -1
- package/core/SpotLight.cjs.js +1 -1
- package/core/SpotLight.d.ts +23 -28
- package/core/SpotLight.js +186 -14
- package/core/Stage.cjs.js +1 -1
- package/core/Stage.d.ts +12 -18
- package/core/Stage.js +77 -63
- package/core/Trail.cjs.js +1 -1
- package/core/Trail.js +4 -3
- package/core/index.cjs.js +1 -1
- package/core/index.js +1 -1
- package/helpers/glsl/DefaultSpotlightShadowShadows.glsl.js +3 -0
- package/index.cjs.js +1 -1
- package/index.js +1 -1
- package/native/index.cjs.js +1 -1
- package/native/index.js +1 -1
- package/package.json +1 -1
- package/web/index.cjs.js +1 -1
- package/web/index.js +1 -1
- package/web/pivotControls/index.cjs.js +1 -1
- package/web/pivotControls/index.js +4 -2
package/README.md
CHANGED
|
@@ -475,7 +475,7 @@ enum Controls {
|
|
|
475
475
|
jump = 'jump',
|
|
476
476
|
}
|
|
477
477
|
function App() {
|
|
478
|
-
const map = useMemo<KeyboardControlsEntry<Controls
|
|
478
|
+
const map = useMemo<KeyboardControlsEntry<Controls>[]>(()=>[
|
|
479
479
|
{ name: Controls.forward, keys: ['ArrowUp', 'w', 'W'] },
|
|
480
480
|
{ name: Controls.back, keys: ['ArrowDown', 's', 'S'] },
|
|
481
481
|
{ name: Controls.left, keys: ['ArrowLeft', 'a', 'A'] },
|
|
@@ -1027,7 +1027,7 @@ You can either pass a Mesh and InstancedMesh as children:
|
|
|
1027
1027
|
```tsx
|
|
1028
1028
|
// This simple example scatters 1000 spheres on the surface of the sphere mesh.
|
|
1029
1029
|
<Sampler
|
|
1030
|
-
weight={
|
|
1030
|
+
weight={'normal'} // the name of the attribute to be used as sampling weight
|
|
1031
1031
|
transform={transformPoint} // a function that transforms each instance given a sample. See the examples for more.
|
|
1032
1032
|
count={16} // Number of samples
|
|
1033
1033
|
>
|
|
@@ -1036,7 +1036,7 @@ You can either pass a Mesh and InstancedMesh as children:
|
|
|
1036
1036
|
</mesh>
|
|
1037
1037
|
|
|
1038
1038
|
<instancedMesh args={[null, null, 1_000]}>
|
|
1039
|
-
<sphereGeometry args={[0.1]}/>
|
|
1039
|
+
<sphereGeometry args={[0.1]} />
|
|
1040
1040
|
</instancedMesh>
|
|
1041
1041
|
</Sampler>
|
|
1042
1042
|
```
|
|
@@ -1950,7 +1950,7 @@ A convenience hook that returns a `THREE.VideoTexture` and integrates loading in
|
|
|
1950
1950
|
|
|
1951
1951
|
```tsx
|
|
1952
1952
|
type VideoTextureProps = {
|
|
1953
|
-
unsuspend?: 'canplay' | 'canplaythrough'
|
|
1953
|
+
unsuspend?: 'canplay' | 'canplaythrough' | 'loadedmetadata'
|
|
1954
1954
|
muted?: boolean
|
|
1955
1955
|
loop?: boolean
|
|
1956
1956
|
start?: boolean
|
|
@@ -2635,12 +2635,32 @@ This component makes its contents float or hover.
|
|
|
2635
2635
|
|
|
2636
2636
|
[](https://drei.pmnd.rs/?path=/story/staging-stage--stage-st)
|
|
2637
2637
|
|
|
2638
|
-
Creates a "stage" with proper studio lighting, content centered and planar, shadows and ground-
|
|
2638
|
+
Creates a "stage" with proper studio lighting, content centered and planar, model-shadows and ground-shadows. Make sure to set `makeDefault` on your controls when `adjustCamera` is true!
|
|
2639
2639
|
|
|
2640
|
-
|
|
2640
|
+
```tsx
|
|
2641
|
+
type StageShadows = Partial<AccumulativeShadowsProps> &
|
|
2642
|
+
Partial<ContactShadowsProps> & {
|
|
2643
|
+
type: 'contact' | 'accumulative'
|
|
2644
|
+
bias?: number
|
|
2645
|
+
size?: number
|
|
2646
|
+
}
|
|
2647
|
+
|
|
2648
|
+
type StageProps = JSX.IntrinsicElements['group'] & {
|
|
2649
|
+
/** Lighting setup, default: "rembrandt" */
|
|
2650
|
+
preset?: keyof typeof presets
|
|
2651
|
+
/** Controls the ground shadows, default: "accumulative" */
|
|
2652
|
+
shadows?: boolean | 'contact' | 'accumulative' | StageShadows
|
|
2653
|
+
/** Optionally wraps and thereby centers the models using <Bounds>, can also be a margin, default: false */
|
|
2654
|
+
adjustCamera?: boolean | number
|
|
2655
|
+
/** The default environment, default: "city" */
|
|
2656
|
+
environment?: PresetsType | null
|
|
2657
|
+
/** The lighting intensity, default: 0.5 */
|
|
2658
|
+
intensity?: number
|
|
2659
|
+
}
|
|
2660
|
+
```
|
|
2641
2661
|
|
|
2642
2662
|
```jsx
|
|
2643
|
-
<Stage
|
|
2663
|
+
<Stage>
|
|
2644
2664
|
<mesh />
|
|
2645
2665
|
</Stage>
|
|
2646
2666
|
```
|
|
@@ -2828,6 +2848,39 @@ function Foo() {
|
|
|
2828
2848
|
return <SpotLight depthBuffer={depthBuffer} />
|
|
2829
2849
|
```
|
|
2830
2850
|
|
|
2851
|
+
#### SpotLightShadows
|
|
2852
|
+
|
|
2853
|
+
A shadow caster that can help cast shadows of different patterns (textures) onto the scene.
|
|
2854
|
+
|
|
2855
|
+
```jsx
|
|
2856
|
+
<SpotLight>
|
|
2857
|
+
<SpotLightShadows
|
|
2858
|
+
distance={0.4} // Distance between the shadow caster and light
|
|
2859
|
+
alphaTest={0.5} // Sets the alpha value to be used when running an alpha test. See Material.alphaTest
|
|
2860
|
+
scale={1} // Scale of the shadow caster plane
|
|
2861
|
+
map={undefined} // Texture - Pattern of the shadow
|
|
2862
|
+
shader={undefined} // Optional shader to run. Lets you add effects to the shadow map. See bellow
|
|
2863
|
+
width={512} // Width of the shadow map. The higher the more expnsive
|
|
2864
|
+
height={512} // Height of the shadow map. The higher the more expnsive
|
|
2865
|
+
/>
|
|
2866
|
+
</SpotLight>
|
|
2867
|
+
```
|
|
2868
|
+
|
|
2869
|
+
An optinal `shader` prop lets you run a custom shader to modify/add effects to your shadow texture. The shader privides the following uniforms and varyings.
|
|
2870
|
+
|
|
2871
|
+
| Type | Name | Notes |
|
|
2872
|
+
| ------------------- | ------------ | -------------------------------------- |
|
|
2873
|
+
| `varying vec2` | `vUv` | UVs of the shadow casting plane |
|
|
2874
|
+
| `uniform sampler2D` | `uShadowMap` | The texture provided to the `map` prop |
|
|
2875
|
+
| `uniform float` | `uTime` | Current time |
|
|
2876
|
+
|
|
2877
|
+
Treat the output of the shader like an alpha map where `1` is opaque and `0` is transparent.
|
|
2878
|
+
|
|
2879
|
+
```glsl
|
|
2880
|
+
gl_FragColor = vec4(vec3(1.), 1.); // Opaque
|
|
2881
|
+
gl_FragColor = vec4(vec3(0.), 1.); // Transparnet
|
|
2882
|
+
```
|
|
2883
|
+
|
|
2831
2884
|
#### Environment
|
|
2832
2885
|
|
|
2833
2886
|
[](https://drei.pmnd.rs/?path=/story/staging-environment--environment-story)
|
|
@@ -1,6 +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
|
+
export declare type AccumulativeShadowsProps = {
|
|
5
|
+
frames?: number;
|
|
6
|
+
blend?: number;
|
|
7
|
+
limit?: number;
|
|
8
|
+
scale?: number;
|
|
9
|
+
temporal?: boolean;
|
|
10
|
+
opacity?: number;
|
|
11
|
+
alphaTest?: number;
|
|
12
|
+
color?: string;
|
|
13
|
+
colorBlend?: number;
|
|
14
|
+
resolution?: number;
|
|
15
|
+
toneMapped?: boolean;
|
|
16
|
+
};
|
|
4
17
|
interface AccumulativeContext {
|
|
5
18
|
lights: Map<any, any>;
|
|
6
19
|
temporal: boolean;
|
|
@@ -46,19 +59,7 @@ export declare const AccumulativeShadows: React.ForwardRefExoticComponent<Pick<O
|
|
|
46
59
|
quaternion?: ReactThreeFiber.Quaternion | undefined;
|
|
47
60
|
layers?: ReactThreeFiber.Layers | undefined;
|
|
48
61
|
dispose?: (() => void) | null | undefined;
|
|
49
|
-
} & import("@react-three/fiber/dist/declarations/src/core/events").EventHandlers &
|
|
50
|
-
frames?: number | undefined;
|
|
51
|
-
blend?: number | undefined;
|
|
52
|
-
limit?: number | undefined;
|
|
53
|
-
scale?: number | undefined;
|
|
54
|
-
temporal?: boolean | undefined;
|
|
55
|
-
opacity?: number | undefined;
|
|
56
|
-
alphaTest?: number | undefined;
|
|
57
|
-
color?: string | undefined;
|
|
58
|
-
colorBlend?: number | undefined;
|
|
59
|
-
resolution?: number | undefined;
|
|
60
|
-
toneMapped?: boolean | undefined;
|
|
61
|
-
}, "visible" | "attach" | "args" | "children" | "key" | "onUpdate" | "position" | "up" | "scale" | "rotation" | "matrix" | "quaternion" | "layers" | "dispose" | "type" | "isGroup" | "id" | "uuid" | "name" | "parent" | "modelViewMatrix" | "normalMatrix" | "matrixWorld" | "matrixAutoUpdate" | "matrixWorldNeedsUpdate" | "castShadow" | "receiveShadow" | "frustumCulled" | "renderOrder" | "animations" | "userData" | "customDepthMaterial" | "customDistanceMaterial" | "isObject3D" | "onBeforeRender" | "onAfterRender" | "applyMatrix4" | "applyQuaternion" | "setRotationFromAxisAngle" | "setRotationFromEuler" | "setRotationFromMatrix" | "setRotationFromQuaternion" | "rotateOnAxis" | "rotateOnWorldAxis" | "rotateX" | "rotateY" | "rotateZ" | "translateOnAxis" | "translateX" | "translateY" | "translateZ" | "localToWorld" | "worldToLocal" | "lookAt" | "add" | "remove" | "removeFromParent" | "clear" | "getObjectById" | "getObjectByName" | "getObjectByProperty" | "getWorldPosition" | "getWorldQuaternion" | "getWorldScale" | "getWorldDirection" | "raycast" | "traverse" | "traverseVisible" | "traverseAncestors" | "updateMatrix" | "updateMatrixWorld" | "updateWorldMatrix" | "toJSON" | "clone" | "copy" | "addEventListener" | "hasEventListener" | "removeEventListener" | "dispatchEvent" | "color" | keyof import("@react-three/fiber/dist/declarations/src/core/events").EventHandlers | "alphaTest" | "opacity" | "toneMapped" | "resolution" | "frames" | "blend" | "temporal" | "limit" | "colorBlend"> & React.RefAttributes<AccumulativeContext>>;
|
|
62
|
+
} & import("@react-three/fiber/dist/declarations/src/core/events").EventHandlers & AccumulativeShadowsProps, "visible" | "attach" | "args" | "children" | "key" | "onUpdate" | "position" | "up" | "rotation" | "matrix" | "quaternion" | "layers" | "dispose" | "type" | "isGroup" | "id" | "uuid" | "name" | "parent" | "modelViewMatrix" | "normalMatrix" | "matrixWorld" | "matrixAutoUpdate" | "matrixWorldNeedsUpdate" | "castShadow" | "receiveShadow" | "frustumCulled" | "renderOrder" | "animations" | "userData" | "customDepthMaterial" | "customDistanceMaterial" | "isObject3D" | "onBeforeRender" | "onAfterRender" | "applyMatrix4" | "applyQuaternion" | "setRotationFromAxisAngle" | "setRotationFromEuler" | "setRotationFromMatrix" | "setRotationFromQuaternion" | "rotateOnAxis" | "rotateOnWorldAxis" | "rotateX" | "rotateY" | "rotateZ" | "translateOnAxis" | "translateX" | "translateY" | "translateZ" | "localToWorld" | "worldToLocal" | "lookAt" | "add" | "remove" | "removeFromParent" | "clear" | "getObjectById" | "getObjectByName" | "getObjectByProperty" | "getWorldPosition" | "getWorldQuaternion" | "getWorldScale" | "getWorldDirection" | "raycast" | "traverse" | "traverseVisible" | "traverseAncestors" | "updateMatrix" | "updateMatrixWorld" | "updateWorldMatrix" | "toJSON" | "clone" | "copy" | "addEventListener" | "hasEventListener" | "removeEventListener" | "dispatchEvent" | keyof import("@react-three/fiber/dist/declarations/src/core/events").EventHandlers | keyof AccumulativeShadowsProps> & React.RefAttributes<AccumulativeContext>>;
|
|
62
63
|
export declare const RandomizedLight: React.ForwardRefExoticComponent<Pick<Omit<ReactThreeFiber.ExtendedColors<ReactThreeFiber.Overwrite<Partial<THREE.Group>, ReactThreeFiber.NodeProps<THREE.Group, typeof THREE.Group>>>, ReactThreeFiber.NonFunctionKeys<{
|
|
63
64
|
position?: ReactThreeFiber.Vector3 | undefined;
|
|
64
65
|
up?: ReactThreeFiber.Vector3 | undefined;
|
package/core/Clone.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/extends"),t=require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/extends"),t=require("three"),r=require("react"),a=require("lodash.pick"),i=require("three-stdlib");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function o(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var c=n(e),l=o(t),d=o(r),u=n(a);const s=d.forwardRef((({isChild:e=!1,object:t,children:r,deep:a,castShadow:n,receiveShadow:o,inject:f,keys:y,...h},m)=>{var p;const b={keys:y,deep:a,inject:f,castShadow:n,receiveShadow:o};if(t=d.useMemo((()=>{if(!1===e&&!Array.isArray(t)){let e=!1;if(t.traverse((t=>{t.isSkinnedMesh&&(e=!0)})),e)return i.SkeletonUtils.clone(t)}return t}),[t,e]),Array.isArray(t))return d.createElement("group",c.default({},h,{ref:m}),t.map((e=>d.createElement(s,c.default({key:e.uuid,object:e},b)))),r);const{children:v,...j}=function(e,{keys:t=["near","far","color","distance","decay","penumbra","angle","intensity","skeleton","visible","castShadow","receiveShadow","morphTargetDictionary","morphTargetInfluences","name","geometry","material","position","rotation","scale","up","userData","bindMode","bindMatrix","bindMatrixInverse","skeleton"],deep:r,inject:a,castShadow:i,receiveShadow:n}){let o=u.default(e,t);return r&&(o.geometry&&"materialsOnly"!==r&&(o.geometry=o.geometry.clone()),o.material&&"geometriesOnly"!==r&&(o.material=o.material.clone())),a&&(o="function"==typeof a?{...o,children:a(e)}:d.isValidElement(a)?{...o,children:a}:{...o,...a}),e instanceof l.Mesh&&(i&&(o.castShadow=!0),n&&(o.receiveShadow=!0)),o}(t,b),w=t.type[0].toLowerCase()+t.type.slice(1);return d.createElement(w,c.default({},j,h,{ref:m}),(null==(p=t)?void 0:p.children).map((e=>"Bone"===e.type?d.createElement("primitive",c.default({key:e.uuid,object:e},b)):d.createElement(s,c.default({key:e.uuid,object:e},b,{isChild:!0})))),r,v)}));exports.Clone=s;
|
package/core/Clone.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
1
2
|
import * as React from 'react';
|
|
2
3
|
import { MeshProps } from '@react-three/fiber';
|
|
3
4
|
export declare const Clone: React.ForwardRefExoticComponent<Pick<Omit<import("@react-three/fiber").GroupProps, "children"> & {
|
|
@@ -8,4 +9,5 @@ export declare const Clone: React.ForwardRefExoticComponent<Pick<Omit<import("@r
|
|
|
8
9
|
inject?: React.ReactNode | MeshProps | ((object: THREE.Object3D) => React.ReactNode);
|
|
9
10
|
castShadow?: boolean | undefined;
|
|
10
11
|
receiveShadow?: boolean | undefined;
|
|
11
|
-
|
|
12
|
+
isChild?: boolean | undefined;
|
|
13
|
+
}, "object" | "visible" | "attach" | "args" | "children" | "key" | "onUpdate" | "position" | "up" | "scale" | "rotation" | "matrix" | "quaternion" | "layers" | "dispose" | "type" | "isGroup" | "id" | "uuid" | "name" | "parent" | "modelViewMatrix" | "normalMatrix" | "matrixWorld" | "matrixAutoUpdate" | "matrixWorldNeedsUpdate" | "castShadow" | "receiveShadow" | "frustumCulled" | "renderOrder" | "animations" | "userData" | "customDepthMaterial" | "customDistanceMaterial" | "isObject3D" | "onBeforeRender" | "onAfterRender" | "applyMatrix4" | "applyQuaternion" | "setRotationFromAxisAngle" | "setRotationFromEuler" | "setRotationFromMatrix" | "setRotationFromQuaternion" | "rotateOnAxis" | "rotateOnWorldAxis" | "rotateX" | "rotateY" | "rotateZ" | "translateOnAxis" | "translateX" | "translateY" | "translateZ" | "localToWorld" | "worldToLocal" | "lookAt" | "add" | "remove" | "removeFromParent" | "clear" | "getObjectById" | "getObjectByName" | "getObjectByProperty" | "getWorldPosition" | "getWorldQuaternion" | "getWorldScale" | "getWorldDirection" | "raycast" | "traverse" | "traverseVisible" | "traverseAncestors" | "updateMatrix" | "updateMatrixWorld" | "updateWorldMatrix" | "toJSON" | "clone" | "copy" | "addEventListener" | "hasEventListener" | "removeEventListener" | "dispatchEvent" | keyof import("@react-three/fiber/dist/declarations/src/core/events").EventHandlers | "keys" | "deep" | "inject" | "isChild"> & React.RefAttributes<THREE.Group>>;
|
package/core/Clone.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import _extends from '@babel/runtime/helpers/esm/extends';
|
|
2
|
+
import * as THREE from 'three';
|
|
2
3
|
import * as React from 'react';
|
|
3
4
|
import pick from 'lodash.pick';
|
|
5
|
+
import { SkeletonUtils } from 'three-stdlib';
|
|
4
6
|
|
|
5
7
|
function createSpread(child, {
|
|
6
|
-
keys = ['near', 'far', 'color', 'distance', 'decay', 'penumbra', 'angle', 'intensity', 'skeleton', 'visible', 'castShadow', 'receiveShadow', 'morphTargetDictionary', 'morphTargetInfluences', 'name', 'geometry', 'material', 'position', 'rotation', 'scale', 'up', 'userData'],
|
|
8
|
+
keys = ['near', 'far', 'color', 'distance', 'decay', 'penumbra', 'angle', 'intensity', 'skeleton', 'visible', 'castShadow', 'receiveShadow', 'morphTargetDictionary', 'morphTargetInfluences', 'name', 'geometry', 'material', 'position', 'rotation', 'scale', 'up', 'userData', 'bindMode', 'bindMatrix', 'bindMatrixInverse', 'skeleton'],
|
|
7
9
|
deep,
|
|
8
10
|
inject,
|
|
9
11
|
castShadow,
|
|
@@ -26,7 +28,7 @@ function createSpread(child, {
|
|
|
26
28
|
};
|
|
27
29
|
}
|
|
28
30
|
|
|
29
|
-
if (child
|
|
31
|
+
if (child instanceof THREE.Mesh) {
|
|
30
32
|
if (castShadow) spread.castShadow = true;
|
|
31
33
|
if (receiveShadow) spread.receiveShadow = true;
|
|
32
34
|
}
|
|
@@ -35,6 +37,7 @@ function createSpread(child, {
|
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
const Clone = /*#__PURE__*/React.forwardRef(({
|
|
40
|
+
isChild = false,
|
|
38
41
|
object,
|
|
39
42
|
children,
|
|
40
43
|
deep,
|
|
@@ -44,13 +47,26 @@ const Clone = /*#__PURE__*/React.forwardRef(({
|
|
|
44
47
|
keys,
|
|
45
48
|
...props
|
|
46
49
|
}, forwardRef) => {
|
|
50
|
+
var _object;
|
|
51
|
+
|
|
47
52
|
const config = {
|
|
48
53
|
keys,
|
|
49
54
|
deep,
|
|
50
55
|
inject,
|
|
51
56
|
castShadow,
|
|
52
57
|
receiveShadow
|
|
53
|
-
};
|
|
58
|
+
};
|
|
59
|
+
object = React.useMemo(() => {
|
|
60
|
+
if (isChild === false && !Array.isArray(object)) {
|
|
61
|
+
let isSkinned = false;
|
|
62
|
+
object.traverse(object => {
|
|
63
|
+
if (object.isSkinnedMesh) isSkinned = true;
|
|
64
|
+
});
|
|
65
|
+
if (isSkinned) return SkeletonUtils.clone(object);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return object;
|
|
69
|
+
}, [object, isChild]); // Deal with arrayed clones
|
|
54
70
|
|
|
55
71
|
if (Array.isArray(object)) {
|
|
56
72
|
return /*#__PURE__*/React.createElement("group", _extends({}, props, {
|
|
@@ -69,23 +85,17 @@ const Clone = /*#__PURE__*/React.forwardRef(({
|
|
|
69
85
|
const Element = object.type[0].toLowerCase() + object.type.slice(1);
|
|
70
86
|
return /*#__PURE__*/React.createElement(Element, _extends({}, spread, props, {
|
|
71
87
|
ref: forwardRef
|
|
72
|
-
}), (object == null ? void 0 :
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
spread = createSpread(child, config);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return /*#__PURE__*/React.createElement(Element, _extends({
|
|
87
|
-
key: child.uuid
|
|
88
|
-
}, spread));
|
|
88
|
+
}), ((_object = object) == null ? void 0 : _object.children).map(child => {
|
|
89
|
+
if (child.type === 'Bone') return /*#__PURE__*/React.createElement("primitive", _extends({
|
|
90
|
+
key: child.uuid,
|
|
91
|
+
object: child
|
|
92
|
+
}, config));
|
|
93
|
+
return /*#__PURE__*/React.createElement(Clone, _extends({
|
|
94
|
+
key: child.uuid,
|
|
95
|
+
object: child
|
|
96
|
+
}, config, {
|
|
97
|
+
isChild: true
|
|
98
|
+
}));
|
|
89
99
|
}), children, injectChildren);
|
|
90
100
|
});
|
|
91
101
|
|
package/core/ContactShadows.d.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import * as THREE from 'three';
|
|
3
|
-
export declare
|
|
4
|
-
opacity?: number
|
|
5
|
-
width?: number
|
|
6
|
-
height?: number
|
|
7
|
-
blur?: number
|
|
8
|
-
far?: number
|
|
9
|
-
smooth?: boolean
|
|
10
|
-
resolution?: number
|
|
11
|
-
frames?: number
|
|
12
|
-
scale?: number | [x: number, y: number]
|
|
13
|
-
color?: THREE.ColorRepresentation
|
|
14
|
-
depthWrite?: boolean
|
|
15
|
-
}
|
|
3
|
+
export declare type ContactShadowsProps = {
|
|
4
|
+
opacity?: number;
|
|
5
|
+
width?: number;
|
|
6
|
+
height?: number;
|
|
7
|
+
blur?: number;
|
|
8
|
+
far?: number;
|
|
9
|
+
smooth?: boolean;
|
|
10
|
+
resolution?: number;
|
|
11
|
+
frames?: number;
|
|
12
|
+
scale?: number | [x: number, y: number];
|
|
13
|
+
color?: THREE.ColorRepresentation;
|
|
14
|
+
depthWrite?: boolean;
|
|
15
|
+
};
|
|
16
|
+
export declare const ContactShadows: React.ForwardRefExoticComponent<Pick<Omit<import("@react-three/fiber").GroupProps, "scale"> & ContactShadowsProps, "visible" | "attach" | "args" | "children" | "key" | "onUpdate" | "position" | "up" | "rotation" | "matrix" | "quaternion" | "layers" | "dispose" | "type" | "isGroup" | "id" | "uuid" | "name" | "parent" | "modelViewMatrix" | "normalMatrix" | "matrixWorld" | "matrixAutoUpdate" | "matrixWorldNeedsUpdate" | "castShadow" | "receiveShadow" | "frustumCulled" | "renderOrder" | "animations" | "userData" | "customDepthMaterial" | "customDistanceMaterial" | "isObject3D" | "onBeforeRender" | "onAfterRender" | "applyMatrix4" | "applyQuaternion" | "setRotationFromAxisAngle" | "setRotationFromEuler" | "setRotationFromMatrix" | "setRotationFromQuaternion" | "rotateOnAxis" | "rotateOnWorldAxis" | "rotateX" | "rotateY" | "rotateZ" | "translateOnAxis" | "translateX" | "translateY" | "translateZ" | "localToWorld" | "worldToLocal" | "lookAt" | "add" | "remove" | "removeFromParent" | "clear" | "getObjectById" | "getObjectByName" | "getObjectByProperty" | "getWorldPosition" | "getWorldQuaternion" | "getWorldScale" | "getWorldDirection" | "raycast" | "traverse" | "traverseVisible" | "traverseAncestors" | "updateMatrix" | "updateMatrixWorld" | "updateWorldMatrix" | "toJSON" | "clone" | "copy" | "addEventListener" | "hasEventListener" | "removeEventListener" | "dispatchEvent" | keyof import("@react-three/fiber/dist/declarations/src/core/events").EventHandlers | keyof ContactShadowsProps> & React.RefAttributes<unknown>>;
|
package/core/Instances.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/extends"),t=require("three"),r=require("react"),n=require("@react-three/fiber"),a=require("react-merge-refs"),c=require("react-composer");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function s(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var o=i(e),u=s(t),l=s(r),f=i(a),d=i(c);const m=new u.Matrix4,y=new u.Matrix4,p=[],h=new u.Mesh;class x extends u.Group{constructor(){super(),this.color=new u.Color("white"),this.instance={current:void 0},this.instanceKey={current:void 0}}get geometry(){var e;return null==(e=this.instance.current)?void 0:e.geometry}raycast(e,t){const r=this.instance.current;if(!r)return;if(!r.geometry||!r.material)return;h.geometry=r.geometry;const n=r.matrixWorld,a=r.userData.instances.indexOf(this.instanceKey);if(!(-1===a||a>r.count)){r.getMatrixAt(a,m),y.multiplyMatrices(n,m),h.matrixWorld=y,h.raycast(e,p);for(let e=0,r=p.length;e<r;e++){const r=p[e];r.instanceId=a,r.object=this,t.push(r)}p.length=0}}}const g=l.createContext(null),M=new u.Matrix4,b=new u.Matrix4,w=new u.Matrix4,v=new u.Vector3,E=new u.Quaternion,A=new u.Vector3,j=l.forwardRef((({context:e,children:t,...r},a)=>{l.useMemo((()=>n.extend({PositionMesh:x})),[]);const c=l.useRef(),{subscribe:i,getParent:s}=l.useContext(e||g);return l.useLayoutEffect((()=>i(c)),[]),l.createElement("positionMesh",o.default({instance:s(),instanceKey:c,ref:f.default([a,c])},r),t)})),O=l.forwardRef((({children:e,range:t,limit:r=1e3,frames:a=1/0,...c},i)=>{const[{context:s,instance:d}]=l.useState((()=>{const e=l.createContext(null);return{context:e,instance:l.forwardRef(((t,r)=>l.createElement(j,o.default({context:e},t,{ref:r}))))}})),m=l.useRef(null),[y,p]=l.useState([]),[[h,x]]=l.useState((()=>{const e=new Float32Array(16*r);for(let t=0;t<r;t++)w.identity().toArray(e,16*t);return[e,new Float32Array([...new Array(3*r)].map((()=>1)))]}));l.useEffect((()=>{m.current.instanceMatrix.needsUpdate=!0}));let O=0,P=0;n.useFrame((()=>{if(a===1/0||O<a){m.current.updateMatrix(),m.current.updateMatrixWorld(),M.copy(m.current.matrixWorld).invert(),P=Math.min(r,void 0!==t?t:r,y.length),m.current.count=P,m.current.instanceMatrix.updateRange.count=16*P,m.current.instanceColor.updateRange.count=3*P;for(let e=0;e<y.length;e++){const t=y[e].current;t.matrixWorld.decompose(v,E,A),b.compose(v,E,A).premultiply(M),b.toArray(h,16*e),m.current.instanceMatrix.needsUpdate=!0,t.color.toArray(x,3*e),m.current.instanceColor.needsUpdate=!0}O++}}));const R=l.useMemo((()=>({getParent:()=>m,subscribe:e=>(p((t=>[...t,e])),()=>p((t=>t.filter((t=>t.current!==e.current)))))})),[]);return l.createElement("instancedMesh",o.default({userData:{instances:y},matrixAutoUpdate:!1,ref:f.default([i,m]),args:[null,null,0],raycast:()=>null},c),l.createElement("instancedBufferAttribute",{attach:"instanceMatrix",count:h.length/16,array:h,itemSize:16,usage:u.DynamicDrawUsage}),l.createElement("instancedBufferAttribute",{attach:"instanceColor",count:x.length/3,array:x,itemSize:3,usage:u.DynamicDrawUsage}),"function"==typeof e?l.createElement(s.Provider,{value:R},e(d)):l.createElement(g.Provider,{value:R},e))})),P=l.forwardRef((function({meshes:e,children:t,...r},n){const a=Array.isArray(e);if(!a)for(const t of Object.keys(e))e[t].isMesh||delete e[t];return l.createElement("group",{ref:n},l.createElement(d.default,{components:(a?e:Object.values(e)).map((({geometry:e,material:t})=>l.createElement(O,o.default({key:e.uuid,geometry:e,material:t},r))))},(r=>a?t(...r):t(Object.keys(e).filter((t=>e[t].isMesh)).reduce(((e,t,n)=>({...e,[t]:r[n]})),{})))))}));exports.Instance=j,exports.Instances=O,exports.Merged=P;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/extends"),t=require("three"),r=require("react"),n=require("@react-three/fiber"),a=require("react-merge-refs"),c=require("react-composer");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function s(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var o=i(e),u=s(t),l=s(r),f=i(a),d=i(c);const m=new u.Matrix4,y=new u.Matrix4,p=[],h=new u.Mesh;class x extends u.Group{constructor(){super(),this.color=new u.Color("white"),this.instance={current:void 0},this.instanceKey={current:void 0}}get geometry(){var e;return null==(e=this.instance.current)?void 0:e.geometry}raycast(e,t){const r=this.instance.current;if(!r)return;if(!r.geometry||!r.material)return;h.geometry=r.geometry;const n=r.matrixWorld,a=r.userData.instances.indexOf(this.instanceKey);if(!(-1===a||a>r.count)){r.getMatrixAt(a,m),y.multiplyMatrices(n,m),h.matrixWorld=y,r.material instanceof u.Material?h.material.side=r.material.side:h.material.side=r.material[0].side,h.raycast(e,p);for(let e=0,r=p.length;e<r;e++){const r=p[e];r.instanceId=a,r.object=this,t.push(r)}p.length=0}}}const g=l.createContext(null),M=new u.Matrix4,b=new u.Matrix4,w=new u.Matrix4,v=new u.Vector3,E=new u.Quaternion,A=new u.Vector3,j=l.forwardRef((({context:e,children:t,...r},a)=>{l.useMemo((()=>n.extend({PositionMesh:x})),[]);const c=l.useRef(),{subscribe:i,getParent:s}=l.useContext(e||g);return l.useLayoutEffect((()=>i(c)),[]),l.createElement("positionMesh",o.default({instance:s(),instanceKey:c,ref:f.default([a,c])},r),t)})),O=l.forwardRef((({children:e,range:t,limit:r=1e3,frames:a=1/0,...c},i)=>{const[{context:s,instance:d}]=l.useState((()=>{const e=l.createContext(null);return{context:e,instance:l.forwardRef(((t,r)=>l.createElement(j,o.default({context:e},t,{ref:r}))))}})),m=l.useRef(null),[y,p]=l.useState([]),[[h,x]]=l.useState((()=>{const e=new Float32Array(16*r);for(let t=0;t<r;t++)w.identity().toArray(e,16*t);return[e,new Float32Array([...new Array(3*r)].map((()=>1)))]}));l.useEffect((()=>{m.current.instanceMatrix.needsUpdate=!0}));let O=0,P=0;n.useFrame((()=>{if(a===1/0||O<a){m.current.updateMatrix(),m.current.updateMatrixWorld(),M.copy(m.current.matrixWorld).invert(),P=Math.min(r,void 0!==t?t:r,y.length),m.current.count=P,m.current.instanceMatrix.updateRange.count=16*P,m.current.instanceColor.updateRange.count=3*P;for(let e=0;e<y.length;e++){const t=y[e].current;t.matrixWorld.decompose(v,E,A),b.compose(v,E,A).premultiply(M),b.toArray(h,16*e),m.current.instanceMatrix.needsUpdate=!0,t.color.toArray(x,3*e),m.current.instanceColor.needsUpdate=!0}O++}}));const R=l.useMemo((()=>({getParent:()=>m,subscribe:e=>(p((t=>[...t,e])),()=>p((t=>t.filter((t=>t.current!==e.current)))))})),[]);return l.createElement("instancedMesh",o.default({userData:{instances:y},matrixAutoUpdate:!1,ref:f.default([i,m]),args:[null,null,0],raycast:()=>null},c),l.createElement("instancedBufferAttribute",{attach:"instanceMatrix",count:h.length/16,array:h,itemSize:16,usage:u.DynamicDrawUsage}),l.createElement("instancedBufferAttribute",{attach:"instanceColor",count:x.length/3,array:x,itemSize:3,usage:u.DynamicDrawUsage}),"function"==typeof e?l.createElement(s.Provider,{value:R},e(d)):l.createElement(g.Provider,{value:R},e))})),P=l.forwardRef((function({meshes:e,children:t,...r},n){const a=Array.isArray(e);if(!a)for(const t of Object.keys(e))e[t].isMesh||delete e[t];return l.createElement("group",{ref:n},l.createElement(d.default,{components:(a?e:Object.values(e)).map((({geometry:e,material:t})=>l.createElement(O,o.default({key:e.uuid,geometry:e,material:t},r))))},(r=>a?t(...r):t(Object.keys(e).filter((t=>e[t].isMesh)).reduce(((e,t,n)=>({...e,[t]:r[n]})),{})))))}));exports.Instance=j,exports.Instances=O,exports.Merged=P;
|
package/core/Instances.js
CHANGED
|
@@ -48,7 +48,9 @@ class PositionMesh extends THREE.Group {
|
|
|
48
48
|
_instanceWorldMatrix.multiplyMatrices(matrixWorld, _instanceLocalMatrix); // the mesh represents this single instance
|
|
49
49
|
|
|
50
50
|
|
|
51
|
-
_mesh.matrixWorld = _instanceWorldMatrix;
|
|
51
|
+
_mesh.matrixWorld = _instanceWorldMatrix; // raycast side according to instance material
|
|
52
|
+
|
|
53
|
+
if (parent.material instanceof THREE.Material) _mesh.material.side = parent.material.side;else _mesh.material.side = parent.material[0].side;
|
|
52
54
|
|
|
53
55
|
_mesh.raycast(raycaster, _instanceIntersects); // process the result of raycast
|
|
54
56
|
|
package/core/SpotLight.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/extends"),t=require("react"),r=require("three"),a=require("@react-three/fiber"),o=require("../materials/SpotLightMaterial.cjs.js");function
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/extends"),t=require("react"),r=require("three"),a=require("@react-three/fiber"),n=require("three-stdlib"),o=require("react-merge-refs"),i=require("../materials/SpotLightMaterial.cjs.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function l(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var c=u(e),s=l(t),p=u(o);function d({opacity:e=1,radiusTop:t,radiusBottom:n,depthBuffer:o,color:u="white",distance:l=5,angle:c=.15,attenuation:p=5,anglePower:d=5}){const m=s.useRef(null),h=a.useThree((e=>e.size)),f=a.useThree((e=>e.camera)),g=a.useThree((e=>e.viewport.dpr)),[v]=s.useState((()=>new i.SpotLightMaterial)),[w]=s.useState((()=>new r.Vector3));t=void 0===t?.1:t,n=void 0===n?7*c:n,a.useFrame((()=>{v.uniforms.spotPosition.value.copy(m.current.getWorldPosition(w)),m.current.lookAt(m.current.parent.target.getWorldPosition(w))}));const S=s.useMemo((()=>{const e=new r.CylinderGeometry(t,n,l,128,64,!0);return e.applyMatrix4((new r.Matrix4).makeTranslation(0,-l/2,0)),e.applyMatrix4((new r.Matrix4).makeRotationX(-Math.PI/2)),e}),[l,t,n]);return s.createElement(s.Fragment,null,s.createElement("mesh",{ref:m,geometry:S,raycast:()=>null},s.createElement("primitive",{object:v,attach:"material","uniforms-opacity-value":e,"uniforms-lightColor-value":u,"uniforms-attenuation-value":p,"uniforms-anglePower-value":d,"uniforms-depth-value":o,"uniforms-cameraNear-value":f.near,"uniforms-cameraFar-value":f.far,"uniforms-resolution-value":o?[h.width*g,h.height*g]:[0,0]})))}function m(e,t,n,o,i){const[[u,l]]=s.useState((()=>[new r.Vector3,new r.Vector3]));s.useLayoutEffect((()=>{if(!(null==(t=e.current)?void 0:t.isSpotLight))throw new Error("SpotlightShadow must be a child of a SpotLight");var t;console.log(e.current),e.current.shadow.mapSize.set(n,o),e.current.shadow.needsUpdate=!0}),[e,n,o]),a.useFrame((()=>{if(!e.current)return;const r=e.current.position,a=e.current.target.position;l.copy(a).sub(r);var n=l.length();l.normalize().multiplyScalar(n*i),u.copy(r).add(l),t.current.position.copy(u),t.current.lookAt(e.current.target.position)}))}function h({distance:e=.4,alphaTest:t=.5,map:o,shader:i="#define GLSLIFY 1\nvarying vec2 vUv;uniform sampler2D uShadowMap;uniform float uTime;void main(){vec3 color=texture2D(uShadowMap,vUv).xyz;gl_FragColor=vec4(color,1.);}",width:u=512,height:l=512,scale:c=1,children:p,...d}){const h=s.useRef(null),f=d.spotlightRef,g=d.debug;m(f,h,u,l,e);const v=s.useMemo((()=>new r.WebGLRenderTarget(u,l,{format:r.RGBAFormat,encoding:r.LinearEncoding,stencilBuffer:!1})),[u,l]),w=s.useRef({uShadowMap:{value:o},uTime:{value:0}});s.useEffect((()=>{w.current.uShadowMap.value=o}),[o]);const S=s.useMemo((()=>new n.FullScreenQuad(new r.ShaderMaterial({uniforms:w.current,vertexShader:"\n varying vec2 vUv;\n\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",fragmentShader:i}))),[i]);return s.useEffect((()=>()=>{S.material.dispose(),S.dispose()}),[S]),s.useEffect((()=>()=>v.dispose()),[v]),a.useFrame((({gl:e},t)=>{w.current.uTime.value+=t,e.setRenderTarget(v),S.render(e),e.setRenderTarget(null)})),s.createElement(s.Fragment,null,s.createElement("mesh",{ref:h,scale:c,castShadow:!0},s.createElement("planeGeometry",null),s.createElement("meshBasicMaterial",{transparent:!0,side:r.DoubleSide,alphaTest:t,alphaMap:v.texture,"alphaMap-wrapS":r.RepeatWrapping,"alphaMap-wrapT":r.RepeatWrapping,opacity:g?1:0},p)))}function f({distance:e=.4,alphaTest:t=.5,map:a,width:n=512,height:o=512,scale:i,children:u,...l}){const c=s.useRef(null),p=l.spotlightRef,d=l.debug;return m(p,c,n,o,e),s.createElement(s.Fragment,null,s.createElement("mesh",{ref:c,scale:i,castShadow:!0},s.createElement("planeGeometry",null),s.createElement("meshBasicMaterial",{transparent:!0,side:r.DoubleSide,alphaTest:t,alphaMap:a,"alphaMap-wrapS":r.RepeatWrapping,"alphaMap-wrapT":r.RepeatWrapping,opacity:d?1:0},u)))}const g=s.forwardRef((({opacity:e=1,radiusTop:t,radiusBottom:r,depthBuffer:a,color:n="white",distance:o=5,angle:i=.15,attenuation:u=5,anglePower:l=5,volumetric:m=!0,debug:h=!1,children:f,...g},v)=>{const w=s.useRef(null);return s.createElement("group",null,h&&w.current&&s.createElement("spotLightHelper",{args:[w.current]}),s.createElement("spotLight",c.default({ref:p.default([v,w]),angle:i,color:n,distance:o,castShadow:!0},g),m&&s.createElement(d,{debug:h,opacity:e,radiusTop:t,radiusBottom:r,depthBuffer:a,color:n,distance:o,angle:i,attenuation:u,anglePower:l})),f&&s.cloneElement(f,{spotlightRef:w,debug:h}))}));exports.SpotLight=g,exports.SpotLightShadow=function(e){return e.shader?s.createElement(h,e):s.createElement(f,e)};
|
package/core/SpotLight.d.ts
CHANGED
|
@@ -1,30 +1,25 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { DepthTexture, SpotLight as SpotLightImpl } from 'three';
|
|
3
|
-
declare
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
radiusTop?: number | undefined;
|
|
26
|
-
radiusBottom?: number | undefined;
|
|
27
|
-
opacity?: number | undefined;
|
|
28
|
-
color?: string | number | undefined;
|
|
29
|
-
}, "visible" | "attach" | "args" | "children" | "key" | "onUpdate" | "position" | "up" | "scale" | "rotation" | "matrix" | "quaternion" | "layers" | "dispose" | "type" | "id" | "uuid" | "name" | "parent" | "modelViewMatrix" | "normalMatrix" | "matrixWorld" | "matrixAutoUpdate" | "matrixWorldNeedsUpdate" | "castShadow" | "receiveShadow" | "frustumCulled" | "renderOrder" | "animations" | "userData" | "customDepthMaterial" | "customDistanceMaterial" | "isObject3D" | "onBeforeRender" | "onAfterRender" | "applyMatrix4" | "applyQuaternion" | "setRotationFromAxisAngle" | "setRotationFromEuler" | "setRotationFromMatrix" | "setRotationFromQuaternion" | "rotateOnAxis" | "rotateOnWorldAxis" | "rotateX" | "rotateY" | "rotateZ" | "translateOnAxis" | "translateX" | "translateY" | "translateZ" | "localToWorld" | "worldToLocal" | "lookAt" | "add" | "remove" | "removeFromParent" | "clear" | "getObjectById" | "getObjectByName" | "getObjectByProperty" | "getWorldPosition" | "getWorldQuaternion" | "getWorldScale" | "getWorldDirection" | "raycast" | "traverse" | "traverseVisible" | "traverseAncestors" | "updateMatrix" | "updateMatrixWorld" | "updateWorldMatrix" | "toJSON" | "clone" | "copy" | "addEventListener" | "hasEventListener" | "removeEventListener" | "dispatchEvent" | "color" | keyof import("@react-three/fiber/dist/declarations/src/core/events").EventHandlers | "intensity" | "isLight" | "shadow" | "shadowCameraFov" | "shadowCameraLeft" | "shadowCameraRight" | "shadowCameraTop" | "shadowCameraBottom" | "shadowCameraNear" | "shadowCameraFar" | "shadowBias" | "shadowMapWidth" | "shadowMapHeight" | "opacity" | "target" | "distance" | "angle" | "decay" | "power" | "penumbra" | "isSpotLight" | "depthBuffer" | "attenuation" | "anglePower" | "radiusTop" | "radiusBottom"> & React.RefAttributes<SpotLightImpl>>;
|
|
2
|
+
import { DepthTexture, SpotLight as SpotLightImpl, Texture } from 'three';
|
|
3
|
+
declare type SpotLightProps = JSX.IntrinsicElements['spotLight'] & {
|
|
4
|
+
depthBuffer?: DepthTexture;
|
|
5
|
+
attenuation?: number;
|
|
6
|
+
anglePower?: number;
|
|
7
|
+
radiusTop?: number;
|
|
8
|
+
radiusBottom?: number;
|
|
9
|
+
opacity?: number;
|
|
10
|
+
color?: string | number;
|
|
11
|
+
volumetric?: boolean;
|
|
12
|
+
debug?: boolean;
|
|
13
|
+
};
|
|
14
|
+
interface ShadowMeshProps {
|
|
15
|
+
distance?: number;
|
|
16
|
+
alphaTest?: number;
|
|
17
|
+
scale?: number;
|
|
18
|
+
map?: Texture;
|
|
19
|
+
shader?: string;
|
|
20
|
+
width?: number;
|
|
21
|
+
height?: number;
|
|
22
|
+
}
|
|
23
|
+
export declare function SpotLightShadow(props: React.PropsWithChildren<ShadowMeshProps>): JSX.Element;
|
|
24
|
+
declare const SpotLight: React.ForwardRefExoticComponent<Pick<SpotLightProps, "visible" | "attach" | "args" | "children" | "key" | "onUpdate" | "position" | "up" | "scale" | "rotation" | "matrix" | "quaternion" | "layers" | "dispose" | "type" | "id" | "uuid" | "name" | "parent" | "modelViewMatrix" | "normalMatrix" | "matrixWorld" | "matrixAutoUpdate" | "matrixWorldNeedsUpdate" | "castShadow" | "receiveShadow" | "frustumCulled" | "renderOrder" | "animations" | "userData" | "customDepthMaterial" | "customDistanceMaterial" | "isObject3D" | "onBeforeRender" | "onAfterRender" | "applyMatrix4" | "applyQuaternion" | "setRotationFromAxisAngle" | "setRotationFromEuler" | "setRotationFromMatrix" | "setRotationFromQuaternion" | "rotateOnAxis" | "rotateOnWorldAxis" | "rotateX" | "rotateY" | "rotateZ" | "translateOnAxis" | "translateX" | "translateY" | "translateZ" | "localToWorld" | "worldToLocal" | "lookAt" | "add" | "remove" | "removeFromParent" | "clear" | "getObjectById" | "getObjectByName" | "getObjectByProperty" | "getWorldPosition" | "getWorldQuaternion" | "getWorldScale" | "getWorldDirection" | "raycast" | "traverse" | "traverseVisible" | "traverseAncestors" | "updateMatrix" | "updateMatrixWorld" | "updateWorldMatrix" | "toJSON" | "clone" | "copy" | "addEventListener" | "hasEventListener" | "removeEventListener" | "dispatchEvent" | "color" | keyof import("@react-three/fiber/dist/declarations/src/core/events").EventHandlers | "intensity" | "isLight" | "shadow" | "shadowCameraFov" | "shadowCameraLeft" | "shadowCameraRight" | "shadowCameraTop" | "shadowCameraBottom" | "shadowCameraNear" | "shadowCameraFar" | "shadowBias" | "shadowMapWidth" | "shadowMapHeight" | "opacity" | "target" | "distance" | "angle" | "decay" | "power" | "penumbra" | "isSpotLight" | "depthBuffer" | "attenuation" | "debug" | "anglePower" | "volumetric" | "radiusTop" | "radiusBottom"> & React.RefAttributes<SpotLightImpl>>;
|
|
30
25
|
export { SpotLight };
|