@babylonjs/core 5.0.0-beta.9 → 5.0.0-rc.2

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 (187) hide show
  1. package/Actions/actionEvent.d.ts +3 -4
  2. package/Actions/actionEvent.js.map +1 -1
  3. package/Animations/animation.d.ts +4 -4
  4. package/Animations/animation.js +4 -4
  5. package/Animations/animation.js.map +1 -1
  6. package/Audio/sound.d.ts +12 -6
  7. package/Audio/sound.js +48 -24
  8. package/Audio/sound.js.map +1 -1
  9. package/BakedVertexAnimation/vertexAnimationBaker.js +0 -1
  10. package/BakedVertexAnimation/vertexAnimationBaker.js.map +1 -1
  11. package/Behaviors/Meshes/baseSixDofDragBehavior.js.map +1 -1
  12. package/Behaviors/Meshes/pointerDragBehavior.js +5 -0
  13. package/Behaviors/Meshes/pointerDragBehavior.js.map +1 -1
  14. package/Bones/skeleton.js +20 -13
  15. package/Bones/skeleton.js.map +1 -1
  16. package/Cameras/Inputs/BaseCameraPointersInput.d.ts +1 -0
  17. package/Cameras/Inputs/BaseCameraPointersInput.js +4 -3
  18. package/Cameras/Inputs/BaseCameraPointersInput.js.map +1 -1
  19. package/Cameras/Inputs/arcRotateCameraMouseWheelInput.js +10 -9
  20. package/Cameras/Inputs/arcRotateCameraMouseWheelInput.js.map +1 -1
  21. package/Cameras/Inputs/followCameraMouseWheelInput.js.map +1 -1
  22. package/Cameras/VR/vrExperienceHelper.js.map +1 -1
  23. package/Cameras/arcRotateCamera.d.ts +4 -2
  24. package/Cameras/arcRotateCamera.js +11 -6
  25. package/Cameras/arcRotateCamera.js.map +1 -1
  26. package/Cameras/targetCamera.d.ts +1 -0
  27. package/Cameras/targetCamera.js +1 -0
  28. package/Cameras/targetCamera.js.map +1 -1
  29. package/Culling/ray.js +4 -2
  30. package/Culling/ray.js.map +1 -1
  31. package/DeviceInput/Helpers/eventFactory.d.ts +6 -6
  32. package/DeviceInput/Helpers/eventFactory.js +34 -16
  33. package/DeviceInput/Helpers/eventFactory.js.map +1 -1
  34. package/DeviceInput/InputDevices/deviceEnums.d.ts +26 -3
  35. package/DeviceInput/InputDevices/deviceEnums.js +31 -7
  36. package/DeviceInput/InputDevices/deviceEnums.js.map +1 -1
  37. package/DeviceInput/InputDevices/deviceSource.d.ts +11 -3
  38. package/DeviceInput/InputDevices/deviceSource.js.map +1 -1
  39. package/DeviceInput/InputDevices/deviceSourceManager.d.ts +12 -9
  40. package/DeviceInput/InputDevices/deviceSourceManager.js +75 -12
  41. package/DeviceInput/InputDevices/deviceSourceManager.js.map +1 -1
  42. package/DeviceInput/InputDevices/deviceTypes.d.ts +1 -1
  43. package/DeviceInput/InputDevices/deviceTypes.js.map +1 -1
  44. package/DeviceInput/InputDevices/inputInterfaces.d.ts +3 -28
  45. package/DeviceInput/InputDevices/inputInterfaces.js.map +1 -1
  46. package/DeviceInput/InputDevices/internalDeviceSourceManager.d.ts +4 -24
  47. package/DeviceInput/InputDevices/internalDeviceSourceManager.js +27 -91
  48. package/DeviceInput/InputDevices/internalDeviceSourceManager.js.map +1 -1
  49. package/DeviceInput/InputDevices/nativeDeviceInputSystem.d.ts +3 -2
  50. package/DeviceInput/InputDevices/nativeDeviceInputSystem.js +7 -13
  51. package/DeviceInput/InputDevices/nativeDeviceInputSystem.js.map +1 -1
  52. package/DeviceInput/InputDevices/webDeviceInputSystem.d.ts +4 -2
  53. package/DeviceInput/InputDevices/webDeviceInputSystem.js +54 -77
  54. package/DeviceInput/InputDevices/webDeviceInputSystem.js.map +1 -1
  55. package/Engines/Extensions/engine.query.d.ts +7 -0
  56. package/Engines/Extensions/engine.query.js +12 -0
  57. package/Engines/Extensions/engine.query.js.map +1 -1
  58. package/Engines/Extensions/engine.renderTarget.d.ts +5 -0
  59. package/Engines/Extensions/engine.renderTarget.js.map +1 -1
  60. package/Engines/ICanvas.d.ts +4 -0
  61. package/Engines/ICanvas.js.map +1 -1
  62. package/Engines/Native/nativeInterfaces.d.ts +1 -1
  63. package/Engines/Native/nativeInterfaces.js.map +1 -1
  64. package/Engines/engine.d.ts +14 -2
  65. package/Engines/engine.js +25 -0
  66. package/Engines/engine.js.map +1 -1
  67. package/Engines/index.d.ts +1 -0
  68. package/Engines/index.js +1 -0
  69. package/Engines/index.js.map +1 -1
  70. package/Engines/nativeEngine.d.ts +8 -0
  71. package/Engines/nativeEngine.js +38 -10
  72. package/Engines/nativeEngine.js.map +1 -1
  73. package/Engines/thinEngine.js +2 -2
  74. package/Engines/thinEngine.js.map +1 -1
  75. package/Engines/webgpuEngine.js +2 -2
  76. package/Engines/webgpuEngine.js.map +1 -1
  77. package/Events/deviceInputEvents.d.ts +17 -18
  78. package/Events/deviceInputEvents.js.map +1 -1
  79. package/Gizmos/boundingBoxGizmo.js.map +1 -1
  80. package/Helpers/environmentHelper.js +2 -2
  81. package/Helpers/environmentHelper.js.map +1 -1
  82. package/Helpers/videoDome.d.ts +8 -0
  83. package/Helpers/videoDome.js +18 -4
  84. package/Helpers/videoDome.js.map +1 -1
  85. package/Inputs/scene.inputManager.js +50 -24
  86. package/Inputs/scene.inputManager.js.map +1 -1
  87. package/Layers/effectLayer.d.ts +1 -0
  88. package/Layers/effectLayer.js +24 -0
  89. package/Layers/effectLayer.js.map +1 -1
  90. package/Materials/Node/Blocks/Dual/textureBlock.d.ts +6 -2
  91. package/Materials/Node/Blocks/Dual/textureBlock.js +50 -8
  92. package/Materials/Node/Blocks/Dual/textureBlock.js.map +1 -1
  93. package/Materials/Node/Blocks/elbowBlock.d.ts +6 -0
  94. package/Materials/Node/Blocks/elbowBlock.js +25 -0
  95. package/Materials/Node/Blocks/elbowBlock.js.map +1 -1
  96. package/Materials/Node/Blocks/simplexPerlin3DBlock.js +1 -0
  97. package/Materials/Node/Blocks/simplexPerlin3DBlock.js.map +1 -1
  98. package/Materials/Node/nodeMaterialBlock.d.ts +1 -1
  99. package/Materials/Node/nodeMaterialBlock.js.map +1 -1
  100. package/Materials/PBR/pbrBaseMaterial.js +1 -0
  101. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  102. package/Materials/Textures/Procedurals/proceduralTexture.d.ts +1 -1
  103. package/Materials/Textures/Procedurals/proceduralTexture.js.map +1 -1
  104. package/Materials/Textures/dynamicTexture.d.ts +1 -1
  105. package/Materials/Textures/dynamicTexture.js.map +1 -1
  106. package/Materials/materialPluginBase.d.ts +5 -0
  107. package/Materials/materialPluginBase.js +5 -0
  108. package/Materials/materialPluginBase.js.map +1 -1
  109. package/Materials/materialPluginEvent.d.ts +1 -0
  110. package/Materials/materialPluginEvent.js.map +1 -1
  111. package/Materials/materialPluginManager.d.ts +1 -0
  112. package/Materials/materialPluginManager.js +20 -15
  113. package/Materials/materialPluginManager.js.map +1 -1
  114. package/Materials/standardMaterial.js +1 -0
  115. package/Materials/standardMaterial.js.map +1 -1
  116. package/Maths/math.vector.d.ts +5 -0
  117. package/Maths/math.vector.js +20 -9
  118. package/Maths/math.vector.js.map +1 -1
  119. package/Meshes/Builders/polygonBuilder.js +2 -1
  120. package/Meshes/Builders/polygonBuilder.js.map +1 -1
  121. package/Meshes/Compression/dracoCompression.js +3 -7
  122. package/Meshes/Compression/dracoCompression.js.map +1 -1
  123. package/Meshes/abstractMesh.d.ts +1 -1
  124. package/Meshes/abstractMesh.js +0 -1
  125. package/Meshes/abstractMesh.js.map +1 -1
  126. package/Meshes/geometry.js +5 -0
  127. package/Meshes/geometry.js.map +1 -1
  128. package/Meshes/instancedMesh.js +7 -4
  129. package/Meshes/instancedMesh.js.map +1 -1
  130. package/Meshes/mesh.js +21 -22
  131. package/Meshes/mesh.js.map +1 -1
  132. package/Meshes/mesh.vertexData.d.ts +3 -2
  133. package/Meshes/mesh.vertexData.js +114 -85
  134. package/Meshes/mesh.vertexData.js.map +1 -1
  135. package/Meshes/transformNode.d.ts +3 -3
  136. package/Meshes/transformNode.js +9 -6
  137. package/Meshes/transformNode.js.map +1 -1
  138. package/Misc/fileTools.js +23 -9
  139. package/Misc/fileTools.js.map +1 -1
  140. package/Misc/khronosTextureContainer2.d.ts +10 -15
  141. package/Misc/khronosTextureContainer2.js +31 -60
  142. package/Misc/khronosTextureContainer2.js.map +1 -1
  143. package/Misc/videoRecorder.d.ts +1 -1
  144. package/Misc/videoRecorder.js +1 -1
  145. package/Misc/videoRecorder.js.map +1 -1
  146. package/Misc/workerPool.d.ts +37 -3
  147. package/Misc/workerPool.js +91 -15
  148. package/Misc/workerPool.js.map +1 -1
  149. package/Morph/morphTarget.d.ts +2 -1
  150. package/Morph/morphTarget.js +5 -1
  151. package/Morph/morphTarget.js.map +1 -1
  152. package/Morph/morphTargetManager.js +1 -1
  153. package/Morph/morphTargetManager.js.map +1 -1
  154. package/Particles/particleSystem.d.ts +13 -1
  155. package/Particles/particleSystem.js +20 -0
  156. package/Particles/particleSystem.js.map +1 -1
  157. package/Particles/pointsCloudSystem.d.ts +1 -1
  158. package/Particles/pointsCloudSystem.js +1 -1
  159. package/Particles/pointsCloudSystem.js.map +1 -1
  160. package/Rendering/prePassRenderer.js +12 -2
  161. package/Rendering/prePassRenderer.js.map +1 -1
  162. package/Rendering/subSurfaceConfiguration.js +1 -1
  163. package/Rendering/subSurfaceConfiguration.js.map +1 -1
  164. package/Rendering/utilityLayerRenderer.js +2 -0
  165. package/Rendering/utilityLayerRenderer.js.map +1 -1
  166. package/Shaders/ShadersInclude/pointCloudVertex.js +1 -1
  167. package/Shaders/ShadersInclude/pointCloudVertex.js.map +1 -1
  168. package/Shaders/background.vertex.js +1 -1
  169. package/Shaders/background.vertex.js.map +1 -1
  170. package/Shaders/pbr.vertex.js +1 -1
  171. package/Shaders/pbr.vertex.js.map +1 -1
  172. package/XR/features/WebXRImageTracking.d.ts +2 -1
  173. package/XR/features/WebXRImageTracking.js +43 -64
  174. package/XR/features/WebXRImageTracking.js.map +1 -1
  175. package/XR/features/WebXRNearInteraction.js +4 -2
  176. package/XR/features/WebXRNearInteraction.js.map +1 -1
  177. package/XR/native/nativeXRFrame.d.ts +1 -0
  178. package/XR/native/nativeXRFrame.js +1 -0
  179. package/XR/native/nativeXRFrame.js.map +1 -1
  180. package/XR/webXRSessionManager.js +1 -0
  181. package/XR/webXRSessionManager.js.map +1 -1
  182. package/package.json +1 -1
  183. package/scene.d.ts +1 -10
  184. package/scene.js +36 -39
  185. package/scene.js.map +1 -1
  186. package/types.d.ts +1 -1
  187. package/types.js.map +1 -1
