@babylonjs/core 5.17.1 → 5.20.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.
Files changed (159) hide show
  1. package/Debug/debugLayer.d.ts +36 -0
  2. package/Debug/debugLayer.js.map +1 -1
  3. package/DeviceInput/InputDevices/deviceSource.d.ts +1 -1
  4. package/DeviceInput/InputDevices/deviceSource.js.map +1 -1
  5. package/DeviceInput/InputDevices/deviceSourceManager.d.ts +1 -1
  6. package/DeviceInput/InputDevices/deviceSourceManager.js +1 -1
  7. package/DeviceInput/InputDevices/deviceSourceManager.js.map +1 -1
  8. package/DeviceInput/{Helpers/eventFactory.d.ts → eventFactory.d.ts} +4 -4
  9. package/DeviceInput/{Helpers/eventFactory.js → eventFactory.js} +2 -2
  10. package/DeviceInput/eventFactory.js.map +1 -0
  11. package/DeviceInput/{InputDevices/inputInterfaces.d.ts → inputInterfaces.d.ts} +2 -2
  12. package/DeviceInput/{InputDevices/inputInterfaces.js → inputInterfaces.js} +0 -0
  13. package/DeviceInput/inputInterfaces.js.map +1 -0
  14. package/DeviceInput/{InputDevices/internalDeviceSourceManager.d.ts → internalDeviceSourceManager.d.ts} +7 -7
  15. package/DeviceInput/{InputDevices/internalDeviceSourceManager.js → internalDeviceSourceManager.js} +2 -2
  16. package/DeviceInput/internalDeviceSourceManager.js.map +1 -0
  17. package/DeviceInput/{InputDevices/nativeDeviceInputSystem.d.ts → nativeDeviceInputSystem.d.ts} +2 -2
  18. package/DeviceInput/{InputDevices/nativeDeviceInputSystem.js → nativeDeviceInputSystem.js} +2 -2
  19. package/DeviceInput/nativeDeviceInputSystem.js.map +1 -0
  20. package/DeviceInput/{InputDevices/webDeviceInputSystem.d.ts → webDeviceInputSystem.d.ts} +3 -3
  21. package/DeviceInput/{InputDevices/webDeviceInputSystem.js → webDeviceInputSystem.js} +4 -4
  22. package/DeviceInput/webDeviceInputSystem.js.map +1 -0
  23. package/Engines/Extensions/engine.query.js +5 -1
  24. package/Engines/Extensions/engine.query.js.map +1 -1
  25. package/Engines/Extensions/engine.transformFeedback.js +5 -1
  26. package/Engines/Extensions/engine.transformFeedback.js.map +1 -1
  27. package/Engines/Extensions/engine.views.d.ts +13 -0
  28. package/Engines/Extensions/engine.views.js +16 -1
  29. package/Engines/Extensions/engine.views.js.map +1 -1
  30. package/Engines/Native/nativeInterfaces.d.ts +1 -1
  31. package/Engines/Native/nativeInterfaces.js.map +1 -1
  32. package/Engines/engine.d.ts +15 -240
  33. package/Engines/engineFeatures.d.ts +2 -0
  34. package/Engines/engineFeatures.js.map +1 -1
  35. package/Engines/nativeEngine.js +1 -0
  36. package/Engines/nativeEngine.js.map +1 -1
  37. package/Engines/nullEngine.js +1 -0
  38. package/Engines/nullEngine.js.map +1 -1
  39. package/Engines/thinEngine.d.ts +1 -1
  40. package/Engines/thinEngine.js +14 -4
  41. package/Engines/thinEngine.js.map +1 -1
  42. package/Engines/webgpuEngine.js +1 -0
  43. package/Engines/webgpuEngine.js.map +1 -1
  44. package/Gizmos/axisDragGizmo.d.ts +31 -9
  45. package/Gizmos/axisDragGizmo.js.map +1 -1
  46. package/Gizmos/axisScaleGizmo.d.ts +46 -14
  47. package/Gizmos/axisScaleGizmo.js.map +1 -1
  48. package/Gizmos/boundingBoxGizmo.d.ts +94 -19
  49. package/Gizmos/boundingBoxGizmo.js.map +1 -1
  50. package/Gizmos/cameraGizmo.d.ts +23 -6
  51. package/Gizmos/cameraGizmo.js.map +1 -1
  52. package/Gizmos/gizmo.d.ts +48 -6
  53. package/Gizmos/gizmo.js.map +1 -1
  54. package/Gizmos/gizmoManager.d.ts +25 -17
  55. package/Gizmos/gizmoManager.js.map +1 -1
  56. package/Gizmos/lightGizmo.d.ts +25 -8
  57. package/Gizmos/lightGizmo.js.map +1 -1
  58. package/Gizmos/planeDragGizmo.d.ts +30 -9
  59. package/Gizmos/planeDragGizmo.js.map +1 -1
  60. package/Gizmos/planeRotationGizmo.d.ts +45 -15
  61. package/Gizmos/planeRotationGizmo.js.map +1 -1
  62. package/Gizmos/positionGizmo.d.ts +53 -17
  63. package/Gizmos/positionGizmo.js +1 -1
  64. package/Gizmos/positionGizmo.js.map +1 -1
  65. package/Gizmos/rotationGizmo.d.ts +35 -10
  66. package/Gizmos/rotationGizmo.js.map +1 -1
  67. package/Gizmos/scaleGizmo.d.ts +49 -18
  68. package/Gizmos/scaleGizmo.js.map +1 -1
  69. package/Loading/Plugins/babylonFileLoader.js +16 -4
  70. package/Loading/Plugins/babylonFileLoader.js.map +1 -1
  71. package/Materials/Node/Blocks/Fragment/heightToNormalBlock.d.ts +39 -0
  72. package/Materials/Node/Blocks/Fragment/heightToNormalBlock.js +97 -0
  73. package/Materials/Node/Blocks/Fragment/heightToNormalBlock.js.map +1 -0
  74. package/Materials/Node/Blocks/Fragment/index.d.ts +1 -0
  75. package/Materials/Node/Blocks/Fragment/index.js +1 -0
  76. package/Materials/Node/Blocks/Fragment/index.js.map +1 -1
  77. package/Materials/Node/Blocks/Vertex/lightInformationBlock.d.ts +18 -0
  78. package/Materials/Node/Blocks/Vertex/lightInformationBlock.js +85 -1
  79. package/Materials/Node/Blocks/Vertex/lightInformationBlock.js.map +1 -1
  80. package/Materials/Node/nodeMaterial.d.ts +6 -0
  81. package/Materials/Node/nodeMaterial.js +11 -0
  82. package/Materials/Node/nodeMaterial.js.map +1 -1
  83. package/Materials/Textures/Procedurals/proceduralTexture.js +5 -1
  84. package/Materials/Textures/Procedurals/proceduralTexture.js.map +1 -1
  85. package/Materials/Textures/renderTargetTexture.js +3 -0
  86. package/Materials/Textures/renderTargetTexture.js.map +1 -1
  87. package/Materials/Textures/texture.js +9 -5
  88. package/Materials/Textures/texture.js.map +1 -1
  89. package/Materials/index.d.ts +1 -0
  90. package/Materials/index.js +1 -0
  91. package/Materials/index.js.map +1 -1
  92. package/Maths/math.vector.d.ts +134 -8
  93. package/Maths/math.vector.js +168 -36
  94. package/Maths/math.vector.js.map +1 -1
  95. package/Meshes/Compression/dracoCompression.js +1 -1
  96. package/Meshes/Compression/dracoCompression.js.map +1 -1
  97. package/Meshes/groundMesh.js +1 -1
  98. package/Meshes/groundMesh.js.map +1 -1
  99. package/Meshes/mesh.js +1 -0
  100. package/Meshes/mesh.js.map +1 -1
  101. package/Meshes/transformNode.js +1 -0
  102. package/Meshes/transformNode.js.map +1 -1
  103. package/Misc/assetsManager.d.ts +9 -0
  104. package/Misc/assetsManager.js +3 -1
  105. package/Misc/assetsManager.js.map +1 -1
  106. package/Misc/basis.js +10 -4
  107. package/Misc/basis.js.map +1 -1
  108. package/Misc/computePressure.d.ts +9 -3
  109. package/Misc/computePressure.js +13 -5
  110. package/Misc/computePressure.js.map +1 -1
  111. package/Misc/fileTools.js +2 -2
  112. package/Misc/fileTools.js.map +1 -1
  113. package/Misc/iInspectable.d.ts +12 -2
  114. package/Misc/iInspectable.js +4 -0
  115. package/Misc/iInspectable.js.map +1 -1
  116. package/Misc/khronosTextureContainer2.js +1 -1
  117. package/Misc/khronosTextureContainer2.js.map +1 -1
  118. package/Misc/sceneSerializer.js +1 -1
  119. package/Misc/sceneSerializer.js.map +1 -1
  120. package/Misc/tools.d.ts +2 -2
  121. package/Misc/tools.js +4 -1
  122. package/Misc/tools.js.map +1 -1
  123. package/Offline/database.js +6 -8
  124. package/Offline/database.js.map +1 -1
  125. package/Particles/solidParticleSystem.d.ts +1 -0
  126. package/Particles/solidParticleSystem.js +4 -1
  127. package/Particles/solidParticleSystem.js.map +1 -1
  128. package/Physics/Plugins/ammoJSPlugin.d.ts +2 -2
  129. package/Physics/Plugins/ammoJSPlugin.js +29 -29
  130. package/Physics/Plugins/ammoJSPlugin.js.map +1 -1
  131. package/Physics/Plugins/cannonJSPlugin.d.ts +2 -2
  132. package/Physics/Plugins/cannonJSPlugin.js +26 -26
  133. package/Physics/Plugins/cannonJSPlugin.js.map +1 -1
  134. package/Physics/Plugins/oimoJSPlugin.js +9 -11
  135. package/Physics/Plugins/oimoJSPlugin.js.map +1 -1
  136. package/Physics/physicsImpostor.d.ts +6 -6
  137. package/Physics/physicsImpostor.js +15 -8
  138. package/Physics/physicsImpostor.js.map +1 -1
  139. package/Shaders/sprites.fragment.js +1 -1
  140. package/Shaders/sprites.fragment.js.map +1 -1
  141. package/Sprites/spriteRenderer.js +1 -1
  142. package/Sprites/spriteRenderer.js.map +1 -1
  143. package/XR/webXRDefaultExperience.d.ts +10 -0
  144. package/XR/webXRDefaultExperience.js +2 -12
  145. package/XR/webXRDefaultExperience.js.map +1 -1
  146. package/XR/webXRExperienceHelper.js +12 -12
  147. package/XR/webXRExperienceHelper.js.map +1 -1
  148. package/node.d.ts +2 -0
  149. package/node.js +2 -0
  150. package/node.js.map +1 -1
  151. package/package.json +1 -1
  152. package/scene.d.ts +1 -1
  153. package/scene.js +5 -3
  154. package/scene.js.map +1 -1
  155. package/DeviceInput/Helpers/eventFactory.js.map +0 -1
  156. package/DeviceInput/InputDevices/inputInterfaces.js.map +0 -1
  157. package/DeviceInput/InputDevices/internalDeviceSourceManager.js.map +0 -1
  158. package/DeviceInput/InputDevices/nativeDeviceInputSystem.js.map +0 -1
  159. package/DeviceInput/InputDevices/webDeviceInputSystem.js.map +0 -1
@@ -25,7 +25,11 @@ var _OcclusionDataStorage = /** @class */ (function () {
25
25
  }());
26
26
  export { _OcclusionDataStorage };
27
27
  Engine.prototype.createQuery = function () {
28
- return this._gl.createQuery();
28
+ var query = this._gl.createQuery();
29
+ if (!query) {
30
+ throw new Error("Unable to create Occlusion Query");
31
+ }
32
+ return query;
29
33
  };
