three-stdlib 2.14.1 → 2.15.0
Sign up to get free protection for your applications and to get access to all the features.
- package/csm/CSM.cjs.js +1 -1
- package/csm/CSM.js +8 -8
- package/csm/CSMFrustum.cjs.js +1 -0
- package/csm/CSMFrustum.d.ts +19 -0
- package/csm/{Frustum.js → CSMFrustum.js} +8 -7
- package/csm/CSMShader.cjs.js +1 -0
- package/csm/CSMShader.d.ts +4 -0
- package/csm/{Shader.js → CSMShader.js} +52 -36
- package/curves/CurveExtras.d.ts +52 -54
- package/geometries/ParametricGeometries.cjs.js +1 -1
- package/geometries/ParametricGeometries.js +91 -99
- package/geometries/ParametricGeometry.cjs.js +1 -0
- package/geometries/ParametricGeometry.d.ts +18 -0
- package/geometries/ParametricGeometry.js +87 -0
- package/index.cjs.js +1 -1
- package/index.d.ts +3 -77
- package/index.js +4 -1
- package/interactive/InteractiveGroup.cjs.js +1 -0
- package/interactive/InteractiveGroup.d.ts +5 -0
- package/interactive/InteractiveGroup.js +87 -0
- package/lines/Line2.cjs.js +1 -1
- package/lines/Line2.d.ts +7 -5
- package/lines/Line2.js +2 -5
- package/lines/LineGeometry.cjs.js +1 -1
- package/lines/LineGeometry.d.ts +6 -8
- package/lines/LineGeometry.js +28 -39
- package/lines/LineMaterial.cjs.js +1 -1
- package/lines/LineMaterial.d.ts +23 -19
- package/lines/LineMaterial.js +263 -107
- package/lines/LineSegments2.cjs.js +1 -1
- package/lines/LineSegments2.d.ts +12 -20
- package/lines/LineSegments2.js +272 -125
- package/lines/LineSegmentsGeometry.cjs.js +1 -1
- package/lines/LineSegmentsGeometry.d.ts +18 -16
- package/lines/LineSegmentsGeometry.js +30 -40
- package/lines/Wireframe.cjs.js +1 -1
- package/lines/Wireframe.js +39 -39
- package/lines/WireframeGeometry2.cjs.js +1 -1
- package/lines/WireframeGeometry2.js +8 -9
- package/loaders/GLTFLoader.d.ts +2 -9
- package/loaders/LUT3dlLoader.d.ts +2 -2
- package/loaders/LUTCubeLoader.d.ts +2 -2
- package/loaders/RGBELoader.cjs.js +1 -1
- package/loaders/RGBELoader.js +1 -9
- package/loaders/VOXLoader.d.ts +2 -2
- package/objects/Reflector.d.ts +1 -0
- package/objects/ReflectorForSSRPass.d.ts +4 -4
- package/objects/Refractor.d.ts +1 -0
- package/objects/Water2.d.ts +1 -1
- package/package.json +2 -1
- package/postprocessing/LUTPass.d.ts +3 -3
- package/postprocessing/SSAARenderPass.d.ts +1 -1
- package/postprocessing/SSRPass.d.ts +3 -3
- package/shaders/BokehShader2.d.ts +27 -72
- package/shaders/BokehShader2.js +0 -1
- package/shaders/index.cjs.js +1 -1
- package/shaders/index.d.ts +2 -1
- package/shaders/index.js +1 -1
- package/csm/Frustum.cjs.js +0 -1
- package/csm/Shader.cjs.js +0 -1
- package/loaders/VRMLoader.d.ts +0 -19
- package/nodes/Nodes.d.ts +0 -106
- package/nodes/accessors/CameraNode.d.ts +0 -29
- package/nodes/accessors/NormalNode.d.ts +0 -13
- package/nodes/accessors/PositionNode.d.ts +0 -15
- package/nodes/accessors/ReflectNode.d.ts +0 -12
- package/nodes/accessors/UVNode.d.ts +0 -10
- package/nodes/core/AttributeNode.d.ts +0 -13
- package/nodes/core/ConstNode.d.ts +0 -22
- package/nodes/core/ExpressionNode.d.ts +0 -5
- package/nodes/core/FunctionCallNode.d.ts +0 -17
- package/nodes/core/FunctionNode.d.ts +0 -28
- package/nodes/core/InputNode.d.ts +0 -12
- package/nodes/core/Node.d.ts +0 -34
- package/nodes/core/NodeBuilder.d.ts +0 -149
- package/nodes/core/NodeFrame.d.ts +0 -17
- package/nodes/core/NodeUniform.d.ts +0 -17
- package/nodes/core/NodeUtils.d.ts +0 -7
- package/nodes/core/TempNode.d.ts +0 -23
- package/nodes/core/VarNode.d.ts +0 -12
- package/nodes/materials/MeshStandardNodeMaterial.d.ts +0 -21
- package/nodes/materials/NodeMaterial.d.ts +0 -28
- package/nodes/math/CondNode.d.ts +0 -26
- package/nodes/math/MathNode.d.ts +0 -57
- package/nodes/math/OperatorNode.d.ts +0 -17
- package/nodes/procedural/CheckerNode.d.ts +0 -17
- package/nodes/utils/JoinNode.d.ts +0 -15
- package/nodes/utils/TimerNode.d.ts +0 -19
- package/objects/ReflectorRTT.d.ts +0 -6
package/lines/Wireframe.js
CHANGED
@@ -1,45 +1,45 @@
|
|
1
|
-
import {
|
1
|
+
import { Vector3, Mesh, InstancedInterleavedBuffer, InterleavedBufferAttribute } from 'three';
|
2
2
|
import { LineSegmentsGeometry } from './LineSegmentsGeometry.js';
|
3
3
|
import { LineMaterial } from './LineMaterial.js';
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
const _start = new Vector3();
|
6
|
+
|
7
|
+
const _end = new Vector3();
|
8
|
+
|
9
|
+
class Wireframe extends Mesh {
|
10
|
+
constructor(geometry = new LineSegmentsGeometry(), material = new LineMaterial({
|
10
11
|
color: Math.random() * 0xffffff
|
11
|
-
})
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
});
|
12
|
+
})) {
|
13
|
+
super(geometry, material);
|
14
|
+
this.isWireframe = true;
|
15
|
+
this.type = 'Wireframe';
|
16
|
+
} // for backwards-compatibility, but could be a method of LineSegmentsGeometry...
|
17
|
+
|
18
|
+
|
19
|
+
computeLineDistances() {
|
20
|
+
const geometry = this.geometry;
|
21
|
+
const instanceStart = geometry.attributes.instanceStart;
|
22
|
+
const instanceEnd = geometry.attributes.instanceEnd;
|
23
|
+
const lineDistances = new Float32Array(2 * instanceStart.count);
|
24
|
+
|
25
|
+
for (let i = 0, j = 0, l = instanceStart.count; i < l; i++, j += 2) {
|
26
|
+
_start.fromBufferAttribute(instanceStart, i);
|
27
|
+
|
28
|
+
_end.fromBufferAttribute(instanceEnd, i);
|
29
|
+
|
30
|
+
lineDistances[j] = j === 0 ? 0 : lineDistances[j - 1];
|
31
|
+
lineDistances[j + 1] = lineDistances[j] + _start.distanceTo(_end);
|
32
|
+
}
|
33
|
+
|
34
|
+
const instanceDistanceBuffer = new InstancedInterleavedBuffer(lineDistances, 2, 1); // d0, d1
|
35
|
+
|
36
|
+
geometry.setAttribute('instanceDistanceStart', new InterleavedBufferAttribute(instanceDistanceBuffer, 1, 0)); // d0
|
37
|
+
|
38
|
+
geometry.setAttribute('instanceDistanceEnd', new InterleavedBufferAttribute(instanceDistanceBuffer, 1, 1)); // d1
|
39
|
+
|
40
|
+
return this;
|
41
|
+
}
|
42
|
+
|
43
|
+
}
|
44
44
|
|
45
45
|
export { Wireframe };
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("three"),r=require("./LineSegmentsGeometry.cjs.js");
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("three"),r=require("./LineSegmentsGeometry.cjs.js");class t extends r.LineSegmentsGeometry{constructor(r){super(),this.isWireframeGeometry2=!0,this.type="WireframeGeometry2",this.fromWireframeGeometry(new e.WireframeGeometry(r))}}exports.WireframeGeometry2=t;
|
@@ -1,15 +1,14 @@
|
|
1
1
|
import { WireframeGeometry } from 'three';
|
2
2
|
import { LineSegmentsGeometry } from './LineSegmentsGeometry.js';
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
class WireframeGeometry2 extends LineSegmentsGeometry {
|
5
|
+
constructor(geometry) {
|
6
|
+
super();
|
7
|
+
this.isWireframeGeometry2 = true;
|
8
|
+
this.type = 'WireframeGeometry2';
|
9
|
+
this.fromWireframeGeometry(new WireframeGeometry(geometry)); // set colors, maybe
|
10
|
+
}
|
9
11
|
|
10
|
-
|
11
|
-
constructor: WireframeGeometry2,
|
12
|
-
isWireframeGeometry2: true
|
13
|
-
});
|
12
|
+
}
|
14
13
|
|
15
14
|
export { WireframeGeometry2 };
|
package/loaders/GLTFLoader.d.ts
CHANGED
@@ -101,15 +101,8 @@ export class GLTFParser {
|
|
101
101
|
loadBufferView: (bufferViewIndex: number) => Promise<ArrayBuffer>;
|
102
102
|
loadAccessor: (accessorIndex: number) => Promise<BufferAttribute | InterleavedBufferAttribute>;
|
103
103
|
loadTexture: (textureIndex: number) => Promise<Texture>;
|
104
|
-
loadTextureImage: (
|
105
|
-
|
106
|
-
/**
|
107
|
-
* GLTF.Image
|
108
|
-
* See: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/schema/image.schema.json
|
109
|
-
*/
|
110
|
-
source: { [key: string]: any },
|
111
|
-
loader: Loader,
|
112
|
-
) => Promise<Texture>;
|
104
|
+
loadTextureImage: (textureIndex: number, sourceIndex: number, loader: Loader) => Promise<Texture>;
|
105
|
+
loadImageSource: (sourceIndex: number, loader: Loader) => Promise<Texture>;
|
113
106
|
assignTexture: (
|
114
107
|
materialParams: { [key: string]: any },
|
115
108
|
mapName: string,
|
@@ -1,9 +1,9 @@
|
|
1
|
-
import { Loader, LoadingManager, DataTexture,
|
1
|
+
import { Loader, LoadingManager, DataTexture, Data3DTexture } from 'three';
|
2
2
|
|
3
3
|
export interface LUT3dlResult {
|
4
4
|
size: number;
|
5
5
|
texture: DataTexture;
|
6
|
-
texture3D:
|
6
|
+
texture3D: Data3DTexture;
|
7
7
|
}
|
8
8
|
|
9
9
|
export class LUT3dlLoader extends Loader {
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Loader, LoadingManager, Vector3, DataTexture,
|
1
|
+
import { Loader, LoadingManager, Vector3, DataTexture, Data3DTexture } from 'three';
|
2
2
|
|
3
3
|
export interface LUTCubeResult {
|
4
4
|
title: string;
|
@@ -6,7 +6,7 @@ export interface LUTCubeResult {
|
|
6
6
|
domainMin: Vector3;
|
7
7
|
domainMax: Vector3;
|
8
8
|
texture: DataTexture;
|
9
|
-
texture3D:
|
9
|
+
texture3D: Data3DTexture;
|
10
10
|
}
|
11
11
|
|
12
12
|
export class LUTCubeLoader extends Loader {
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("three");class t extends e.DataTextureLoader{constructor(t){super(t),this.type=e.HalfFloatType}parse(t){const r=function(e,t){switch(e){case 1:console.error("THREE.RGBELoader Read Error: "+(t||""));break;case 2:console.error("THREE.RGBELoader Write Error: "+(t||""));break;case 3:console.error("THREE.RGBELoader Bad File Format: "+(t||""));break;default:case 4:console.error("THREE.RGBELoader: Error: "+(t||""))}return-1},a=function(e,t,r){t=t||1024;let a=e.pos,n=-1,o=0,s="",i=String.fromCharCode.apply(null,new Uint16Array(e.subarray(a,a+128)));for(;0>(n=i.indexOf("\n"))&&o<t&&a<e.byteLength;)s+=i,o+=i.length,a+=128,i+=String.fromCharCode.apply(null,new Uint16Array(e.subarray(a,a+128)));return-1<n&&(!1!==r&&(e.pos+=o+n+1),s+i.slice(0,n))},n=function(e,t,r,a){const n=e[t+3],o=Math.pow(2,n-128)/255;r[a+0]=e[t+0]*o,r[a+1]=e[t+1]*o,r[a+2]=e[t+2]*o,r[a+3]=1},o=function(t,r,a,n){const o=t[r+3],s=Math.pow(2,o-128)/255;a[n+0]=e.DataUtils.toHalfFloat(Math.min(t[r+0]*s,65504)),a[n+1]=e.DataUtils.toHalfFloat(Math.min(t[r+1]*s,65504)),a[n+2]=e.DataUtils.toHalfFloat(Math.min(t[r+2]*s,65504)),a[n+3]=e.DataUtils.toHalfFloat(1)},s=new Uint8Array(t);s.pos=0;const i=function(e){const t=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,n=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,o=/^\s*FORMAT=(\S+)\s*$/,s=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,i={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let l,c;if(e.pos>=e.byteLength||!(l=a(e)))return r(1,"no header found");if(!(c=l.match(/^#\?(\S+)/)))return r(3,"bad initial token");for(i.valid|=1,i.programtype=c[1],i.string+=l+"\n";l=a(e),!1!==l;)if(i.string+=l+"\n","#"!==l.charAt(0)){if((c=l.match(t))&&(i.gamma=parseFloat(c[1])),(c=l.match(n))&&(i.exposure=parseFloat(c[1])),(c=l.match(o))&&(i.valid|=2,i.format=c[1]),(c=l.match(s))&&(i.valid|=4,i.height=parseInt(c[1],10),i.width=parseInt(c[2],10)),2&i.valid&&4&i.valid)break}else i.comments+=l+"\n";return 2&i.valid?4&i.valid?i:r(3,"missing image size specifier"):r(3,"missing format specifier")}(s);if(-1!==i){const t=i.width,a=i.height,l=function(e,t,a){const n=t;if(n<8||n>32767||2!==e[0]||2!==e[1]||128&e[2])return new Uint8Array(e);if(n!==(e[2]<<8|e[3]))return r(3,"wrong scanline width");const o=new Uint8Array(4*t*a);if(!o.length)return r(4,"unable to allocate buffer space");let s=0,i=0;const l=4*n,c=new Uint8Array(4),f=new Uint8Array(l);let p=a;for(;p>0&&i<e.byteLength;){if(i+4>e.byteLength)return r(1);if(c[0]=e[i++],c[1]=e[i++],c[2]=e[i++],c[3]=e[i++],2!=c[0]||2!=c[1]||(c[2]<<8|c[3])!=n)return r(3,"bad rgbe scanline format");let t,a=0;for(;a<l&&i<e.byteLength;){t=e[i++];const n=t>128;if(n&&(t-=128),0===t||a+t>l)return r(3,"bad scanline data");if(n){const r=e[i++];for(let e=0;e<t;e++)f[a++]=r}else f.set(e.subarray(i,i+t),a),a+=t,i+=t}const d=n;for(let e=0;e<d;e++){let t=0;o[s]=f[e+t],t+=n,o[s+1]=f[e+t],t+=n,o[s+2]=f[e+t],t+=n,o[s+3]=f[e+t],s+=4}p--}return o}(s.subarray(s.pos),t,a);if(-1!==l){let r,s,c
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("three");class t extends e.DataTextureLoader{constructor(t){super(t),this.type=e.HalfFloatType}parse(t){const r=function(e,t){switch(e){case 1:console.error("THREE.RGBELoader Read Error: "+(t||""));break;case 2:console.error("THREE.RGBELoader Write Error: "+(t||""));break;case 3:console.error("THREE.RGBELoader Bad File Format: "+(t||""));break;default:case 4:console.error("THREE.RGBELoader: Error: "+(t||""))}return-1},a=function(e,t,r){t=t||1024;let a=e.pos,n=-1,o=0,s="",i=String.fromCharCode.apply(null,new Uint16Array(e.subarray(a,a+128)));for(;0>(n=i.indexOf("\n"))&&o<t&&a<e.byteLength;)s+=i,o+=i.length,a+=128,i+=String.fromCharCode.apply(null,new Uint16Array(e.subarray(a,a+128)));return-1<n&&(!1!==r&&(e.pos+=o+n+1),s+i.slice(0,n))},n=function(e,t,r,a){const n=e[t+3],o=Math.pow(2,n-128)/255;r[a+0]=e[t+0]*o,r[a+1]=e[t+1]*o,r[a+2]=e[t+2]*o,r[a+3]=1},o=function(t,r,a,n){const o=t[r+3],s=Math.pow(2,o-128)/255;a[n+0]=e.DataUtils.toHalfFloat(Math.min(t[r+0]*s,65504)),a[n+1]=e.DataUtils.toHalfFloat(Math.min(t[r+1]*s,65504)),a[n+2]=e.DataUtils.toHalfFloat(Math.min(t[r+2]*s,65504)),a[n+3]=e.DataUtils.toHalfFloat(1)},s=new Uint8Array(t);s.pos=0;const i=function(e){const t=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,n=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,o=/^\s*FORMAT=(\S+)\s*$/,s=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,i={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let l,c;if(e.pos>=e.byteLength||!(l=a(e)))return r(1,"no header found");if(!(c=l.match(/^#\?(\S+)/)))return r(3,"bad initial token");for(i.valid|=1,i.programtype=c[1],i.string+=l+"\n";l=a(e),!1!==l;)if(i.string+=l+"\n","#"!==l.charAt(0)){if((c=l.match(t))&&(i.gamma=parseFloat(c[1])),(c=l.match(n))&&(i.exposure=parseFloat(c[1])),(c=l.match(o))&&(i.valid|=2,i.format=c[1]),(c=l.match(s))&&(i.valid|=4,i.height=parseInt(c[1],10),i.width=parseInt(c[2],10)),2&i.valid&&4&i.valid)break}else i.comments+=l+"\n";return 2&i.valid?4&i.valid?i:r(3,"missing image size specifier"):r(3,"missing format specifier")}(s);if(-1!==i){const t=i.width,a=i.height,l=function(e,t,a){const n=t;if(n<8||n>32767||2!==e[0]||2!==e[1]||128&e[2])return new Uint8Array(e);if(n!==(e[2]<<8|e[3]))return r(3,"wrong scanline width");const o=new Uint8Array(4*t*a);if(!o.length)return r(4,"unable to allocate buffer space");let s=0,i=0;const l=4*n,c=new Uint8Array(4),f=new Uint8Array(l);let p=a;for(;p>0&&i<e.byteLength;){if(i+4>e.byteLength)return r(1);if(c[0]=e[i++],c[1]=e[i++],c[2]=e[i++],c[3]=e[i++],2!=c[0]||2!=c[1]||(c[2]<<8|c[3])!=n)return r(3,"bad rgbe scanline format");let t,a=0;for(;a<l&&i<e.byteLength;){t=e[i++];const n=t>128;if(n&&(t-=128),0===t||a+t>l)return r(3,"bad scanline data");if(n){const r=e[i++];for(let e=0;e<t;e++)f[a++]=r}else f.set(e.subarray(i,i+t),a),a+=t,i+=t}const d=n;for(let e=0;e<d;e++){let t=0;o[s]=f[e+t],t+=n,o[s+1]=f[e+t],t+=n,o[s+2]=f[e+t],t+=n,o[s+3]=f[e+t],s+=4}p--}return o}(s.subarray(s.pos),t,a);if(-1!==l){let r,s,c;switch(this.type){case e.FloatType:c=l.length/4;const t=new Float32Array(4*c);for(let e=0;e<c;e++)n(l,4*e,t,4*e);r=t,s=e.FloatType;break;case e.HalfFloatType:c=l.length/4;const a=new Uint16Array(4*c);for(let e=0;e<c;e++)o(l,4*e,a,4*e);r=a,s=e.HalfFloatType;break;default:console.error("THREE.RGBELoader: unsupported type: ",this.type)}return{width:t,height:a,data:r,header:i.string,gamma:i.gamma,exposure:i.exposure,type:s}}}return null}setDataType(e){return this.type=e,this}load(t,r,a,n){return super.load(t,(function(t,a){switch(t.type){case e.FloatType:case e.HalfFloatType:t.encoding=e.LinearEncoding,t.minFilter=e.LinearFilter,t.magFilter=e.LinearFilter,t.generateMipmaps=!1,t.flipY=!0}r&&r(t,a)}),a,n)}}exports.RGBELoader=t;
|
package/loaders/RGBELoader.js
CHANGED
@@ -304,7 +304,7 @@ class RGBELoader extends DataTextureLoader {
|
|
304
304
|
image_rgba_data = RGBE_ReadPixels_RLE(byteArray.subarray(byteArray.pos), w, h);
|
305
305
|
|
306
306
|
if (RGBE_RETURN_FAILURE !== image_rgba_data) {
|
307
|
-
let data,
|
307
|
+
let data, type;
|
308
308
|
let numElements;
|
309
309
|
|
310
310
|
switch (this.type) {
|
@@ -344,7 +344,6 @@ class RGBELoader extends DataTextureLoader {
|
|
344
344
|
header: rgbe_header_info.string,
|
345
345
|
gamma: rgbe_header_info.gamma,
|
346
346
|
exposure: rgbe_header_info.exposure,
|
347
|
-
format: format,
|
348
347
|
type: type
|
349
348
|
};
|
350
349
|
}
|
@@ -362,13 +361,6 @@ class RGBELoader extends DataTextureLoader {
|
|
362
361
|
function onLoadCallback(texture, texData) {
|
363
362
|
switch (texture.type) {
|
364
363
|
case FloatType:
|
365
|
-
texture.encoding = LinearEncoding;
|
366
|
-
texture.minFilter = LinearFilter;
|
367
|
-
texture.magFilter = LinearFilter;
|
368
|
-
texture.generateMipmaps = false;
|
369
|
-
texture.flipY = true;
|
370
|
-
break;
|
371
|
-
|
372
364
|
case HalfFloatType:
|
373
365
|
texture.encoding = LinearEncoding;
|
374
366
|
texture.minFilter = LinearFilter;
|
package/loaders/VOXLoader.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { Data3DTexture, Mesh, Loader, LoadingManager } from 'three';
|
2
2
|
|
3
3
|
export interface Chunk {
|
4
4
|
palette: number[];
|
@@ -23,6 +23,6 @@ export class VOXMesh extends Mesh {
|
|
23
23
|
constructor(chunk: Chunk);
|
24
24
|
}
|
25
25
|
|
26
|
-
export class
|
26
|
+
export class VOXData3DTexture extends Data3DTexture {
|
27
27
|
constructor(chunk: Chunk);
|
28
28
|
}
|
package/objects/Reflector.d.ts
CHANGED
@@ -21,7 +21,7 @@ export interface ReflectorShader {
|
|
21
21
|
fragmentShader: string;
|
22
22
|
}
|
23
23
|
|
24
|
-
export interface
|
24
|
+
export interface ReflectorForSSRPassOptions {
|
25
25
|
clipBias?: number | undefined;
|
26
26
|
textureWidth?: number | undefined;
|
27
27
|
textureHeight?: number | undefined;
|
@@ -30,9 +30,9 @@ export interface ReflectorOptions {
|
|
30
30
|
shader?: ReflectorShader | undefined;
|
31
31
|
}
|
32
32
|
|
33
|
-
export class
|
33
|
+
export class ReflectorForSSRPass<TGeometry extends BufferGeometry = BufferGeometry> extends Mesh<TGeometry> {
|
34
34
|
type: 'ReflectorForSSRPass';
|
35
|
-
options:
|
35
|
+
options: ReflectorForSSRPassOptions;
|
36
36
|
|
37
37
|
static ReflectorShader: ReflectorShader;
|
38
38
|
|
@@ -49,7 +49,7 @@ export class Reflector<TGeometry extends BufferGeometry = BufferGeometry> extend
|
|
49
49
|
|
50
50
|
renderTarget: WebGLRenderTarget;
|
51
51
|
|
52
|
-
constructor(geometry: TGeometry, options:
|
52
|
+
constructor(geometry: TGeometry, options: ReflectorForSSRPassOptions);
|
53
53
|
|
54
54
|
doRender: (renderer: WebGLRenderer, scene: Scene, camera: Camera) => void;
|
55
55
|
|
package/objects/Refractor.d.ts
CHANGED
package/objects/Water2.d.ts
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "three-stdlib",
|
3
|
-
"version": "2.
|
3
|
+
"version": "2.15.0",
|
4
4
|
"private": false,
|
5
5
|
"description": "stand-alone library of threejs examples",
|
6
6
|
"main": "index.cjs.js",
|
@@ -21,6 +21,7 @@
|
|
21
21
|
"homepage": "https://github.com/pmndrs/three-stdlib#readme",
|
22
22
|
"dependencies": {
|
23
23
|
"@babel/runtime": "^7.16.7",
|
24
|
+
"@types/offscreencanvas": "^2019.6.4",
|
24
25
|
"@webgpu/glslang": "^0.0.15",
|
25
26
|
"chevrotain": "^10.1.2",
|
26
27
|
"draco3d": "^1.4.1",
|
@@ -1,13 +1,13 @@
|
|
1
|
-
import { DataTexture,
|
1
|
+
import { DataTexture, Data3DTexture } from 'three';
|
2
2
|
import { ShaderPass } from './ShaderPass';
|
3
3
|
|
4
4
|
export interface LUTPassParameters {
|
5
|
-
lut?: DataTexture |
|
5
|
+
lut?: DataTexture | Data3DTexture;
|
6
6
|
intensity?: number;
|
7
7
|
}
|
8
8
|
|
9
9
|
export class LUTPass extends ShaderPass {
|
10
|
-
lut?: DataTexture |
|
10
|
+
lut?: DataTexture | Data3DTexture;
|
11
11
|
intensity?: number;
|
12
12
|
constructor(params: LUTPassParameters);
|
13
13
|
}
|
@@ -3,7 +3,7 @@ import { Scene, Camera, ColorRepresentation, ShaderMaterial, WebGLRenderTarget }
|
|
3
3
|
import { Pass } from './Pass';
|
4
4
|
|
5
5
|
export class SSAARenderPass extends Pass {
|
6
|
-
constructor(scene: Scene, camera: Camera, clearColor
|
6
|
+
constructor(scene: Scene, camera: Camera, clearColor?: ColorRepresentation, clearAlpha?: number);
|
7
7
|
scene: Scene;
|
8
8
|
camera: Camera;
|
9
9
|
sampleLevel: number;
|
@@ -12,7 +12,7 @@ import {
|
|
12
12
|
ColorRepresentation,
|
13
13
|
} from 'three';
|
14
14
|
import { Pass, FullScreenQuad } from '../postprocessing/Pass';
|
15
|
-
import {
|
15
|
+
import { ReflectorForSSRPass } from '../objects/ReflectorForSSRPass';
|
16
16
|
|
17
17
|
export interface SSRPassParams {
|
18
18
|
renderer: WebGLRenderer;
|
@@ -23,7 +23,7 @@ export interface SSRPassParams {
|
|
23
23
|
selects: Mesh[] | null;
|
24
24
|
isPerspectiveCamera?: boolean | undefined;
|
25
25
|
isBouncing?: boolean | undefined;
|
26
|
-
groundReflector:
|
26
|
+
groundReflector: ReflectorForSSRPass | null;
|
27
27
|
}
|
28
28
|
|
29
29
|
export class SSRPass extends Pass {
|
@@ -33,7 +33,7 @@ export class SSRPass extends Pass {
|
|
33
33
|
renderer: WebGLRenderer;
|
34
34
|
scene: Scene;
|
35
35
|
camera: Camera;
|
36
|
-
groundReflector:
|
36
|
+
groundReflector: ReflectorForSSRPass | null;
|
37
37
|
opacity: number;
|
38
38
|
output: number;
|
39
39
|
maxDistance: number;
|
@@ -1,76 +1,31 @@
|
|
1
|
-
import { Vector2 } from 'three';
|
1
|
+
import { IUniform, Texture, Vector2 } from 'three';
|
2
|
+
export interface BokehShaderUniforms {
|
3
|
+
textureWidth: IUniform<number>;
|
4
|
+
textureHeight: IUniform<number>;
|
5
|
+
focalDepth: IUniform<number>;
|
6
|
+
focalLength: IUniform<number>;
|
7
|
+
fstop: IUniform<number>;
|
8
|
+
tColor: IUniform<Texture | null>;
|
9
|
+
tDepth: IUniform<Texture | null>;
|
10
|
+
maxblur: IUniform<number>;
|
11
|
+
showFocus: IUniform<number>;
|
12
|
+
manualdof: IUniform<number>;
|
13
|
+
vignetting: IUniform<number>;
|
14
|
+
depthblur: IUniform<number>;
|
15
|
+
threshold: IUniform<number>;
|
16
|
+
gain: IUniform<number>;
|
17
|
+
bias: IUniform<number>;
|
18
|
+
fringe: IUniform<number>;
|
19
|
+
znear: IUniform<number>;
|
20
|
+
zfar: IUniform<number>;
|
21
|
+
noise: IUniform<number>;
|
22
|
+
dithering: IUniform<number>;
|
23
|
+
pentagon: IUniform<number>;
|
24
|
+
shaderFocus: IUniform<number>;
|
25
|
+
focusCoords: IUniform<Vector2>;
|
26
|
+
}
|
2
27
|
export declare const BokehShader2: {
|
3
|
-
uniforms:
|
4
|
-
textureWidth: {
|
5
|
-
value: number;
|
6
|
-
};
|
7
|
-
textureHeight: {
|
8
|
-
value: number;
|
9
|
-
};
|
10
|
-
focalDepth: {
|
11
|
-
value: number;
|
12
|
-
};
|
13
|
-
focalLength: {
|
14
|
-
value: number;
|
15
|
-
};
|
16
|
-
fstop: {
|
17
|
-
value: number;
|
18
|
-
};
|
19
|
-
tColor: {
|
20
|
-
value: null;
|
21
|
-
};
|
22
|
-
tDepth: {
|
23
|
-
value: null;
|
24
|
-
};
|
25
|
-
maxblur: {
|
26
|
-
value: number;
|
27
|
-
};
|
28
|
-
showFocus: {
|
29
|
-
value: number;
|
30
|
-
};
|
31
|
-
manualdof: {
|
32
|
-
value: number;
|
33
|
-
};
|
34
|
-
vignetting: {
|
35
|
-
value: number;
|
36
|
-
};
|
37
|
-
depthblur: {
|
38
|
-
value: number;
|
39
|
-
};
|
40
|
-
threshold: {
|
41
|
-
value: number;
|
42
|
-
};
|
43
|
-
gain: {
|
44
|
-
value: number;
|
45
|
-
};
|
46
|
-
bias: {
|
47
|
-
value: number;
|
48
|
-
};
|
49
|
-
fringe: {
|
50
|
-
value: number;
|
51
|
-
};
|
52
|
-
znear: {
|
53
|
-
value: number;
|
54
|
-
};
|
55
|
-
zfar: {
|
56
|
-
value: number;
|
57
|
-
};
|
58
|
-
noise: {
|
59
|
-
value: number;
|
60
|
-
};
|
61
|
-
dithering: {
|
62
|
-
value: number;
|
63
|
-
};
|
64
|
-
pentagon: {
|
65
|
-
value: number;
|
66
|
-
};
|
67
|
-
shaderFocus: {
|
68
|
-
value: number;
|
69
|
-
};
|
70
|
-
focusCoords: {
|
71
|
-
value: Vector2;
|
72
|
-
};
|
73
|
-
};
|
28
|
+
uniforms: BokehShaderUniforms;
|
74
29
|
vertexShader: string;
|
75
30
|
fragmentShader: string;
|
76
31
|
};
|
package/shaders/BokehShader2.js
CHANGED
package/shaders/index.cjs.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./ACESFilmicToneMappingShader.cjs.js"),r=require("./AfterimageShader.cjs.js"),a=require("./BasicShader.cjs.js"),S=require("./BleachBypassShader.cjs.js"),h=require("./BlendShader.cjs.js"),s=require("./BokehShader.cjs.js"),
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./ACESFilmicToneMappingShader.cjs.js"),r=require("./AfterimageShader.cjs.js"),a=require("./BasicShader.cjs.js"),S=require("./BleachBypassShader.cjs.js"),h=require("./BlendShader.cjs.js"),s=require("./BokehShader.cjs.js"),d=require("./BokehShader2.cjs.js"),o=require("./BrightnessContrastShader.cjs.js"),t=require("./ColorCorrectionShader.cjs.js"),i=require("./ColorifyShader.cjs.js"),p=require("./ConvolutionShader.cjs.js"),j=require("./CopyShader.cjs.js"),c=require("./DOFMipMapShader.cjs.js"),u=require("./DepthLimitedBlurShader.cjs.js"),l=require("./DigitalGlitch.cjs.js"),n=require("./DotScreenShader.cjs.js"),x=require("./FXAAShader.cjs.js"),q=require("./FilmShader.cjs.js"),B=require("./FocusShader.cjs.js"),A=require("./FreiChenShader.cjs.js"),m=require("./FresnelShader.cjs.js"),g=require("./GammaCorrectionShader.cjs.js"),C=require("./GodRaysShader.cjs.js"),M=require("./HalftoneShader.cjs.js"),R=require("./HorizontalBlurShader.cjs.js"),T=require("./HorizontalTiltShiftShader.cjs.js"),f=require("./HueSaturationShader.cjs.js"),y=require("./KaleidoShader.cjs.js"),D=require("./LuminosityHighPassShader.cjs.js"),F=require("./LuminosityShader.cjs.js"),G=require("./MirrorShader.cjs.js"),H=require("./NormalMapShader.cjs.js"),O=require("./ParallaxShader.cjs.js"),k=require("./PixelShader.cjs.js"),V=require("./RGBShiftShader.cjs.js"),P=require("./SAOShader.cjs.js"),b=require("./SMAAShader.cjs.js"),L=require("./SSAOShader.cjs.js"),z=require("./SSRShader.cjs.js"),v=require("./SepiaShader.cjs.js"),E=require("./SobelOperatorShader.cjs.js"),U=require("./SubsurfaceScatteringShader.cjs.js"),W=require("./TechnicolorShader.cjs.js"),K=require("./ToneMapShader.cjs.js"),N=require("./ToonShader.cjs.js"),X=require("./TriangleBlurShader.cjs.js"),_=require("./UnpackDepthRGBAShader.cjs.js"),w=require("./VerticalBlurShader.cjs.js"),I=require("./VerticalTiltShiftShader.cjs.js"),J=require("./VignetteShader.cjs.js"),Q=require("./VolumeShader.cjs.js"),Y=require("./WaterRefractionShader.cjs.js");require("three"),exports.ACESFilmicToneMappingShader=e.ACESFilmicToneMappingShader,exports.AfterimageShader=r.AfterimageShader,exports.BasicShader=a.BasicShader,exports.BleachBypassShader=S.BleachBypassShader,exports.BlendShader=h.BlendShader,exports.BokehShader=s.BokehShader,exports.BokehShader2=d.BokehShader2,exports.BrightnessContrastShader=o.BrightnessContrastShader,exports.ColorCorrectionShader=t.ColorCorrectionShader,exports.ColorifyShader=i.ColorifyShader,exports.ConvolutionShader=p.ConvolutionShader,exports.CopyShader=j.CopyShader,exports.DOFMipMapShader=c.DOFMipMapShader,exports.BlurShaderUtils=u.BlurShaderUtils,exports.DepthLimitedBlurShader=u.DepthLimitedBlurShader,exports.DigitalGlitch=l.DigitalGlitch,exports.DotScreenShader=n.DotScreenShader,exports.FXAAShader=x.FXAAShader,exports.FilmShader=q.FilmShader,exports.FocusShader=B.FocusShader,exports.FreiChenShader=A.FreiChenShader,exports.FresnelShader=m.FresnelShader,exports.GammaCorrectionShader=g.GammaCorrectionShader,exports.GodRaysCombineShader=C.GodRaysCombineShader,exports.GodRaysDepthMaskShader=C.GodRaysDepthMaskShader,exports.GodRaysFakeSunShader=C.GodRaysFakeSunShader,exports.GodRaysGenerateShader=C.GodRaysGenerateShader,exports.HalftoneShader=M.HalftoneShader,exports.HorizontalBlurShader=R.HorizontalBlurShader,exports.HorizontalTiltShiftShader=T.HorizontalTiltShiftShader,exports.HueSaturationShader=f.HueSaturationShader,exports.KaleidoShader=y.KaleidoShader,exports.LuminosityHighPassShader=D.LuminosityHighPassShader,exports.LuminosityShader=F.LuminosityShader,exports.MirrorShader=G.MirrorShader,exports.NormalMapShader=H.NormalMapShader,exports.ParallaxShader=O.ParallaxShader,exports.PixelShader=k.PixelShader,exports.RGBShiftShader=V.RGBShiftShader,exports.SAOShader=P.SAOShader,exports.SMAABlendShader=b.SMAABlendShader,exports.SMAAEdgesShader=b.SMAAEdgesShader,exports.SMAAWeightsShader=b.SMAAWeightsShader,exports.SSAOBlurShader=L.SSAOBlurShader,exports.SSAODepthShader=L.SSAODepthShader,exports.SSAOShader=L.SSAOShader,exports.SSRBlurShader=z.SSRBlurShader,exports.SSRDepthShader=z.SSRDepthShader,exports.SSRShader=z.SSRShader,exports.SepiaShader=v.SepiaShader,exports.SobelOperatorShader=E.SobelOperatorShader,exports.SubsurfaceScatteringShader=U.SubsurfaceScatteringShader,exports.TechnicolorShader=W.TechnicolorShader,exports.ToneMapShader=K.ToneMapShader,exports.ToonShader1=N.ToonShader1,exports.ToonShader2=N.ToonShader2,exports.ToonShaderDotted=N.ToonShaderDotted,exports.ToonShaderHatching=N.ToonShaderHatching,exports.TriangleBlurShader=X.TriangleBlurShader,exports.UnpackDepthRGBAShader=_.UnpackDepthRGBAShader,exports.VerticalBlurShader=w.VerticalBlurShader,exports.VerticalTiltShiftShader=I.VerticalTiltShiftShader,exports.VignetteShader=J.VignetteShader,exports.VolumeRenderShader1=Q.VolumeRenderShader1,exports.WaterRefractionShader=Y.WaterRefractionShader;
|
package/shaders/index.d.ts
CHANGED
@@ -5,7 +5,8 @@ export * from './BasicShader';
|
|
5
5
|
export * from './BleachBypassShader';
|
6
6
|
export * from './BlendShader';
|
7
7
|
export * from './BokehShader';
|
8
|
-
export
|
8
|
+
export { BokehShader2 } from './BokehShader2';
|
9
|
+
export type { BokehShaderUniforms as BokehShader2Uniforms } from './BokehShader2';
|
9
10
|
export * from './BrightnessContrastShader';
|
10
11
|
export * from './ColorCorrectionShader';
|
11
12
|
export * from './ColorifyShader';
|
package/shaders/index.js
CHANGED
@@ -4,7 +4,7 @@ export { BasicShader } from './BasicShader.js';
|
|
4
4
|
export { BleachBypassShader } from './BleachBypassShader.js';
|
5
5
|
export { BlendShader } from './BlendShader.js';
|
6
6
|
export { BokehShader } from './BokehShader.js';
|
7
|
-
export {
|
7
|
+
export { BokehShader2 } from './BokehShader2.js';
|
8
8
|
export { BrightnessContrastShader } from './BrightnessContrastShader.js';
|
9
9
|
export { ColorCorrectionShader } from './ColorCorrectionShader.js';
|
10
10
|
export { ColorifyShader } from './ColorifyShader.js';
|
package/csm/Frustum.cjs.js
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";var e=require("three");const t=new e.Matrix4;class r{constructor(t){t=t||{},this.vertices={near:[new e.Vector3,new e.Vector3,new e.Vector3,new e.Vector3],far:[new e.Vector3,new e.Vector3,new e.Vector3,new e.Vector3]},void 0!==t.projectionMatrix&&this.setFromProjectionMatrix(t.projectionMatrix,t.maxFar||1e4)}setFromProjectionMatrix(e,r){const s=0===e.elements[11];return t.copy(e).invert(),this.vertices.near[0].set(1,1,-1),this.vertices.near[1].set(1,-1,-1),this.vertices.near[2].set(-1,-1,-1),this.vertices.near[3].set(-1,1,-1),this.vertices.near.forEach((e=>{e.applyMatrix4(t)})),this.vertices.far[0].set(1,1,1),this.vertices.far[1].set(1,-1,1),this.vertices.far[2].set(-1,-1,1),this.vertices.far[3].set(-1,1,1),this.vertices.far.forEach((e=>{e.applyMatrix4(t);const i=Math.abs(e.z);s?e.z*=Math.min(r/i,1):e.multiplyScalar(Math.min(r/i,1))})),this.vertices}split(e,t){for(;e.length>t.length;)t.push(new r);t.length=e.length;for(let r=0;r<e.length;r++){const s=t[r];if(0===r)for(let e=0;e<4;e++)s.vertices.near[e].copy(this.vertices.near[e]);else for(let t=0;t<4;t++)s.vertices.near[t].lerpVectors(this.vertices.near[t],this.vertices.far[t],e[r-1]);if(r===e-1)for(let e=0;e<4;e++)s.vertices.far[e].copy(this.vertices.far[e]);else for(let t=0;t<4;t++)s.vertices.far[t].lerpVectors(this.vertices.near[t],this.vertices.far[t],e[r])}}toSpace(e,t){for(let r=0;r<4;r++)t.vertices.near[r].copy(this.vertices.near[r]).applyMatrix4(e),t.vertices.far[r].copy(this.vertices.far[r]).applyMatrix4(e)}}module.exports=r;
|
package/csm/Shader.cjs.js
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";var t={lights_fragment_begin:"\nGeometricContext geometry;\n\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n\n#ifdef CLEARCOAT\n\n\tgeometry.clearcoatNormal = clearcoatNormal;\n\n#endif\n\nIncidentLight directLight;\n\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\n\t\tpointLight = pointLights[ i ];\n\n\t\tgetPointLightInfo( pointLight, geometry, directLight );\n\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\n\t\tspotLight = spotLights[ i ];\n\n\t\tgetSpotLightInfo( spotLight, geometry, directLight );\n\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if ( NUM_DIR_LIGHTS > 0) && defined( RE_Direct ) && defined( USE_CSM ) && defined( CSM_CASCADES )\n\n\tDirectionalLight directionalLight;\n\tfloat linearDepth = (vViewPosition.z) / (shadowFar - cameraNear);\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\n\t#if defined( USE_SHADOWMAP ) && defined( CSM_FADE )\n\tvec2 cascade;\n\tfloat cascadeCenter;\n\tfloat closestEdge;\n\tfloat margin;\n\tfloat csmx;\n\tfloat csmy;\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\n\t\t// NOTE: Depth gets larger away from the camera.\n\t\t// cascade.x is closer, cascade.y is further\n\t\tcascade = CSM_cascades[ i ];\n\t\tcascadeCenter = ( cascade.x + cascade.y ) / 2.0;\n\t\tclosestEdge = linearDepth < cascadeCenter ? cascade.x : cascade.y;\n\t\tmargin = 0.25 * pow( closestEdge, 2.0 );\n\t\tcsmx = cascade.x - margin / 2.0;\n\t\tcsmy = cascade.y + margin / 2.0;\n\t\tif( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS && linearDepth >= csmx && ( linearDepth < csmy || UNROLLED_LOOP_INDEX == CSM_CASCADES - 1 ) ) {\n\n\t\t\tfloat dist = min( linearDepth - csmx, csmy - linearDepth );\n\t\t\tfloat ratio = clamp( dist / margin, 0.0, 1.0 );\n\t\t\tif( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) {\n\n\t\t\t\tvec3 prevColor = directLight.color;\n\t\t\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\t\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\n\t\t\t\tbool shouldFadeLastCascade = UNROLLED_LOOP_INDEX == CSM_CASCADES - 1 && linearDepth > cascadeCenter;\n\t\t\t\tdirectLight.color = mix( prevColor, directLight.color, shouldFadeLastCascade ? ratio : 1.0 );\n\n\t\t\t}\n\n\t\t\tReflectedLight prevLight = reflectedLight;\n\t\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\n\t\t\tbool shouldBlend = UNROLLED_LOOP_INDEX != CSM_CASCADES - 1 || UNROLLED_LOOP_INDEX == CSM_CASCADES - 1 && linearDepth < cascadeCenter;\n\t\t\tfloat blendRatio = shouldBlend ? ratio : 1.0;\n\n\t\t\treflectedLight.directDiffuse = mix( prevLight.directDiffuse, reflectedLight.directDiffuse, blendRatio );\n\t\t\treflectedLight.directSpecular = mix( prevLight.directSpecular, reflectedLight.directSpecular, blendRatio );\n\t\t\treflectedLight.indirectDiffuse = mix( prevLight.indirectDiffuse, reflectedLight.indirectDiffuse, blendRatio );\n\t\t\treflectedLight.indirectSpecular = mix( prevLight.indirectSpecular, reflectedLight.indirectSpecular, blendRatio );\n\n\t\t}\n\n\t}\n\t#pragma unroll_loop_end\n\t#else\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tif(linearDepth >= CSM_cascades[UNROLLED_LOOP_INDEX].x && linearDepth < CSM_cascades[UNROLLED_LOOP_INDEX].y) directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\n\t\t#endif\n\n\t\tif(linearDepth >= CSM_cascades[UNROLLED_LOOP_INDEX].x && (linearDepth < CSM_cascades[UNROLLED_LOOP_INDEX].y || UNROLLED_LOOP_INDEX == CSM_CASCADES - 1)) RE_Direct( directLight, geometry, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n\t#endif\n\n#endif\n\n\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) && !defined( USE_CSM ) && !defined( CSM_CASCADES )\n\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\n\t\tdirectionalLight = directionalLights[ i ];\n\n\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\n\tRectAreaLight rectAreaLight;\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if defined( RE_IndirectDiffuse )\n\n\tvec3 iblIrradiance = vec3( 0.0 );\n\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\n\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\n\t\t}\n\t\t#pragma unroll_loop_end\n\n\t#endif\n\n#endif\n\n#if defined( RE_IndirectSpecular )\n\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n\n#endif\n",lights_pars_begin:"\n#if defined( USE_CSM ) && defined( CSM_CASCADES )\nuniform vec2 CSM_cascades[CSM_CASCADES];\nuniform float cameraNear;\nuniform float shadowFar;\n#endif\n\t"+require("three").ShaderChunk.lights_pars_begin};module.exports=t;
|
package/loaders/VRMLoader.d.ts
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
import { Loader, LoadingManager } from 'three';
|
2
|
-
|
3
|
-
import { GLTFLoader, GLTF } from './GLTFLoader';
|
4
|
-
import { DRACOLoader } from './DRACOLoader';
|
5
|
-
|
6
|
-
export class VRMLoader extends Loader {
|
7
|
-
constructor(manager?: LoadingManager);
|
8
|
-
gltfLoader: GLTFLoader;
|
9
|
-
|
10
|
-
load(
|
11
|
-
url: string,
|
12
|
-
onLoad: (scene: GLTF) => void,
|
13
|
-
onProgress?: (event: ProgressEvent) => void,
|
14
|
-
onError?: (event: ErrorEvent) => void,
|
15
|
-
): void;
|
16
|
-
loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise<GLTF>;
|
17
|
-
parse(gltf: GLTF, onLoad: (scene: GLTF) => void): void;
|
18
|
-
setDRACOLoader(dracoLoader: DRACOLoader): this;
|
19
|
-
}
|