@@ -17,6 +17,8 @@ var _OcclusionDataStorage = /** @class */ (function () {
17
17
  this.occlusionType = AbstractMesh.OCCLUSION_TYPE_NONE;
18
18
  /** @hidden */
19
19
  this.occlusionQueryAlgorithmType = AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE;
20
+ /** @hidden */
21
+ this.forceRenderingWhenOccluded = false;
20
22
  }
21
23
  return _OcclusionDataStorage;
22
24
  }());
@@ -262,6 +264,16 @@ Object.defineProperty(AbstractMesh.prototype, "occlusionRetryCount", {
262
264
  enumerable: true,
263
265
  configurable: true
264
266
  });
267
+ Object.defineProperty(AbstractMesh.prototype, "forceRenderingWhenOccluded", {
268
+ get: function () {
269
+ return this._occlusionDataStorage.forceRenderingWhenOccluded;
270
+ },
271
+ set: function (value) {
272
+ this._occlusionDataStorage.forceRenderingWhenOccluded = value;
273
+ },
274
+ enumerable: true,
275
+ configurable: true
276
+ });
265
277
  // We also need to update AbstractMesh as there is a portion of the code there
266
278
  AbstractMesh.prototype._checkOcclusionQuery = function () {
267
279
  var dataStorage = this._occlusionDataStorage;
@@ -1 +1 @@
1
- {"version":3,"file":"engine.query.js","sourceRoot":"","sources":["../../../../sourceES6/core/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;IAAA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yB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC;aAChH;SACJ;KACJ;IAED,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC5B,IAAI,KAAK,CAAC,sBAAsB,EAAE;QAC9B,IAAI,4BAA4B,GAAG,KAAK,CAAC,sBAAsB,EAAE,CAAC;QAElE,IAAI,IAAI,CAAC,eAAe,KAAK,IAAI,EAAE;YAC/B,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;SAC/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 { 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 { Observer } from \"../../Misc/observable\";\r\n\r\n/** @hidden */\r\nexport type OcclusionQuery = WebGLQuery | number;\r\n\r\n/** @hidden */\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\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 var 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 var 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 let 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 let 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 let 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 let 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 let caps = this.getCaps();\r\n let timerQuery = caps.timerQuery;\r\n if (!timerQuery) {\r\n return null;\r\n }\r\n\r\n let 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 let caps = this.getCaps();\r\n let 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 }\r\n token._timeElapsedQueryEnded = true;\r\n }\r\n\r\n let 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 let timeStart = this._getTimeQueryResult(token._startTimeQuery);\r\n let 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 this._currentNonTimestampToken = null;\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 let 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 __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 retireved, 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\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\n// We also need to update AbstractMesh as there is a portion of the code there\r\nAbstractMesh.prototype._checkOcclusionQuery = function () {\r\n let 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 var 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) { // 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\r\n var isOcclusionQueryAvailable = engine.isQueryResultAvailable(this._occlusionQuery);\r\n if (isOcclusionQueryAvailable) {\r\n var 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 }\r\n else {\r\n\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 }\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 var scene = this.getScene();\r\n if (scene.getBoundingBoxRenderer) {\r\n var 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":["../../../../sourceES6/core/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;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,OAAO,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;AAClC,CAAC,CAAC;AAEF,MAAM,CAAC,SAAS,CAAC,WAAW,GAAG,U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I,4BAA4B,GAAG,KAAK,CAAC,sBAAsB,EAAE,CAAC;QAElE,IAAI,IAAI,CAAC,eAAe,KAAK,IAAI,EAAE;YAC/B,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;SAC/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 { 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 { Observer } from \"../../Misc/observable\";\r\n\r\n/** @hidden */\r\nexport type OcclusionQuery = WebGLQuery | number;\r\n\r\n/** @hidden */\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 var 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 var 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 let 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 let 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 let 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 let 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 let caps = this.getCaps();\r\n let timerQuery = caps.timerQuery;\r\n if (!timerQuery) {\r\n return null;\r\n }\r\n\r\n let 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 let caps = this.getCaps();\r\n let 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 }\r\n token._timeElapsedQueryEnded = true;\r\n }\r\n\r\n let 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 let timeStart = this._getTimeQueryResult(token._startTimeQuery);\r\n let 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 this._currentNonTimestampToken = null;\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 let 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 __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 retireved, 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 let 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 var 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) { // 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\r\n var isOcclusionQueryAvailable = engine.isQueryResultAvailable(this._occlusionQuery);\r\n if (isOcclusionQueryAvailable) {\r\n var 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 }\r\n else {\r\n\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 }\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 var scene = this.getScene();\r\n if (scene.getBoundingBoxRenderer) {\r\n var 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,6 +3,11 @@ import { RenderTargetCreationOptions, DepthTextureCreationOptions } from "../../
3
3
  import { Nullable } from "../../types";
4
4
  import { RenderTargetWrapper } from "../renderTargetWrapper";
5
5
  import { TextureSize } from "../../Materials/Textures/textureCreationOptions";
6
+ /**
7
+ * Type used to define a texture size (either with a number or with a rect width and height)
8
+ * @deprecated please use TextureSize instead
9
+ */
10
+ export declare type RenderTargetTextureSize = TextureSize;
6
11
  declare module "../../Engines/thinEngine" {
7
12
  interface ThinEngine {
8
13
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"engine.renderTarget.js","sourceRoot":"","sources":["../../../../sourceES6/core/Engines/Extensions/engine.renderTarget.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AAClG,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AA0C7E,UAAU,CAAC,SAAS,CA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,CACR,CAAC;QAEF,IAAI,CAAC,iBAAiB,EAAE;YACpB,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;SACjE;QAED,eAAe,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;KACzD;SAAM;QACH,IAAI,CAAC,uBAAuB,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;KACxD;IAED,SAAS,CAAC,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC;IACpC,SAAS,CAAC,mBAAmB,GAAG,IAAI,CAAC,iCAAiC,CAClE,SAAS,CAAC,sBAAsB,EAChC,SAAS,CAAC,oBAAoB,EAC9B,SAAS,CAAC,OAAO,CAAC,KAAK,EACvB,SAAS,CAAC,OAAO,CAAC,MAAM,EACxB,OAAO,CACV,CAAC;IAEF,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,CAAC;IAEnC,OAAO,OAAO,CAAC;AACnB,CAAC,CAAC","sourcesContent":["import { InternalTexture, InternalTextureSource } from \"../../Materials/Textures/internalTexture\";\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport { RenderTargetCreationOptions, DepthTextureCreationOptions } from \"../../Materials/Textures/textureCreationOptions\";\r\nimport { ThinEngine } from \"../thinEngine\";\r\nimport { Nullable } from \"../../types\";\r\nimport { RenderTargetWrapper } from \"../renderTargetWrapper\";\r\nimport { WebGLRenderTargetWrapper } from \"../WebGL/webGLRenderTargetWrapper\";\r\nimport { WebGLHardwareTexture } from \"../WebGL/webGLHardwareTexture\";\r\nimport { TextureSize } from \"../../Materials/Textures/textureCreationOptions\";\r\n\r\n\r\ndeclare module \"../../Engines/thinEngine\" {\r\n export interface ThinEngine {\r\n /**\r\n * Creates a new render target texture\r\n * @param size defines the size of the texture\r\n * @param options defines the options used to create the texture\r\n * @returns a new render target wrapper ready to render texture\r\n */\r\n createRenderTargetTexture(size: TextureSize, options: boolean | RenderTargetCreationOptions): RenderTargetWrapper;\r\n\r\n /**\r\n * Creates a depth stencil texture.\r\n * This is only available in WebGL 2 or with the depth texture extension available.\r\n * @param size The size of face edge in the texture.\r\n * @param options The options defining the texture.\r\n * @param rtWrapper The render target wrapper for which the depth/stencil texture must be created\r\n * @returns The texture\r\n */\r\n createDepthStencilTexture(size: TextureSize, options: DepthTextureCreationOptions, rtWrapper: RenderTargetWrapper): InternalTexture;\r\n\r\n /**\r\n * Updates the sample count of a render target texture\r\n * @see https://doc.babylonjs.com/features/webgl2#multisample-render-targets\r\n * @param rtWrapper defines the render target wrapper to update\r\n * @param samples defines the sample count to set\r\n * @returns the effective sample count (could be 0 if multisample render targets are not supported)\r\n */\r\n updateRenderTargetTextureSampleCount(rtWrapper: Nullable<RenderTargetWrapper>, samples: number): number;\r\n\r\n /** @hidden */\r\n _createDepthStencilTexture(size: TextureSize, options: DepthTextureCreationOptions, rtWrapper: RenderTargetWrapper): InternalTexture;\r\n\r\n /** @hidden */\r\n _createHardwareRenderTargetWrapper(isMulti: boolean, isCube: boolean, size: TextureSize): RenderTargetWrapper;\r\n }\r\n}\r\n\r\nThinEngine.prototype._createHardwareRenderTargetWrapper = function (isMulti: boolean, isCube: boolean, size: TextureSize): RenderTargetWrapper {\r\n const rtWrapper = new WebGLRenderTargetWrapper(isMulti, isCube, size, this, this._gl);\r\n this._renderTargetWrapperCache.push(rtWrapper);\r\n return rtWrapper;\r\n};\r\n\r\nThinEngine.prototype.createRenderTargetTexture = function (this: ThinEngine, size: TextureSize, options: boolean | RenderTargetCreationOptions): RenderTargetWrapper {\r\n const rtWrapper = this._createHardwareRenderTargetWrapper(false, false, size) as WebGLRenderTargetWrapper;\r\n\r\n const fullOptions: RenderTargetCreationOptions = {};\r\n if (options !== undefined && typeof options === \"object\") {\r\n fullOptions.generateDepthBuffer = !!options.generateDepthBuffer;\r\n fullOptions.generateStencilBuffer = !!options.generateStencilBuffer;\r\n } else {\r\n fullOptions.generateDepthBuffer = true;\r\n fullOptions.generateStencilBuffer = false;\r\n }\r\n\r\n const texture = this._createInternalTexture(size, options, true, InternalTextureSource.RenderTarget);\r\n const width = (<{ width: number; height: number; layers?: number }>size).width || <number>size;\r\n const height = (<{ width: number; height: number; layers?: number }>size).height || <number>size;\r\n\r\n const currentFrameBuffer = this._currentFramebuffer;\r\n const gl = this._gl;\r\n\r\n // Create the framebuffer\r\n const framebuffer = gl.createFramebuffer();\r\n this._bindUnboundFramebuffer(framebuffer);\r\n rtWrapper._depthStencilBuffer = this._setupFramebufferDepthAttachments(fullOptions.generateStencilBuffer ? true : false, fullOptions.generateDepthBuffer, width, height);\r\n\r\n // No need to rebind on every frame\r\n if (!texture.is2DArray) {\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture._hardwareTexture!.underlyingResource, 0);\r\n }\r\n\r\n this._bindUnboundFramebuffer(currentFrameBuffer);\r\n\r\n rtWrapper._framebuffer = framebuffer;\r\n rtWrapper._generateDepthBuffer = fullOptions.generateDepthBuffer;\r\n rtWrapper._generateStencilBuffer = fullOptions.generateStencilBuffer ? true : false;\r\n\r\n rtWrapper.setTextures(texture);\r\n\r\n return rtWrapper;\r\n};\r\n\r\nThinEngine.prototype.createDepthStencilTexture = function (size: TextureSize, options: DepthTextureCreationOptions, rtWrapper: RenderTargetWrapper): InternalTexture {\r\n if (options.isCube) {\r\n let width = (<{ width: number; height: number }>size).width || <number>size;\r\n return this._createDepthStencilCubeTexture(width, options, rtWrapper);\r\n } else {\r\n return this._createDepthStencilTexture(size, options, rtWrapper);\r\n }\r\n};\r\n\r\nThinEngine.prototype._createDepthStencilTexture = function (size: TextureSize, options: DepthTextureCreationOptions, rtWrapper: RenderTargetWrapper): InternalTexture {\r\n const gl = this._gl;\r\n const layers = (<{ width: number; height: number; layers?: number }>size).layers || 0;\r\n const target = layers !== 0 ? gl.TEXTURE_2D_ARRAY : gl.TEXTURE_2D;\r\n const internalTexture = new InternalTexture(this, InternalTextureSource.DepthStencil);\r\n if (!this._caps.depthTextureExtension) {\r\n Logger.Error(\"Depth texture is not supported by your browser or hardware.\");\r\n return internalTexture;\r\n }\r\n\r\n const internalOptions = {\r\n bilinearFiltering: false,\r\n comparisonFunction: 0,\r\n generateStencil: false,\r\n ...options,\r\n };\r\n\r\n this._bindTextureDirectly(target, internalTexture, true);\r\n\r\n this._setupDepthStencilTexture(\r\n internalTexture,\r\n size,\r\n internalOptions.generateStencil,\r\n\r\n internalOptions.comparisonFunction === 0 ? false : internalOptions.bilinearFiltering,\r\n internalOptions.comparisonFunction\r\n );\r\n\r\n internalTexture.format = internalOptions.generateStencil ? 13 : 16;\r\n\r\n rtWrapper._depthStencilTexture = internalTexture;\r\n rtWrapper._depthStencilTextureWithStencil = internalOptions.generateStencil;\r\n\r\n const type = internalOptions.generateStencil ? gl.UNSIGNED_INT_24_8 : gl.UNSIGNED_INT;\r\n const internalFormat = internalOptions.generateStencil ? gl.DEPTH_STENCIL : gl.DEPTH_COMPONENT;\r\n let sizedFormat = internalFormat;\r\n if (this.webGLVersion > 1) {\r\n sizedFormat = internalOptions.generateStencil ? gl.DEPTH24_STENCIL8 : gl.DEPTH_COMPONENT24;\r\n }\r\n\r\n if (internalTexture.is2DArray) {\r\n gl.texImage3D(target, 0, sizedFormat, internalTexture.width, internalTexture.height, layers, 0, internalFormat, type, null);\r\n } else {\r\n gl.texImage2D(target, 0, sizedFormat, internalTexture.width, internalTexture.height, 0, internalFormat, type, null);\r\n }\r\n\r\n this._bindTextureDirectly(target, null);\r\n\r\n this._internalTexturesCache.push(internalTexture);\r\n\r\n return internalTexture;\r\n};\r\n\r\nThinEngine.prototype.updateRenderTargetTextureSampleCount = function (rtWrapper: Nullable<WebGLRenderTargetWrapper>, samples: number): number {\r\n if (this.webGLVersion < 2 || !rtWrapper || !rtWrapper.texture) {\r\n return 1;\r\n }\r\n\r\n if (rtWrapper.samples === samples) {\r\n return samples;\r\n }\r\n\r\n var gl = this._gl;\r\n\r\n samples = Math.min(samples, this.getCaps().maxMSAASamples);\r\n\r\n // Dispose previous render buffers\r\n if (rtWrapper._depthStencilBuffer) {\r\n gl.deleteRenderbuffer(rtWrapper._depthStencilBuffer);\r\n rtWrapper._depthStencilBuffer = null;\r\n }\r\n\r\n if (rtWrapper._MSAAFramebuffer) {\r\n gl.deleteFramebuffer(rtWrapper._MSAAFramebuffer);\r\n rtWrapper._MSAAFramebuffer = null;\r\n }\r\n\r\n const hardwareTexture = rtWrapper.texture._hardwareTexture as WebGLHardwareTexture;\r\n if (hardwareTexture._MSAARenderBuffer) {\r\n gl.deleteRenderbuffer(hardwareTexture._MSAARenderBuffer);\r\n hardwareTexture._MSAARenderBuffer = null;\r\n }\r\n\r\n if (samples > 1 && gl.renderbufferStorageMultisample) {\r\n let framebuffer = gl.createFramebuffer();\r\n\r\n if (!framebuffer) {\r\n throw new Error(\"Unable to create multi sampled framebuffer\");\r\n }\r\n\r\n rtWrapper._MSAAFramebuffer = framebuffer;\r\n this._bindUnboundFramebuffer(rtWrapper._MSAAFramebuffer);\r\n\r\n const colorRenderbuffer = this._createRenderBuffer(\r\n rtWrapper.texture.width,\r\n rtWrapper.texture.height,\r\n samples,\r\n -1 /* not used */,\r\n this._getRGBAMultiSampleBufferFormat(rtWrapper.texture.type),\r\n gl.COLOR_ATTACHMENT0,\r\n false\r\n );\r\n\r\n if (!colorRenderbuffer) {\r\n throw new Error(\"Unable to create multi sampled framebuffer\");\r\n }\r\n\r\n hardwareTexture._MSAARenderBuffer = colorRenderbuffer;\r\n } else {\r\n this._bindUnboundFramebuffer(rtWrapper._framebuffer);\r\n }\r\n\r\n rtWrapper.texture.samples = samples;\r\n rtWrapper._depthStencilBuffer = this._setupFramebufferDepthAttachments(\r\n rtWrapper._generateStencilBuffer,\r\n rtWrapper._generateDepthBuffer,\r\n rtWrapper.texture.width,\r\n rtWrapper.texture.height,\r\n samples\r\n );\r\n\r\n this._bindUnboundFramebuffer(null);\r\n\r\n return samples;\r\n};\r\n"]}
1
+ {"version":3,"file":"engine.renderTarget.js","sourceRoot":"","sources":["../../../../sourceES6/core/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AgB,CAAC,CAAC;QAEzD,IAAM,iBAAiB,GAAG,IAAI,CAAC,mBAAmB,CAC9C,SAAS,CAAC,OAAO,CAAC,KAAK,EACvB,SAAS,CAAC,OAAO,CAAC,MAAM,EACxB,OAAO,EACP,CAAC,CAAC,CAAC,cAAc,EACjB,IAAI,CAAC,+BAA+B,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,EAC5D,EAAE,CAAC,iBAAiB,EACpB,KAAK,CACR,CAAC;QAEF,IAAI,CAAC,iBAAiB,EAAE;YACpB,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;SACjE;QAED,eAAe,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;KACzD;SAAM;QACH,IAAI,CAAC,uBAAuB,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;KACxD;IAED,SAAS,CAAC,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC;IACpC,SAAS,CAAC,mBAAmB,GAAG,IAAI,CAAC,iCAAiC,CAClE,SAAS,CAAC,sBAAsB,EAChC,SAAS,CAAC,oBAAoB,EAC9B,SAAS,CAAC,OAAO,CAAC,KAAK,EACvB,SAAS,CAAC,OAAO,CAAC,MAAM,EACxB,OAAO,CACV,CAAC;IAEF,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,CAAC;IAEnC,OAAO,OAAO,CAAC;AACnB,CAAC,CAAC","sourcesContent":["import { InternalTexture, InternalTextureSource } from \"../../Materials/Textures/internalTexture\";\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport { RenderTargetCreationOptions, DepthTextureCreationOptions } from \"../../Materials/Textures/textureCreationOptions\";\r\nimport { ThinEngine } from \"../thinEngine\";\r\nimport { Nullable } from \"../../types\";\r\nimport { RenderTargetWrapper } from \"../renderTargetWrapper\";\r\nimport { WebGLRenderTargetWrapper } from \"../WebGL/webGLRenderTargetWrapper\";\r\nimport { WebGLHardwareTexture } from \"../WebGL/webGLHardwareTexture\";\r\nimport { TextureSize } from \"../../Materials/Textures/textureCreationOptions\";\r\n\r\n\r\n/**\r\n * Type used to define a texture size (either with a number or with a rect width and height)\r\n * @deprecated please use TextureSize instead\r\n */\r\nexport type RenderTargetTextureSize = TextureSize;\r\n\r\ndeclare module \"../../Engines/thinEngine\" {\r\n export interface ThinEngine {\r\n /**\r\n * Creates a new render target texture\r\n * @param size defines the size of the texture\r\n * @param options defines the options used to create the texture\r\n * @returns a new render target wrapper ready to render texture\r\n */\r\n createRenderTargetTexture(size: TextureSize, options: boolean | RenderTargetCreationOptions): RenderTargetWrapper;\r\n\r\n /**\r\n * Creates a depth stencil texture.\r\n * This is only available in WebGL 2 or with the depth texture extension available.\r\n * @param size The size of face edge in the texture.\r\n * @param options The options defining the texture.\r\n * @param rtWrapper The render target wrapper for which the depth/stencil texture must be created\r\n * @returns The texture\r\n */\r\n createDepthStencilTexture(size: TextureSize, options: DepthTextureCreationOptions, rtWrapper: RenderTargetWrapper): InternalTexture;\r\n\r\n /**\r\n * Updates the sample count of a render target texture\r\n * @see https://doc.babylonjs.com/features/webgl2#multisample-render-targets\r\n * @param rtWrapper defines the render target wrapper to update\r\n * @param samples defines the sample count to set\r\n * @returns the effective sample count (could be 0 if multisample render targets are not supported)\r\n */\r\n updateRenderTargetTextureSampleCount(rtWrapper: Nullable<RenderTargetWrapper>, samples: number): number;\r\n\r\n /** @hidden */\r\n _createDepthStencilTexture(size: TextureSize, options: DepthTextureCreationOptions, rtWrapper: RenderTargetWrapper): InternalTexture;\r\n\r\n /** @hidden */\r\n _createHardwareRenderTargetWrapper(isMulti: boolean, isCube: boolean, size: TextureSize): RenderTargetWrapper;\r\n }\r\n}\r\n\r\nThinEngine.prototype._createHardwareRenderTargetWrapper = function (isMulti: boolean, isCube: boolean, size: TextureSize): RenderTargetWrapper {\r\n const rtWrapper = new WebGLRenderTargetWrapper(isMulti, isCube, size, this, this._gl);\r\n this._renderTargetWrapperCache.push(rtWrapper);\r\n return rtWrapper;\r\n};\r\n\r\nThinEngine.prototype.createRenderTargetTexture = function (this: ThinEngine, size: TextureSize, options: boolean | RenderTargetCreationOptions): RenderTargetWrapper {\r\n const rtWrapper = this._createHardwareRenderTargetWrapper(false, false, size) as WebGLRenderTargetWrapper;\r\n\r\n const fullOptions: RenderTargetCreationOptions = {};\r\n if (options !== undefined && typeof options === \"object\") {\r\n fullOptions.generateDepthBuffer = !!options.generateDepthBuffer;\r\n fullOptions.generateStencilBuffer = !!options.generateStencilBuffer;\r\n } else {\r\n fullOptions.generateDepthBuffer = true;\r\n fullOptions.generateStencilBuffer = false;\r\n }\r\n\r\n const texture = this._createInternalTexture(size, options, true, InternalTextureSource.RenderTarget);\r\n const width = (<{ width: number; height: number; layers?: number }>size).width || <number>size;\r\n const height = (<{ width: number; height: number; layers?: number }>size).height || <number>size;\r\n\r\n const currentFrameBuffer = this._currentFramebuffer;\r\n const gl = this._gl;\r\n\r\n // Create the framebuffer\r\n const framebuffer = gl.createFramebuffer();\r\n this._bindUnboundFramebuffer(framebuffer);\r\n rtWrapper._depthStencilBuffer = this._setupFramebufferDepthAttachments(fullOptions.generateStencilBuffer ? true : false, fullOptions.generateDepthBuffer, width, height);\r\n\r\n // No need to rebind on every frame\r\n if (!texture.is2DArray) {\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture._hardwareTexture!.underlyingResource, 0);\r\n }\r\n\r\n this._bindUnboundFramebuffer(currentFrameBuffer);\r\n\r\n rtWrapper._framebuffer = framebuffer;\r\n rtWrapper._generateDepthBuffer = fullOptions.generateDepthBuffer;\r\n rtWrapper._generateStencilBuffer = fullOptions.generateStencilBuffer ? true : false;\r\n\r\n rtWrapper.setTextures(texture);\r\n\r\n return rtWrapper;\r\n};\r\n\r\nThinEngine.prototype.createDepthStencilTexture = function (size: TextureSize, options: DepthTextureCreationOptions, rtWrapper: RenderTargetWrapper): InternalTexture {\r\n if (options.isCube) {\r\n let width = (<{ width: number; height: number }>size).width || <number>size;\r\n return this._createDepthStencilCubeTexture(width, options, rtWrapper);\r\n } else {\r\n return this._createDepthStencilTexture(size, options, rtWrapper);\r\n }\r\n};\r\n\r\nThinEngine.prototype._createDepthStencilTexture = function (size: TextureSize, options: DepthTextureCreationOptions, rtWrapper: RenderTargetWrapper): InternalTexture {\r\n const gl = this._gl;\r\n const layers = (<{ width: number; height: number; layers?: number }>size).layers || 0;\r\n const target = layers !== 0 ? gl.TEXTURE_2D_ARRAY : gl.TEXTURE_2D;\r\n const internalTexture = new InternalTexture(this, InternalTextureSource.DepthStencil);\r\n if (!this._caps.depthTextureExtension) {\r\n Logger.Error(\"Depth texture is not supported by your browser or hardware.\");\r\n return internalTexture;\r\n }\r\n\r\n const internalOptions = {\r\n bilinearFiltering: false,\r\n comparisonFunction: 0,\r\n generateStencil: false,\r\n ...options,\r\n };\r\n\r\n this._bindTextureDirectly(target, internalTexture, true);\r\n\r\n this._setupDepthStencilTexture(\r\n internalTexture,\r\n size,\r\n internalOptions.generateStencil,\r\n\r\n internalOptions.comparisonFunction === 0 ? false : internalOptions.bilinearFiltering,\r\n internalOptions.comparisonFunction\r\n );\r\n\r\n internalTexture.format = internalOptions.generateStencil ? 13 : 16;\r\n\r\n rtWrapper._depthStencilTexture = internalTexture;\r\n rtWrapper._depthStencilTextureWithStencil = internalOptions.generateStencil;\r\n\r\n const type = internalOptions.generateStencil ? gl.UNSIGNED_INT_24_8 : gl.UNSIGNED_INT;\r\n const internalFormat = internalOptions.generateStencil ? gl.DEPTH_STENCIL : gl.DEPTH_COMPONENT;\r\n let sizedFormat = internalFormat;\r\n if (this.webGLVersion > 1) {\r\n sizedFormat = internalOptions.generateStencil ? gl.DEPTH24_STENCIL8 : gl.DEPTH_COMPONENT24;\r\n }\r\n\r\n if (internalTexture.is2DArray) {\r\n gl.texImage3D(target, 0, sizedFormat, internalTexture.width, internalTexture.height, layers, 0, internalFormat, type, null);\r\n } else {\r\n gl.texImage2D(target, 0, sizedFormat, internalTexture.width, internalTexture.height, 0, internalFormat, type, null);\r\n }\r\n\r\n this._bindTextureDirectly(target, null);\r\n\r\n this._internalTexturesCache.push(internalTexture);\r\n\r\n return internalTexture;\r\n};\r\n\r\nThinEngine.prototype.updateRenderTargetTextureSampleCount = function (rtWrapper: Nullable<WebGLRenderTargetWrapper>, samples: number): number {\r\n if (this.webGLVersion < 2 || !rtWrapper || !rtWrapper.texture) {\r\n return 1;\r\n }\r\n\r\n if (rtWrapper.samples === samples) {\r\n return samples;\r\n }\r\n\r\n var gl = this._gl;\r\n\r\n samples = Math.min(samples, this.getCaps().maxMSAASamples);\r\n\r\n // Dispose previous render buffers\r\n if (rtWrapper._depthStencilBuffer) {\r\n gl.deleteRenderbuffer(rtWrapper._depthStencilBuffer);\r\n rtWrapper._depthStencilBuffer = null;\r\n }\r\n\r\n if (rtWrapper._MSAAFramebuffer) {\r\n gl.deleteFramebuffer(rtWrapper._MSAAFramebuffer);\r\n rtWrapper._MSAAFramebuffer = null;\r\n }\r\n\r\n const hardwareTexture = rtWrapper.texture._hardwareTexture as WebGLHardwareTexture;\r\n if (hardwareTexture._MSAARenderBuffer) {\r\n gl.deleteRenderbuffer(hardwareTexture._MSAARenderBuffer);\r\n hardwareTexture._MSAARenderBuffer = null;\r\n }\r\n\r\n if (samples > 1 && gl.renderbufferStorageMultisample) {\r\n let framebuffer = gl.createFramebuffer();\r\n\r\n if (!framebuffer) {\r\n throw new Error(\"Unable to create multi sampled framebuffer\");\r\n }\r\n\r\n rtWrapper._MSAAFramebuffer = framebuffer;\r\n this._bindUnboundFramebuffer(rtWrapper._MSAAFramebuffer);\r\n\r\n const colorRenderbuffer = this._createRenderBuffer(\r\n rtWrapper.texture.width,\r\n rtWrapper.texture.height,\r\n samples,\r\n -1 /* not used */,\r\n this._getRGBAMultiSampleBufferFormat(rtWrapper.texture.type),\r\n gl.COLOR_ATTACHMENT0,\r\n false\r\n );\r\n\r\n if (!colorRenderbuffer) {\r\n throw new Error(\"Unable to create multi sampled framebuffer\");\r\n }\r\n\r\n hardwareTexture._MSAARenderBuffer = colorRenderbuffer;\r\n } else {\r\n this._bindUnboundFramebuffer(rtWrapper._framebuffer);\r\n }\r\n\r\n rtWrapper.texture.samples = samples;\r\n rtWrapper._depthStencilBuffer = this._setupFramebufferDepthAttachments(\r\n rtWrapper._generateStencilBuffer,\r\n rtWrapper._generateDepthBuffer,\r\n rtWrapper.texture.width,\r\n rtWrapper.texture.height,\r\n samples\r\n );\r\n\r\n this._bindUnboundFramebuffer(null);\r\n\r\n return samples;\r\n};\r\n"]}
@@ -32,6 +32,10 @@ export interface IImage {
32
32
  * onload callback.
33
33
  */
34
34
  onload: ((this: GlobalEventHandlers, ev: Event) => any) | null;
35
+ /**
36
+ * Error callback.
37
+ */
38
+ onerror: ((this: GlobalEventHandlers, ev: Event) => any) | null;
35
39
  /**
36
40
  * Image source.
37
41
  */
@@ -1 +1 @@
1
- {"version":3,"file":"ICanvas.js","sourceRoot":"","sources":["../../../sourceES6/core/Engines/ICanvas.ts"],"names":[],"mappings":"","sourcesContent":["/**\r\n * Class used to abstract a canvas\r\n */\r\nexport interface ICanvas {\r\n /**\r\n * Canvas width.\r\n */\r\n width: number;\r\n\r\n /**\r\n * Canvas height.\r\n */\r\n height: number;\r\n\r\n /**\r\n * returns a drawing context on the canvas.\r\n * @param contextType context identifier.\r\n * @param contextAttributes context attributes.\r\n * @returns ICanvasRenderingContext object.\r\n */\r\n getContext(contextType: string, contextAttributes?: any): ICanvasRenderingContext;\r\n\r\n /**\r\n * returns a data URI containing a representation of the image in the format specified by the type parameter.\r\n * @param mime the image format.\r\n * @returns string containing the requested data URI.\r\n */\r\n toDataURL(mime: string): string;\r\n}\r\n\r\n/**\r\n * Class used to abstract am image to use with the canvas and its context\r\n */\r\nexport interface IImage {\r\n /**\r\n * onload callback.\r\n */\r\n onload: ((this: GlobalEventHandlers, ev: Event) => any) | null;\r\n\r\n /**\r\n * Image source.\r\n */\r\n src: string;\r\n\r\n /**\r\n * Image width.\r\n */\r\n readonly width: number;\r\n\r\n /**\r\n * Image height.\r\n */\r\n readonly height: number;\r\n\r\n /**\r\n * The original height of the image resource before sizing.\r\n */\r\n readonly naturalHeight: number;\r\n\r\n /**\r\n * The original width of the image resource before sizing.\r\n */\r\n readonly naturalWidth: number;\r\n\r\n /**\r\n * provides support for CORS, defining how the element handles crossorigin requests,\r\n * thereby enabling the configuration of the CORS requests for the element's fetched data.\r\n */\r\n crossOrigin: string | null;\r\n}\r\n\r\n/**\r\n * Class used to abstract a canvas gradient\r\n */\r\nexport interface ICanvasGradient {\r\n /**\r\n * adds a new color stop, defined by an offset and a color, to a given canvas gradient.\r\n * @param offset A number between 0 and 1, inclusive, representing the position of the color stop. 0 represents the start of the gradient and 1 represents the end.\r\n * @param color value representing the color of the stop.\r\n */\r\n addColorStop(offset: number, color: string): void;\r\n}\r\n\r\n/**\r\n * Class used to abstract a text measurement\r\n */\r\nexport interface ITextMetrics {\r\n /**\r\n * Text width.\r\n */\r\n readonly width: number;\r\n /**\r\n * distance (in pixels) parallel to the baseline from the alignment point given by the CanvasRenderingContext2D.textAlign\r\n * property to the left side of the bounding rectangle of the given text\r\n */\r\n readonly actualBoundingBoxLeft: number;\r\n /**\r\n * distance (in pixels) parallel to the baseline from the alignment point given by the CanvasRenderingContext2D.textAlign\r\n * property to the right side of the bounding rectangle of the given text\r\n */\r\n readonly actualBoundingBoxRight: number;\r\n}\r\n\r\n/**\r\n * Class used to abstract canvas rendering\r\n */\r\nexport interface ICanvasRenderingContext {\r\n /**\r\n * Defines the type of corners where two lines meet. Possible values: round, bevel, miter (default).\r\n */\r\n lineJoin: string;\r\n\r\n /**\r\n * Miter limit ratio. Default 10.\r\n */\r\n miterLimit: number;\r\n\r\n /**\r\n * Font setting. Default value 10px sans-serif.\r\n */\r\n font: string;\r\n\r\n /**\r\n * Color or style to use for the lines around shapes. Default #000 (black).\r\n */\r\n strokeStyle: string;\r\n\r\n /**\r\n * Color or style to use inside shapes. Default #000 (black).\r\n */\r\n fillStyle: string | ICanvasGradient;\r\n\r\n /**\r\n * Alpha value that is applied to shapes and images before they are composited onto the canvas. Default 1.0 (opaque).\r\n */\r\n globalAlpha: number;\r\n\r\n /**\r\n * Color of the shadow. Default: fully-transparent black.\r\n */\r\n shadowColor: string;\r\n\r\n /**\r\n * Specifies the blurring effect. Default: 0.\r\n */\r\n shadowBlur: number;\r\n\r\n /**\r\n * Horizontal distance the shadow will be offset. Default: 0.\r\n */\r\n shadowOffsetX: number;\r\n\r\n /**\r\n * Vertical distance the shadow will be offset. Default: 0.\r\n */\r\n shadowOffsetY: number;\r\n\r\n /**\r\n * Width of lines. Default 1.0.\r\n */\r\n lineWidth: number;\r\n\r\n /**\r\n * canvas is a read-only reference to ICanvas.\r\n */\r\n readonly canvas: ICanvas;\r\n\r\n /**\r\n * Sets all pixels in the rectangle defined by starting point (x, y) and size (width, height) to transparent black, erasing any previously drawn content.\r\n * @param x The x-axis coordinate of the rectangle's starting point.\r\n * @param y The y-axis coordinate of the rectangle's starting point.\r\n * @param width The rectangle's width. Positive values are to the right, and negative to the left.\r\n * @param height The rectangle's height. Positive values are down, and negative are up.\r\n */\r\n clearRect(x: number, y: number, width: number, height: number): void;\r\n\r\n /**\r\n * Saves the current drawing style state using a stack so you can revert any change you make to it using restore().\r\n */\r\n save(): void;\r\n\r\n /**\r\n * Restores the drawing style state to the last element on the 'state stack' saved by save().\r\n */\r\n restore(): void;\r\n\r\n /**\r\n * Draws a filled rectangle at (x, y) position whose size is determined by width and height.\r\n * @param x The x-axis coordinate of the rectangle's starting point.\r\n * @param y The y-axis coordinate of the rectangle's starting point.\r\n * @param width The rectangle's width. Positive values are to the right, and negative to the left.\r\n * @param height The rectangle's height. Positive values are down, and negative are up.\r\n */\r\n fillRect(x: number, y: number, width: number, height: number): void;\r\n\r\n /**\r\n * Adds a scaling transformation to the canvas units by x horizontally and by y vertically.\r\n * @param x Scaling factor in the horizontal direction. A negative value flips pixels across the vertical axis. A value of 1 results in no horizontal scaling.\r\n * @param y Scaling factor in the vertical direction. A negative value flips pixels across the horizontal axis. A value of 1 results in no vertical scaling.\r\n */\r\n scale(x: number, y: number): void;\r\n\r\n /**\r\n * Adds a rotation to the transformation matrix. The angle argument represents a clockwise rotation angle and is expressed in radians.\r\n * @param angle The rotation angle, clockwise in radians. You can use degree * Math.PI / 180 to calculate a radian from a degree.\r\n */\r\n rotate(angle: number): void;\r\n\r\n /**\r\n * Adds a translation transformation by moving the canvas and its origin x horzontally and y vertically on the grid.\r\n * @param x Distance to move in the horizontal direction. Positive values are to the right, and negative to the left.\r\n * @param y Distance to move in the vertical direction. Positive values are down, and negative are up.\r\n */\r\n translate(x: number, y: number): void;\r\n\r\n /**\r\n * Paints a rectangle which has a starting point at (x, y) and has a w width and an h height onto the canvas, using the current stroke style.\r\n * @param x The x-axis coordinate of the rectangle's starting point.\r\n * @param y The y-axis coordinate of the rectangle's starting point.\r\n * @param width The rectangle's width. Positive values are to the right, and negative to the left.\r\n * @param height The rectangle's height. Positive values are down, and negative are up.\r\n */\r\n strokeRect(x: number, y: number, width: number, height: number): void;\r\n\r\n /**\r\n * Creates a path for a rectangle at position (x, y) with a size that is determined by width and height.\r\n * @param x The x-axis coordinate of the rectangle's starting point.\r\n * @param y The y-axis coordinate of the rectangle's starting point.\r\n * @param width The rectangle's width. Positive values are to the right, and negative to the left.\r\n * @param height The rectangle's height. Positive values are down, and negative are up.\r\n */\r\n rect(x: number, y: number, width: number, height: number): void;\r\n\r\n /**\r\n * Creates a clipping path from the current sub-paths. Everything drawn after clip() is called appears inside the clipping path only.\r\n */\r\n clip(): void;\r\n\r\n /**\r\n * Paints data from the given ImageData object onto the bitmap. If a dirty rectangle is provided, only the pixels from that rectangle are painted.\r\n * @param imageData An ImageData object containing the array of pixel values.\r\n * @param dx Horizontal position (x coordinate) at which to place the image data in the destination canvas.\r\n * @param dy Vertical position (y coordinate) at which to place the image data in the destination canvas.\r\n */\r\n putImageData(imageData: ImageData, dx: number, dy: number): void;\r\n\r\n /**\r\n * Adds a circular arc to the current path.\r\n * @param x The horizontal coordinate of the arc's center.\r\n * @param y The vertical coordinate of the arc's center.\r\n * @param radius The arc's radius. Must be positive.\r\n * @param startAngle The angle at which the arc starts in radians, measured from the positive x-axis.\r\n * @param endAngle The angle at which the arc ends in radians, measured from the positive x-axis.\r\n * @param anticlockwise An optional Boolean. If true, draws the arc counter-clockwise between the start and end angles. The default is false (clockwise).\r\n */\r\n arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void;\r\n\r\n /**\r\n * Starts a new path by emptying the list of sub-paths. Call this method when you want to create a new path.\r\n */\r\n beginPath(): void;\r\n\r\n /**\r\n * Causes the point of the pen to move back to the start of the current sub-path. It tries to draw a straight line from the current point to the start.\r\n * If the shape has already been closed or has only one point, this function does nothing.\r\n */\r\n closePath(): void;\r\n\r\n /**\r\n * Moves the starting point of a new sub-path to the (x, y) coordinates.\r\n * @param x The x-axis (horizontal) coordinate of the point.\r\n * @param y The y-axis (vertical) coordinate of the point.\r\n */\r\n moveTo(x: number, y: number): void;\r\n\r\n /**\r\n * Connects the last point in the current sub-path to the specified (x, y) coordinates with a straight line.\r\n * @param x The x-axis coordinate of the line's end point.\r\n * @param y The y-axis coordinate of the line's end point.\r\n */\r\n lineTo(x: number, y: number): void;\r\n\r\n /**\r\n * Adds a quadratic Bézier curve to the current path.\r\n * @param cpx The x-axis coordinate of the control point.\r\n * @param cpy The y-axis coordinate of the control point.\r\n * @param x The x-axis coordinate of the end point.\r\n * @param y The y-axis coordinate of the end point.\r\n */\r\n quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void;\r\n\r\n /**\r\n * Returns a TextMetrics object.\r\n * @param text The text String to measure.\r\n * @returns ITextMetrics A ITextMetrics object.\r\n */\r\n measureText(text: string): ITextMetrics;\r\n\r\n /**\r\n * Strokes the current sub-paths with the current stroke style.\r\n */\r\n stroke(): void;\r\n\r\n /**\r\n * Fills the current sub-paths with the current fill style.\r\n */\r\n fill(): void;\r\n\r\n /**\r\n * Draws the specified image. This method is available in multiple formats, providing a great deal of flexibility in its use.\r\n * @param image An element to draw into the context.\r\n * @param sx The x-axis coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context.\r\n * @param sy The y-axis coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context.\r\n * @param sWidth The width of the sub-rectangle of the source image to draw into the destination context. If not specified, the entire rectangle from the coordinates specified by sx and sy to the bottom-right corner of the image is used.\r\n * @param sHeight The height of the sub-rectangle of the source image to draw into the destination context.\r\n * @param dx The x-axis coordinate in the destination canvas at which to place the top-left corner of the source image.\r\n * @param dy The y-axis coordinate in the destination canvas at which to place the top-left corner of the source image.\r\n * @param dWidth The width to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in width when drawn.\r\n * @param dHeight The height to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in height when drawn.\r\n */\r\n\r\n drawImage(image: any, sx: number, sy: number, sWidth: number, sHeight: number, dx: number, dy: number, dWidth: number, dHeight: number): void;\r\n /**\r\n * Draws the specified image. This method is available in multiple formats, providing a great deal of flexibility in its use.\r\n * @param image An element to draw into the context.\r\n * @param dx The x-axis coordinate in the destination canvas at which to place the top-left corner of the source image.\r\n * @param dy The y-axis coordinate in the destination canvas at which to place the top-left corner of the source image.\r\n * @param dWidth The width to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in width when drawn.\r\n * @param dHeight The height to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in height when drawn.\r\n */\r\n drawImage(image: any, dx: number, dy: number, dWidth: number, dHeight: number): void;\r\n\r\n /**\r\n * Draws the specified image. This method is available in multiple formats, providing a great deal of flexibility in its use.\r\n * @param image An element to draw into the context.\r\n * @param dx The x-axis coordinate in the destination canvas at which to place the top-left corner of the source image.\r\n * @param dy The y-axis coordinate in the destination canvas at which to place the top-left corner of the source image.\r\n */\r\n drawImage(image: any, dx: number, dy: number): void;\r\n\r\n /**\r\n * Returns an ImageData object representing the underlying pixel data for the area of the canvas denoted by the rectangle which starts at (sx, sy) and has an sw width and sh height.\r\n * @param sx The x-axis coordinate of the top-left corner of the rectangle from which the ImageData will be extracted.\r\n * @param sy The y-axis coordinate of the top-left corner of the rectangle from which the ImageData will be extracted.\r\n * @param sw The width of the rectangle from which the ImageData will be extracted. Positive values are to the right, and negative to the left.\r\n * @param sh The height of the rectangle from which the ImageData will be extracted. Positive values are down, and negative are up.\r\n * @returns ImageData An ImageData object containing the image data for the rectangle of the canvas specified.\r\n */\r\n getImageData(sx: number, sy: number, sw: number, sh: number): ImageData;\r\n\r\n /**\r\n * Sets the current line dash pattern.\r\n * @param segments An Array of numbers that specify distances to alternately draw a line and a gap (in coordinate space units).\r\n */\r\n setLineDash(segments: Array<number>): void;\r\n\r\n /**\r\n * Draws (fills) a given text at the given (x, y) position.\r\n * @param text A String specifying the text string to render into the context. The text is rendered using the settings specified by font, textAlign, textBaseline, and direction.\r\n * @param x The x-axis coordinate of the point at which to begin drawing the text, in pixels.\r\n * @param y The y-axis coordinate of the baseline on which to begin drawing the text, in pixels.\r\n * @param maxWidth The maximum number of pixels wide the text may be once rendered. If not specified, there is no limit to the width of the text.\r\n */\r\n fillText(text: string, x: number, y: number, maxWidth?: number): void;\r\n\r\n /**\r\n * Draws (strokes) a given text at the given (x, y) position.\r\n * @param text A String specifying the text string to render into the context. The text is rendered using the settings specified by font, textAlign, textBaseline, and direction.\r\n * @param x The x-axis coordinate of the point at which to begin drawing the text, in pixels.\r\n * @param y The y-axis coordinate of the baseline on which to begin drawing the text, in pixels.\r\n * @param maxWidth The maximum number of pixels wide the text may be once rendered. If not specified, there is no limit to the width of the text.\r\n */\r\n strokeText(text: string, x: number, y: number, maxWidth?: number): void;\r\n\r\n /**\r\n * Creates a linear gradient along the line given by the coordinates represented by the parameters.\r\n * @param x0 The x-axis coordinate of the start point.\r\n * @param y0 The y-axis coordinate of the start point.\r\n * @param x1 The x-axis coordinate of the end point.\r\n * @param y1 The y-axis coordinate of the end point.\r\n * @returns ICanvasGradient A linear ICanvasGradient initialized with the specified line.\r\n */\r\n createLinearGradient(x0: number, y0: number, x1: number, y1: number): ICanvasGradient;\r\n\r\n /**\r\n * Resets the current transform to matrix composed with a, b, c, d, e, f.\r\n * @param a Horizontal scaling. A value of 1 results in no scaling.\r\n * @param b Vertical skewing.\r\n * @param c Horizontal skewing.\r\n * @param d Vertical scaling. A value of 1 results in no scaling.\r\n * @param e Horizontal translation (moving).\r\n * @param f Vertical translation (moving).\r\n */\r\n setTransform(a: number, b: number, c: number, d: number, e: number, f: number): void;\r\n}\r\n"]}
1
+ {"version":3,"file":"ICanvas.js","sourceRoot":"","sources":["../../../sourceES6/core/Engines/ICanvas.ts"],"names":[],"mappings":"","sourcesContent":["/**\r\n * Class used to abstract a canvas\r\n */\r\nexport interface ICanvas {\r\n /**\r\n * Canvas width.\r\n */\r\n width: number;\r\n\r\n /**\r\n * Canvas height.\r\n */\r\n height: number;\r\n\r\n /**\r\n * returns a drawing context on the canvas.\r\n * @param contextType context identifier.\r\n * @param contextAttributes context attributes.\r\n * @returns ICanvasRenderingContext object.\r\n */\r\n getContext(contextType: string, contextAttributes?: any): ICanvasRenderingContext;\r\n\r\n /**\r\n * returns a data URI containing a representation of the image in the format specified by the type parameter.\r\n * @param mime the image format.\r\n * @returns string containing the requested data URI.\r\n */\r\n toDataURL(mime: string): string;\r\n}\r\n\r\n/**\r\n * Class used to abstract am image to use with the canvas and its context\r\n */\r\nexport interface IImage {\r\n /**\r\n * onload callback.\r\n */\r\n onload: ((this: GlobalEventHandlers, ev: Event) => any) | null;\r\n\r\n /**\r\n * Error callback.\r\n */\r\n onerror: ((this: GlobalEventHandlers, ev: Event) => any) | null;\r\n\r\n /**\r\n * Image source.\r\n */\r\n src: string;\r\n\r\n /**\r\n * Image width.\r\n */\r\n readonly width: number;\r\n\r\n /**\r\n * Image height.\r\n */\r\n readonly height: number;\r\n\r\n /**\r\n * The original height of the image resource before sizing.\r\n */\r\n readonly naturalHeight: number;\r\n\r\n /**\r\n * The original width of the image resource before sizing.\r\n */\r\n readonly naturalWidth: number;\r\n\r\n /**\r\n * provides support for CORS, defining how the element handles crossorigin requests,\r\n * thereby enabling the configuration of the CORS requests for the element's fetched data.\r\n */\r\n crossOrigin: string | null;\r\n}\r\n\r\n/**\r\n * Class used to abstract a canvas gradient\r\n */\r\nexport interface ICanvasGradient {\r\n /**\r\n * adds a new color stop, defined by an offset and a color, to a given canvas gradient.\r\n * @param offset A number between 0 and 1, inclusive, representing the position of the color stop. 0 represents the start of the gradient and 1 represents the end.\r\n * @param color value representing the color of the stop.\r\n */\r\n addColorStop(offset: number, color: string): void;\r\n}\r\n\r\n/**\r\n * Class used to abstract a text measurement\r\n */\r\nexport interface ITextMetrics {\r\n /**\r\n * Text width.\r\n */\r\n readonly width: number;\r\n /**\r\n * distance (in pixels) parallel to the baseline from the alignment point given by the CanvasRenderingContext2D.textAlign\r\n * property to the left side of the bounding rectangle of the given text\r\n */\r\n readonly actualBoundingBoxLeft: number;\r\n /**\r\n * distance (in pixels) parallel to the baseline from the alignment point given by the CanvasRenderingContext2D.textAlign\r\n * property to the right side of the bounding rectangle of the given text\r\n */\r\n readonly actualBoundingBoxRight: number;\r\n}\r\n\r\n/**\r\n * Class used to abstract canvas rendering\r\n */\r\nexport interface ICanvasRenderingContext {\r\n /**\r\n * Defines the type of corners where two lines meet. Possible values: round, bevel, miter (default).\r\n */\r\n lineJoin: string;\r\n\r\n /**\r\n * Miter limit ratio. Default 10.\r\n */\r\n miterLimit: number;\r\n\r\n /**\r\n * Font setting. Default value 10px sans-serif.\r\n */\r\n font: string;\r\n\r\n /**\r\n * Color or style to use for the lines around shapes. Default #000 (black).\r\n */\r\n strokeStyle: string;\r\n\r\n /**\r\n * Color or style to use inside shapes. Default #000 (black).\r\n */\r\n fillStyle: string | ICanvasGradient;\r\n\r\n /**\r\n * Alpha value that is applied to shapes and images before they are composited onto the canvas. Default 1.0 (opaque).\r\n */\r\n globalAlpha: number;\r\n\r\n /**\r\n * Color of the shadow. Default: fully-transparent black.\r\n */\r\n shadowColor: string;\r\n\r\n /**\r\n * Specifies the blurring effect. Default: 0.\r\n */\r\n shadowBlur: number;\r\n\r\n /**\r\n * Horizontal distance the shadow will be offset. Default: 0.\r\n */\r\n shadowOffsetX: number;\r\n\r\n /**\r\n * Vertical distance the shadow will be offset. Default: 0.\r\n */\r\n shadowOffsetY: number;\r\n\r\n /**\r\n * Width of lines. Default 1.0.\r\n */\r\n lineWidth: number;\r\n\r\n /**\r\n * canvas is a read-only reference to ICanvas.\r\n */\r\n readonly canvas: ICanvas;\r\n\r\n /**\r\n * Sets all pixels in the rectangle defined by starting point (x, y) and size (width, height) to transparent black, erasing any previously drawn content.\r\n * @param x The x-axis coordinate of the rectangle's starting point.\r\n * @param y The y-axis coordinate of the rectangle's starting point.\r\n * @param width The rectangle's width. Positive values are to the right, and negative to the left.\r\n * @param height The rectangle's height. Positive values are down, and negative are up.\r\n */\r\n clearRect(x: number, y: number, width: number, height: number): void;\r\n\r\n /**\r\n * Saves the current drawing style state using a stack so you can revert any change you make to it using restore().\r\n */\r\n save(): void;\r\n\r\n /**\r\n * Restores the drawing style state to the last element on the 'state stack' saved by save().\r\n */\r\n restore(): void;\r\n\r\n /**\r\n * Draws a filled rectangle at (x, y) position whose size is determined by width and height.\r\n * @param x The x-axis coordinate of the rectangle's starting point.\r\n * @param y The y-axis coordinate of the rectangle's starting point.\r\n * @param width The rectangle's width. Positive values are to the right, and negative to the left.\r\n * @param height The rectangle's height. Positive values are down, and negative are up.\r\n */\r\n fillRect(x: number, y: number, width: number, height: number): void;\r\n\r\n /**\r\n * Adds a scaling transformation to the canvas units by x horizontally and by y vertically.\r\n * @param x Scaling factor in the horizontal direction. A negative value flips pixels across the vertical axis. A value of 1 results in no horizontal scaling.\r\n * @param y Scaling factor in the vertical direction. A negative value flips pixels across the horizontal axis. A value of 1 results in no vertical scaling.\r\n */\r\n scale(x: number, y: number): void;\r\n\r\n /**\r\n * Adds a rotation to the transformation matrix. The angle argument represents a clockwise rotation angle and is expressed in radians.\r\n * @param angle The rotation angle, clockwise in radians. You can use degree * Math.PI / 180 to calculate a radian from a degree.\r\n */\r\n rotate(angle: number): void;\r\n\r\n /**\r\n * Adds a translation transformation by moving the canvas and its origin x horzontally and y vertically on the grid.\r\n * @param x Distance to move in the horizontal direction. Positive values are to the right, and negative to the left.\r\n * @param y Distance to move in the vertical direction. Positive values are down, and negative are up.\r\n */\r\n translate(x: number, y: number): void;\r\n\r\n /**\r\n * Paints a rectangle which has a starting point at (x, y) and has a w width and an h height onto the canvas, using the current stroke style.\r\n * @param x The x-axis coordinate of the rectangle's starting point.\r\n * @param y The y-axis coordinate of the rectangle's starting point.\r\n * @param width The rectangle's width. Positive values are to the right, and negative to the left.\r\n * @param height The rectangle's height. Positive values are down, and negative are up.\r\n */\r\n strokeRect(x: number, y: number, width: number, height: number): void;\r\n\r\n /**\r\n * Creates a path for a rectangle at position (x, y) with a size that is determined by width and height.\r\n * @param x The x-axis coordinate of the rectangle's starting point.\r\n * @param y The y-axis coordinate of the rectangle's starting point.\r\n * @param width The rectangle's width. Positive values are to the right, and negative to the left.\r\n * @param height The rectangle's height. Positive values are down, and negative are up.\r\n */\r\n rect(x: number, y: number, width: number, height: number): void;\r\n\r\n /**\r\n * Creates a clipping path from the current sub-paths. Everything drawn after clip() is called appears inside the clipping path only.\r\n */\r\n clip(): void;\r\n\r\n /**\r\n * Paints data from the given ImageData object onto the bitmap. If a dirty rectangle is provided, only the pixels from that rectangle are painted.\r\n * @param imageData An ImageData object containing the array of pixel values.\r\n * @param dx Horizontal position (x coordinate) at which to place the image data in the destination canvas.\r\n * @param dy Vertical position (y coordinate) at which to place the image data in the destination canvas.\r\n */\r\n putImageData(imageData: ImageData, dx: number, dy: number): void;\r\n\r\n /**\r\n * Adds a circular arc to the current path.\r\n * @param x The horizontal coordinate of the arc's center.\r\n * @param y The vertical coordinate of the arc's center.\r\n * @param radius The arc's radius. Must be positive.\r\n * @param startAngle The angle at which the arc starts in radians, measured from the positive x-axis.\r\n * @param endAngle The angle at which the arc ends in radians, measured from the positive x-axis.\r\n * @param anticlockwise An optional Boolean. If true, draws the arc counter-clockwise between the start and end angles. The default is false (clockwise).\r\n */\r\n arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void;\r\n\r\n /**\r\n * Starts a new path by emptying the list of sub-paths. Call this method when you want to create a new path.\r\n */\r\n beginPath(): void;\r\n\r\n /**\r\n * Causes the point of the pen to move back to the start of the current sub-path. It tries to draw a straight line from the current point to the start.\r\n * If the shape has already been closed or has only one point, this function does nothing.\r\n */\r\n closePath(): void;\r\n\r\n /**\r\n * Moves the starting point of a new sub-path to the (x, y) coordinates.\r\n * @param x The x-axis (horizontal) coordinate of the point.\r\n * @param y The y-axis (vertical) coordinate of the point.\r\n */\r\n moveTo(x: number, y: number): void;\r\n\r\n /**\r\n * Connects the last point in the current sub-path to the specified (x, y) coordinates with a straight line.\r\n * @param x The x-axis coordinate of the line's end point.\r\n * @param y The y-axis coordinate of the line's end point.\r\n */\r\n lineTo(x: number, y: number): void;\r\n\r\n /**\r\n * Adds a quadratic Bézier curve to the current path.\r\n * @param cpx The x-axis coordinate of the control point.\r\n * @param cpy The y-axis coordinate of the control point.\r\n * @param x The x-axis coordinate of the end point.\r\n * @param y The y-axis coordinate of the end point.\r\n */\r\n quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void;\r\n\r\n /**\r\n * Returns a TextMetrics object.\r\n * @param text The text String to measure.\r\n * @returns ITextMetrics A ITextMetrics object.\r\n */\r\n measureText(text: string): ITextMetrics;\r\n\r\n /**\r\n * Strokes the current sub-paths with the current stroke style.\r\n */\r\n stroke(): void;\r\n\r\n /**\r\n * Fills the current sub-paths with the current fill style.\r\n */\r\n fill(): void;\r\n\r\n /**\r\n * Draws the specified image. This method is available in multiple formats, providing a great deal of flexibility in its use.\r\n * @param image An element to draw into the context.\r\n * @param sx The x-axis coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context.\r\n * @param sy The y-axis coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context.\r\n * @param sWidth The width of the sub-rectangle of the source image to draw into the destination context. If not specified, the entire rectangle from the coordinates specified by sx and sy to the bottom-right corner of the image is used.\r\n * @param sHeight The height of the sub-rectangle of the source image to draw into the destination context.\r\n * @param dx The x-axis coordinate in the destination canvas at which to place the top-left corner of the source image.\r\n * @param dy The y-axis coordinate in the destination canvas at which to place the top-left corner of the source image.\r\n * @param dWidth The width to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in width when drawn.\r\n * @param dHeight The height to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in height when drawn.\r\n */\r\n\r\n drawImage(image: any, sx: number, sy: number, sWidth: number, sHeight: number, dx: number, dy: number, dWidth: number, dHeight: number): void;\r\n /**\r\n * Draws the specified image. This method is available in multiple formats, providing a great deal of flexibility in its use.\r\n * @param image An element to draw into the context.\r\n * @param dx The x-axis coordinate in the destination canvas at which to place the top-left corner of the source image.\r\n * @param dy The y-axis coordinate in the destination canvas at which to place the top-left corner of the source image.\r\n * @param dWidth The width to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in width when drawn.\r\n * @param dHeight The height to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in height when drawn.\r\n */\r\n drawImage(image: any, dx: number, dy: number, dWidth: number, dHeight: number): void;\r\n\r\n /**\r\n * Draws the specified image. This method is available in multiple formats, providing a great deal of flexibility in its use.\r\n * @param image An element to draw into the context.\r\n * @param dx The x-axis coordinate in the destination canvas at which to place the top-left corner of the source image.\r\n * @param dy The y-axis coordinate in the destination canvas at which to place the top-left corner of the source image.\r\n */\r\n drawImage(image: any, dx: number, dy: number): void;\r\n\r\n /**\r\n * Returns an ImageData object representing the underlying pixel data for the area of the canvas denoted by the rectangle which starts at (sx, sy) and has an sw width and sh height.\r\n * @param sx The x-axis coordinate of the top-left corner of the rectangle from which the ImageData will be extracted.\r\n * @param sy The y-axis coordinate of the top-left corner of the rectangle from which the ImageData will be extracted.\r\n * @param sw The width of the rectangle from which the ImageData will be extracted. Positive values are to the right, and negative to the left.\r\n * @param sh The height of the rectangle from which the ImageData will be extracted. Positive values are down, and negative are up.\r\n * @returns ImageData An ImageData object containing the image data for the rectangle of the canvas specified.\r\n */\r\n getImageData(sx: number, sy: number, sw: number, sh: number): ImageData;\r\n\r\n /**\r\n * Sets the current line dash pattern.\r\n * @param segments An Array of numbers that specify distances to alternately draw a line and a gap (in coordinate space units).\r\n */\r\n setLineDash(segments: Array<number>): void;\r\n\r\n /**\r\n * Draws (fills) a given text at the given (x, y) position.\r\n * @param text A String specifying the text string to render into the context. The text is rendered using the settings specified by font, textAlign, textBaseline, and direction.\r\n * @param x The x-axis coordinate of the point at which to begin drawing the text, in pixels.\r\n * @param y The y-axis coordinate of the baseline on which to begin drawing the text, in pixels.\r\n * @param maxWidth The maximum number of pixels wide the text may be once rendered. If not specified, there is no limit to the width of the text.\r\n */\r\n fillText(text: string, x: number, y: number, maxWidth?: number): void;\r\n\r\n /**\r\n * Draws (strokes) a given text at the given (x, y) position.\r\n * @param text A String specifying the text string to render into the context. The text is rendered using the settings specified by font, textAlign, textBaseline, and direction.\r\n * @param x The x-axis coordinate of the point at which to begin drawing the text, in pixels.\r\n * @param y The y-axis coordinate of the baseline on which to begin drawing the text, in pixels.\r\n * @param maxWidth The maximum number of pixels wide the text may be once rendered. If not specified, there is no limit to the width of the text.\r\n */\r\n strokeText(text: string, x: number, y: number, maxWidth?: number): void;\r\n\r\n /**\r\n * Creates a linear gradient along the line given by the coordinates represented by the parameters.\r\n * @param x0 The x-axis coordinate of the start point.\r\n * @param y0 The y-axis coordinate of the start point.\r\n * @param x1 The x-axis coordinate of the end point.\r\n * @param y1 The y-axis coordinate of the end point.\r\n * @returns ICanvasGradient A linear ICanvasGradient initialized with the specified line.\r\n */\r\n createLinearGradient(x0: number, y0: number, x1: number, y1: number): ICanvasGradient;\r\n\r\n /**\r\n * Resets the current transform to matrix composed with a, b, c, d, e, f.\r\n * @param a Horizontal scaling. A value of 1 results in no scaling.\r\n * @param b Vertical skewing.\r\n * @param c Horizontal skewing.\r\n * @param d Vertical scaling. A value of 1 results in no scaling.\r\n * @param e Horizontal translation (moving).\r\n * @param f Vertical translation (moving).\r\n */\r\n setTransform(a: number, b: number, c: number, d: number, e: number, f: number): void;\r\n}\r\n"]}
@@ -27,7 +27,7 @@ export interface INativeEngine {
27
27
  getTextureHeight(texture: WebGLTexture): number;
28
28
  copyTexture(desination: Nullable<WebGLTexture>, source: Nullable<WebGLTexture>): void;
29
29
  deleteTexture(texture: Nullable<WebGLTexture>): void;
30
- createImageBitmap(data: ArrayBufferView): ImageBitmap;
30
+ createImageBitmap(data: ArrayBufferView | IImage): ImageBitmap;
31
31
  resizeImageBitmap(image: ImageBitmap, bufferWidth: number, bufferHeight: number): Uint8Array;
32
32
  createFrameBuffer(texture: WebGLTexture, width: number, height: number, format: number, generateStencilBuffer: boolean, generateDepthBuffer: boolean, generateMips: boolean): WebGLFramebuffer;
33
33
  getRenderWidth(): number;
@@ -1 +1 @@
1
- {"version":3,"file":"nativeInterfaces.js","sourceRoot":"","sources":["../../../../sourceES6/core/Engines/Native/nativeInterfaces.ts"],"names":[],"mappings":"","sourcesContent":["import { INativeInput } from \"../../DeviceInput/InputDevices/inputInterfaces\";\r\nimport { InternalTexture } from \"../../Materials/Textures/internalTexture\";\r\nimport { Nullable } from \"../../types\";\r\nimport { ICanvas, IImage } from \"../ICanvas\";\r\nimport { 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(vertexArray: NativeData, vertexBuffer: NativeData, location: number, byteOffset: number, byteStride: number, numElements: number, type: number, normalized: boolean, instanceDivisor: number): 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(texture: WebGLTexture, data: Nullable<ArrayBufferView>, width: number, height: number, depth: number, format: number, generateMipMaps: boolean, invertY: boolean): 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\r\n createImageBitmap(data: ArrayBufferView): ImageBitmap;\r\n resizeImageBitmap(image: ImageBitmap, bufferWidth: number, bufferHeight: number): Uint8Array;\r\n\r\n createFrameBuffer(texture: WebGLTexture, width: number, height: number, format: number, generateStencilBuffer: boolean, generateDepthBuffer: boolean, generateMips: boolean): 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 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: INativeInput;\r\n new(): INativeInput;\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":["../../../../sourceES6/core/Engines/Native/nativeInterfaces.ts"],"names":[],"mappings":"","sourcesContent":["import { INativeInput } from \"../../DeviceInput/InputDevices/inputInterfaces\";\r\nimport { InternalTexture } from \"../../Materials/Textures/internalTexture\";\r\nimport { Nullable } from \"../../types\";\r\nimport { ICanvas, IImage } from \"../ICanvas\";\r\nimport { 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(vertexArray: NativeData, vertexBuffer: NativeData, location: number, byteOffset: number, byteStride: number, numElements: number, type: number, normalized: boolean, instanceDivisor: number): 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(texture: WebGLTexture, data: Nullable<ArrayBufferView>, width: number, height: number, depth: number, format: number, generateMipMaps: boolean, invertY: boolean): 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\r\n createImageBitmap(data: ArrayBufferView | IImage): ImageBitmap;\r\n resizeImageBitmap(image: ImageBitmap, bufferWidth: number, bufferHeight: number): Uint8Array;\r\n\r\n createFrameBuffer(texture: WebGLTexture, width: number, height: number, format: number, generateStencilBuffer: boolean, generateDepthBuffer: boolean, generateMips: boolean): 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 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: INativeInput;\r\n new(): INativeInput;\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"]}
@@ -18,7 +18,6 @@ import "./Extensions/engine.alpha";
18
18
  import "./Extensions/engine.readTexture";
19
19
  import "./Extensions/engine.dynamicBuffer";
20
20
  import { IAudioEngine } from '../Audio/Interfaces/IAudioEngine';
21
- import { IPointerEvent } from "../Events/deviceInputEvents";
22
21
  declare type Material = import("../Materials/material").Material;
23
22
  declare type PostProcess = import("../PostProcesses/postProcess").PostProcess;
24
23
  /**
@@ -249,6 +248,14 @@ export declare class Engine extends ThinEngine {
249
248
  * Gets the latest created scene
250
249
  */
251
250
  static get LastCreatedScene(): Nullable<Scene>;
251
+ /** @hidden */
252
+ /**
253
+ * Engine abstraction for loading and creating an image bitmap from a given source string.
254
+ * @param imageSource source to load the image from.
255
+ * @param options An object that sets options for the image's extraction.
256
+ * @returns ImageBitmap.
257
+ */
258
+ createImageBitmapFromSource(imageSource: string, options?: ImageBitmapOptions): Promise<ImageBitmap>;
252
259
  /**
253
260
  * Engine abstraction for createImageBitmap
254
261
  * @param image source for image
@@ -322,7 +329,7 @@ export declare class Engine extends ThinEngine {
322
329
  /**
323
330
  * Observable event triggered each time the canvas receives pointerout event
324
331
  */
325
- onCanvasPointerOutObservable: Observable<IPointerEvent>;
332
+ onCanvasPointerOutObservable: Observable<PointerEvent>;
326
333
  /**
327
334
  * Observable raised when the engine begins a new frame
328
335
  */
@@ -944,6 +951,11 @@ interface CanvasRenderingContext2D {
944
951
  msImageSmoothingEnabled: boolean;
945
952
  }
946
953
 
954
+ // Babylon Extension to enable UIEvents to work with our IUIEvents
955
+ interface UIEvent {
956
+ inputIndex: number;
957
+ }
958
+
947
959
  interface MouseEvent {
948
960
  mozMovementX: number;
949
961
  mozMovementY: number;
package/Engines/engine.js CHANGED
@@ -224,6 +224,31 @@ var Engine = /** @class */ (function (_super) {
224
224
  enumerable: false,
225
225
  configurable: true
226
226
  });
227
+ /** @hidden */
228
+ /**
229
+ * Engine abstraction for loading and creating an image bitmap from a given source string.
230
+ * @param imageSource source to load the image from.
231
+ * @param options An object that sets options for the image's extraction.
232
+ * @returns ImageBitmap.
233
+ */
234
+ Engine.prototype.createImageBitmapFromSource = function (imageSource, options) {
235
+ var _this = this;
236
+ var promise = new Promise(function (resolve, reject) {
237
+ var image = new Image();
238
+ image.onload = function () {
239
+ image.decode().then(function () {
240
+ _this.createImageBitmap(image, options).then(function (imageBitmap) {
241
+ resolve(imageBitmap);
242
+ });
243
+ });
244
+ };
245
+ image.onerror = function () {
246
+ reject("Error loading image ".concat(image.src));
247
+ };
248
+ image.src = imageSource;
249
+ });
250
+ return promise;
251
+ };
227
252
  /**
228
253
  * Engine abstraction for createImageBitmap
229
254
  * @param image source for image