@babylonjs-toolkit/next 9.30.0 → 9.34.0
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/lib/contentdownloadoutcome.d.ts +2 -0
- package/lib/contentdownloadoutcome.d.ts.map +1 -0
- package/lib/contentdownloadoutcome.js +1 -0
- package/lib/contentgraphicsoutcome.d.ts +2 -0
- package/lib/contentgraphicsoutcome.d.ts.map +1 -0
- package/lib/contentgraphicsoutcome.js +1 -0
- package/lib/contentgraphicsstatus.d.ts +2 -0
- package/lib/contentgraphicsstatus.d.ts.map +1 -0
- package/lib/contentgraphicsstatus.js +1 -0
- package/lib/contentinstaller.d.ts +245 -0
- package/lib/contentinstaller.d.ts.map +1 -0
- package/lib/contentinstaller.js +1929 -0
- package/lib/contentinstalleravailability.d.ts +2 -0
- package/lib/contentinstalleravailability.d.ts.map +1 -0
- package/lib/contentinstalleravailability.js +1 -0
- package/lib/contentinstallererrorkind.d.ts +2 -0
- package/lib/contentinstallererrorkind.d.ts.map +1 -0
- package/lib/contentinstallererrorkind.js +1 -0
- package/lib/contentinstallphase.d.ts +2 -0
- package/lib/contentinstallphase.d.ts.map +1 -0
- package/lib/contentinstallphase.js +1 -0
- package/lib/contentinstallpolicy.d.ts +2 -0
- package/lib/contentinstallpolicy.d.ts.map +1 -0
- package/lib/contentinstallpolicy.js +1 -0
- package/lib/contentupdatepolicy.d.ts +2 -0
- package/lib/contentupdatepolicy.d.ts.map +1 -0
- package/lib/contentupdatepolicy.js +1 -0
- package/lib/iafterspawned.d.ts +4 -0
- package/lib/iafterspawned.d.ts.map +1 -0
- package/lib/iafterspawned.js +1 -0
- package/lib/iaftertick.d.ts +4 -0
- package/lib/iaftertick.d.ts.map +1 -0
- package/lib/iaftertick.js +1 -0
- package/lib/iafterupdate.d.ts +4 -0
- package/lib/iafterupdate.d.ts.map +1 -0
- package/lib/iafterupdate.js +1 -0
- package/lib/ibeforetick.d.ts +4 -0
- package/lib/ibeforetick.d.ts.map +1 -0
- package/lib/ibeforetick.js +1 -0
- package/lib/ibeforeupdate.d.ts +4 -0
- package/lib/ibeforeupdate.d.ts.map +1 -0
- package/lib/ibeforeupdate.js +1 -0
- package/lib/icontentavailabilityblock.d.ts +6 -0
- package/lib/icontentavailabilityblock.d.ts.map +1 -0
- package/lib/icontentavailabilityblock.js +1 -0
- package/lib/icontentchannelmessage.d.ts +24 -0
- package/lib/icontentchannelmessage.d.ts.map +1 -0
- package/lib/icontentchannelmessage.js +1 -0
- package/lib/icontentdownloadjob.d.ts +7 -0
- package/lib/icontentdownloadjob.d.ts.map +1 -0
- package/lib/icontentdownloadjob.js +1 -0
- package/lib/icontentfileref.d.ts +9 -0
- package/lib/icontentfileref.d.ts.map +1 -0
- package/lib/icontentfileref.js +1 -0
- package/lib/icontentforwardedrequest.d.ts +9 -0
- package/lib/icontentforwardedrequest.d.ts.map +1 -0
- package/lib/icontentforwardedrequest.js +1 -0
- package/lib/icontentgraphicssession.d.ts +8 -0
- package/lib/icontentgraphicssession.d.ts.map +1 -0
- package/lib/icontentgraphicssession.js +1 -0
- package/lib/icontentgroupref.d.ts +6 -0
- package/lib/icontentgroupref.d.ts.map +1 -0
- package/lib/icontentgroupref.js +1 -0
- package/lib/icontentgroupstatus.d.ts +14 -0
- package/lib/icontentgroupstatus.d.ts.map +1 -0
- package/lib/icontentgroupstatus.js +1 -0
- package/lib/icontentinflightdownload.d.ts +8 -0
- package/lib/icontentinflightdownload.d.ts.map +1 -0
- package/lib/icontentinflightdownload.js +1 -0
- package/lib/icontentinstallcall.d.ts +6 -0
- package/lib/icontentinstallcall.d.ts.map +1 -0
- package/lib/icontentinstallcall.js +1 -0
- package/lib/icontentinstallererror.d.ts +7 -0
- package/lib/icontentinstallererror.d.ts.map +1 -0
- package/lib/icontentinstallererror.js +1 -0
- package/lib/icontentinstalleroptions.d.ts +20 -0
- package/lib/icontentinstalleroptions.d.ts.map +1 -0
- package/lib/icontentinstalleroptions.js +1 -0
- package/lib/icontentinstallerstate.d.ts +30 -0
- package/lib/icontentinstallerstate.d.ts.map +1 -0
- package/lib/icontentinstallerstate.js +1 -0
- package/lib/icontentinstalloptions.d.ts +5 -0
- package/lib/icontentinstalloptions.d.ts.map +1 -0
- package/lib/icontentinstalloptions.js +1 -0
- package/lib/icontentinstallprogress.d.ts +21 -0
- package/lib/icontentinstallprogress.d.ts.map +1 -0
- package/lib/icontentinstallprogress.js +1 -0
- package/lib/icontentmanifest.d.ts +10 -0
- package/lib/icontentmanifest.d.ts.map +1 -0
- package/lib/icontentmanifest.js +1 -0
- package/lib/icontentmanifestfile.d.ts +8 -0
- package/lib/icontentmanifestfile.d.ts.map +1 -0
- package/lib/icontentmanifestfile.js +1 -0
- package/lib/icontentmanifestgroup.d.ts +5 -0
- package/lib/icontentmanifestgroup.d.ts.map +1 -0
- package/lib/icontentmanifestgroup.js +1 -0
- package/lib/icontentpreparegraphicsoptions.d.ts +5 -0
- package/lib/icontentpreparegraphicsoptions.d.ts.map +1 -0
- package/lib/icontentpreparegraphicsoptions.js +1 -0
- package/lib/icontentprogresssession.d.ts +10 -0
- package/lib/icontentprogresssession.d.ts.map +1 -0
- package/lib/icontentprogresssession.js +1 -0
- package/lib/icontentretrywait.d.ts +6 -0
- package/lib/icontentretrywait.d.ts.map +1 -0
- package/lib/icontentretrywait.js +1 -0
- package/lib/icontentrootoptions.d.ts +6 -0
- package/lib/icontentrootoptions.d.ts.map +1 -0
- package/lib/icontentrootoptions.js +1 -0
- package/lib/icontentrootruntime.d.ts +8 -0
- package/lib/icontentrootruntime.d.ts.map +1 -0
- package/lib/icontentrootruntime.js +1 -0
- package/lib/icontentrootstate.d.ts +29 -0
- package/lib/icontentrootstate.d.ts.map +1 -0
- package/lib/icontentrootstate.js +1 -0
- package/lib/icontentstorageestimate.d.ts +8 -0
- package/lib/icontentstorageestimate.d.ts.map +1 -0
- package/lib/icontentstorageestimate.js +1 -0
- package/lib/icontentstoreresult.d.ts +8 -0
- package/lib/icontentstoreresult.d.ts.map +1 -0
- package/lib/icontentstoreresult.js +1 -0
- package/lib/icontentstorewaiter.d.ts +6 -0
- package/lib/icontentstorewaiter.d.ts.map +1 -0
- package/lib/icontentstorewaiter.js +1 -0
- package/lib/icontentupdateinfo.d.ts +8 -0
- package/lib/icontentupdateinfo.d.ts.map +1 -0
- package/lib/icontentupdateinfo.js +1 -0
- package/lib/idespawned.d.ts +5 -0
- package/lib/idespawned.d.ts.map +1 -0
- package/lib/idespawned.js +1 -0
- package/lib/iinputauthoritylost.d.ts +4 -0
- package/lib/iinputauthoritylost.d.ts.map +1 -0
- package/lib/iinputauthoritylost.js +1 -0
- package/lib/index.d.ts +141 -29
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +141 -29
- package/lib/iplayerjoined.d.ts +5 -0
- package/lib/iplayerjoined.d.ts.map +1 -0
- package/lib/iplayerjoined.js +1 -0
- package/lib/iplayerleft.d.ts +5 -0
- package/lib/iplayerleft.d.ts.map +1 -0
- package/lib/iplayerleft.js +1 -0
- package/lib/ispawned.d.ts +4 -0
- package/lib/ispawned.d.ts.map +1 -0
- package/lib/ispawned.js +1 -0
- package/lib/istateauthoritychanged.d.ts +4 -0
- package/lib/istateauthoritychanged.d.ts.map +1 -0
- package/lib/istateauthoritychanged.js +1 -0
- package/lib/loopbackdelivery.d.ts +6 -0
- package/lib/loopbackdelivery.d.ts.map +1 -0
- package/lib/loopbackdelivery.js +1 -0
- package/lib/loopbackhub.d.ts +206 -0
- package/lib/loopbackhub.d.ts.map +1 -0
- package/lib/loopbackhub.js +986 -0
- package/lib/loopbackhuboptions.d.ts +8 -0
- package/lib/loopbackhuboptions.d.ts.map +1 -0
- package/lib/loopbackhuboptions.js +1 -0
- package/lib/network_reconnect_grace_seconds.d.ts +2 -0
- package/lib/network_reconnect_grace_seconds.d.ts.map +1 -0
- package/lib/network_reconnect_grace_seconds.js +1 -0
- package/lib/networkstats.d.ts +51 -0
- package/lib/networkstats.d.ts.map +1 -0
- package/lib/networkstats.js +204 -0
- package/lib/networkstatssample.d.ts +7 -0
- package/lib/networkstatssample.d.ts.map +1 -0
- package/lib/networkstatssample.js +1 -0
- package/lib/networkstatssliderrow.d.ts +9 -0
- package/lib/networkstatssliderrow.d.ts.map +1 -0
- package/lib/networkstatssliderrow.js +1 -0
- package/lib/project.d.ts +2907 -133
- package/lib/project.d.ts.map +1 -1
- package/lib/project.js +14960 -3764
- package/lib/scenemanager.d.ts +4434 -51
- package/lib/scenemanager.d.ts.map +1 -1
- package/lib/scenemanager.js +18725 -1147
- package/lib/shadercodecachememorystorage.d.ts +10 -0
- package/lib/shadercodecachememorystorage.d.ts.map +1 -0
- package/lib/shadercodecachememorystorage.js +32 -0
- package/lib/workers/bt-content-worker.js +1180 -0
- package/lib/zigzagdecode.d.ts +2 -0
- package/lib/zigzagdecode.d.ts.map +1 -0
- package/lib/zigzagdecode.js +3 -0
- package/lib/zigzagencode.d.ts +2 -0
- package/lib/zigzagencode.d.ts.map +1 -0
- package/lib/zigzagencode.js +3 -0
- package/package.json +18 -13
- package/lib/entitycontroller.d.ts +0 -11
- package/lib/entitycontroller.d.ts.map +0 -1
- package/lib/entitycontroller.js +0 -41
- package/lib/sgshadowdepth.d.ts +0 -19
- package/lib/sgshadowdepth.d.ts.map +0 -1
- package/lib/sgshadowdepth.js +0 -214
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zigzagdecode.d.ts","sourceRoot":"","sources":["../src/zigzagdecode.ts"],"names":[],"mappings":"AACA,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEhD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zigzagencode.d.ts","sourceRoot":"","sources":["../src/zigzagencode.ts"],"names":[],"mappings":"AACA,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE9C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@babylonjs-toolkit/next",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.34.0",
|
|
4
4
|
"description": "Babylon Toolkit Runtime Library (ES6)",
|
|
5
5
|
"author": "MackeyK24 <mackeyk24@gmail.com>",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -137,6 +137,11 @@
|
|
|
137
137
|
"import": "./lib/project.js",
|
|
138
138
|
"types": "./lib/project.d.ts"
|
|
139
139
|
},
|
|
140
|
+
"./contentinstaller": {
|
|
141
|
+
"import": "./lib/contentinstaller.js",
|
|
142
|
+
"types": "./lib/contentinstaller.d.ts"
|
|
143
|
+
},
|
|
144
|
+
"./workers/bt-content-worker.js": "./lib/workers/bt-content-worker.js",
|
|
140
145
|
"./package.json": "./package.json"
|
|
141
146
|
},
|
|
142
147
|
"scripts": {
|
|
@@ -160,23 +165,23 @@
|
|
|
160
165
|
"lib/**/*"
|
|
161
166
|
],
|
|
162
167
|
"devDependencies": {
|
|
163
|
-
"@babylonjs/core": "9.
|
|
164
|
-
"@babylonjs/gui": "9.
|
|
168
|
+
"@babylonjs/core": "9.34.0",
|
|
169
|
+
"@babylonjs/gui": "9.34.0",
|
|
165
170
|
"@babylonjs/havok": "^1.3.14",
|
|
166
|
-
"@babylonjs/addons": "9.
|
|
167
|
-
"@babylonjs/loaders": "9.
|
|
168
|
-
"@babylonjs/materials": "9.
|
|
169
|
-
"@babylonjs/inspector": "9.
|
|
171
|
+
"@babylonjs/addons": "9.34.0",
|
|
172
|
+
"@babylonjs/loaders": "9.34.0",
|
|
173
|
+
"@babylonjs/materials": "9.34.0",
|
|
174
|
+
"@babylonjs/inspector": "9.34.0",
|
|
170
175
|
"rimraf": "^6.0.1",
|
|
171
176
|
"typescript": "^6.0.3"
|
|
172
177
|
},
|
|
173
178
|
"peerDependencies": {
|
|
174
|
-
"@babylonjs/core": "9.
|
|
175
|
-
"@babylonjs/gui": "9.
|
|
179
|
+
"@babylonjs/core": "9.34.0",
|
|
180
|
+
"@babylonjs/gui": "9.34.0",
|
|
176
181
|
"@babylonjs/havok": "^1.3.14",
|
|
177
|
-
"@babylonjs/addons": "9.
|
|
178
|
-
"@babylonjs/loaders": "9.
|
|
179
|
-
"@babylonjs/materials": "9.
|
|
180
|
-
"@babylonjs/inspector": "9.
|
|
182
|
+
"@babylonjs/addons": "9.34.0",
|
|
183
|
+
"@babylonjs/loaders": "9.34.0",
|
|
184
|
+
"@babylonjs/materials": "9.34.0",
|
|
185
|
+
"@babylonjs/inspector": "9.34.0"
|
|
181
186
|
}
|
|
182
187
|
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { TransformNode } from '@babylonjs/core/Meshes/transformNode';
|
|
2
|
-
export declare class EntityController {
|
|
3
|
-
static HasNetworkEntity(transform: TransformNode): boolean;
|
|
4
|
-
static GetNetworkEntityId(transform: TransformNode): string;
|
|
5
|
-
static GetNetworkEntityType(transform: TransformNode): number;
|
|
6
|
-
static GetNetworkEntitySessionId(transform: TransformNode): string;
|
|
7
|
-
static QueryNetworkAttribute(transform: TransformNode, key: string): string;
|
|
8
|
-
static QueryBufferedAttribute(transform: TransformNode, index: number): number;
|
|
9
|
-
static PostBufferedAttribute(transform: TransformNode, index: number, value: number): void;
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=entitycontroller.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"entitycontroller.d.ts","sourceRoot":"","sources":["../src/entitycontroller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAErE,qBAAa,gBAAgB;WAEP,gBAAgB,CAAC,SAAS,EAAE,aAAa,GAAG,OAAO;WAKnD,kBAAkB,CAAC,SAAS,EAAE,aAAa,GAAG,MAAM;WAKpD,oBAAoB,CAAC,SAAS,EAAE,aAAa,GAAG,MAAM;WAKtD,yBAAyB,CAAC,SAAS,EAAE,aAAa,GAAG,MAAM;WAK3D,qBAAqB,CAAC,SAAS,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM;WAQpE,sBAAsB,CAAC,SAAS,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;WAQvE,qBAAqB,CAAC,SAAS,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;CAIpG"}
|
package/lib/entitycontroller.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
export class EntityController {
|
|
2
|
-
static HasNetworkEntity(transform) {
|
|
3
|
-
if (transform == null)
|
|
4
|
-
return false;
|
|
5
|
-
return (transform.networkEntity != null);
|
|
6
|
-
}
|
|
7
|
-
static GetNetworkEntityId(transform) {
|
|
8
|
-
if (transform == null)
|
|
9
|
-
return null;
|
|
10
|
-
return (transform.networkEntity != null) ? transform.networkEntity.id : null;
|
|
11
|
-
}
|
|
12
|
-
static GetNetworkEntityType(transform) {
|
|
13
|
-
if (transform == null)
|
|
14
|
-
return 0;
|
|
15
|
-
return (transform.networkEntityType != null) ? transform.networkEntityType : 0;
|
|
16
|
-
}
|
|
17
|
-
static GetNetworkEntitySessionId(transform) {
|
|
18
|
-
if (transform == null)
|
|
19
|
-
return null;
|
|
20
|
-
return (transform.networkEntity != null) ? transform.networkEntity.ownerId : null;
|
|
21
|
-
}
|
|
22
|
-
static QueryNetworkAttribute(transform, key) {
|
|
23
|
-
let result = null;
|
|
24
|
-
if (transform != null && transform.networkEntity != null && transform.networkEntity.attributes != null) {
|
|
25
|
-
result = transform.networkEntity.attributes.get(key);
|
|
26
|
-
}
|
|
27
|
-
return result;
|
|
28
|
-
}
|
|
29
|
-
static QueryBufferedAttribute(transform, index) {
|
|
30
|
-
let result = 0;
|
|
31
|
-
if (transform != null && transform.networkEntityAttributeBuffer != null) {
|
|
32
|
-
result = transform.networkEntityAttributeBuffer[index.toFixed(0)];
|
|
33
|
-
}
|
|
34
|
-
return result;
|
|
35
|
-
}
|
|
36
|
-
static PostBufferedAttribute(transform, index, value) {
|
|
37
|
-
if (transform.networkEntityBatch == null)
|
|
38
|
-
transform.networkEntityBatch = {};
|
|
39
|
-
transform.networkEntityBatch[index.toFixed(0)] = value;
|
|
40
|
-
}
|
|
41
|
-
}
|
package/lib/sgshadowdepth.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Material } from '@babylonjs/core/Materials/material';
|
|
2
|
-
import { SubMesh } from '@babylonjs/core/Meshes/subMesh';
|
|
3
|
-
import { Scene } from '@babylonjs/core/scene';
|
|
4
|
-
import { ShadowDepthWrapper } from '@babylonjs/core/Materials';
|
|
5
|
-
import { Light } from '@babylonjs/core/Lights/light';
|
|
6
|
-
export declare class SgShadowDepth {
|
|
7
|
-
static Enabled: boolean;
|
|
8
|
-
static Create(material: Material, scene: Scene): ShadowDepthWrapper;
|
|
9
|
-
static Token(options: string, baseKey: string): string;
|
|
10
|
-
static Hash(text: string): string;
|
|
11
|
-
static IsDefinesObject(defines: any): boolean;
|
|
12
|
-
static BaseDefines(wrapper: any, subMesh: SubMesh): any;
|
|
13
|
-
static ResolveHolderDefines(wrapper: any, subMesh: SubMesh, shadowGenerator: any): boolean;
|
|
14
|
-
static BaseDefinesStale(wrapper: any, subMesh: SubMesh): boolean;
|
|
15
|
-
static LightsMatch(defines: any, lights: Light[]): boolean;
|
|
16
|
-
static FilterDefines(defines: string): string;
|
|
17
|
-
static Share(wrapper: any, scene: Scene, options: string): void;
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=sgshadowdepth.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sgshadowdepth.d.ts","sourceRoot":"","sources":["../src/sgshadowdepth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAkB,MAAM,2BAA2B,CAAC;AAC/E,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAWrD,qBAAa,aAAa;IAOlB,OAAc,OAAO,EAAE,OAAO,CAAS;WAGzB,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,GAAG,kBAAkB;WAY5D,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM;WAK/C,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;WAa1B,eAAe,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO;WAQtC,WAAW,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,GAAG,GAAG;WAqBhD,oBAAoB,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,GAAG,GAAG,OAAO;WAwBnF,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO;WAezD,WAAW,CAAC,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO;WAenD,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;WAKtC,KAAK,CAAC,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;CA6GzE"}
|
package/lib/sgshadowdepth.js
DELETED
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
import { ShadowDepthWrapper, ShaderLanguage } from '@babylonjs/core/Materials';
|
|
2
|
-
export class SgShadowDepth {
|
|
3
|
-
static Create(material, scene) {
|
|
4
|
-
if (SgShadowDepth.Enabled !== true)
|
|
5
|
-
return null;
|
|
6
|
-
const wgsl = (material.shaderLanguage === ShaderLanguage.WGSL);
|
|
7
|
-
const options = { standalone: true };
|
|
8
|
-
if (wgsl)
|
|
9
|
-
options.remappedVariables = ["vNormalW", "vertexOutputs.vNormalW"];
|
|
10
|
-
const wrapper = new ShadowDepthWrapper(material, scene, options);
|
|
11
|
-
SgShadowDepth.Share(wrapper, scene, (wgsl ? "wgsl" : "glsl") + "|" + (options.remappedVariables || []).join(","));
|
|
12
|
-
material.onDisposeObservable.addOnce(() => { wrapper.dispose(); });
|
|
13
|
-
return wrapper;
|
|
14
|
-
}
|
|
15
|
-
static Token(options, baseKey) {
|
|
16
|
-
return "sgShadowDepth|" + options + "|" + SgShadowDepth.Hash(baseKey);
|
|
17
|
-
}
|
|
18
|
-
static Hash(text) {
|
|
19
|
-
let h1 = 0xdeadbeef, h2 = 0x41c6ce57;
|
|
20
|
-
for (let i = 0; i < text.length; i++) {
|
|
21
|
-
const c = text.charCodeAt(i);
|
|
22
|
-
h1 = Math.imul(h1 ^ c, 2654435761);
|
|
23
|
-
h2 = Math.imul(h2 ^ c, 1597334677);
|
|
24
|
-
}
|
|
25
|
-
h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507) ^ Math.imul(h2 ^ (h2 >>> 13), 3266489909);
|
|
26
|
-
h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507) ^ Math.imul(h1 ^ (h1 >>> 13), 3266489909);
|
|
27
|
-
return (4294967296 * (2097151 & h2) + (h1 >>> 0)).toString(36) + ":" + text.length.toString(36);
|
|
28
|
-
}
|
|
29
|
-
static IsDefinesObject(defines) {
|
|
30
|
-
return (defines != null && typeof defines === "object");
|
|
31
|
-
}
|
|
32
|
-
static BaseDefines(wrapper, subMesh) {
|
|
33
|
-
const entry = (wrapper._subMeshToEffect != null) ? wrapper._subMeshToEffect.get(subMesh) : null;
|
|
34
|
-
if (entry == null || entry[0] == null)
|
|
35
|
-
return null;
|
|
36
|
-
const created = wrapper.__sgCreatedDefines;
|
|
37
|
-
const record = (created != null) ? created.get(subMesh) : null;
|
|
38
|
-
if (record != null && record.effect === entry[0] && SgShadowDepth.IsDefinesObject(record.defines))
|
|
39
|
-
return record.defines;
|
|
40
|
-
const s = subMesh;
|
|
41
|
-
const own = (typeof s._getDrawWrapper === "function") ? s._getDrawWrapper(entry[1]) : null;
|
|
42
|
-
if (own != null && SgShadowDepth.IsDefinesObject(own.defines))
|
|
43
|
-
return own.defines;
|
|
44
|
-
const wrappers = s._drawWrappers || [];
|
|
45
|
-
for (let i = 0; i < wrappers.length; i++) {
|
|
46
|
-
const dw = wrappers[i];
|
|
47
|
-
if (dw != null && dw.effect === entry[0] && SgShadowDepth.IsDefinesObject(dw.defines))
|
|
48
|
-
return dw.defines;
|
|
49
|
-
}
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
52
|
-
static ResolveHolderDefines(wrapper, subMesh, shadowGenerator) {
|
|
53
|
-
const holders = wrapper._subMeshToDepthWrapper;
|
|
54
|
-
const holder = (holders != null && typeof holders.get === "function") ? holders.get(subMesh, shadowGenerator) : null;
|
|
55
|
-
if (holder == null || holder.mainDrawWrapper == null)
|
|
56
|
-
return true;
|
|
57
|
-
const main = holder.mainDrawWrapper;
|
|
58
|
-
let defines = main.defines;
|
|
59
|
-
if (!SgShadowDepth.IsDefinesObject(defines)) {
|
|
60
|
-
defines = SgShadowDepth.BaseDefines(wrapper, subMesh);
|
|
61
|
-
if (defines == null)
|
|
62
|
-
return false;
|
|
63
|
-
main.defines = defines;
|
|
64
|
-
}
|
|
65
|
-
const passes = holder.drawWrapper || [];
|
|
66
|
-
for (let i = 0; i < passes.length; i++) {
|
|
67
|
-
const dw = passes[i];
|
|
68
|
-
if (dw != null && !SgShadowDepth.IsDefinesObject(dw.defines))
|
|
69
|
-
dw.defines = defines;
|
|
70
|
-
}
|
|
71
|
-
return true;
|
|
72
|
-
}
|
|
73
|
-
static BaseDefinesStale(wrapper, subMesh) {
|
|
74
|
-
const defines = SgShadowDepth.BaseDefines(wrapper, subMesh);
|
|
75
|
-
if (defines == null)
|
|
76
|
-
return false;
|
|
77
|
-
if (defines.isDirty === true)
|
|
78
|
-
return true;
|
|
79
|
-
const mesh = (subMesh != null) ? subMesh.getRenderingMesh() : null;
|
|
80
|
-
return !SgShadowDepth.LightsMatch(defines, (mesh != null) ? mesh.lightSources : null);
|
|
81
|
-
}
|
|
82
|
-
static LightsMatch(defines, lights) {
|
|
83
|
-
if (defines == null)
|
|
84
|
-
return true;
|
|
85
|
-
const list = lights || [];
|
|
86
|
-
for (let i = 0; i < 32; i++) {
|
|
87
|
-
if (defines["LIGHT" + i] !== true)
|
|
88
|
-
break;
|
|
89
|
-
const light = list[i];
|
|
90
|
-
if (light == null)
|
|
91
|
-
return false;
|
|
92
|
-
const kind = (typeof light.getClassName === "function") ? light.getClassName() : "";
|
|
93
|
-
const flag = (kind === "DirectionalLight") ? "DIRLIGHT" : (kind === "HemisphericLight") ? "HEMILIGHT" : (kind === "PointLight") ? "POINTLIGHT" : (kind === "SpotLight") ? "SPOTLIGHT" : null;
|
|
94
|
-
if (flag != null && defines[flag + i] !== true)
|
|
95
|
-
return false;
|
|
96
|
-
}
|
|
97
|
-
return true;
|
|
98
|
-
}
|
|
99
|
-
static FilterDefines(defines) {
|
|
100
|
-
return defines.split("\n").filter((line) => !/^\s*#define\s+(PREPASS|SCENE_MRT_COUNT)/.test(line)).join("\n");
|
|
101
|
-
}
|
|
102
|
-
static Share(wrapper, scene, options) {
|
|
103
|
-
const created = new WeakMap();
|
|
104
|
-
wrapper.__sgCreatedDefines = created;
|
|
105
|
-
const observer = wrapper._onEffectCreatedObserver;
|
|
106
|
-
if (observer != null && typeof observer.callback === "function") {
|
|
107
|
-
const callback = observer.callback;
|
|
108
|
-
observer.callback = function (info) {
|
|
109
|
-
const result = callback.apply(this, arguments);
|
|
110
|
-
const subMesh = (info != null) ? info.subMesh : null;
|
|
111
|
-
if (subMesh != null && info.effect != null) {
|
|
112
|
-
const defines = subMesh.materialDefines;
|
|
113
|
-
if (SgShadowDepth.IsDefinesObject(defines))
|
|
114
|
-
created.set(subMesh, { effect: info.effect, defines: defines });
|
|
115
|
-
}
|
|
116
|
-
return result;
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
const makeEffect = wrapper._makeEffect;
|
|
120
|
-
if (typeof makeEffect === "function") {
|
|
121
|
-
wrapper._makeEffect = function (subMesh, depthDefines, shadowGenerator) {
|
|
122
|
-
const entry = (this._subMeshToEffect != null) ? this._subMeshToEffect.get(subMesh) : null;
|
|
123
|
-
const base = (entry != null) ? entry[0] : null;
|
|
124
|
-
const engine = scene.getEngine();
|
|
125
|
-
const createEffect = engine.createEffect;
|
|
126
|
-
engine.createEffect = function (source, effectOptions) {
|
|
127
|
-
if (effectOptions != null && typeof effectOptions.defines === "string")
|
|
128
|
-
effectOptions.defines = SgShadowDepth.FilterDefines(effectOptions.defines) + "\n#define SG_SHADOWPASS";
|
|
129
|
-
const baseMaterial = wrapper._baseMaterial;
|
|
130
|
-
const processor = (baseMaterial != null && typeof baseMaterial.getGraphFinalCodeProcessor === "function") ? baseMaterial.getGraphFinalCodeProcessor() : null;
|
|
131
|
-
if (effectOptions != null && processor != null && effectOptions.processFinalCode == null)
|
|
132
|
-
effectOptions.processFinalCode = processor;
|
|
133
|
-
const token = (base != null && typeof base._key === "string" && base._key.length > 0) ? SgShadowDepth.Token(options, base._key) : null;
|
|
134
|
-
if (token != null && source != null && typeof source === "object" && (source.vertexSource != null || source.fragmentSource != null)) {
|
|
135
|
-
source.vertexToken = token;
|
|
136
|
-
source.fragmentToken = token;
|
|
137
|
-
}
|
|
138
|
-
return createEffect.apply(engine, arguments);
|
|
139
|
-
};
|
|
140
|
-
let effect = null;
|
|
141
|
-
try {
|
|
142
|
-
effect = makeEffect.apply(this, arguments);
|
|
143
|
-
}
|
|
144
|
-
finally {
|
|
145
|
-
engine.createEffect = createEffect;
|
|
146
|
-
}
|
|
147
|
-
if (effect != null && !SgShadowDepth.ResolveHolderDefines(this, subMesh, shadowGenerator))
|
|
148
|
-
return null;
|
|
149
|
-
return effect;
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
const isReady = wrapper.isReadyForSubMesh;
|
|
153
|
-
if (typeof isReady === "function") {
|
|
154
|
-
wrapper.isReadyForSubMesh = function (subMesh, defines, shadowGenerator, useInstances, passId) {
|
|
155
|
-
const entry = (this._subMeshToEffect != null) ? this._subMeshToEffect.get(subMesh) : null;
|
|
156
|
-
if (entry != null && entry[0] != null && typeof entry[0].isReady === "function" && entry[0].isReady()) {
|
|
157
|
-
if (SgShadowDepth.BaseDefinesStale(this, subMesh)) {
|
|
158
|
-
const renderingMesh = (subMesh != null) ? subMesh.getRenderingMesh() : null;
|
|
159
|
-
const meshInfo = (renderingMesh != null) ? renderingMesh._internalAbstractMeshDataInfo : null;
|
|
160
|
-
if (meshInfo != null && meshInfo._isActive === true)
|
|
161
|
-
return false;
|
|
162
|
-
return isReady.apply(this, arguments);
|
|
163
|
-
}
|
|
164
|
-
const effect = this._makeEffect(subMesh, defines, shadowGenerator, passId);
|
|
165
|
-
return (effect != null && effect.isReady());
|
|
166
|
-
}
|
|
167
|
-
const mesh = (subMesh != null) ? subMesh.getRenderingMesh() : null;
|
|
168
|
-
const info = (mesh != null) ? mesh._internalAbstractMeshDataInfo : null;
|
|
169
|
-
if (entry == null && info != null && info._isActive === true)
|
|
170
|
-
return false;
|
|
171
|
-
return isReady.apply(this, arguments);
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
const retired = new Set();
|
|
175
|
-
if (typeof wrapper._deleteDepthWrapperEffect === "function") {
|
|
176
|
-
wrapper._deleteDepthWrapperEffect = function (subMesh) {
|
|
177
|
-
const map = (this._subMeshToDepthWrapper != null) ? this._subMeshToDepthWrapper.mm.get(subMesh) : null;
|
|
178
|
-
if (map == null)
|
|
179
|
-
return;
|
|
180
|
-
map.forEach((holder) => {
|
|
181
|
-
const effect = (holder != null && holder.mainDrawWrapper != null) ? holder.mainDrawWrapper.effect : null;
|
|
182
|
-
if (effect == null)
|
|
183
|
-
return;
|
|
184
|
-
if (retired.has(effect))
|
|
185
|
-
effect.dispose();
|
|
186
|
-
else
|
|
187
|
-
retired.add(effect);
|
|
188
|
-
});
|
|
189
|
-
this._subMeshToDepthWrapper.mm.delete(subMesh);
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
const dispose = wrapper.dispose;
|
|
193
|
-
let disposed = false;
|
|
194
|
-
wrapper.dispose = function () {
|
|
195
|
-
if (disposed)
|
|
196
|
-
return;
|
|
197
|
-
disposed = true;
|
|
198
|
-
dispose.apply(this, arguments);
|
|
199
|
-
if (this._subMeshToDepthWrapper != null) {
|
|
200
|
-
this._subMeshToDepthWrapper.mm.forEach((map) => map.forEach((holder) => {
|
|
201
|
-
const effect = (holder != null && holder.mainDrawWrapper != null) ? holder.mainDrawWrapper.effect : null;
|
|
202
|
-
if (effect != null && !retired.has(effect))
|
|
203
|
-
retired.add(effect);
|
|
204
|
-
else if (effect != null)
|
|
205
|
-
effect.dispose();
|
|
206
|
-
}));
|
|
207
|
-
this._subMeshToDepthWrapper.mm.clear();
|
|
208
|
-
}
|
|
209
|
-
retired.forEach((effect) => effect.dispose());
|
|
210
|
-
retired.clear();
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
SgShadowDepth.Enabled = false;
|