@babylonjs-toolkit/next 9.30.0 → 9.34.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.
Files changed (191) hide show
  1. package/lib/contentdownloadoutcome.d.ts +2 -0
  2. package/lib/contentdownloadoutcome.d.ts.map +1 -0
  3. package/lib/contentdownloadoutcome.js +1 -0
  4. package/lib/contentgraphicsoutcome.d.ts +2 -0
  5. package/lib/contentgraphicsoutcome.d.ts.map +1 -0
  6. package/lib/contentgraphicsoutcome.js +1 -0
  7. package/lib/contentgraphicsstatus.d.ts +2 -0
  8. package/lib/contentgraphicsstatus.d.ts.map +1 -0
  9. package/lib/contentgraphicsstatus.js +1 -0
  10. package/lib/contentinstaller.d.ts +248 -0
  11. package/lib/contentinstaller.d.ts.map +1 -0
  12. package/lib/contentinstaller.js +1939 -0
  13. package/lib/contentinstalleravailability.d.ts +2 -0
  14. package/lib/contentinstalleravailability.d.ts.map +1 -0
  15. package/lib/contentinstalleravailability.js +1 -0
  16. package/lib/contentinstallererrorkind.d.ts +2 -0
  17. package/lib/contentinstallererrorkind.d.ts.map +1 -0
  18. package/lib/contentinstallererrorkind.js +1 -0
  19. package/lib/contentinstallphase.d.ts +2 -0
  20. package/lib/contentinstallphase.d.ts.map +1 -0
  21. package/lib/contentinstallphase.js +1 -0
  22. package/lib/contentinstallpolicy.d.ts +2 -0
  23. package/lib/contentinstallpolicy.d.ts.map +1 -0
  24. package/lib/contentinstallpolicy.js +1 -0
  25. package/lib/contentupdatepolicy.d.ts +2 -0
  26. package/lib/contentupdatepolicy.d.ts.map +1 -0
  27. package/lib/contentupdatepolicy.js +1 -0
  28. package/lib/iafterspawned.d.ts +4 -0
  29. package/lib/iafterspawned.d.ts.map +1 -0
  30. package/lib/iafterspawned.js +1 -0
  31. package/lib/iaftertick.d.ts +4 -0
  32. package/lib/iaftertick.d.ts.map +1 -0
  33. package/lib/iaftertick.js +1 -0
  34. package/lib/iafterupdate.d.ts +4 -0
  35. package/lib/iafterupdate.d.ts.map +1 -0
  36. package/lib/iafterupdate.js +1 -0
  37. package/lib/ibeforetick.d.ts +4 -0
  38. package/lib/ibeforetick.d.ts.map +1 -0
  39. package/lib/ibeforetick.js +1 -0
  40. package/lib/ibeforeupdate.d.ts +4 -0
  41. package/lib/ibeforeupdate.d.ts.map +1 -0
  42. package/lib/ibeforeupdate.js +1 -0
  43. package/lib/icontentavailabilityblock.d.ts +6 -0
  44. package/lib/icontentavailabilityblock.d.ts.map +1 -0
  45. package/lib/icontentavailabilityblock.js +1 -0
  46. package/lib/icontentchannelmessage.d.ts +24 -0
  47. package/lib/icontentchannelmessage.d.ts.map +1 -0
  48. package/lib/icontentchannelmessage.js +1 -0
  49. package/lib/icontentdownloadjob.d.ts +7 -0
  50. package/lib/icontentdownloadjob.d.ts.map +1 -0
  51. package/lib/icontentdownloadjob.js +1 -0
  52. package/lib/icontentfileref.d.ts +9 -0
  53. package/lib/icontentfileref.d.ts.map +1 -0
  54. package/lib/icontentfileref.js +1 -0
  55. package/lib/icontentforwardedrequest.d.ts +9 -0
  56. package/lib/icontentforwardedrequest.d.ts.map +1 -0
  57. package/lib/icontentforwardedrequest.js +1 -0
  58. package/lib/icontentgraphicssession.d.ts +8 -0
  59. package/lib/icontentgraphicssession.d.ts.map +1 -0
  60. package/lib/icontentgraphicssession.js +1 -0
  61. package/lib/icontentgroupref.d.ts +6 -0
  62. package/lib/icontentgroupref.d.ts.map +1 -0
  63. package/lib/icontentgroupref.js +1 -0
  64. package/lib/icontentgroupstatus.d.ts +14 -0
  65. package/lib/icontentgroupstatus.d.ts.map +1 -0
  66. package/lib/icontentgroupstatus.js +1 -0
  67. package/lib/icontentinflightdownload.d.ts +8 -0
  68. package/lib/icontentinflightdownload.d.ts.map +1 -0
  69. package/lib/icontentinflightdownload.js +1 -0
  70. package/lib/icontentinstallcall.d.ts +6 -0
  71. package/lib/icontentinstallcall.d.ts.map +1 -0
  72. package/lib/icontentinstallcall.js +1 -0
  73. package/lib/icontentinstallererror.d.ts +7 -0
  74. package/lib/icontentinstallererror.d.ts.map +1 -0
  75. package/lib/icontentinstallererror.js +1 -0
  76. package/lib/icontentinstalleroptions.d.ts +20 -0
  77. package/lib/icontentinstalleroptions.d.ts.map +1 -0
  78. package/lib/icontentinstalleroptions.js +1 -0
  79. package/lib/icontentinstallerstate.d.ts +30 -0
  80. package/lib/icontentinstallerstate.d.ts.map +1 -0
  81. package/lib/icontentinstallerstate.js +1 -0
  82. package/lib/icontentinstalloptions.d.ts +5 -0
  83. package/lib/icontentinstalloptions.d.ts.map +1 -0
  84. package/lib/icontentinstalloptions.js +1 -0
  85. package/lib/icontentinstallprogress.d.ts +21 -0
  86. package/lib/icontentinstallprogress.d.ts.map +1 -0
  87. package/lib/icontentinstallprogress.js +1 -0
  88. package/lib/icontentmanifest.d.ts +10 -0
  89. package/lib/icontentmanifest.d.ts.map +1 -0
  90. package/lib/icontentmanifest.js +1 -0
  91. package/lib/icontentmanifestfile.d.ts +8 -0
  92. package/lib/icontentmanifestfile.d.ts.map +1 -0
  93. package/lib/icontentmanifestfile.js +1 -0
  94. package/lib/icontentmanifestgroup.d.ts +5 -0
  95. package/lib/icontentmanifestgroup.d.ts.map +1 -0
  96. package/lib/icontentmanifestgroup.js +1 -0
  97. package/lib/icontentpreparegraphicsoptions.d.ts +5 -0
  98. package/lib/icontentpreparegraphicsoptions.d.ts.map +1 -0
  99. package/lib/icontentpreparegraphicsoptions.js +1 -0
  100. package/lib/icontentprogresssession.d.ts +10 -0
  101. package/lib/icontentprogresssession.d.ts.map +1 -0
  102. package/lib/icontentprogresssession.js +1 -0
  103. package/lib/icontentretrywait.d.ts +6 -0
  104. package/lib/icontentretrywait.d.ts.map +1 -0
  105. package/lib/icontentretrywait.js +1 -0
  106. package/lib/icontentrootoptions.d.ts +6 -0
  107. package/lib/icontentrootoptions.d.ts.map +1 -0
  108. package/lib/icontentrootoptions.js +1 -0
  109. package/lib/icontentrootruntime.d.ts +8 -0
  110. package/lib/icontentrootruntime.d.ts.map +1 -0
  111. package/lib/icontentrootruntime.js +1 -0
  112. package/lib/icontentrootstate.d.ts +29 -0
  113. package/lib/icontentrootstate.d.ts.map +1 -0
  114. package/lib/icontentrootstate.js +1 -0
  115. package/lib/icontentstorageestimate.d.ts +8 -0
  116. package/lib/icontentstorageestimate.d.ts.map +1 -0
  117. package/lib/icontentstorageestimate.js +1 -0
  118. package/lib/icontentstoreresult.d.ts +8 -0
  119. package/lib/icontentstoreresult.d.ts.map +1 -0
  120. package/lib/icontentstoreresult.js +1 -0
  121. package/lib/icontentstorewaiter.d.ts +6 -0
  122. package/lib/icontentstorewaiter.d.ts.map +1 -0
  123. package/lib/icontentstorewaiter.js +1 -0
  124. package/lib/icontentupdateinfo.d.ts +8 -0
  125. package/lib/icontentupdateinfo.d.ts.map +1 -0
  126. package/lib/icontentupdateinfo.js +1 -0
  127. package/lib/idespawned.d.ts +5 -0
  128. package/lib/idespawned.d.ts.map +1 -0
  129. package/lib/idespawned.js +1 -0
  130. package/lib/iinputauthoritylost.d.ts +4 -0
  131. package/lib/iinputauthoritylost.d.ts.map +1 -0
  132. package/lib/iinputauthoritylost.js +1 -0
  133. package/lib/index.d.ts +141 -29
  134. package/lib/index.d.ts.map +1 -1
  135. package/lib/index.js +141 -29
  136. package/lib/iplayerjoined.d.ts +5 -0
  137. package/lib/iplayerjoined.d.ts.map +1 -0
  138. package/lib/iplayerjoined.js +1 -0
  139. package/lib/iplayerleft.d.ts +5 -0
  140. package/lib/iplayerleft.d.ts.map +1 -0
  141. package/lib/iplayerleft.js +1 -0
  142. package/lib/ispawned.d.ts +4 -0
  143. package/lib/ispawned.d.ts.map +1 -0
  144. package/lib/ispawned.js +1 -0
  145. package/lib/istateauthoritychanged.d.ts +4 -0
  146. package/lib/istateauthoritychanged.d.ts.map +1 -0
  147. package/lib/istateauthoritychanged.js +1 -0
  148. package/lib/loopbackdelivery.d.ts +6 -0
  149. package/lib/loopbackdelivery.d.ts.map +1 -0
  150. package/lib/loopbackdelivery.js +1 -0
  151. package/lib/loopbackhub.d.ts +206 -0
  152. package/lib/loopbackhub.d.ts.map +1 -0
  153. package/lib/loopbackhub.js +986 -0
  154. package/lib/loopbackhuboptions.d.ts +8 -0
  155. package/lib/loopbackhuboptions.d.ts.map +1 -0
  156. package/lib/loopbackhuboptions.js +1 -0
  157. package/lib/network_reconnect_grace_seconds.d.ts +2 -0
  158. package/lib/network_reconnect_grace_seconds.d.ts.map +1 -0
  159. package/lib/network_reconnect_grace_seconds.js +1 -0
  160. package/lib/networkstats.d.ts +51 -0
  161. package/lib/networkstats.d.ts.map +1 -0
  162. package/lib/networkstats.js +204 -0
  163. package/lib/networkstatssample.d.ts +7 -0
  164. package/lib/networkstatssample.d.ts.map +1 -0
  165. package/lib/networkstatssample.js +1 -0
  166. package/lib/networkstatssliderrow.d.ts +9 -0
  167. package/lib/networkstatssliderrow.d.ts.map +1 -0
  168. package/lib/networkstatssliderrow.js +1 -0
  169. package/lib/project.d.ts +2907 -133
  170. package/lib/project.d.ts.map +1 -1
  171. package/lib/project.js +14960 -3764
  172. package/lib/scenemanager.d.ts +4434 -51
  173. package/lib/scenemanager.d.ts.map +1 -1
  174. package/lib/scenemanager.js +18729 -1149
  175. package/lib/shadercodecachememorystorage.d.ts +10 -0
  176. package/lib/shadercodecachememorystorage.d.ts.map +1 -0
  177. package/lib/shadercodecachememorystorage.js +32 -0
  178. package/lib/workers/bt-content-worker.js +1180 -0
  179. package/lib/zigzagdecode.d.ts +2 -0
  180. package/lib/zigzagdecode.d.ts.map +1 -0
  181. package/lib/zigzagdecode.js +3 -0
  182. package/lib/zigzagencode.d.ts +2 -0
  183. package/lib/zigzagencode.d.ts.map +1 -0
  184. package/lib/zigzagencode.js +3 -0
  185. package/package.json +18 -13
  186. package/lib/entitycontroller.d.ts +0 -11
  187. package/lib/entitycontroller.d.ts.map +0 -1
  188. package/lib/entitycontroller.js +0 -41
  189. package/lib/sgshadowdepth.d.ts +0 -19
  190. package/lib/sgshadowdepth.d.ts.map +0 -1
  191. package/lib/sgshadowdepth.js +0 -214