30
34
  Engine.prototype.deleteQuery = function (query) {
31
35
  this._gl.deleteQuery(query);
@@ -1 +1 @@
1
- {"version":3,"file":"engine.query.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/Engines/Extensions/engine.query.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,UAA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Engines/engine\";\r\nimport { AbstractMesh } from \"../../Meshes/abstractMesh\";\r\nimport { _TimeToken } from \"../../Instrumentation/timeToken\";\r\nimport { PerfCounter } from \"../../Misc/perfCounter\";\r\nimport type { Observer } from \"../../Misc/observable\";\r\n\r\n/** @hidden */\r\nexport type OcclusionQuery = WebGLQuery | number;\r\n\r\n/** @hidden */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport class _OcclusionDataStorage {\r\n /** @hidden */\r\n public occlusionInternalRetryCounter = 0;\r\n\r\n /** @hidden */\r\n public isOcclusionQueryInProgress = false;\r\n\r\n /** @hidden */\r\n public isOccluded = false;\r\n\r\n /** @hidden */\r\n public occlusionRetryCount = -1;\r\n\r\n /** @hidden */\r\n public occlusionType = AbstractMesh.OCCLUSION_TYPE_NONE;\r\n\r\n /** @hidden */\r\n public occlusionQueryAlgorithmType = AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE;\r\n\r\n /** @hidden */\r\n public forceRenderingWhenOccluded = false;\r\n}\r\n\r\ndeclare module \"../../Engines/engine\" {\r\n export interface Engine {\r\n /**\r\n * Create a new webGL query (you must be sure that queries are supported by checking getCaps() function)\r\n * @return the new query\r\n */\r\n createQuery(): OcclusionQuery;\r\n\r\n /**\r\n * Delete and release a webGL query\r\n * @param query defines the query to delete\r\n * @return the current engine\r\n */\r\n deleteQuery(query: OcclusionQuery): Engine;\r\n\r\n /**\r\n * Check if a given query has resolved and got its value\r\n * @param query defines the query to check\r\n * @returns true if the query got its value\r\n */\r\n isQueryResultAvailable(query: OcclusionQuery): boolean;\r\n\r\n /**\r\n * Gets the value of a given query\r\n * @param query defines the query to check\r\n * @returns the value of the query\r\n */\r\n getQueryResult(query: OcclusionQuery): number;\r\n\r\n /**\r\n * Initiates an occlusion query\r\n * @param algorithmType defines the algorithm to use\r\n * @param query defines the query to use\r\n * @returns the current engine\r\n * @see https://doc.babylonjs.com/features/occlusionquery\r\n */\r\n beginOcclusionQuery(algorithmType: number, query: OcclusionQuery): boolean;\r\n\r\n /**\r\n * Ends an occlusion query\r\n * @see https://doc.babylonjs.com/features/occlusionquery\r\n * @param algorithmType defines the algorithm to use\r\n * @returns the current engine\r\n */\r\n endOcclusionQuery(algorithmType: number): Engine;\r\n\r\n /**\r\n * Starts a time query (used to measure time spent by the GPU on a specific frame)\r\n * Please note that only one query can be issued at a time\r\n * @returns a time token used to track the time span\r\n */\r\n startTimeQuery(): Nullable<_TimeToken>;\r\n\r\n /**\r\n * Ends a time query\r\n * @param token defines the token used to measure the time span\r\n * @returns the time spent (in ns)\r\n */\r\n endTimeQuery(token: _TimeToken): int;\r\n\r\n /**\r\n * Get the performance counter associated with the frame time computation\r\n * @returns the perf counter\r\n */\r\n getGPUFrameTimeCounter(): PerfCounter;\r\n\r\n /**\r\n * Enable or disable the GPU frame time capture\r\n * @param value True to enable, false to disable\r\n */\r\n captureGPUFrameTime(value: boolean): void;\r\n\r\n /** @hidden */\r\n _currentNonTimestampToken: Nullable<_TimeToken>;\r\n /** @hidden */\r\n _captureGPUFrameTime: boolean;\r\n /** @hidden */\r\n _gpuFrameTimeToken: Nullable<_TimeToken>;\r\n /** @hidden */\r\n _gpuFrameTime: PerfCounter;\r\n /** @hidden */\r\n _onBeginFrameObserver: Nullable<Observer<Engine>>;\r\n /** @hidden */\r\n _onEndFrameObserver: Nullable<Observer<Engine>>;\r\n\r\n /** @hidden */\r\n _createTimeQuery(): WebGLQuery;\r\n\r\n /** @hidden */\r\n _deleteTimeQuery(query: WebGLQuery): void;\r\n\r\n /** @hidden */\r\n _getGlAlgorithmType(algorithmType: number): number;\r\n\r\n /** @hidden */\r\n _getTimeQueryResult(query: WebGLQuery): any;\r\n\r\n /** @hidden */\r\n _getTimeQueryAvailability(query: WebGLQuery): any;\r\n }\r\n}\r\n\r\nEngine.prototype.createQuery = function (): OcclusionQuery {\r\n return this._gl.createQuery();\r\n};\r\n\r\nEngine.prototype.deleteQuery = function (query: OcclusionQuery): Engine {\r\n this._gl.deleteQuery(query);\r\n\r\n return this;\r\n};\r\n\r\nEngine.prototype.isQueryResultAvailable = function (query: OcclusionQuery): boolean {\r\n return this._gl.getQueryParameter(query, this._gl.QUERY_RESULT_AVAILABLE) as boolean;\r\n};\r\n\r\nEngine.prototype.getQueryResult = function (query: OcclusionQuery): number {\r\n return this._gl.getQueryParameter(query, this._gl.QUERY_RESULT) as number;\r\n};\r\n\r\nEngine.prototype.beginOcclusionQuery = function (algorithmType: number, query: OcclusionQuery): boolean {\r\n const glAlgorithm = this._getGlAlgorithmType(algorithmType);\r\n this._gl.beginQuery(glAlgorithm, query);\r\n\r\n return true;\r\n};\r\n\r\nEngine.prototype.endOcclusionQuery = function (algorithmType: number): Engine {\r\n const glAlgorithm = this._getGlAlgorithmType(algorithmType);\r\n this._gl.endQuery(glAlgorithm);\r\n\r\n return this;\r\n};\r\n\r\nEngine.prototype._createTimeQuery = function (): WebGLQuery {\r\n const timerQuery = <EXT_disjoint_timer_query>this.getCaps().timerQuery;\r\n\r\n if (timerQuery.createQueryEXT) {\r\n return timerQuery.createQueryEXT();\r\n }\r\n\r\n return this.createQuery();\r\n};\r\n\r\nEngine.prototype._deleteTimeQuery = function (query: WebGLQuery): void {\r\n const timerQuery = <EXT_disjoint_timer_query>this.getCaps().timerQuery;\r\n\r\n if (timerQuery.deleteQueryEXT) {\r\n timerQuery.deleteQueryEXT(query);\r\n return;\r\n }\r\n\r\n this.deleteQuery(query);\r\n};\r\n\r\nEngine.prototype._getTimeQueryResult = function (query: WebGLQuery): any {\r\n const timerQuery = <EXT_disjoint_timer_query>this.getCaps().timerQuery;\r\n\r\n if (timerQuery.getQueryObjectEXT) {\r\n return timerQuery.getQueryObjectEXT(query, timerQuery.QUERY_RESULT_EXT);\r\n }\r\n return this.getQueryResult(query);\r\n};\r\n\r\nEngine.prototype._getTimeQueryAvailability = function (query: WebGLQuery): any {\r\n const timerQuery = <EXT_disjoint_timer_query>this.getCaps().timerQuery;\r\n\r\n if (timerQuery.getQueryObjectEXT) {\r\n return timerQuery.getQueryObjectEXT(query, timerQuery.QUERY_RESULT_AVAILABLE_EXT);\r\n }\r\n return this.isQueryResultAvailable(query);\r\n};\r\n\r\nEngine.prototype.startTimeQuery = function (): Nullable<_TimeToken> {\r\n const caps = this.getCaps();\r\n const timerQuery = caps.timerQuery;\r\n if (!timerQuery) {\r\n return null;\r\n }\r\n\r\n const token = new _TimeToken();\r\n this._gl.getParameter(timerQuery.GPU_DISJOINT_EXT);\r\n if (caps.canUseTimestampForTimerQuery) {\r\n token._startTimeQuery = this._createTimeQuery();\r\n\r\n timerQuery.queryCounterEXT(token._startTimeQuery, timerQuery.TIMESTAMP_EXT);\r\n } else {\r\n if (this._currentNonTimestampToken) {\r\n return this._currentNonTimestampToken;\r\n }\r\n\r\n token._timeElapsedQuery = this._createTimeQuery();\r\n if (timerQuery.beginQueryEXT) {\r\n timerQuery.beginQueryEXT(timerQuery.TIME_ELAPSED_EXT, token._timeElapsedQuery);\r\n } else {\r\n this._gl.beginQuery(timerQuery.TIME_ELAPSED_EXT, token._timeElapsedQuery);\r\n }\r\n\r\n this._currentNonTimestampToken = token;\r\n }\r\n return token;\r\n};\r\n\r\nEngine.prototype.endTimeQuery = function (token: _TimeToken): int {\r\n const caps = this.getCaps();\r\n const timerQuery = caps.timerQuery;\r\n if (!timerQuery || !token) {\r\n return -1;\r\n }\r\n\r\n if (caps.canUseTimestampForTimerQuery) {\r\n if (!token._startTimeQuery) {\r\n return -1;\r\n }\r\n if (!token._endTimeQuery) {\r\n token._endTimeQuery = this._createTimeQuery();\r\n timerQuery.queryCounterEXT(token._endTimeQuery, timerQuery.TIMESTAMP_EXT);\r\n }\r\n } else if (!token._timeElapsedQueryEnded) {\r\n if (!token._timeElapsedQuery) {\r\n return -1;\r\n }\r\n if (timerQuery.endQueryEXT) {\r\n timerQuery.endQueryEXT(timerQuery.TIME_ELAPSED_EXT);\r\n } else {\r\n this._gl.endQuery(timerQuery.TIME_ELAPSED_EXT);\r\n this._currentNonTimestampToken = null;\r\n }\r\n token._timeElapsedQueryEnded = true;\r\n }\r\n\r\n const disjoint = this._gl.getParameter(timerQuery.GPU_DISJOINT_EXT);\r\n let available: boolean = false;\r\n if (token._endTimeQuery) {\r\n available = this._getTimeQueryAvailability(token._endTimeQuery);\r\n } else if (token._timeElapsedQuery) {\r\n available = this._getTimeQueryAvailability(token._timeElapsedQuery);\r\n }\r\n\r\n if (available && !disjoint) {\r\n let result = 0;\r\n if (caps.canUseTimestampForTimerQuery) {\r\n if (!token._startTimeQuery || !token._endTimeQuery) {\r\n return -1;\r\n }\r\n const timeStart = this._getTimeQueryResult(token._startTimeQuery);\r\n const timeEnd = this._getTimeQueryResult(token._endTimeQuery);\r\n\r\n result = timeEnd - timeStart;\r\n this._deleteTimeQuery(token._startTimeQuery);\r\n this._deleteTimeQuery(token._endTimeQuery);\r\n token._startTimeQuery = null;\r\n token._endTimeQuery = null;\r\n } else {\r\n if (!token._timeElapsedQuery) {\r\n return -1;\r\n }\r\n\r\n result = this._getTimeQueryResult(token._timeElapsedQuery);\r\n this._deleteTimeQuery(token._timeElapsedQuery);\r\n token._timeElapsedQuery = null;\r\n token._timeElapsedQueryEnded = false;\r\n }\r\n return result;\r\n }\r\n\r\n return -1;\r\n};\r\n\r\nEngine.prototype._captureGPUFrameTime = false;\r\nEngine.prototype._gpuFrameTime = new PerfCounter();\r\n\r\nEngine.prototype.getGPUFrameTimeCounter = function () {\r\n return this._gpuFrameTime;\r\n};\r\n\r\nEngine.prototype.captureGPUFrameTime = function (value: boolean) {\r\n if (value === this._captureGPUFrameTime) {\r\n return;\r\n }\r\n\r\n this._captureGPUFrameTime = value;\r\n\r\n if (value) {\r\n this._onBeginFrameObserver = this.onBeginFrameObservable.add(() => {\r\n if (!this._gpuFrameTimeToken) {\r\n this._gpuFrameTimeToken = this.startTimeQuery();\r\n }\r\n });\r\n\r\n this._onEndFrameObserver = this.onEndFrameObservable.add(() => {\r\n if (!this._gpuFrameTimeToken) {\r\n return;\r\n }\r\n const time = this.endTimeQuery(this._gpuFrameTimeToken);\r\n\r\n if (time > -1) {\r\n this._gpuFrameTimeToken = null;\r\n this._gpuFrameTime.fetchNewFrame();\r\n this._gpuFrameTime.addCount(time, true);\r\n }\r\n });\r\n } else {\r\n this.onBeginFrameObservable.remove(this._onBeginFrameObserver);\r\n this._onBeginFrameObserver = null;\r\n this.onEndFrameObservable.remove(this._onEndFrameObserver);\r\n this._onEndFrameObserver = null;\r\n }\r\n};\r\n\r\nEngine.prototype._getGlAlgorithmType = function (algorithmType: number): number {\r\n return algorithmType === AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE ? this._gl.ANY_SAMPLES_PASSED_CONSERVATIVE : this._gl.ANY_SAMPLES_PASSED;\r\n};\r\n\r\ndeclare module \"../../Meshes/abstractMesh\" {\r\n export interface AbstractMesh {\r\n /**\r\n * Backing filed\r\n * @hidden\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n __occlusionDataStorage: _OcclusionDataStorage;\r\n\r\n /**\r\n * Access property\r\n * @hidden\r\n */\r\n _occlusionDataStorage: _OcclusionDataStorage;\r\n\r\n /**\r\n * This number indicates the number of allowed retries before stop the occlusion query, this is useful if the occlusion query is taking long time before to the query result is retrieved, the query result indicates if the object is visible within the scene or not and based on that Babylon.Js engine decides to show or hide the object.\r\n * The default value is -1 which means don't break the query and wait till the result\r\n * @see https://doc.babylonjs.com/features/occlusionquery\r\n */\r\n occlusionRetryCount: number;\r\n\r\n /**\r\n * This property is responsible for starting the occlusion query within the Mesh or not, this property is also used to determine what should happen when the occlusionRetryCount is reached. It has supports 3 values:\r\n * * OCCLUSION_TYPE_NONE (Default Value): this option means no occlusion query within the Mesh.\r\n * * OCCLUSION_TYPE_OPTIMISTIC: this option is means use occlusion query and if occlusionRetryCount is reached and the query is broken show the mesh.\r\n * * OCCLUSION_TYPE_STRICT: this option is means use occlusion query and if occlusionRetryCount is reached and the query is broken restore the last state of the mesh occlusion if the mesh was visible then show the mesh if was hidden then hide don't show.\r\n * @see https://doc.babylonjs.com/features/occlusionquery\r\n */\r\n occlusionType: number;\r\n\r\n /**\r\n * This property determines the type of occlusion query algorithm to run in WebGl, you can use:\r\n * * AbstractMesh.OCCLUSION_ALGORITHM_TYPE_ACCURATE which is mapped to GL_ANY_SAMPLES_PASSED.\r\n * * AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE (Default Value) which is mapped to GL_ANY_SAMPLES_PASSED_CONSERVATIVE which is a false positive algorithm that is faster than GL_ANY_SAMPLES_PASSED but less accurate.\r\n * @see https://doc.babylonjs.com/features/occlusionquery\r\n */\r\n occlusionQueryAlgorithmType: number;\r\n\r\n /**\r\n * Gets or sets whether the mesh is occluded or not, it is used also to set the initial state of the mesh to be occluded or not\r\n * @see https://doc.babylonjs.com/features/occlusionquery\r\n */\r\n isOccluded: boolean;\r\n\r\n /**\r\n * Flag to check the progress status of the query\r\n * @see https://doc.babylonjs.com/features/occlusionquery\r\n */\r\n isOcclusionQueryInProgress: boolean;\r\n\r\n /**\r\n * Flag to force rendering the mesh even if occluded\r\n * @see https://doc.babylonjs.com/features/occlusionquery\r\n */\r\n forceRenderingWhenOccluded: boolean;\r\n }\r\n}\r\nObject.defineProperty(AbstractMesh.prototype, \"isOcclusionQueryInProgress\", {\r\n get: function (this: AbstractMesh) {\r\n return this._occlusionDataStorage.isOcclusionQueryInProgress;\r\n },\r\n set: function (this: AbstractMesh, value: boolean) {\r\n this._occlusionDataStorage.isOcclusionQueryInProgress = value;\r\n },\r\n enumerable: false,\r\n configurable: true,\r\n});\r\n\r\nObject.defineProperty(AbstractMesh.prototype, \"_occlusionDataStorage\", {\r\n get: function (this: AbstractMesh) {\r\n if (!this.__occlusionDataStorage) {\r\n this.__occlusionDataStorage = new _OcclusionDataStorage();\r\n }\r\n return this.__occlusionDataStorage;\r\n },\r\n enumerable: false,\r\n configurable: true,\r\n});\r\n\r\nObject.defineProperty(AbstractMesh.prototype, \"isOccluded\", {\r\n get: function (this: AbstractMesh) {\r\n return this._occlusionDataStorage.isOccluded;\r\n },\r\n set: function (this: AbstractMesh, value: boolean) {\r\n this._occlusionDataStorage.isOccluded = value;\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\nObject.defineProperty(AbstractMesh.prototype, \"occlusionQueryAlgorithmType\", {\r\n get: function (this: AbstractMesh) {\r\n return this._occlusionDataStorage.occlusionQueryAlgorithmType;\r\n },\r\n set: function (this: AbstractMesh, value: number) {\r\n this._occlusionDataStorage.occlusionQueryAlgorithmType = value;\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\nObject.defineProperty(AbstractMesh.prototype, \"occlusionType\", {\r\n get: function (this: AbstractMesh) {\r\n return this._occlusionDataStorage.occlusionType;\r\n },\r\n set: function (this: AbstractMesh, value: number) {\r\n this._occlusionDataStorage.occlusionType = value;\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\nObject.defineProperty(AbstractMesh.prototype, \"occlusionRetryCount\", {\r\n get: function (this: AbstractMesh) {\r\n return this._occlusionDataStorage.occlusionRetryCount;\r\n },\r\n set: function (this: AbstractMesh, value: number) {\r\n this._occlusionDataStorage.occlusionRetryCount = value;\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\nObject.defineProperty(AbstractMesh.prototype, \"forceRenderingWhenOccluded\", {\r\n get: function (this: AbstractMesh) {\r\n return this._occlusionDataStorage.forceRenderingWhenOccluded;\r\n },\r\n set: function (this: AbstractMesh, value: boolean) {\r\n this._occlusionDataStorage.forceRenderingWhenOccluded = value;\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\n// We also need to update AbstractMesh as there is a portion of the code there\r\nAbstractMesh.prototype._checkOcclusionQuery = function () {\r\n const dataStorage = this._occlusionDataStorage;\r\n\r\n if (dataStorage.occlusionType === AbstractMesh.OCCLUSION_TYPE_NONE) {\r\n dataStorage.isOccluded = false;\r\n return false;\r\n }\r\n\r\n const engine = this.getEngine();\r\n\r\n if (!engine.getCaps().supportOcclusionQuery) {\r\n dataStorage.isOccluded = false;\r\n return false;\r\n }\r\n\r\n if (!engine.isQueryResultAvailable) {\r\n // Occlusion query where not referenced\r\n dataStorage.isOccluded = false;\r\n return false;\r\n }\r\n\r\n if (this.isOcclusionQueryInProgress && this._occlusionQuery) {\r\n const isOcclusionQueryAvailable = engine.isQueryResultAvailable(this._occlusionQuery);\r\n if (isOcclusionQueryAvailable) {\r\n const occlusionQueryResult = engine.getQueryResult(this._occlusionQuery);\r\n\r\n dataStorage.isOcclusionQueryInProgress = false;\r\n dataStorage.occlusionInternalRetryCounter = 0;\r\n dataStorage.isOccluded = occlusionQueryResult > 0 ? false : true;\r\n } else {\r\n dataStorage.occlusionInternalRetryCounter++;\r\n\r\n if (dataStorage.occlusionRetryCount !== -1 && dataStorage.occlusionInternalRetryCounter > dataStorage.occlusionRetryCount) {\r\n dataStorage.isOcclusionQueryInProgress = false;\r\n dataStorage.occlusionInternalRetryCounter = 0;\r\n\r\n // if optimistic set isOccluded to false regardless of the status of isOccluded. (Render in the current render loop)\r\n // if strict continue the last state of the object.\r\n dataStorage.isOccluded = dataStorage.occlusionType === AbstractMesh.OCCLUSION_TYPE_OPTIMISTIC ? false : dataStorage.isOccluded;\r\n } else {\r\n return dataStorage.occlusionType === AbstractMesh.OCCLUSION_TYPE_OPTIMISTIC ? false : dataStorage.isOccluded;\r\n }\r\n }\r\n }\r\n\r\n const scene = this.getScene();\r\n if (scene.getBoundingBoxRenderer) {\r\n const occlusionBoundingBoxRenderer = scene.getBoundingBoxRenderer();\r\n\r\n if (this._occlusionQuery === null) {\r\n this._occlusionQuery = engine.createQuery();\r\n }\r\n\r\n if (engine.beginOcclusionQuery(dataStorage.occlusionQueryAlgorithmType, this._occlusionQuery)) {\r\n occlusionBoundingBoxRenderer.renderOcclusionBoundingBox(this);\r\n engine.endOcclusionQuery(dataStorage.occlusionQueryAlgorithmType);\r\n this._occlusionDataStorage.isOcclusionQueryInProgress = true;\r\n }\r\n }\r\n\r\n return dataStorage.isOccluded;\r\n};\r\n"]}
1
+ {"version":3,"file":"engine.query.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/Engines/Extensions/engine.query.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAMrD,cAAc;AACd,gEAAgE;AAChE;IAAA;QACI,cAAc;QACP,kCAA6B,GAAG,CAAC,CAAC;QAEzC,cAAc;QACP,+BAA0B,GAAG,KAAK,CAAC;QAE1C,cAAc;QACP,eAAU,GAAG,KAAK,CAAC;QAE1B,cAAc;QACP,wBAAmB,GAAG,CAAC,CAAC,CAAC;QAEhC,cAAc;QACP,kBAAa,GAAG,YAAY,CAAC,mBAAmB,CAAC;QAExD,cAAc;QACP,gCAA2B,GAAG,YAAY,CAAC,qCAAqC,CAAC;QAExF,cAAc;QACP,+BAA0B,GAAG,KAAK,CAAC;IAC9C,CAAC;IAAD,4BAAC;AAAD,CAAC,AArBD,IAqBC;;AAwGD,MAAM,CAAC,SAAS,CAAC,WAAW,GAAG;IAC3B,IAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;IACrC,IAAI,CAAC,KAAK,EAAE;QACR,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;KACvD;IACD,OAAO,KAAK,CAAC;AACjB,CAAC,CAAC;AAEF,MAAM,CAAC,SAAS,CAAC,WAAW,GAAG,UAAU,KAAqB;IAC1D,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAE5B,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC;AAEF,MAAM,CAAC,SAAS,CAAC,sBAAsB,GAAG,UAAU,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AC/C;QAED,IAAI,MAAM,CAAC,mBAAmB,CAAC,WAAW,CAAC,2BAA2B,EAAE,IAAI,CAAC,eAAe,CAAC,EAAE;YAC3F,4BAA4B,CAAC,0BAA0B,CAAC,IAAI,CAAC,CAAC;YAC9D,MAAM,CAAC,iBAAiB,CAAC,WAAW,CAAC,2BAA2B,CAAC,CAAC;YAClE,IAAI,CAAC,qBAAqB,CAAC,0BAA0B,GAAG,IAAI,CAAC;SAChE;KACJ;IAED,OAAO,WAAW,CAAC,UAAU,CAAC;AAClC,CAAC,CAAC","sourcesContent":["import type { Nullable, int } from \"../../types\";\r\nimport { Engine } from \"../../Engines/engine\";\r\nimport { AbstractMesh } from \"../../Meshes/abstractMesh\";\r\nimport { _TimeToken } from \"../../Instrumentation/timeToken\";\r\nimport { PerfCounter } from \"../../Misc/perfCounter\";\r\nimport type { Observer } from \"../../Misc/observable\";\r\n\r\n/** @hidden */\r\nexport type OcclusionQuery = WebGLQuery | number;\r\n\r\n/** @hidden */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport class _OcclusionDataStorage {\r\n /** @hidden */\r\n public occlusionInternalRetryCounter = 0;\r\n\r\n /** @hidden */\r\n public isOcclusionQueryInProgress = false;\r\n\r\n /** @hidden */\r\n public isOccluded = false;\r\n\r\n /** @hidden */\r\n public occlusionRetryCount = -1;\r\n\r\n /** @hidden */\r\n public occlusionType = AbstractMesh.OCCLUSION_TYPE_NONE;\r\n\r\n /** @hidden */\r\n public occlusionQueryAlgorithmType = AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE;\r\n\r\n /** @hidden */\r\n public forceRenderingWhenOccluded = false;\r\n}\r\n\r\ndeclare module \"../../Engines/engine\" {\r\n export interface Engine {\r\n /**\r\n * Create a new webGL query (you must be sure that queries are supported by checking getCaps() function)\r\n * @return the new query\r\n */\r\n createQuery(): OcclusionQuery;\r\n\r\n /**\r\n * Delete and release a webGL query\r\n * @param query defines the query to delete\r\n * @return the current engine\r\n */\r\n deleteQuery(query: OcclusionQuery): Engine;\r\n\r\n /**\r\n * Check if a given query has resolved and got its value\r\n * @param query defines the query to check\r\n * @returns true if the query got its value\r\n */\r\n isQueryResultAvailable(query: OcclusionQuery): boolean;\r\n\r\n /**\r\n * Gets the value of a given query\r\n * @param query defines the query to check\r\n * @returns the value of the query\r\n */\r\n getQueryResult(query: OcclusionQuery): number;\r\n\r\n /**\r\n * Initiates an occlusion query\r\n * @param algorithmType defines the algorithm to use\r\n * @param query defines the query to use\r\n * @returns the current engine\r\n * @see https://doc.babylonjs.com/features/occlusionquery\r\n */\r\n beginOcclusionQuery(algorithmType: number, query: OcclusionQuery): boolean;\r\n\r\n /**\r\n * Ends an occlusion query\r\n * @see https://doc.babylonjs.com/features/occlusionquery\r\n * @param algorithmType defines the algorithm to use\r\n * @returns the current engine\r\n */\r\n endOcclusionQuery(algorithmType: number): Engine;\r\n\r\n /**\r\n * Starts a time query (used to measure time spent by the GPU on a specific frame)\r\n * Please note that only one query can be issued at a time\r\n * @returns a time token used to track the time span\r\n */\r\n startTimeQuery(): Nullable<_TimeToken>;\r\n\r\n /**\r\n * Ends a time query\r\n * @param token defines the token used to measure the time span\r\n * @returns the time spent (in ns)\r\n */\r\n endTimeQuery(token: _TimeToken): int;\r\n\r\n /**\r\n * Get the performance counter associated with the frame time computation\r\n * @returns the perf counter\r\n */\r\n getGPUFrameTimeCounter(): PerfCounter;\r\n\r\n /**\r\n * Enable or disable the GPU frame time capture\r\n * @param value True to enable, false to disable\r\n */\r\n captureGPUFrameTime(value: boolean): void;\r\n\r\n /** @hidden */\r\n _currentNonTimestampToken: Nullable<_TimeToken>;\r\n /** @hidden */\r\n _captureGPUFrameTime: boolean;\r\n /** @hidden */\r\n _gpuFrameTimeToken: Nullable<_TimeToken>;\r\n /** @hidden */\r\n _gpuFrameTime: PerfCounter;\r\n /** @hidden */\r\n _onBeginFrameObserver: Nullable<Observer<Engine>>;\r\n /** @hidden */\r\n _onEndFrameObserver: Nullable<Observer<Engine>>;\r\n\r\n /** @hidden */\r\n _createTimeQuery(): WebGLQuery;\r\n\r\n /** @hidden */\r\n _deleteTimeQuery(query: WebGLQuery): void;\r\n\r\n /** @hidden */\r\n _getGlAlgorithmType(algorithmType: number): number;\r\n\r\n /** @hidden */\r\n _getTimeQueryResult(query: WebGLQuery): any;\r\n\r\n /** @hidden */\r\n _getTimeQueryAvailability(query: WebGLQuery): any;\r\n }\r\n}\r\n\r\nEngine.prototype.createQuery = function (): OcclusionQuery {\r\n const query = this._gl.createQuery();\r\n if (!query) {\r\n throw new Error(\"Unable to create Occlusion Query\");\r\n }\r\n return query;\r\n};\r\n\r\nEngine.prototype.deleteQuery = function (query: OcclusionQuery): Engine {\r\n this._gl.deleteQuery(query);\r\n\r\n return this;\r\n};\r\n\r\nEngine.prototype.isQueryResultAvailable = function (query: OcclusionQuery): boolean {\r\n return this._gl.getQueryParameter(query, this._gl.QUERY_RESULT_AVAILABLE) as boolean;\r\n};\r\n\r\nEngine.prototype.getQueryResult = function (query: OcclusionQuery): number {\r\n return this._gl.getQueryParameter(query, this._gl.QUERY_RESULT) as number;\r\n};\r\n\r\nEngine.prototype.beginOcclusionQuery = function (algorithmType: number, query: OcclusionQuery): boolean {\r\n const glAlgorithm = this._getGlAlgorithmType(algorithmType);\r\n this._gl.beginQuery(glAlgorithm, query);\r\n\r\n return true;\r\n};\r\n\r\nEngine.prototype.endOcclusionQuery = function (algorithmType: number): Engine {\r\n const glAlgorithm = this._getGlAlgorithmType(algorithmType);\r\n this._gl.endQuery(glAlgorithm);\r\n\r\n return this;\r\n};\r\n\r\nEngine.prototype._createTimeQuery = function (): WebGLQuery {\r\n const timerQuery = <EXT_disjoint_timer_query>this.getCaps().timerQuery;\r\n\r\n if (timerQuery.createQueryEXT) {\r\n return timerQuery.createQueryEXT();\r\n }\r\n\r\n return this.createQuery();\r\n};\r\n\r\nEngine.prototype._deleteTimeQuery = function (query: WebGLQuery): void {\r\n const timerQuery = <EXT_disjoint_timer_query>this.getCaps().timerQuery;\r\n\r\n if (timerQuery.deleteQueryEXT) {\r\n timerQuery.deleteQueryEXT(query);\r\n return;\r\n }\r\n\r\n this.deleteQuery(query);\r\n};\r\n\r\nEngine.prototype._getTimeQueryResult = function (query: WebGLQuery): any {\r\n const timerQuery = <EXT_disjoint_timer_query>this.getCaps().timerQuery;\r\n\r\n if (timerQuery.getQueryObjectEXT) {\r\n return timerQuery.getQueryObjectEXT(query, timerQuery.QUERY_RESULT_EXT);\r\n }\r\n return this.getQueryResult(query);\r\n};\r\n\r\nEngine.prototype._getTimeQueryAvailability = function (query: WebGLQuery): any {\r\n const timerQuery = <EXT_disjoint_timer_query>this.getCaps().timerQuery;\r\n\r\n if (timerQuery.getQueryObjectEXT) {\r\n return timerQuery.getQueryObjectEXT(query, timerQuery.QUERY_RESULT_AVAILABLE_EXT);\r\n }\r\n return this.isQueryResultAvailable(query);\r\n};\r\n\r\nEngine.prototype.startTimeQuery = function (): Nullable<_TimeToken> {\r\n const caps = this.getCaps();\r\n const timerQuery = caps.timerQuery;\r\n if (!timerQuery) {\r\n return null;\r\n }\r\n\r\n const token = new _TimeToken();\r\n this._gl.getParameter(timerQuery.GPU_DISJOINT_EXT);\r\n if (caps.canUseTimestampForTimerQuery) {\r\n token._startTimeQuery = this._createTimeQuery();\r\n\r\n timerQuery.queryCounterEXT(token._startTimeQuery, timerQuery.TIMESTAMP_EXT);\r\n } else {\r\n if (this._currentNonTimestampToken) {\r\n return this._currentNonTimestampToken;\r\n }\r\n\r\n token._timeElapsedQuery = this._createTimeQuery();\r\n if (timerQuery.beginQueryEXT) {\r\n timerQuery.beginQueryEXT(timerQuery.TIME_ELAPSED_EXT, token._timeElapsedQuery);\r\n } else {\r\n this._gl.beginQuery(timerQuery.TIME_ELAPSED_EXT, token._timeElapsedQuery);\r\n }\r\n\r\n this._currentNonTimestampToken = token;\r\n }\r\n return token;\r\n};\r\n\r\nEngine.prototype.endTimeQuery = function (token: _TimeToken): int {\r\n const caps = this.getCaps();\r\n const timerQuery = caps.timerQuery;\r\n if (!timerQuery || !token) {\r\n return -1;\r\n }\r\n\r\n if (caps.canUseTimestampForTimerQuery) {\r\n if (!token._startTimeQuery) {\r\n return -1;\r\n }\r\n if (!token._endTimeQuery) {\r\n token._endTimeQuery = this._createTimeQuery();\r\n timerQuery.queryCounterEXT(token._endTimeQuery, timerQuery.TIMESTAMP_EXT);\r\n }\r\n } else if (!token._timeElapsedQueryEnded) {\r\n if (!token._timeElapsedQuery) {\r\n return -1;\r\n }\r\n if (timerQuery.endQueryEXT) {\r\n timerQuery.endQueryEXT(timerQuery.TIME_ELAPSED_EXT);\r\n } else {\r\n this._gl.endQuery(timerQuery.TIME_ELAPSED_EXT);\r\n this._currentNonTimestampToken = null;\r\n }\r\n token._timeElapsedQueryEnded = true;\r\n }\r\n\r\n const disjoint = this._gl.getParameter(timerQuery.GPU_DISJOINT_EXT);\r\n let available: boolean = false;\r\n if (token._endTimeQuery) {\r\n available = this._getTimeQueryAvailability(token._endTimeQuery);\r\n } else if (token._timeElapsedQuery) {\r\n available = this._getTimeQueryAvailability(token._timeElapsedQuery);\r\n }\r\n\r\n if (available && !disjoint) {\r\n let result = 0;\r\n if (caps.canUseTimestampForTimerQuery) {\r\n if (!token._startTimeQuery || !token._endTimeQuery) {\r\n return -1;\r\n }\r\n const timeStart = this._getTimeQueryResult(token._startTimeQuery);\r\n const timeEnd = this._getTimeQueryResult(token._endTimeQuery);\r\n\r\n result = timeEnd - timeStart;\r\n this._deleteTimeQuery(token._startTimeQuery);\r\n this._deleteTimeQuery(token._endTimeQuery);\r\n token._startTimeQuery = null;\r\n token._endTimeQuery = null;\r\n } else {\r\n if (!token._timeElapsedQuery) {\r\n return -1;\r\n }\r\n\r\n result = this._getTimeQueryResult(token._timeElapsedQuery);\r\n this._deleteTimeQuery(token._timeElapsedQuery);\r\n token._timeElapsedQuery = null;\r\n token._timeElapsedQueryEnded = false;\r\n }\r\n return result;\r\n }\r\n\r\n return -1;\r\n};\r\n\r\nEngine.prototype._captureGPUFrameTime = false;\r\nEngine.prototype._gpuFrameTime = new PerfCounter();\r\n\r\nEngine.prototype.getGPUFrameTimeCounter = function () {\r\n return this._gpuFrameTime;\r\n};\r\n\r\nEngine.prototype.captureGPUFrameTime = function (value: boolean) {\r\n if (value === this._captureGPUFrameTime) {\r\n return;\r\n }\r\n\r\n this._captureGPUFrameTime = value;\r\n\r\n if (value) {\r\n this._onBeginFrameObserver = this.onBeginFrameObservable.add(() => {\r\n if (!this._gpuFrameTimeToken) {\r\n this._gpuFrameTimeToken = this.startTimeQuery();\r\n }\r\n });\r\n\r\n this._onEndFrameObserver = this.onEndFrameObservable.add(() => {\r\n if (!this._gpuFrameTimeToken) {\r\n return;\r\n }\r\n const time = this.endTimeQuery(this._gpuFrameTimeToken);\r\n\r\n if (time > -1) {\r\n this._gpuFrameTimeToken = null;\r\n this._gpuFrameTime.fetchNewFrame();\r\n this._gpuFrameTime.addCount(time, true);\r\n }\r\n });\r\n } else {\r\n this.onBeginFrameObservable.remove(this._onBeginFrameObserver);\r\n this._onBeginFrameObserver = null;\r\n this.onEndFrameObservable.remove(this._onEndFrameObserver);\r\n this._onEndFrameObserver = null;\r\n }\r\n};\r\n\r\nEngine.prototype._getGlAlgorithmType = function (algorithmType: number): number {\r\n return algorithmType === AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE ? this._gl.ANY_SAMPLES_PASSED_CONSERVATIVE : this._gl.ANY_SAMPLES_PASSED;\r\n};\r\n\r\ndeclare module \"../../Meshes/abstractMesh\" {\r\n export interface AbstractMesh {\r\n /**\r\n * Backing filed\r\n * @hidden\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n __occlusionDataStorage: _OcclusionDataStorage;\r\n\r\n /**\r\n * Access property\r\n * @hidden\r\n */\r\n _occlusionDataStorage: _OcclusionDataStorage;\r\n\r\n /**\r\n * This number indicates the number of allowed retries before stop the occlusion query, this is useful if the occlusion query is taking long time before to the query result is retrieved, the query result indicates if the object is visible within the scene or not and based on that Babylon.Js engine decides to show or hide the object.\r\n * The default value is -1 which means don't break the query and wait till the result\r\n * @see https://doc.babylonjs.com/features/occlusionquery\r\n */\r\n occlusionRetryCount: number;\r\n\r\n /**\r\n * This property is responsible for starting the occlusion query within the Mesh or not, this property is also used to determine what should happen when the occlusionRetryCount is reached. It has supports 3 values:\r\n * * OCCLUSION_TYPE_NONE (Default Value): this option means no occlusion query within the Mesh.\r\n * * OCCLUSION_TYPE_OPTIMISTIC: this option is means use occlusion query and if occlusionRetryCount is reached and the query is broken show the mesh.\r\n * * OCCLUSION_TYPE_STRICT: this option is means use occlusion query and if occlusionRetryCount is reached and the query is broken restore the last state of the mesh occlusion if the mesh was visible then show the mesh if was hidden then hide don't show.\r\n * @see https://doc.babylonjs.com/features/occlusionquery\r\n */\r\n occlusionType: number;\r\n\r\n /**\r\n * This property determines the type of occlusion query algorithm to run in WebGl, you can use:\r\n * * AbstractMesh.OCCLUSION_ALGORITHM_TYPE_ACCURATE which is mapped to GL_ANY_SAMPLES_PASSED.\r\n * * AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE (Default Value) which is mapped to GL_ANY_SAMPLES_PASSED_CONSERVATIVE which is a false positive algorithm that is faster than GL_ANY_SAMPLES_PASSED but less accurate.\r\n * @see https://doc.babylonjs.com/features/occlusionquery\r\n */\r\n occlusionQueryAlgorithmType: number;\r\n\r\n /**\r\n * Gets or sets whether the mesh is occluded or not, it is used also to set the initial state of the mesh to be occluded or not\r\n * @see https://doc.babylonjs.com/features/occlusionquery\r\n */\r\n isOccluded: boolean;\r\n\r\n /**\r\n * Flag to check the progress status of the query\r\n * @see https://doc.babylonjs.com/features/occlusionquery\r\n */\r\n isOcclusionQueryInProgress: boolean;\r\n\r\n /**\r\n * Flag to force rendering the mesh even if occluded\r\n * @see https://doc.babylonjs.com/features/occlusionquery\r\n */\r\n forceRenderingWhenOccluded: boolean;\r\n }\r\n}\r\nObject.defineProperty(AbstractMesh.prototype, \"isOcclusionQueryInProgress\", {\r\n get: function (this: AbstractMesh) {\r\n return this._occlusionDataStorage.isOcclusionQueryInProgress;\r\n },\r\n set: function (this: AbstractMesh, value: boolean) {\r\n this._occlusionDataStorage.isOcclusionQueryInProgress = value;\r\n },\r\n enumerable: false,\r\n configurable: true,\r\n});\r\n\r\nObject.defineProperty(AbstractMesh.prototype, \"_occlusionDataStorage\", {\r\n get: function (this: AbstractMesh) {\r\n if (!this.__occlusionDataStorage) {\r\n this.__occlusionDataStorage = new _OcclusionDataStorage();\r\n }\r\n return this.__occlusionDataStorage;\r\n },\r\n enumerable: false,\r\n configurable: true,\r\n});\r\n\r\nObject.defineProperty(AbstractMesh.prototype, \"isOccluded\", {\r\n get: function (this: AbstractMesh) {\r\n return this._occlusionDataStorage.isOccluded;\r\n },\r\n set: function (this: AbstractMesh, value: boolean) {\r\n this._occlusionDataStorage.isOccluded = value;\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\nObject.defineProperty(AbstractMesh.prototype, \"occlusionQueryAlgorithmType\", {\r\n get: function (this: AbstractMesh) {\r\n return this._occlusionDataStorage.occlusionQueryAlgorithmType;\r\n },\r\n set: function (this: AbstractMesh, value: number) {\r\n this._occlusionDataStorage.occlusionQueryAlgorithmType = value;\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\nObject.defineProperty(AbstractMesh.prototype, \"occlusionType\", {\r\n get: function (this: AbstractMesh) {\r\n return this._occlusionDataStorage.occlusionType;\r\n },\r\n set: function (this: AbstractMesh, value: number) {\r\n this._occlusionDataStorage.occlusionType = value;\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\nObject.defineProperty(AbstractMesh.prototype, \"occlusionRetryCount\", {\r\n get: function (this: AbstractMesh) {\r\n return this._occlusionDataStorage.occlusionRetryCount;\r\n },\r\n set: function (this: AbstractMesh, value: number) {\r\n this._occlusionDataStorage.occlusionRetryCount = value;\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\nObject.defineProperty(AbstractMesh.prototype, \"forceRenderingWhenOccluded\", {\r\n get: function (this: AbstractMesh) {\r\n return this._occlusionDataStorage.forceRenderingWhenOccluded;\r\n },\r\n set: function (this: AbstractMesh, value: boolean) {\r\n this._occlusionDataStorage.forceRenderingWhenOccluded = value;\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\n// We also need to update AbstractMesh as there is a portion of the code there\r\nAbstractMesh.prototype._checkOcclusionQuery = function () {\r\n const dataStorage = this._occlusionDataStorage;\r\n\r\n if (dataStorage.occlusionType === AbstractMesh.OCCLUSION_TYPE_NONE) {\r\n dataStorage.isOccluded = false;\r\n return false;\r\n }\r\n\r\n const engine = this.getEngine();\r\n\r\n if (!engine.getCaps().supportOcclusionQuery) {\r\n dataStorage.isOccluded = false;\r\n return false;\r\n }\r\n\r\n if (!engine.isQueryResultAvailable) {\r\n // Occlusion query where not referenced\r\n dataStorage.isOccluded = false;\r\n return false;\r\n }\r\n\r\n if (this.isOcclusionQueryInProgress && this._occlusionQuery) {\r\n const isOcclusionQueryAvailable = engine.isQueryResultAvailable(this._occlusionQuery);\r\n if (isOcclusionQueryAvailable) {\r\n const occlusionQueryResult = engine.getQueryResult(this._occlusionQuery);\r\n\r\n dataStorage.isOcclusionQueryInProgress = false;\r\n dataStorage.occlusionInternalRetryCounter = 0;\r\n dataStorage.isOccluded = occlusionQueryResult > 0 ? false : true;\r\n } else {\r\n dataStorage.occlusionInternalRetryCounter++;\r\n\r\n if (dataStorage.occlusionRetryCount !== -1 && dataStorage.occlusionInternalRetryCounter > dataStorage.occlusionRetryCount) {\r\n dataStorage.isOcclusionQueryInProgress = false;\r\n dataStorage.occlusionInternalRetryCounter = 0;\r\n\r\n // if optimistic set isOccluded to false regardless of the status of isOccluded. (Render in the current render loop)\r\n // if strict continue the last state of the object.\r\n dataStorage.isOccluded = dataStorage.occlusionType === AbstractMesh.OCCLUSION_TYPE_OPTIMISTIC ? false : dataStorage.isOccluded;\r\n } else {\r\n return dataStorage.occlusionType === AbstractMesh.OCCLUSION_TYPE_OPTIMISTIC ? false : dataStorage.isOccluded;\r\n }\r\n }\r\n }\r\n\r\n const scene = this.getScene();\r\n if (scene.getBoundingBoxRenderer) {\r\n const occlusionBoundingBoxRenderer = scene.getBoundingBoxRenderer();\r\n\r\n if (this._occlusionQuery === null) {\r\n this._occlusionQuery = engine.createQuery();\r\n }\r\n\r\n if (engine.beginOcclusionQuery(dataStorage.occlusionQueryAlgorithmType, this._occlusionQuery)) {\r\n occlusionBoundingBoxRenderer.renderOcclusionBoundingBox(this);\r\n engine.endOcclusionQuery(dataStorage.occlusionQueryAlgorithmType);\r\n this._occlusionDataStorage.isOcclusionQueryInProgress = true;\r\n }\r\n }\r\n\r\n return dataStorage.isOccluded;\r\n};\r\n"]}
@@ -3,7 +3,11 @@ import { Engine } from "../../Engines/engine.js";
3
3
  // eslint-disable-next-line no-var