@@ -0,0 +1,2 @@
1
+ export declare function zigZagDecode(encoded: number): number;
2
+ //# sourceMappingURL=zigzagdecode.d.ts.map
@@ -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,3 @@
1
+ export function zigZagDecode(encoded) {
2
+ return (encoded >>> 1) ^ -(encoded & 1);
3
+ }
@@ -0,0 +1,2 @@
1
+ export declare function zigZagEncode(value: number): number;
2
+ //# sourceMappingURL=zigzagencode.d.ts.map
@@ -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"}
@@ -0,0 +1,3 @@
1
+ export function zigZagEncode(value) {
2
+ return ((value << 1) ^ (value >> 31)) >>> 0;
3
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babylonjs-toolkit/next",
3
- "version": "9.30.0",
3
+ "version": "9.34.1",
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.30.0",
164
- "@babylonjs/gui": "9.30.0",
168
+ "@babylonjs/core": "9.34.0",
169
+ "@babylonjs/gui": "9.34.0",
165
170
  "@babylonjs/havok": "^1.3.14",
166
- "@babylonjs/addons": "9.30.0",
167
- "@babylonjs/loaders": "9.30.0",
168
- "@babylonjs/materials": "9.30.0",
169
- "@babylonjs/inspector": "9.30.0",
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.30.0",
175
- "@babylonjs/gui": "9.30.0",
179
+ "@babylonjs/core": "9.34.0",
180
+ "@babylonjs/gui": "9.34.0",
176
181
  "@babylonjs/havok": "^1.3.14",
177
- "@babylonjs/addons": "9.30.0",
178
- "@babylonjs/loaders": "9.30.0",
179
- "@babylonjs/materials": "9.30.0",
180
- "@babylonjs/inspector": "9.30.0"
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"}
@@ -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
- }
@@ -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"}
@@ -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;