4
4
  export var _forceTransformFeedbackToBundle = true;
5
5
  Engine.prototype.createTransformFeedback = function () {
6
- return this._gl.createTransformFeedback();
6
+ var transformFeedback = this._gl.createTransformFeedback();
7
+ if (!transformFeedback) {
8
+ throw new Error("Unable to create Transform Feedback");
9
+ }
10
+ return transformFeedback;
7
11
  };
8
12
  Engine.prototype.deleteTransformFeedback = function (value) {
9
13
  this._gl.deleteTransformFeedback(value);
@@ -1 +1 @@
1
- {"version":3,"file":"engine.transformFeedback.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/Engines/Extensions/engine.transformFeedback.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAG9C,cAAc;AACd,kCAAkC;AAClC,MAAM,CAAC,IAAI,+BAA+B,GAAG,IAAI,CAAC;AAiDlD,MAAM,CAAC,SAAS,CAAC,uBAAuB,GAAG;IACvC,OAAO,IAAI,CAAC,GAAG,CAAC,uBAAuB,EAAE,CAAC;AAC9C,CAAC,CAAC;AAEF,MAAM,CAAC,SAAS,CAAC,uBAAuB,GAAG,UAAU,KAA6B;IAC9E,IAAI,CAAC,GAAG,CAAC,uBAAuB,CAAC,KAAK,CAAC,CAAC;AAC5C,CAAC,CAAC;AAEF,MAAM,CAAC,SAAS,CAAC,qBAAqB,GAAG,UAAU,KAAuC;IACtF,IAAI,CAAC,GAAG,CAAC,qBAAqB,CAAC,IAAI,CAAC,GAAG,CAAC,kBAAkB,EAAE,KAAK,CAAC,CAAC;AACvE,CAAC,CAAC;AAEF,MAAM,CAAC,SAAS,CAAC,sBAAsB,GAAG,UAAU,SAAyB;IAAzB,0BAAA,EAAA,gBAAyB;IACzE,IAAI,CAAC,GAAG,CAAC,sBAAsB,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;AACtF,CAAC,CAAC;AAEF,MAAM,CAAC,SAAS,CAAC,oBAAoB,GAAG;IACpC,IAAI,CAAC,GAAG,CAAC,oBAAoB,EAAE,CAAC;AACpC,CAAC,CAAC;AAEF,MAAM,CAAC,SAAS,CAAC,2BAA2B,GAAG,UAAU,OAAqB,EAAE,KAAe;IAC3F,IAAI,CAAC,GAAG,CAAC,yBAAyB,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;AACrF,CAAC,CAAC;AAEF,MAAM,CAAC,SAAS,CAAC,2BAA2B,GAAG,UAAU,KAA2B;IAChF,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,yBAAyB,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AAC5G,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"../../types\";\r\nimport { Engine } from \"../../Engines/engine\";\r\nimport type { DataBuffer } from \"../../Buffers/dataBuffer\";\r\n\r\n/** @hidden */\r\n// eslint-disable-next-line no-var\r\nexport var _forceTransformFeedbackToBundle = true;\r\n\r\ndeclare module \"../../Engines/engine\" {\r\n export interface Engine {\r\n /**\r\n * Creates a webGL transform feedback object\r\n * Please makes sure to check webGLVersion property to check if you are running webGL 2+\r\n * @returns the webGL transform feedback object\r\n */\r\n createTransformFeedback(): WebGLTransformFeedback;\r\n\r\n /**\r\n * Delete a webGL transform feedback object\r\n * @param value defines the webGL transform feedback object to delete\r\n */\r\n deleteTransformFeedback(value: WebGLTransformFeedback): void;\r\n\r\n /**\r\n * Bind a webGL transform feedback object to the webgl context\r\n * @param value defines the webGL transform feedback object to bind\r\n */\r\n bindTransformFeedback(value: Nullable<WebGLTransformFeedback>): void;\r\n\r\n /**\r\n * Begins a transform feedback operation\r\n * @param usePoints defines if points or triangles must be used\r\n */\r\n beginTransformFeedback(usePoints: boolean): void;\r\n\r\n /**\r\n * Ends a transform feedback operation\r\n */\r\n endTransformFeedback(): void;\r\n\r\n /**\r\n * Specify the varyings to use with transform feedback\r\n * @param program defines the associated webGL program\r\n * @param value defines the list of strings representing the varying names\r\n */\r\n setTranformFeedbackVaryings(program: WebGLProgram, value: string[]): void;\r\n\r\n /**\r\n * Bind a webGL buffer for a transform feedback operation\r\n * @param value defines the webGL buffer to bind\r\n */\r\n bindTransformFeedbackBuffer(value: Nullable<DataBuffer>): void;\r\n }\r\n}\r\n\r\nEngine.prototype.createTransformFeedback = function (): WebGLTransformFeedback {\r\n return this._gl.createTransformFeedback();\r\n};\r\n\r\nEngine.prototype.deleteTransformFeedback = function (value: WebGLTransformFeedback): void {\r\n this._gl.deleteTransformFeedback(value);\r\n};\r\n\r\nEngine.prototype.bindTransformFeedback = function (value: Nullable<WebGLTransformFeedback>): void {\r\n this._gl.bindTransformFeedback(this._gl.TRANSFORM_FEEDBACK, value);\r\n};\r\n\r\nEngine.prototype.beginTransformFeedback = function (usePoints: boolean = true): void {\r\n this._gl.beginTransformFeedback(usePoints ? this._gl.POINTS : this._gl.TRIANGLES);\r\n};\r\n\r\nEngine.prototype.endTransformFeedback = function (): void {\r\n this._gl.endTransformFeedback();\r\n};\r\n\r\nEngine.prototype.setTranformFeedbackVaryings = function (program: WebGLProgram, value: string[]): void {\r\n this._gl.transformFeedbackVaryings(program, value, this._gl.INTERLEAVED_ATTRIBS);\r\n};\r\n\r\nEngine.prototype.bindTransformFeedbackBuffer = function (value: Nullable<DataBuffer>): void {\r\n this._gl.bindBufferBase(this._gl.TRANSFORM_FEEDBACK_BUFFER, 0, value ? value.underlyingResource : null);\r\n};\r\n"]}
1
+ {"version":3,"file":"engine.transformFeedback.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/Engines/Extensions/engine.transformFeedback.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAG9C,cAAc;AACd,kCAAkC;AAClC,MAAM,CAAC,IAAI,+BAA+B,GAAG,IAAI,CAAC;AAiDlD,MAAM,CAAC,SAAS,CAAC,uBAAuB,GAAG;IACvC,IAAM,iBAAiB,GAAG,IAAI,CAAC,GAAG,CAAC,uBAAuB,EAAE,CAAC;IAC7D,IAAI,CAAC,iBAAiB,EAAE;QACpB,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;KAC1D;IACD,OAAO,iBAAiB,CAAC;AAC7B,CAAC,CAAC;AAEF,MAAM,CAAC,SAAS,CAAC,uBAAuB,GAAG,UAAU,KAA6B;IAC9E,IAAI,CAAC,GAAG,CAAC,uBAAuB,CAAC,KAAK,CAAC,CAAC;AAC5C,CAAC,CAAC;AAEF,MAAM,CAAC,SAAS,CAAC,qBAAqB,GAAG,UAAU,KAAuC;IACtF,IAAI,CAAC,GAAG,CAAC,qBAAqB,CAAC,IAAI,CAAC,GAAG,CAAC,kBAAkB,EAAE,KAAK,CAAC,CAAC;AACvE,CAAC,CAAC;AAEF,MAAM,CAAC,SAAS,CAAC,sBAAsB,GAAG,UAAU,SAAyB;IAAzB,0BAAA,EAAA,gBAAyB;IACzE,IAAI,CAAC,GAAG,CAAC,sBAAsB,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;AACtF,CAAC,CAAC;AAEF,MAAM,CAAC,SAAS,CAAC,oBAAoB,GAAG;IACpC,IAAI,CAAC,GAAG,CAAC,oBAAoB,EAAE,CAAC;AACpC,CAAC,CAAC;AAEF,MAAM,CAAC,SAAS,CAAC,2BAA2B,GAAG,UAAU,OAAqB,EAAE,KAAe;IAC3F,IAAI,CAAC,GAAG,CAAC,yBAAyB,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;AACrF,CAAC,CAAC;AAEF,MAAM,CAAC,SAAS,CAAC,2BAA2B,GAAG,UAAU,KAA2B;IAChF,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,yBAAyB,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AAC5G,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"../../types\";\r\nimport { Engine } from \"../../Engines/engine\";\r\nimport type { DataBuffer } from \"../../Buffers/dataBuffer\";\r\n\r\n/** @hidden */\r\n// eslint-disable-next-line no-var\r\nexport var _forceTransformFeedbackToBundle = true;\r\n\r\ndeclare module \"../../Engines/engine\" {\r\n export interface Engine {\r\n /**\r\n * Creates a webGL transform feedback object\r\n * Please makes sure to check webGLVersion property to check if you are running webGL 2+\r\n * @returns the webGL transform feedback object\r\n */\r\n createTransformFeedback(): WebGLTransformFeedback;\r\n\r\n /**\r\n * Delete a webGL transform feedback object\r\n * @param value defines the webGL transform feedback object to delete\r\n */\r\n deleteTransformFeedback(value: WebGLTransformFeedback): void;\r\n\r\n /**\r\n * Bind a webGL transform feedback object to the webgl context\r\n * @param value defines the webGL transform feedback object to bind\r\n */\r\n bindTransformFeedback(value: Nullable<WebGLTransformFeedback>): void;\r\n\r\n /**\r\n * Begins a transform feedback operation\r\n * @param usePoints defines if points or triangles must be used\r\n */\r\n beginTransformFeedback(usePoints: boolean): void;\r\n\r\n /**\r\n * Ends a transform feedback operation\r\n */\r\n endTransformFeedback(): void;\r\n\r\n /**\r\n * Specify the varyings to use with transform feedback\r\n * @param program defines the associated webGL program\r\n * @param value defines the list of strings representing the varying names\r\n */\r\n setTranformFeedbackVaryings(program: WebGLProgram, value: string[]): void;\r\n\r\n /**\r\n * Bind a webGL buffer for a transform feedback operation\r\n * @param value defines the webGL buffer to bind\r\n */\r\n bindTransformFeedbackBuffer(value: Nullable<DataBuffer>): void;\r\n }\r\n}\r\n\r\nEngine.prototype.createTransformFeedback = function (): WebGLTransformFeedback {\r\n const transformFeedback = this._gl.createTransformFeedback();\r\n if (!transformFeedback) {\r\n throw new Error(\"Unable to create Transform Feedback\");\r\n }\r\n return transformFeedback;\r\n};\r\n\r\nEngine.prototype.deleteTransformFeedback = function (value: WebGLTransformFeedback): void {\r\n this._gl.deleteTransformFeedback(value);\r\n};\r\n\r\nEngine.prototype.bindTransformFeedback = function (value: Nullable<WebGLTransformFeedback>): void {\r\n this._gl.bindTransformFeedback(this._gl.TRANSFORM_FEEDBACK, value);\r\n};\r\n\r\nEngine.prototype.beginTransformFeedback = function (usePoints: boolean = true): void {\r\n this._gl.beginTransformFeedback(usePoints ? this._gl.POINTS : this._gl.TRIANGLES);\r\n};\r\n\r\nEngine.prototype.endTransformFeedback = function (): void {\r\n this._gl.endTransformFeedback();\r\n};\r\n\r\nEngine.prototype.setTranformFeedbackVaryings = function (program: WebGLProgram, value: string[]): void {\r\n this._gl.transformFeedbackVaryings(program, value, this._gl.INTERLEAVED_ATTRIBS);\r\n};\r\n\r\nEngine.prototype.bindTransformFeedbackBuffer = function (value: Nullable<DataBuffer>): void {\r\n this._gl.bindBufferBase(this._gl.TRANSFORM_FEEDBACK_BUFFER, 0, value ? value.underlyingResource : null);\r\n};\r\n"]}
@@ -1,10 +1,15 @@
1
1
  import type { Camera } from "../../Cameras/camera";
2
2
  import type { Nullable } from "../../types";
3
+ import { Observable } from "../../Misc/observable";
3
4
  /**
4
5
  * Class used to define an additional view for the engine
5
6
  * @see https://doc.babylonjs.com/divingDeeper/scene/multiCanvas
6
7
  */
7
8
  export declare class EngineView {
9
+ /**
10
+ * A randomly generated unique id
11
+ */
12
+ readonly id: string;
8
13
  /** Defines the canvas where to render the view */
9
14
  target: HTMLCanvasElement;
10
15
  /** Defines an optional camera used to render the view (will use active camera else) */
@@ -29,6 +34,14 @@ declare module "../../Engines/engine" {
29
34
  * @hidden
30
35
  */
31
36
  _onEngineViewChanged?: () => void;
37
+ /**
38
+ * Will be triggered before the view renders
39
+ */
40
+ readonly onBeforeViewRenderObservable: Observable<EngineView>;
41
+ /**
42
+ * Will be triggered after the view rendered
43
+ */
44
+ readonly onAfterViewRenderObservable: Observable<EngineView>;
32
45
  /**
33
46
  * Gets the current engine view
34
47
  * @see https://doc.babylonjs.com/how_to/multi_canvases
@@ -1,4 +1,5 @@
1
1
  import { Engine } from "../engine.js";
2
+ import { Observable } from "../../Misc/observable.js";
2
3
  /**
3
4
  * Class used to define an additional view for the engine
4
5
  * @see https://doc.babylonjs.com/divingDeeper/scene/multiCanvas
@@ -9,6 +10,18 @@ var EngineView = /** @class */ (function () {
9
10
  return EngineView;
10
11
  }());
11
12
  export { EngineView };
13
+ var _onBeforeViewRenderObservable = new Observable();
14
+ var _onAfterViewRenderObservable = new Observable();
15
+ Object.defineProperty(Engine.prototype, "onBeforeViewRenderObservable", {
16
+ get: function () {
17
+ return _onBeforeViewRenderObservable;
18
+ },
19
+ });
20
+ Object.defineProperty(Engine.prototype, "onAfterViewRenderObservable", {
21
+ get: function () {
22
+ return _onAfterViewRenderObservable;
23
+ },
24
+ });
12
25
  Object.defineProperty(Engine.prototype, "inputElement", {
13
26
  get: function () {
14
27
  return this._inputElement;
@@ -40,7 +53,7 @@ Engine.prototype.registerView = function (canvas, camera, clearBeforeCopy) {
40
53
  canvas.width = masterCanvas.width;
41
54
  canvas.height = masterCanvas.height;
42
55
  }
43
- var newView = { target: canvas, camera: camera, clearBeforeCopy: clearBeforeCopy, enabled: true };
56
+ var newView = { target: canvas, camera: camera, clearBeforeCopy: clearBeforeCopy, enabled: true, id: (Math.random() * 100000).toFixed() };
44
57
  this.views.push(newView);
45
58
  if (camera) {
46
59
  camera.onDisposeObservable.add(function () {
@@ -83,6 +96,7 @@ Engine.prototype._renderViews = function () {
83
96
  if (!context_1) {
84
97
  continue;
85
98
  }
99
+ _onBeforeViewRenderObservable.notifyObservers(view);
86
100
  var camera = view.camera;
87
101
  var previewCamera = null;
88
102
  var scene = null;
@@ -124,6 +138,7 @@ Engine.prototype._renderViews = function () {
124
138
  if (previewCamera && scene) {
125
139
  scene.activeCamera = previewCamera;
126
140
  }
141
+ _onAfterViewRenderObservable.notifyObservers(view);
127
142
  }
128
143
  this.activeView = null;
129
144
  return true;
@@ -1 +1 @@
1
- {"version":3,"file":"engine.views.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/Engines/Extensions/engine.views.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAKnC;;;GAGG;AACH;IAAA;IAWA,CAAC;IAAD,iBAAC;AAAD,CAAC,AAXD,IAWC;;AA6CD,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,SAAS,EAAE,cAAc,EAAE;IACpD,GAAG,EAAE;QACD,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;IACD,GAAG,EAAE,UAAwB,KAAkB;;QAC3C,IAAI,IAAI,CAAC,aAAa,KAAK,KAAK,EAAE;YAC9B,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;YAC3B,MAAA,IAAI,CAAC,oBAAoB,oDAAI,CAAC;SACjC;IACL,CAAC;CACJ,CAA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SAAO,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAEhC,UAAU;QACV,IAAI,aAAa,IAAI,KAAK,EAAE;YACxB,KAAK,CAAC,YAAY,GAAG,aAAa,CAAC;SACtC;KACJ;IAED,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;IAEvB,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC","sourcesContent":["import { Engine } from \"../engine\";\r\nimport type { Camera } from \"../../Cameras/camera\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Scene } from \"../../scene\";\r\n\r\n/**\r\n * Class used to define an additional view for the engine\r\n * @see https://doc.babylonjs.com/divingDeeper/scene/multiCanvas\r\n */\r\nexport class EngineView {\r\n /** Defines the canvas where to render the view */\r\n target: HTMLCanvasElement;\r\n /** Defines an optional camera used to render the view (will use active camera else) */\r\n camera?: Camera;\r\n /** Indicates if the destination view canvas should be cleared before copying the parent canvas. Can help if the scene clear color has alpha < 1 */\r\n clearBeforeCopy?: boolean;\r\n /** Indicates if the view is enabled (true by default) */\r\n enabled: boolean;\r\n /** Defines a custom function to handle canvas size changes. (the canvas to render into is provided to the callback) */\r\n customResize?: (canvas: HTMLCanvasElement) => void;\r\n}\r\n\r\ndeclare module \"../../Engines/engine\" {\r\n export interface Engine {\r\n /** @hidden */\r\n _inputElement: Nullable<HTMLElement>;\r\n\r\n /**\r\n * Gets or sets the HTML element to use for attaching events\r\n */\r\n inputElement: Nullable<HTMLElement>;\r\n\r\n /**\r\n * Observable to handle when a change to inputElement occurs\r\n * @hidden\r\n */\r\n _onEngineViewChanged?: () => void;\r\n\r\n /**\r\n * Gets the current engine view\r\n * @see https://doc.babylonjs.com/how_to/multi_canvases\r\n */\r\n activeView: Nullable<EngineView>;\r\n\r\n /** Gets or sets the list of views */\r\n views: EngineView[];\r\n\r\n /**\r\n * Register a new child canvas\r\n * @param canvas defines the canvas to register\r\n * @param camera defines an optional camera to use with this canvas (it will overwrite the scene.camera for this view)\r\n * @param clearBeforeCopy Indicates if the destination view canvas should be cleared before copying the parent canvas. Can help if the scene clear color has alpha < 1\r\n * @returns the associated view\r\n */\r\n registerView(canvas: HTMLCanvasElement, camera?: Camera, clearBeforeCopy?: boolean): EngineView;\r\n\r\n /**\r\n * Remove a registered child canvas\r\n * @param canvas defines the canvas to remove\r\n * @returns the current engine\r\n */\r\n unRegisterView(canvas: HTMLCanvasElement): Engine;\r\n }\r\n}\r\n\r\nObject.defineProperty(Engine.prototype, \"inputElement\", {\r\n get: function (this: Engine) {\r\n return this._inputElement;\r\n },\r\n set: function (this: Engine, value: HTMLElement) {\r\n if (this._inputElement !== value) {\r\n this._inputElement = value;\r\n this._onEngineViewChanged?.();\r\n }\r\n },\r\n});\r\n\r\nEngine.prototype.getInputElement = function (): Nullable<HTMLElement> {\r\n return this.inputElement || this.getRenderingCanvas();\r\n};\r\n\r\nEngine.prototype.registerView = function (canvas: HTMLCanvasElement, camera?: Camera, clearBeforeCopy?: boolean): EngineView {\r\n if (!this.views) {\r\n this.views = [];\r\n }\r\n\r\n for (const view of this.views) {\r\n if (view.target === canvas) {\r\n return view;\r\n }\r\n }\r\n\r\n const masterCanvas = this.getRenderingCanvas();\r\n if (masterCanvas) {\r\n canvas.width = masterCanvas.width;\r\n canvas.height = masterCanvas.height;\r\n }\r\n\r\n const newView = { target: canvas, camera, clearBeforeCopy, enabled: true };\r\n this.views.push(newView);\r\n\r\n if (camera) {\r\n camera.onDisposeObservable.add(() => {\r\n this.unRegisterView(canvas);\r\n });\r\n }\r\n\r\n return newView;\r\n};\r\n\r\nEngine.prototype.unRegisterView = function (canvas: HTMLCanvasElement): Engine {\r\n if (!this.views) {\r\n return this;\r\n }\r\n\r\n for (const view of this.views) {\r\n if (view.target === canvas) {\r\n const index = this.views.indexOf(view);\r\n\r\n if (index !== -1) {\r\n this.views.splice(index, 1);\r\n }\r\n break;\r\n }\r\n }\r\n\r\n return this;\r\n};\r\n\r\nEngine.prototype._renderViews = function () {\r\n if (!this.views) {\r\n return false;\r\n }\r\n\r\n const parent = this.getRenderingCanvas();\r\n\r\n if (!parent) {\r\n return false;\r\n }\r\n\r\n for (const view of this.views) {\r\n if (!view.enabled) {\r\n continue;\r\n }\r\n const canvas = view.target;\r\n const context = canvas.getContext(\"2d\");\r\n if (!context) {\r\n continue;\r\n }\r\n const camera = view.camera;\r\n let previewCamera: Nullable<Camera> = null;\r\n let scene: Nullable<Scene> = null;\r\n if (camera) {\r\n scene = camera.getScene();\r\n\r\n if (scene.activeCameras && scene.activeCameras.length) {\r\n continue;\r\n }\r\n\r\n this.activeView = view;\r\n\r\n previewCamera = scene.activeCamera;\r\n scene.activeCamera = camera;\r\n }\r\n\r\n if (view.customResize) {\r\n view.customResize(canvas);\r\n } else {\r\n // Set sizes\r\n const width = Math.floor(canvas.clientWidth / this._hardwareScalingLevel);\r\n const height = Math.floor(canvas.clientHeight / this._hardwareScalingLevel);\r\n\r\n const dimsChanged = width !== canvas.width || parent.width !== canvas.width || height !== canvas.height || parent.height !== canvas.height;\r\n if (canvas.clientWidth && canvas.clientHeight && dimsChanged) {\r\n canvas.width = width;\r\n canvas.height = height;\r\n this.setSize(width, height);\r\n }\r\n }\r\n\r\n if (!parent.width || !parent.height) {\r\n return false;\r\n }\r\n\r\n // Render the frame\r\n this._renderFrame();\r\n\r\n this.flushFramebuffer();\r\n\r\n // Copy to target\r\n if (view.clearBeforeCopy) {\r\n context.clearRect(0, 0, parent.width, parent.height);\r\n }\r\n context.drawImage(parent, 0, 0);\r\n\r\n // Restore\r\n if (previewCamera && scene) {\r\n scene.activeCamera = previewCamera;\r\n }\r\n }\r\n\r\n this.activeView = null;\r\n\r\n return true;\r\n};\r\n"]}
1
+ {"version":3,"file":"engine.views.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/Engines/Extensions/engine.views.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAInC,OAAO,EAAE,UAAU,EAAE,MAAM,uBA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C,CAAC","sourcesContent":["import { Engine } from \"../engine\";\r\nimport type { Camera } from \"../../Cameras/camera\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { Observable } from \"../../Misc/observable\";\r\n\r\n/**\r\n * Class used to define an additional view for the engine\r\n * @see https://doc.babylonjs.com/divingDeeper/scene/multiCanvas\r\n */\r\nexport class EngineView {\r\n /**\r\n * A randomly generated unique id\r\n */\r\n readonly id: string;\r\n /** Defines the canvas where to render the view */\r\n target: HTMLCanvasElement;\r\n /** Defines an optional camera used to render the view (will use active camera else) */\r\n camera?: Camera;\r\n /** Indicates if the destination view canvas should be cleared before copying the parent canvas. Can help if the scene clear color has alpha < 1 */\r\n clearBeforeCopy?: boolean;\r\n /** Indicates if the view is enabled (true by default) */\r\n enabled: boolean;\r\n /** Defines a custom function to handle canvas size changes. (the canvas to render into is provided to the callback) */\r\n customResize?: (canvas: HTMLCanvasElement) => void;\r\n}\r\n\r\ndeclare module \"../../Engines/engine\" {\r\n export interface Engine {\r\n /** @hidden */\r\n _inputElement: Nullable<HTMLElement>;\r\n\r\n /**\r\n * Gets or sets the HTML element to use for attaching events\r\n */\r\n inputElement: Nullable<HTMLElement>;\r\n\r\n /**\r\n * Observable to handle when a change to inputElement occurs\r\n * @hidden\r\n */\r\n _onEngineViewChanged?: () => void;\r\n\r\n /**\r\n * Will be triggered before the view renders\r\n */\r\n readonly onBeforeViewRenderObservable: Observable<EngineView>;\r\n /**\r\n * Will be triggered after the view rendered\r\n */\r\n readonly onAfterViewRenderObservable: Observable<EngineView>;\r\n\r\n /**\r\n * Gets the current engine view\r\n * @see https://doc.babylonjs.com/how_to/multi_canvases\r\n */\r\n activeView: Nullable<EngineView>;\r\n\r\n /** Gets or sets the list of views */\r\n views: EngineView[];\r\n\r\n /**\r\n * Register a new child canvas\r\n * @param canvas defines the canvas to register\r\n * @param camera defines an optional camera to use with this canvas (it will overwrite the scene.camera for this view)\r\n * @param clearBeforeCopy Indicates if the destination view canvas should be cleared before copying the parent canvas. Can help if the scene clear color has alpha < 1\r\n * @returns the associated view\r\n */\r\n registerView(canvas: HTMLCanvasElement, camera?: Camera, clearBeforeCopy?: boolean): EngineView;\r\n\r\n /**\r\n * Remove a registered child canvas\r\n * @param canvas defines the canvas to remove\r\n * @returns the current engine\r\n */\r\n unRegisterView(canvas: HTMLCanvasElement): Engine;\r\n }\r\n}\r\n\r\nconst _onBeforeViewRenderObservable = new Observable<EngineView>();\r\nconst _onAfterViewRenderObservable = new Observable<EngineView>();\r\n\r\nObject.defineProperty(Engine.prototype, \"onBeforeViewRenderObservable\", {\r\n get: function (this: Engine) {\r\n return _onBeforeViewRenderObservable;\r\n },\r\n});\r\n\r\nObject.defineProperty(Engine.prototype, \"onAfterViewRenderObservable\", {\r\n get: function (this: Engine) {\r\n return _onAfterViewRenderObservable;\r\n },\r\n});\r\n\r\nObject.defineProperty(Engine.prototype, \"inputElement\", {\r\n get: function (this: Engine) {\r\n return this._inputElement;\r\n },\r\n set: function (this: Engine, value: HTMLElement) {\r\n if (this._inputElement !== value) {\r\n this._inputElement = value;\r\n this._onEngineViewChanged?.();\r\n }\r\n },\r\n});\r\n\r\nEngine.prototype.getInputElement = function (): Nullable<HTMLElement> {\r\n return this.inputElement || this.getRenderingCanvas();\r\n};\r\n\r\nEngine.prototype.registerView = function (canvas: HTMLCanvasElement, camera?: Camera, clearBeforeCopy?: boolean): EngineView {\r\n if (!this.views) {\r\n this.views = [];\r\n }\r\n\r\n for (const view of this.views) {\r\n if (view.target === canvas) {\r\n return view;\r\n }\r\n }\r\n\r\n const masterCanvas = this.getRenderingCanvas();\r\n if (masterCanvas) {\r\n canvas.width = masterCanvas.width;\r\n canvas.height = masterCanvas.height;\r\n }\r\n\r\n const newView = { target: canvas, camera, clearBeforeCopy, enabled: true, id: (Math.random() * 100000).toFixed() };\r\n this.views.push(newView);\r\n\r\n if (camera) {\r\n camera.onDisposeObservable.add(() => {\r\n this.unRegisterView(canvas);\r\n });\r\n }\r\n\r\n return newView;\r\n};\r\n\r\nEngine.prototype.unRegisterView = function (canvas: HTMLCanvasElement): Engine {\r\n if (!this.views) {\r\n return this;\r\n }\r\n\r\n for (const view of this.views) {\r\n if (view.target === canvas) {\r\n const index = this.views.indexOf(view);\r\n\r\n if (index !== -1) {\r\n this.views.splice(index, 1);\r\n }\r\n break;\r\n }\r\n }\r\n\r\n return this;\r\n};\r\n\r\nEngine.prototype._renderViews = function () {\r\n if (!this.views) {\r\n return false;\r\n }\r\n\r\n const parent = this.getRenderingCanvas();\r\n\r\n if (!parent) {\r\n return false;\r\n }\r\n\r\n for (const view of this.views) {\r\n if (!view.enabled) {\r\n continue;\r\n }\r\n const canvas = view.target;\r\n const context = canvas.getContext(\"2d\");\r\n if (!context) {\r\n continue;\r\n }\r\n _onBeforeViewRenderObservable.notifyObservers(view);\r\n const camera = view.camera;\r\n let previewCamera: Nullable<Camera> = null;\r\n let scene: Nullable<Scene> = null;\r\n if (camera) {\r\n scene = camera.getScene();\r\n\r\n if (scene.activeCameras && scene.activeCameras.length) {\r\n continue;\r\n }\r\n\r\n this.activeView = view;\r\n\r\n previewCamera = scene.activeCamera;\r\n scene.activeCamera = camera;\r\n }\r\n\r\n if (view.customResize) {\r\n view.customResize(canvas);\r\n } else {\r\n // Set sizes\r\n const width = Math.floor(canvas.clientWidth / this._hardwareScalingLevel);\r\n const height = Math.floor(canvas.clientHeight / this._hardwareScalingLevel);\r\n\r\n const dimsChanged = width !== canvas.width || parent.width !== canvas.width || height !== canvas.height || parent.height !== canvas.height;\r\n if (canvas.clientWidth && canvas.clientHeight && dimsChanged) {\r\n canvas.width = width;\r\n canvas.height = height;\r\n this.setSize(width, height);\r\n }\r\n }\r\n\r\n if (!parent.width || !parent.height) {\r\n return false;\r\n }\r\n\r\n // Render the frame\r\n this._renderFrame();\r\n\r\n this.flushFramebuffer();\r\n\r\n // Copy to target\r\n if (view.clearBeforeCopy) {\r\n context.clearRect(0, 0, parent.width, parent.height);\r\n }\r\n context.drawImage(parent, 0, 0);\r\n\r\n // Restore\r\n if (previewCamera && scene) {\r\n scene.activeCamera = previewCamera;\r\n }\r\n _onAfterViewRenderObservable.notifyObservers(view);\r\n }\r\n\r\n this.activeView = null;\r\n\r\n return true;\r\n};\r\n"]}
@@ -1,5 +1,5 @@
1
1
  import type { DeviceType } from "../../DeviceInput/InputDevices/deviceEnums";
2
- import type { IDeviceInputSystem } from "../../DeviceInput/InputDevices/inputInterfaces";
2
+ import type { IDeviceInputSystem } from "../../DeviceInput/inputInterfaces";
3
3
  import type { InternalTexture } from "../../Materials/Textures/internalTexture";
4
4
  import type { Nullable } from "../../types";
5
5
  import type { ICanvas, IImage } from "../ICanvas";
@@ -1 +1 @@
1
- {"version":3,"file":"nativeInterfaces.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/Engines/Native/nativeInterfaces.ts"],"names":[],"mappings":"","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { DeviceType } from \"../../DeviceInput/InputDevices/deviceEnums\";\r\nimport type { IDeviceInputSystem } from \"../../DeviceInput/InputDevices/inputInterfaces\";\r\nimport type { InternalTexture } from \"../../Materials/Textures/internalTexture\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { ICanvas, IImage } from \"../ICanvas\";\r\nimport type { NativeData, NativeDataStream } from \"./nativeDataStream\";\r\n\r\n/** @hidden */\r\nexport interface INativeEngine {\r\n dispose(): void;\r\n\r\n requestAnimationFrame(callback: () => void): void;\r\n\r\n createVertexArray(): NativeData;\r\n\r\n createIndexBuffer(bytes: ArrayBuffer, byteOffset: number, byteLength: number, is32Bits: boolean, dynamic: boolean): NativeData;\r\n recordIndexBuffer(vertexArray: NativeData, indexBuffer: NativeData): void;\r\n updateDynamicIndexBuffer(buffer: NativeData, bytes: ArrayBuffer, byteOffset: number, byteLength: number, startIndex: number): void;\r\n\r\n createVertexBuffer(bytes: ArrayBuffer, byteOffset: number, byteLength: number, dynamic: boolean): NativeData;\r\n recordVertexBuffer(\r\n vertexArray: NativeData,\r\n vertexBuffer: NativeData,\r\n location: number,\r\n byteOffset: number,\r\n byteStride: number,\r\n numElements: number,\r\n type: number,\r\n normalized: boolean,\r\n instanceDivisor: number\r\n ): void;\r\n updateDynamicVertexBuffer(vertexBuffer: NativeData, bytes: ArrayBuffer, byteOffset: number, byteLength: number): void;\r\n\r\n createProgram(vertexShader: string, fragmentShader: string): any;\r\n getUniforms(shaderProgram: any, uniformsNames: string[]): WebGLUniformLocation[];\r\n getAttributes(shaderProgram: any, attributeNames: string[]): number[];\r\n\r\n createTexture(): WebGLTexture;\r\n loadTexture(texture: WebGLTexture, data: ArrayBufferView, generateMips: boolean, invertY: boolean, srgb: boolean, onSuccess: () => void, onError: () => void): void;\r\n loadRawTexture(texture: WebGLTexture, data: ArrayBufferView, width: number, height: number, format: number, generateMips: boolean, invertY: boolean): void;\r\n loadRawTexture2DArray(\r\n texture: WebGLTexture,\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n depth: number,\r\n format: number,\r\n generateMipMaps: boolean,\r\n invertY: boolean\r\n ): void;\r\n loadCubeTexture(texture: WebGLTexture, data: Array<ArrayBufferView>, generateMips: boolean, invertY: boolean, srgb: boolean, onSuccess: () => void, onError: () => void): void;\r\n loadCubeTextureWithMips(texture: WebGLTexture, data: Array<Array<ArrayBufferView>>, invertY: boolean, srgb: boolean, onSuccess: () => void, onError: () => void): void;\r\n getTextureWidth(texture: WebGLTexture): number;\r\n getTextureHeight(texture: WebGLTexture): number;\r\n copyTexture(desination: Nullable<WebGLTexture>, source: Nullable<WebGLTexture>): void;\r\n deleteTexture(texture: Nullable<WebGLTexture>): void;\r\n readTexture(\r\n texture: WebGLTexture,\r\n mipLevel: number,\r\n x: number,\r\n y: number,\r\n width: number,\r\n height: number,\r\n buffer: Nullable<ArrayBuffer>,\r\n bufferOffset: number,\r\n bufferLength: number\r\n ): Promise<ArrayBuffer>;\r\n\r\n createImageBitmap(data: ArrayBufferView | IImage): ImageBitmap;\r\n resizeImageBitmap(image: ImageBitmap, bufferWidth: number, bufferHeight: number): Uint8Array;\r\n\r\n createFrameBuffer(\r\n texture: WebGLTexture,\r\n width: number,\r\n height: number,\r\n format: number,\r\n generateStencilBuffer: boolean,\r\n generateDepthBuffer: boolean,\r\n generateMips: boolean\r\n ): WebGLFramebuffer;\r\n\r\n getRenderWidth(): number;\r\n getRenderHeight(): number;\r\n getHardwareScalingLevel(): number;\r\n setHardwareScalingLevel(level: number): void;\r\n\r\n setViewPort(x: number, y: number, width: number, height: number): void;\r\n\r\n setCommandDataStream(dataStream: NativeDataStream): void;\r\n submitCommands(): void;\r\n}\r\n\r\n/** @hidden */\r\ninterface INativeEngineConstructor {\r\n prototype: INativeEngine;\r\n new (): INativeEngine;\r\n\r\n readonly PROTOCOL_VERSION: number;\r\n\r\n readonly CAPS_LIMITS_MAX_TEXTURE_SIZE: number;\r\n readonly CAPS_LIMITS_MAX_TEXTURE_LAYERS: number;\r\n\r\n readonly TEXTURE_NEAREST_NEAREST: number;\r\n readonly TEXTURE_LINEAR_LINEAR: number;\r\n readonly TEXTURE_LINEAR_LINEAR_MIPLINEAR: number;\r\n readonly TEXTURE_NEAREST_NEAREST_MIPNEAREST: number;\r\n readonly TEXTURE_NEAREST_LINEAR_MIPNEAREST: number;\r\n readonly TEXTURE_NEAREST_LINEAR_MIPLINEAR: number;\r\n readonly TEXTURE_NEAREST_LINEAR: number;\r\n readonly TEXTURE_NEAREST_NEAREST_MIPLINEAR: number;\r\n readonly TEXTURE_LINEAR_NEAREST_MIPNEAREST: number;\r\n readonly TEXTURE_LINEAR_NEAREST_MIPLINEAR: number;\r\n readonly TEXTURE_LINEAR_LINEAR_MIPNEAREST: number;\r\n readonly TEXTURE_LINEAR_NEAREST: number;\r\n\r\n readonly DEPTH_TEST_LESS: number;\r\n readonly DEPTH_TEST_LEQUAL: number;\r\n readonly DEPTH_TEST_EQUAL: number;\r\n readonly DEPTH_TEST_GEQUAL: number;\r\n readonly DEPTH_TEST_GREATER: number;\r\n readonly DEPTH_TEST_NOTEQUAL: number;\r\n readonly DEPTH_TEST_NEVER: number;\r\n readonly DEPTH_TEST_ALWAYS: number;\r\n\r\n readonly ADDRESS_MODE_WRAP: number;\r\n readonly ADDRESS_MODE_MIRROR: number;\r\n readonly ADDRESS_MODE_CLAMP: number;\r\n readonly ADDRESS_MODE_BORDER: number;\r\n readonly ADDRESS_MODE_MIRROR_ONCE: number;\r\n\r\n readonly TEXTURE_FORMAT_RGB8: number;\r\n readonly TEXTURE_FORMAT_RGBA8: number;\r\n readonly TEXTURE_FORMAT_RGBA32F: number;\r\n\r\n readonly ATTRIB_TYPE_INT8: number;\r\n readonly ATTRIB_TYPE_UINT8: number;\r\n readonly ATTRIB_TYPE_INT16: number;\r\n readonly ATTRIB_TYPE_UINT16: number;\r\n readonly ATTRIB_TYPE_FLOAT: number;\r\n\r\n readonly ALPHA_DISABLE: number;\r\n readonly ALPHA_ADD: number;\r\n readonly ALPHA_COMBINE: number;\r\n readonly ALPHA_SUBTRACT: number;\r\n readonly ALPHA_MULTIPLY: number;\r\n readonly ALPHA_MAXIMIZED: number;\r\n readonly ALPHA_ONEONE: number;\r\n readonly ALPHA_PREMULTIPLIED: number;\r\n readonly ALPHA_PREMULTIPLIED_PORTERDUFF: number;\r\n readonly ALPHA_INTERPOLATE: number;\r\n readonly ALPHA_SCREENMODE: number;\r\n\r\n readonly STENCIL_TEST_LESS: number;\r\n readonly STENCIL_TEST_LEQUAL: number;\r\n readonly STENCIL_TEST_EQUAL: number;\r\n readonly STENCIL_TEST_GEQUAL: number;\r\n readonly STENCIL_TEST_GREATER: number;\r\n readonly STENCIL_TEST_NOTEQUAL: number;\r\n readonly STENCIL_TEST_NEVER: number;\r\n readonly STENCIL_TEST_ALWAYS: number;\r\n\r\n readonly STENCIL_OP_FAIL_S_ZERO: number;\r\n readonly STENCIL_OP_FAIL_S_KEEP: number;\r\n readonly STENCIL_OP_FAIL_S_REPLACE: number;\r\n readonly STENCIL_OP_FAIL_S_INCR: number;\r\n readonly STENCIL_OP_FAIL_S_INCRSAT: number;\r\n readonly STENCIL_OP_FAIL_S_DECR: number;\r\n readonly STENCIL_OP_FAIL_S_DECRSAT: number;\r\n readonly STENCIL_OP_FAIL_S_INVERT: number;\r\n\r\n readonly STENCIL_OP_FAIL_Z_ZERO: number;\r\n readonly STENCIL_OP_FAIL_Z_KEEP: number;\r\n readonly STENCIL_OP_FAIL_Z_REPLACE: number;\r\n readonly STENCIL_OP_FAIL_Z_INCR: number;\r\n readonly STENCIL_OP_FAIL_Z_INCRSAT: number;\r\n readonly STENCIL_OP_FAIL_Z_DECR: number;\r\n readonly STENCIL_OP_FAIL_Z_DECRSAT: number;\r\n readonly STENCIL_OP_FAIL_Z_INVERT: number;\r\n\r\n readonly STENCIL_OP_PASS_Z_ZERO: number;\r\n readonly STENCIL_OP_PASS_Z_KEEP: number;\r\n readonly STENCIL_OP_PASS_Z_REPLACE: number;\r\n readonly STENCIL_OP_PASS_Z_INCR: number;\r\n readonly STENCIL_OP_PASS_Z_INCRSAT: number;\r\n readonly STENCIL_OP_PASS_Z_DECR: number;\r\n readonly STENCIL_OP_PASS_Z_DECRSAT: number;\r\n readonly STENCIL_OP_PASS_Z_INVERT: number;\r\n\r\n readonly COMMAND_DELETEVERTEXARRAY: NativeData;\r\n readonly COMMAND_DELETEINDEXBUFFER: NativeData;\r\n readonly COMMAND_DELETEVERTEXBUFFER: NativeData;\r\n readonly COMMAND_SETPROGRAM: NativeData;\r\n readonly COMMAND_SETMATRIX: NativeData;\r\n readonly COMMAND_SETMATRIX3X3: NativeData;\r\n readonly COMMAND_SETMATRIX2X2: NativeData;\r\n readonly COMMAND_SETMATRICES: NativeData;\r\n readonly COMMAND_SETINT: NativeData;\r\n readonly COMMAND_SETINTARRAY: NativeData;\r\n readonly COMMAND_SETINTARRAY2: NativeData;\r\n readonly COMMAND_SETINTARRAY3: NativeData;\r\n readonly COMMAND_SETINTARRAY4: NativeData;\r\n readonly COMMAND_SETFLOATARRAY: NativeData;\r\n readonly COMMAND_SETFLOATARRAY2: NativeData;\r\n readonly COMMAND_SETFLOATARRAY3: NativeData;\r\n readonly COMMAND_SETFLOATARRAY4: NativeData;\r\n readonly COMMAND_SETTEXTURESAMPLING: NativeData;\r\n readonly COMMAND_SETTEXTUREWRAPMODE: NativeData;\r\n readonly COMMAND_SETTEXTUREANISOTROPICLEVEL: NativeData;\r\n readonly COMMAND_SETTEXTURE: NativeData;\r\n readonly COMMAND_BINDVERTEXARRAY: NativeData;\r\n readonly COMMAND_SETSTATE: NativeData;\r\n readonly COMMAND_DELETEPROGRAM: NativeData;\r\n readonly COMMAND_SETZOFFSET: NativeData;\r\n readonly COMMAND_SETZOFFSETUNITS: NativeData;\r\n readonly COMMAND_SETDEPTHTEST: NativeData;\r\n readonly COMMAND_SETDEPTHWRITE: NativeData;\r\n readonly COMMAND_SETCOLORWRITE: NativeData;\r\n readonly COMMAND_SETBLENDMODE: NativeData;\r\n readonly COMMAND_SETFLOAT: NativeData;\r\n readonly COMMAND_SETFLOAT2: NativeData;\r\n readonly COMMAND_SETFLOAT3: NativeData;\r\n readonly COMMAND_SETFLOAT4: NativeData;\r\n readonly COMMAND_BINDFRAMEBUFFER: NativeData;\r\n readonly COMMAND_UNBINDFRAMEBUFFER: NativeData;\r\n readonly COMMAND_DELETEFRAMEBUFFER: NativeData;\r\n readonly COMMAND_DRAWINDEXED: NativeData;\r\n readonly COMMAND_DRAW: NativeData;\r\n readonly COMMAND_CLEAR: NativeData;\r\n readonly COMMAND_SETSTENCIL: NativeData;\r\n}\r\n\r\n/** @hidden */\r\nexport interface INativeCamera {\r\n createVideo(constraints: MediaTrackConstraints): any;\r\n updateVideoTexture(texture: Nullable<InternalTexture>, video: HTMLVideoElement, invertY: boolean): void;\r\n}\r\n\r\n/** @hidden */\r\ninterface INativeCameraConstructor {\r\n prototype: INativeCamera;\r\n new (): INativeCamera;\r\n}\r\n\r\n/** @hidden */\r\ninterface INativeCanvasConstructor {\r\n prototype: ICanvas;\r\n new (): ICanvas;\r\n\r\n loadTTFAsync(fontName: string, buffer: ArrayBuffer): void;\r\n}\r\n\r\n/** @hidden */\r\ninterface INativeImageConstructor {\r\n prototype: IImage;\r\n new (): IImage;\r\n}\r\n\r\n/** @hidden */\r\ninterface IDeviceInputSystemConstructor {\r\n prototype: IDeviceInputSystem;\r\n new (\r\n onDeviceConnected: (deviceType: DeviceType, deviceSlot: number) => void,\r\n onDeviceDisconnected: (deviceType: DeviceType, deviceSlot: number) => void,\r\n onInputChanged: (deviceType: DeviceType, deviceSlot: number, inputIndex: number, currentState: number) => void\r\n ): IDeviceInputSystem;\r\n}\r\n\r\n/** @hidden */\r\nexport interface INativeDataStream {\r\n writeBuffer(buffer: ArrayBuffer, length: number): void;\r\n}\r\n\r\n/** @hidden */\r\ninterface INativeDataStreamConstructor {\r\n prototype: INativeDataStream;\r\n new (requestFlushCallback: () => void): INativeDataStream;\r\n\r\n readonly VALIDATION_ENABLED: boolean;\r\n readonly VALIDATION_UINT_32: number;\r\n readonly VALIDATION_INT_32: number;\r\n readonly VALIDATION_FLOAT_32: number;\r\n readonly VALIDATION_UINT_32_ARRAY: number;\r\n readonly VALIDATION_INT_32_ARRAY: number;\r\n readonly VALIDATION_FLOAT_32_ARRAY: number;\r\n readonly VALIDATION_NATIVE_DATA: number;\r\n readonly VALIDATION_BOOLEAN: number;\r\n}\r\n\r\n/** @hidden */\r\nexport interface INative {\r\n Engine: INativeEngineConstructor;\r\n Camera: INativeCameraConstructor;\r\n Canvas: INativeCanvasConstructor;\r\n Image: INativeImageConstructor;\r\n XMLHttpRequest: any; // TODO: how to do this?\r\n DeviceInputSystem: IDeviceInputSystemConstructor;\r\n NativeDataStream: INativeDataStreamConstructor;\r\n}\r\n"]}
1
+ {"version":3,"file":"nativeInterfaces.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/Engines/Native/nativeInterfaces.ts"],"names":[],"mappings":"","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { DeviceType } from \"../../DeviceInput/InputDevices/deviceEnums\";\r\nimport type { IDeviceInputSystem } from \"../../DeviceInput/inputInterfaces\";\r\nimport type { InternalTexture } from \"../../Materials/Textures/internalTexture\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { ICanvas, IImage } from \"../ICanvas\";\r\nimport type { NativeData, NativeDataStream } from \"./nativeDataStream\";\r\n\r\n/** @hidden */\r\nexport interface INativeEngine {\r\n dispose(): void;\r\n\r\n requestAnimationFrame(callback: () => void): void;\r\n\r\n createVertexArray(): NativeData;\r\n\r\n createIndexBuffer(bytes: ArrayBuffer, byteOffset: number, byteLength: number, is32Bits: boolean, dynamic: boolean): NativeData;\r\n recordIndexBuffer(vertexArray: NativeData, indexBuffer: NativeData): void;\r\n updateDynamicIndexBuffer(buffer: NativeData, bytes: ArrayBuffer, byteOffset: number, byteLength: number, startIndex: number): void;\r\n\r\n createVertexBuffer(bytes: ArrayBuffer, byteOffset: number, byteLength: number, dynamic: boolean): NativeData;\r\n recordVertexBuffer(\r\n vertexArray: NativeData,\r\n vertexBuffer: NativeData,\r\n location: number,\r\n byteOffset: number,\r\n byteStride: number,\r\n numElements: number,\r\n type: number,\r\n normalized: boolean,\r\n instanceDivisor: number\r\n ): void;\r\n updateDynamicVertexBuffer(vertexBuffer: NativeData, bytes: ArrayBuffer, byteOffset: number, byteLength: number): void;\r\n\r\n createProgram(vertexShader: string, fragmentShader: string): any;\r\n getUniforms(shaderProgram: any, uniformsNames: string[]): WebGLUniformLocation[];\r\n getAttributes(shaderProgram: any, attributeNames: string[]): number[];\r\n\r\n createTexture(): WebGLTexture;\r\n loadTexture(texture: WebGLTexture, data: ArrayBufferView, generateMips: boolean, invertY: boolean, srgb: boolean, onSuccess: () => void, onError: () => void): void;\r\n loadRawTexture(texture: WebGLTexture, data: ArrayBufferView, width: number, height: number, format: number, generateMips: boolean, invertY: boolean): void;\r\n loadRawTexture2DArray(\r\n texture: WebGLTexture,\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n depth: number,\r\n format: number,\r\n generateMipMaps: boolean,\r\n invertY: boolean\r\n ): void;\r\n loadCubeTexture(texture: WebGLTexture, data: Array<ArrayBufferView>, generateMips: boolean, invertY: boolean, srgb: boolean, onSuccess: () => void, onError: () => void): void;\r\n loadCubeTextureWithMips(texture: WebGLTexture, data: Array<Array<ArrayBufferView>>, invertY: boolean, srgb: boolean, onSuccess: () => void, onError: () => void): void;\r\n getTextureWidth(texture: WebGLTexture): number;\r\n getTextureHeight(texture: WebGLTexture): number;\r\n copyTexture(desination: Nullable<WebGLTexture>, source: Nullable<WebGLTexture>): void;\r\n deleteTexture(texture: Nullable<WebGLTexture>): void;\r\n readTexture(\r\n texture: WebGLTexture,\r\n mipLevel: number,\r\n x: number,\r\n y: number,\r\n width: number,\r\n height: number,\r\n buffer: Nullable<ArrayBuffer>,\r\n bufferOffset: number,\r\n bufferLength: number\r\n ): Promise<ArrayBuffer>;\r\n\r\n createImageBitmap(data: ArrayBufferView | IImage): ImageBitmap;\r\n resizeImageBitmap(image: ImageBitmap, bufferWidth: number, bufferHeight: number): Uint8Array;\r\n\r\n createFrameBuffer(\r\n texture: WebGLTexture,\r\n width: number,\r\n height: number,\r\n format: number,\r\n generateStencilBuffer: boolean,\r\n generateDepthBuffer: boolean,\r\n generateMips: boolean\r\n ): WebGLFramebuffer;\r\n\r\n getRenderWidth(): number;\r\n getRenderHeight(): number;\r\n getHardwareScalingLevel(): number;\r\n setHardwareScalingLevel(level: number): void;\r\n\r\n setViewPort(x: number, y: number, width: number, height: number): void;\r\n\r\n setCommandDataStream(dataStream: NativeDataStream): void;\r\n submitCommands(): void;\r\n}\r\n\r\n/** @hidden */\r\ninterface INativeEngineConstructor {\r\n prototype: INativeEngine;\r\n new (): INativeEngine;\r\n\r\n readonly PROTOCOL_VERSION: number;\r\n\r\n readonly CAPS_LIMITS_MAX_TEXTURE_SIZE: number;\r\n readonly CAPS_LIMITS_MAX_TEXTURE_LAYERS: number;\r\n\r\n readonly TEXTURE_NEAREST_NEAREST: number;\r\n readonly TEXTURE_LINEAR_LINEAR: number;\r\n readonly TEXTURE_LINEAR_LINEAR_MIPLINEAR: number;\r\n readonly TEXTURE_NEAREST_NEAREST_MIPNEAREST: number;\r\n readonly TEXTURE_NEAREST_LINEAR_MIPNEAREST: number;\r\n readonly TEXTURE_NEAREST_LINEAR_MIPLINEAR: number;\r\n readonly TEXTURE_NEAREST_LINEAR: number;\r\n readonly TEXTURE_NEAREST_NEAREST_MIPLINEAR: number;\r\n readonly TEXTURE_LINEAR_NEAREST_MIPNEAREST: number;\r\n readonly TEXTURE_LINEAR_NEAREST_MIPLINEAR: number;\r\n readonly TEXTURE_LINEAR_LINEAR_MIPNEAREST: number;\r\n readonly TEXTURE_LINEAR_NEAREST: number;\r\n\r\n readonly DEPTH_TEST_LESS: number;\r\n readonly DEPTH_TEST_LEQUAL: number;\r\n readonly DEPTH_TEST_EQUAL: number;\r\n readonly DEPTH_TEST_GEQUAL: number;\r\n readonly DEPTH_TEST_GREATER: number;\r\n readonly DEPTH_TEST_NOTEQUAL: number;\r\n readonly DEPTH_TEST_NEVER: number;\r\n readonly DEPTH_TEST_ALWAYS: number;\r\n\r\n readonly ADDRESS_MODE_WRAP: number;\r\n readonly ADDRESS_MODE_MIRROR: number;\r\n readonly ADDRESS_MODE_CLAMP: number;\r\n readonly ADDRESS_MODE_BORDER: number;\r\n readonly ADDRESS_MODE_MIRROR_ONCE: number;\r\n\r\n readonly TEXTURE_FORMAT_RGB8: number;\r\n readonly TEXTURE_FORMAT_RGBA8: number;\r\n readonly TEXTURE_FORMAT_RGBA32F: number;\r\n\r\n readonly ATTRIB_TYPE_INT8: number;\r\n readonly ATTRIB_TYPE_UINT8: number;\r\n readonly ATTRIB_TYPE_INT16: number;\r\n readonly ATTRIB_TYPE_UINT16: number;\r\n readonly ATTRIB_TYPE_FLOAT: number;\r\n\r\n readonly ALPHA_DISABLE: number;\r\n readonly ALPHA_ADD: number;\r\n readonly ALPHA_COMBINE: number;\r\n readonly ALPHA_SUBTRACT: number;\r\n readonly ALPHA_MULTIPLY: number;\r\n readonly ALPHA_MAXIMIZED: number;\r\n readonly ALPHA_ONEONE: number;\r\n readonly ALPHA_PREMULTIPLIED: number;\r\n readonly ALPHA_PREMULTIPLIED_PORTERDUFF: number;\r\n readonly ALPHA_INTERPOLATE: number;\r\n readonly ALPHA_SCREENMODE: number;\r\n\r\n readonly STENCIL_TEST_LESS: number;\r\n readonly STENCIL_TEST_LEQUAL: number;\r\n readonly STENCIL_TEST_EQUAL: number;\r\n readonly STENCIL_TEST_GEQUAL: number;\r\n readonly STENCIL_TEST_GREATER: number;\r\n readonly STENCIL_TEST_NOTEQUAL: number;\r\n readonly STENCIL_TEST_NEVER: number;\r\n readonly STENCIL_TEST_ALWAYS: number;\r\n\r\n readonly STENCIL_OP_FAIL_S_ZERO: number;\r\n readonly STENCIL_OP_FAIL_S_KEEP: number;\r\n readonly STENCIL_OP_FAIL_S_REPLACE: number;\r\n readonly STENCIL_OP_FAIL_S_INCR: number;\r\n readonly STENCIL_OP_FAIL_S_INCRSAT: number;\r\n readonly STENCIL_OP_FAIL_S_DECR: number;\r\n readonly STENCIL_OP_FAIL_S_DECRSAT: number;\r\n readonly STENCIL_OP_FAIL_S_INVERT: number;\r\n\r\n readonly STENCIL_OP_FAIL_Z_ZERO: number;\r\n readonly STENCIL_OP_FAIL_Z_KEEP: number;\r\n readonly STENCIL_OP_FAIL_Z_REPLACE: number;\r\n readonly STENCIL_OP_FAIL_Z_INCR: number;\r\n readonly STENCIL_OP_FAIL_Z_INCRSAT: number;\r\n readonly STENCIL_OP_FAIL_Z_DECR: number;\r\n readonly STENCIL_OP_FAIL_Z_DECRSAT: number;\r\n readonly STENCIL_OP_FAIL_Z_INVERT: number;\r\n\r\n readonly STENCIL_OP_PASS_Z_ZERO: number;\r\n readonly STENCIL_OP_PASS_Z_KEEP: number;\r\n readonly STENCIL_OP_PASS_Z_REPLACE: number;\r\n readonly STENCIL_OP_PASS_Z_INCR: number;\r\n readonly STENCIL_OP_PASS_Z_INCRSAT: number;\r\n readonly STENCIL_OP_PASS_Z_DECR: number;\r\n readonly STENCIL_OP_PASS_Z_DECRSAT: number;\r\n readonly STENCIL_OP_PASS_Z_INVERT: number;\r\n\r\n readonly COMMAND_DELETEVERTEXARRAY: NativeData;\r\n readonly COMMAND_DELETEINDEXBUFFER: NativeData;\r\n readonly COMMAND_DELETEVERTEXBUFFER: NativeData;\r\n readonly COMMAND_SETPROGRAM: NativeData;\r\n readonly COMMAND_SETMATRIX: NativeData;\r\n readonly COMMAND_SETMATRIX3X3: NativeData;\r\n readonly COMMAND_SETMATRIX2X2: NativeData;\r\n readonly COMMAND_SETMATRICES: NativeData;\r\n readonly COMMAND_SETINT: NativeData;\r\n readonly COMMAND_SETINTARRAY: NativeData;\r\n readonly COMMAND_SETINTARRAY2: NativeData;\r\n readonly COMMAND_SETINTARRAY3: NativeData;\r\n readonly COMMAND_SETINTARRAY4: NativeData;\r\n readonly COMMAND_SETFLOATARRAY: NativeData;\r\n readonly COMMAND_SETFLOATARRAY2: NativeData;\r\n readonly COMMAND_SETFLOATARRAY3: NativeData;\r\n readonly COMMAND_SETFLOATARRAY4: NativeData;\r\n readonly COMMAND_SETTEXTURESAMPLING: NativeData;\r\n readonly COMMAND_SETTEXTUREWRAPMODE: NativeData;\r\n readonly COMMAND_SETTEXTUREANISOTROPICLEVEL: NativeData;\r\n readonly COMMAND_SETTEXTURE: NativeData;\r\n readonly COMMAND_BINDVERTEXARRAY: NativeData;\r\n readonly COMMAND_SETSTATE: NativeData;\r\n readonly COMMAND_DELETEPROGRAM: NativeData;\r\n readonly COMMAND_SETZOFFSET: NativeData;\r\n readonly COMMAND_SETZOFFSETUNITS: NativeData;\r\n readonly COMMAND_SETDEPTHTEST: NativeData;\r\n readonly COMMAND_SETDEPTHWRITE: NativeData;\r\n readonly COMMAND_SETCOLORWRITE: NativeData;\r\n readonly COMMAND_SETBLENDMODE: NativeData;\r\n readonly COMMAND_SETFLOAT: NativeData;\r\n readonly COMMAND_SETFLOAT2: NativeData;\r\n readonly COMMAND_SETFLOAT3: NativeData;\r\n readonly COMMAND_SETFLOAT4: NativeData;\r\n readonly COMMAND_BINDFRAMEBUFFER: NativeData;\r\n readonly COMMAND_UNBINDFRAMEBUFFER: NativeData;\r\n readonly COMMAND_DELETEFRAMEBUFFER: NativeData;\r\n readonly COMMAND_DRAWINDEXED: NativeData;\r\n readonly COMMAND_DRAW: NativeData;\r\n readonly COMMAND_CLEAR: NativeData;\r\n readonly COMMAND_SETSTENCIL: NativeData;\r\n}\r\n\r\n/** @hidden */\r\nexport interface INativeCamera {\r\n createVideo(constraints: MediaTrackConstraints): any;\r\n updateVideoTexture(texture: Nullable<InternalTexture>, video: HTMLVideoElement, invertY: boolean): void;\r\n}\r\n\r\n/** @hidden */\r\ninterface INativeCameraConstructor {\r\n prototype: INativeCamera;\r\n new (): INativeCamera;\r\n}\r\n\r\n/** @hidden */\r\ninterface INativeCanvasConstructor {\r\n prototype: ICanvas;\r\n new (): ICanvas;\r\n\r\n loadTTFAsync(fontName: string, buffer: ArrayBuffer): void;\r\n}\r\n\r\n/** @hidden */\r\ninterface INativeImageConstructor {\r\n prototype: IImage;\r\n new (): IImage;\r\n}\r\n\r\n/** @hidden */\r\ninterface IDeviceInputSystemConstructor {\r\n prototype: IDeviceInputSystem;\r\n new (\r\n onDeviceConnected: (deviceType: DeviceType, deviceSlot: number) => void,\r\n onDeviceDisconnected: (deviceType: DeviceType, deviceSlot: number) => void,\r\n onInputChanged: (deviceType: DeviceType, deviceSlot: number, inputIndex: number, currentState: number) => void\r\n ): IDeviceInputSystem;\r\n}\r\n\r\n/** @hidden */\r\nexport interface INativeDataStream {\r\n writeBuffer(buffer: ArrayBuffer, length: number): void;\r\n}\r\n\r\n/** @hidden */\r\ninterface INativeDataStreamConstructor {\r\n prototype: INativeDataStream;\r\n new (requestFlushCallback: () => void): INativeDataStream;\r\n\r\n readonly VALIDATION_ENABLED: boolean;\r\n readonly VALIDATION_UINT_32: number;\r\n readonly VALIDATION_INT_32: number;\r\n readonly VALIDATION_FLOAT_32: number;\r\n readonly VALIDATION_UINT_32_ARRAY: number;\r\n readonly VALIDATION_INT_32_ARRAY: number;\r\n readonly VALIDATION_FLOAT_32_ARRAY: number;\r\n readonly VALIDATION_NATIVE_DATA: number;\r\n readonly VALIDATION_BOOLEAN: number;\r\n}\r\n\r\n/** @hidden */\r\nexport interface INative {\r\n Engine: INativeEngineConstructor;\r\n Camera: INativeCameraConstructor;\r\n Canvas: INativeCanvasConstructor;\r\n Image: INativeImageConstructor;\r\n XMLHttpRequest: any; // TODO: how to do this?\r\n DeviceInputSystem: IDeviceInputSystemConstructor;\r\n NativeDataStream: INativeDataStreamConstructor;\r\n}\r\n"]}