@onerjs/core 8.30.9 → 8.31.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/Animations/animationGroup.js +1 -4
  2. package/Animations/animationGroup.js.map +1 -1
  3. package/Behaviors/Cameras/interpolatingBehavior.d.ts +52 -0
  4. package/Behaviors/Cameras/interpolatingBehavior.js +105 -0
  5. package/Behaviors/Cameras/interpolatingBehavior.js.map +1 -0
  6. package/Cameras/Inputs/arcRotateCameraPointersInput.d.ts +5 -20
  7. package/Cameras/Inputs/arcRotateCameraPointersInput.js +9 -69
  8. package/Cameras/Inputs/arcRotateCameraPointersInput.js.map +1 -1
  9. package/Cameras/Inputs/geospatialCameraKeyboardInput.d.ts +81 -0
  10. package/Cameras/Inputs/geospatialCameraKeyboardInput.js +223 -0
  11. package/Cameras/Inputs/geospatialCameraKeyboardInput.js.map +1 -0
  12. package/Cameras/Inputs/geospatialCameraMouseWheelInput.js +1 -1
  13. package/Cameras/Inputs/geospatialCameraMouseWheelInput.js.map +1 -1
  14. package/Cameras/Inputs/geospatialCameraPointersInput.d.ts +16 -21
  15. package/Cameras/Inputs/geospatialCameraPointersInput.js +43 -73
  16. package/Cameras/Inputs/geospatialCameraPointersInput.js.map +1 -1
  17. package/Cameras/Inputs/orbitCameraPointersInput.d.ts +49 -0
  18. package/Cameras/Inputs/orbitCameraPointersInput.js +105 -0
  19. package/Cameras/Inputs/orbitCameraPointersInput.js.map +1 -0
  20. package/Cameras/Limits/geospatialLimits.d.ts +60 -0
  21. package/Cameras/Limits/geospatialLimits.js +89 -0
  22. package/Cameras/Limits/geospatialLimits.js.map +1 -0
  23. package/Cameras/cameraMovement.d.ts +150 -0
  24. package/Cameras/cameraMovement.js +190 -0
  25. package/Cameras/cameraMovement.js.map +1 -0
  26. package/Cameras/geospatialCamera.d.ts +53 -49
  27. package/Cameras/geospatialCamera.js +172 -192
  28. package/Cameras/geospatialCamera.js.map +1 -1
  29. package/Cameras/geospatialCameraInputsManager.d.ts +5 -0
  30. package/Cameras/geospatialCameraInputsManager.js +9 -0
  31. package/Cameras/geospatialCameraInputsManager.js.map +1 -1
  32. package/Cameras/geospatialCameraMovement.d.ts +66 -0
  33. package/Cameras/geospatialCameraMovement.js +199 -0
  34. package/Cameras/geospatialCameraMovement.js.map +1 -0
  35. package/Engines/Native/nativeInterfaces.d.ts +14 -6
  36. package/Engines/Native/nativeInterfaces.js +6 -1
  37. package/Engines/Native/nativeInterfaces.js.map +1 -1
  38. package/Engines/nativeEngine.js +2 -2
  39. package/Engines/nativeEngine.js.map +1 -1
  40. package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.js +1 -1
  41. package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.js.map +1 -1
  42. package/FlowGraph/flowGraphMath.d.ts +25 -0
  43. package/FlowGraph/flowGraphMath.js +40 -0
  44. package/FlowGraph/flowGraphMath.js.map +1 -0
  45. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +1 -1
  46. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
  47. package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.js +5 -1
  48. package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.js.map +1 -1
  49. package/Materials/Node/Blocks/GaussianSplatting/splatReaderBlock.js +6 -5
  50. package/Materials/Node/Blocks/GaussianSplatting/splatReaderBlock.js.map +1 -1
  51. package/Materials/shaderMaterial.js +4 -2
  52. package/Materials/shaderMaterial.js.map +1 -1
  53. package/Maths/math.vector.functions.d.ts +5 -24
  54. package/Maths/math.vector.functions.js +32 -35
  55. package/Maths/math.vector.functions.js.map +1 -1
  56. package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +1 -0
  57. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +51 -16
  58. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  59. package/Meshes/csg2.js +1 -1
  60. package/Meshes/csg2.js.map +1 -1
  61. package/Meshes/thinInstanceMesh.js +15 -0
  62. package/Meshes/thinInstanceMesh.js.map +1 -1
  63. package/Misc/fileTools.js.map +1 -1
  64. package/Misc/tools.d.ts +3 -0
  65. package/Misc/tools.js +43 -4
  66. package/Misc/tools.js.map +1 -1
  67. package/Particles/Node/Blocks/Update/basicColorUpdateBlock.d.ts +1 -1
  68. package/Particles/Node/Blocks/Update/basicColorUpdateBlock.js +1 -1
  69. package/Particles/Node/Blocks/Update/basicColorUpdateBlock.js.map +1 -1
  70. package/Particles/Node/Blocks/Update/basicPositionUpdateBlock.d.ts +1 -1
  71. package/Particles/Node/Blocks/Update/basicPositionUpdateBlock.js +3 -3
  72. package/Particles/Node/Blocks/Update/basicPositionUpdateBlock.js.map +1 -1
  73. package/Particles/Node/Blocks/Update/updateSizeBlock.d.ts +35 -0
  74. package/Particles/Node/Blocks/Update/updateSizeBlock.js +73 -0
  75. package/Particles/Node/Blocks/Update/updateSizeBlock.js.map +1 -0
  76. package/Particles/Node/Blocks/index.d.ts +1 -0
  77. package/Particles/Node/Blocks/index.js +1 -0
  78. package/Particles/Node/Blocks/index.js.map +1 -1
  79. package/Particles/Node/Blocks/particleInputBlock.js +1 -0
  80. package/Particles/Node/Blocks/particleInputBlock.js.map +1 -1
  81. package/Particles/Node/Blocks/particleRandomBlock.d.ts +5 -2
  82. package/Particles/Node/Blocks/particleRandomBlock.js +32 -14
  83. package/Particles/Node/Blocks/particleRandomBlock.js.map +1 -1
  84. package/Particles/Node/Blocks/systemBlock.d.ts +8 -0
  85. package/Particles/Node/Blocks/systemBlock.js +8 -0
  86. package/Particles/Node/Blocks/systemBlock.js.map +1 -1
  87. package/Particles/Node/Enums/nodeParticleContextualSources.d.ts +3 -1
  88. package/Particles/Node/Enums/nodeParticleContextualSources.js +2 -0
  89. package/Particles/Node/Enums/nodeParticleContextualSources.js.map +1 -1
  90. package/Particles/Node/nodeParticleBuildState.js +6 -4
  91. package/Particles/Node/nodeParticleBuildState.js.map +1 -1
  92. package/Particles/Node/nodeParticleSystemSet.helper.d.ts +0 -2
  93. package/Particles/Node/nodeParticleSystemSet.helper.js +279 -161
  94. package/Particles/Node/nodeParticleSystemSet.helper.js.map +1 -1
  95. package/Particles/particle.d.ts +4 -0
  96. package/Particles/particle.js +2 -0
  97. package/Particles/particle.js.map +1 -1
  98. package/Particles/thinParticleSystem.d.ts +3 -7
  99. package/Particles/thinParticleSystem.function.d.ts +1 -1
  100. package/Particles/thinParticleSystem.function.js +9 -6
  101. package/Particles/thinParticleSystem.function.js.map +1 -1
  102. package/Particles/thinParticleSystem.js +4 -6
  103. package/Particles/thinParticleSystem.js.map +1 -1
  104. package/Shaders/ShadersInclude/gaussianSplatting.js +5 -1
  105. package/Shaders/ShadersInclude/gaussianSplatting.js.map +1 -1
  106. package/Shaders/ShadersInclude/gaussianSplattingUboDeclaration.js +2 -1
  107. package/Shaders/ShadersInclude/gaussianSplattingUboDeclaration.js.map +1 -1
  108. package/Shaders/ShadersInclude/gaussianSplattingVertexDeclaration.js +1 -1
  109. package/Shaders/ShadersInclude/gaussianSplattingVertexDeclaration.js.map +1 -1
  110. package/Shaders/gaussianSplatting.vertex.js +3 -3
  111. package/Shaders/gaussianSplatting.vertex.js.map +1 -1
  112. package/Shaders/gaussianSplattingDepth.vertex.js +2 -2
  113. package/Shaders/gaussianSplattingDepth.vertex.js.map +1 -1
  114. package/ShadersWGSL/ShadersInclude/gaussianSplatting.js +35 -1
  115. package/ShadersWGSL/ShadersInclude/gaussianSplatting.js.map +1 -1
  116. package/ShadersWGSL/ShadersInclude/gaussianSplattingUboDeclaration.js +2 -1
  117. package/ShadersWGSL/ShadersInclude/gaussianSplattingUboDeclaration.js.map +1 -1
  118. package/ShadersWGSL/ShadersInclude/gaussianSplattingVertexDeclaration.js +1 -2
  119. package/ShadersWGSL/ShadersInclude/gaussianSplattingVertexDeclaration.js.map +1 -1
  120. package/ShadersWGSL/gaussianSplatting.vertex.js +3 -3
  121. package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
  122. package/ShadersWGSL/gaussianSplattingDepth.vertex.js +2 -2
  123. package/ShadersWGSL/gaussianSplattingDepth.vertex.js.map +1 -1
  124. package/package.json +1 -1
@@ -0,0 +1,66 @@
1
+ import { CameraMovement } from "./cameraMovement.js";
2
+ import type { GeospatialLimits } from "./Limits/geospatialLimits.js";
3
+ import { Vector3 } from "../Maths/math.vector.js";
4
+ import type { MeshPredicate } from "../Culling/ray.core.js";
5
+ import type { Scene } from "../scene.js";
6
+ import type { PickingInfo } from "../Collisions/pickingInfo.js";
7
+ import type { Nullable } from "../types.js";
8
+ /**
9
+ * @experimental
10
+ * This class is subject to change as the geospatial camera evolves.
11
+ *
12
+ * Geospatial-specific camera movement system that extends the base movement with
13
+ * raycasting and altitude-aware zoom constraints.
14
+ *
15
+ * This class encapsulates geospatial camera movement logic:
16
+ * - Dragging in a way which keeps cursor anchored to globe
17
+ * - Latitude-based pan speed dampening
18
+ * - Zoom speed scaling based on distance to center
19
+ * - Raycasting to determine zoom constraints based on terrain/globe
20
+ * - Altitude-based zoom clamping
21
+ * - Zoom direction calculation (towards cursor vs along look vector)
22
+ */
23
+ export declare class GeospatialCameraMovement extends CameraMovement {
24
+ limits: GeospatialLimits;
25
+ private _cameraCenter;
26
+ private _cameraLookAt;
27
+ /** Predicate function to determine which meshes to pick against (e.g., globe mesh) */
28
+ pickPredicate?: MeshPredicate;
29
+ computedPerFrameZoomVector: Vector3;
30
+ zoomToCursor: boolean;
31
+ /**
32
+ * Enables rotation around a specific point, instead of default rotation around center
33
+ * @internal
34
+ */
35
+ alternateRotationPt?: Vector3;
36
+ private _tempPickingRay;
37
+ private _storedZoomPickDistance;
38
+ private _hitPointRadius?;
39
+ private _dragPlane;
40
+ private _dragPlaneNormal;
41
+ private _dragPlaneOriginPointEcef;
42
+ private _dragPlaneHitPointLocal;
43
+ private _previousDragPlaneHitPointLocal;
44
+ constructor(scene: Scene, limits: GeospatialLimits, cameraPosition: Vector3, _cameraCenter: Vector3, _cameraLookAt: Vector3, pickPredicate?: MeshPredicate);
45
+ startDrag(pointerX: number, pointerY: number): void;
46
+ stopDrag(): void;
47
+ /**
48
+ * The previous drag plane hit point in local space is stored to compute the movement delta.
49
+ * As the drag movement occurs, we will continuously recalculate this point. The delta between the previous and current hit points is the delta we will apply to the camera's localtranslation
50
+ * @param hitPointRadius The distance between the world origin (center of globe) and the initial drag hit point
51
+ * @param ray The ray from the camera to the new cursor location
52
+ * @param localToEcefResult The matrix to convert from local to ECEF space
53
+ */
54
+ private _recalculateDragPlaneHitPoint;
55
+ handleDrag(pointerX: number, pointerY: number): void;
56
+ /** @override */
57
+ computeCurrentFrameDeltas(): void;
58
+ private _handleZoom;
59
+ private _clampZoomDistance;
60
+ pickAlongVector(vector: Vector3): Nullable<PickingInfo>;
61
+ }
62
+ /**
63
+ * Helper to build east/north/up basis vectors at a world position.
64
+ * @internal
65
+ */
66
+ export declare function ComputeLocalBasisToRefs(worldPos: Vector3, refEast: Vector3, refNorth: Vector3, refUp: Vector3): void;
@@ -0,0 +1,199 @@
1
+ import { CameraMovement } from "./cameraMovement.js";
2
+ import { Epsilon } from "../Maths/math.constants.js";
3
+ import { Matrix, TmpVectors, Vector3 } from "../Maths/math.vector.js";
4
+ import { Plane } from "../Maths/math.plane.js";
5
+ import { Ray } from "../Culling/ray.js";
6
+ import { Vector3Distance } from "../Maths/math.vector.functions.js";
7
+ /**
8
+ * @experimental
9
+ * This class is subject to change as the geospatial camera evolves.
10
+ *
11
+ * Geospatial-specific camera movement system that extends the base movement with
12
+ * raycasting and altitude-aware zoom constraints.
13
+ *
14
+ * This class encapsulates geospatial camera movement logic:
15
+ * - Dragging in a way which keeps cursor anchored to globe
16
+ * - Latitude-based pan speed dampening
17
+ * - Zoom speed scaling based on distance to center
18
+ * - Raycasting to determine zoom constraints based on terrain/globe
19
+ * - Altitude-based zoom clamping
20
+ * - Zoom direction calculation (towards cursor vs along look vector)
21
+ */
22
+ export class GeospatialCameraMovement extends CameraMovement {
23
+ constructor(scene, limits, cameraPosition, _cameraCenter, _cameraLookAt, pickPredicate) {
24
+ super(scene, cameraPosition);
25
+ this.limits = limits;
26
+ this._cameraCenter = _cameraCenter;
27
+ this._cameraLookAt = _cameraLookAt;
28
+ this.computedPerFrameZoomVector = new Vector3();
29
+ this.zoomToCursor = true;
30
+ this._hitPointRadius = undefined;
31
+ this._dragPlane = new Plane(0, 0, 0, 0);
32
+ this._dragPlaneNormal = Vector3.Zero();
33
+ this._dragPlaneOriginPointEcef = Vector3.Zero();
34
+ this._dragPlaneHitPointLocal = Vector3.Zero();
35
+ this._previousDragPlaneHitPointLocal = Vector3.Zero();
36
+ this.computedPerFrameZoomVector.copyFrom(this._cameraLookAt);
37
+ this.pickPredicate = pickPredicate;
38
+ this._tempPickingRay = new Ray(this._cameraPosition, this._cameraLookAt);
39
+ this.panInertia = 0;
40
+ this.rotationInertia = 0;
41
+ this.rotationXSpeed = Math.PI / 500; // Move 1/500th of a half circle per pixel
42
+ this.rotationYSpeed = Math.PI / 500; // Move 1/500th of a half circle per pixel
43
+ }
44
+ startDrag(pointerX, pointerY) {
45
+ const pickResult = this._scene.pick(pointerX, pointerY, this.pickPredicate);
46
+ if (pickResult.pickedPoint && pickResult.ray) {
47
+ // Store radius from earth center to pickedPoint, used when calculating drag plane
48
+ this._hitPointRadius = pickResult.pickedPoint.length();
49
+ this._recalculateDragPlaneHitPoint(this._hitPointRadius, pickResult.ray, TmpVectors.Matrix[0]);
50
+ this._previousDragPlaneHitPointLocal.copyFrom(this._dragPlaneHitPointLocal);
51
+ }
52
+ else {
53
+ this._hitPointRadius = undefined; // can't drag without a hit on the globe
54
+ }
55
+ }
56
+ stopDrag() {
57
+ this._hitPointRadius = undefined;
58
+ }
59
+ /**
60
+ * The previous drag plane hit point in local space is stored to compute the movement delta.
61
+ * As the drag movement occurs, we will continuously recalculate this point. The delta between the previous and current hit points is the delta we will apply to the camera's localtranslation
62
+ * @param hitPointRadius The distance between the world origin (center of globe) and the initial drag hit point
63
+ * @param ray The ray from the camera to the new cursor location
64
+ * @param localToEcefResult The matrix to convert from local to ECEF space
65
+ */
66
+ _recalculateDragPlaneHitPoint(hitPointRadius, ray, localToEcefResult) {
67
+ // Use the camera's geocentric normal to find the dragPlaneOriginPoint which lives at hitPointRadius along the camera's geocentric normal
68
+ this._cameraPosition.normalizeToRef(this._dragPlaneNormal);
69
+ this._dragPlaneNormal.scaleToRef(hitPointRadius, this._dragPlaneOriginPointEcef);
70
+ // The dragPlaneOffsetVector will later be recalculated when drag occurs, and the delta between the offset vectors will be applied to localTranslation
71
+ ComputeLocalBasisToRefs(this._dragPlaneOriginPointEcef, TmpVectors.Vector3[0], TmpVectors.Vector3[1], TmpVectors.Vector3[2]);
72
+ const localToEcef = Matrix.FromXYZAxesToRef(TmpVectors.Vector3[0], TmpVectors.Vector3[1], TmpVectors.Vector3[2], localToEcefResult);
73
+ localToEcef.setTranslationFromFloats(this._dragPlaneOriginPointEcef.x, this._dragPlaneOriginPointEcef.y, this._dragPlaneOriginPointEcef.z);
74
+ const ecefToLocal = localToEcef.invertToRef(TmpVectors.Matrix[1]);
75
+ // Now create a plane at that point, perpendicular to the camera's geocentric normal
76
+ Plane.FromPositionAndNormalToRef(this._dragPlaneOriginPointEcef, this._dragPlaneNormal, this._dragPlane);
77
+ // Lastly, find the _dragPlaneHitPoint where the ray intersects the _dragPlane.
78
+ if (IntersectRayWithPlaneToRef(ray, this._dragPlane, this._dragPlaneHitPointLocal)) {
79
+ // If hit, convert the drag plane hit point into the local space.
80
+ Vector3.TransformCoordinatesToRef(this._dragPlaneHitPointLocal, ecefToLocal, this._dragPlaneHitPointLocal);
81
+ }
82
+ }
83
+ handleDrag(pointerX, pointerY) {
84
+ if (this._hitPointRadius) {
85
+ const pickResult = this._scene.pick(pointerX, pointerY);
86
+ if (pickResult.ray) {
87
+ const localToEcef = TmpVectors.Matrix[0];
88
+ this._recalculateDragPlaneHitPoint(this._hitPointRadius, pickResult.ray, localToEcef);
89
+ const delta = this._dragPlaneHitPointLocal.subtractToRef(this._previousDragPlaneHitPointLocal, TmpVectors.Vector3[6]);
90
+ this._previousDragPlaneHitPointLocal.copyFrom(this._dragPlaneHitPointLocal);
91
+ Vector3.TransformNormalToRef(delta, localToEcef, delta);
92
+ this._dragPlaneOriginPointEcef.addInPlace(delta);
93
+ this.panAccumulatedPixels.subtractInPlace(delta);
94
+ }
95
+ }
96
+ }
97
+ /** @override */
98
+ computeCurrentFrameDeltas() {
99
+ const cameraCenter = this._cameraCenter;
100
+ // If a pan drag is occurring, stop zooming.
101
+ const isDragging = this._hitPointRadius !== undefined;
102
+ if (isDragging) {
103
+ this._zoomSpeedMultiplier = 0;
104
+ this._zoomVelocity = 0;
105
+ }
106
+ else {
107
+ // Scales zoom movement speed based on camera distance to origin (so long as no active pan is occurring)
108
+ this._zoomSpeedMultiplier = Vector3Distance(this._cameraPosition, cameraCenter) * 0.01;
109
+ }
110
+ // Before zero-ing out pixel deltas, capture if we have any active zoom in this frame (compared to zoom from inertia)
111
+ const activeZoom = Math.abs(this.zoomAccumulatedPixels) > 0;
112
+ super.computeCurrentFrameDeltas();
113
+ this._handleZoom(activeZoom);
114
+ }
115
+ _handleZoom(activeZoom) {
116
+ if (Math.abs(this.zoomDeltaCurrentFrame) > Epsilon) {
117
+ let pickDistance;
118
+ if (!activeZoom) {
119
+ // During inertia, use the previously stored pick distance
120
+ // TODO fix this to work with raycasting
121
+ pickDistance = this._storedZoomPickDistance;
122
+ }
123
+ else {
124
+ // Active zoom - pick and store the distance
125
+ const pickResult = this._scene.pick(this._scene.pointerX, this._scene.pointerY, this.pickPredicate);
126
+ if (pickResult.hit && pickResult.pickedPoint && pickResult.ray && this.zoomToCursor) {
127
+ // Store both the zoom direction and the pick distance for use during inertia
128
+ pickResult.ray.direction.normalizeToRef(this.computedPerFrameZoomVector);
129
+ pickDistance = pickResult.distance;
130
+ this._storedZoomPickDistance = pickDistance;
131
+ }
132
+ else {
133
+ // If no hit under cursor, zoom along lookVector instead
134
+ this._cameraLookAt.normalizeToRef(this.computedPerFrameZoomVector);
135
+ const lookPickResult = this.pickAlongVector(this.computedPerFrameZoomVector);
136
+ pickDistance = lookPickResult?.distance;
137
+ this._storedZoomPickDistance = pickDistance;
138
+ }
139
+ }
140
+ // Clamp distance based on limits and update center
141
+ this._clampZoomDistance(this.zoomDeltaCurrentFrame, pickDistance);
142
+ }
143
+ }
144
+ _clampZoomDistance(requestedDistance, pickResultDistance) {
145
+ // If pickResult is defined
146
+ if (requestedDistance > 0) {
147
+ if (pickResultDistance !== undefined) {
148
+ // If there is a pick, allow movement up to pick - minAltitude
149
+ if (pickResultDistance - this.limits.altitudeMin < 0) {
150
+ this.zoomDeltaCurrentFrame = 0;
151
+ }
152
+ this.zoomDeltaCurrentFrame = Math.min(requestedDistance, pickResultDistance - this.limits.altitudeMin);
153
+ }
154
+ else {
155
+ this.zoomDeltaCurrentFrame = requestedDistance;
156
+ }
157
+ }
158
+ if (requestedDistance < 0) {
159
+ const maxZoomOut = this.limits.radiusMax ? this.limits.radiusMax - this._cameraPosition.length() : Number.POSITIVE_INFINITY;
160
+ this.zoomDeltaCurrentFrame = Math.max(requestedDistance, -maxZoomOut);
161
+ }
162
+ return this.zoomDeltaCurrentFrame;
163
+ }
164
+ pickAlongVector(vector) {
165
+ this._tempPickingRay.origin.copyFrom(this._cameraPosition);
166
+ this._tempPickingRay.direction.copyFrom(vector);
167
+ return this._scene.pickWithRay(this._tempPickingRay, this.pickPredicate);
168
+ }
169
+ }
170
+ function IntersectRayWithPlaneToRef(ray, plane, ref) {
171
+ // Distance along the ray to the plane; null if no hit
172
+ const dist = ray.intersectsPlane(plane);
173
+ if (dist !== null && dist >= 0) {
174
+ ray.origin.addToRef(ray.direction.scaleToRef(dist, TmpVectors.Vector3[0]), ref);
175
+ return true;
176
+ }
177
+ return false;
178
+ }
179
+ /**
180
+ * Helper to build east/north/up basis vectors at a world position.
181
+ * @internal
182
+ */
183
+ export function ComputeLocalBasisToRefs(worldPos, refEast, refNorth, refUp) {
184
+ // up = normalized position (geocentric normal)
185
+ refUp.copyFrom(worldPos).normalize();
186
+ // east = normalize(worldNorth × up)
187
+ // (cross product of Earth rotation axis with up gives east except near poles)
188
+ const worldNorth = Vector3.LeftHandedForwardReadOnly; // (0,0,1)
189
+ Vector3.CrossToRef(worldNorth, refUp, refEast);
190
+ // at poles, cross with worldRight instead
191
+ if (refEast.lengthSquared() < Epsilon) {
192
+ Vector3.CrossToRef(Vector3.Right(), refUp, refEast);
193
+ }
194
+ refEast.normalize();
195
+ // north = up × east (completes right-handed basis)
196
+ Vector3.CrossToRef(refUp, refEast, refNorth);
197
+ refNorth.normalize();
198
+ }
199
+ //# sourceMappingURL=geospatialCameraMovement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geospatialCameraMovement.js","sourceRoot":"","sources":["../../../../dev/core/src/Cameras/geospatialCameraMovement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAElD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEnE,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAErC,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAIjE;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,wBAAyB,SAAQ,cAAc;IAuBxD,YACI,KAAY,EACL,MAAwB,EAC/B,cAAuB,EACf,aAAsB,EACtB,aAAsB,EAC9B,aAA6B;QAE7B,KAAK,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;QANtB,WAAM,GAAN,MAAM,CAAkB;QAEvB,kBAAa,GAAb,aAAa,CAAS;QACtB,kBAAa,GAAb,aAAa,CAAS;QAzB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IAC9E,MAAM,UAAU,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC,UAAU;IAChE,OAAO,CAAC,UAAU,CAAC,UAAU,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IAE/C,0CAA0C;IAC1C,IAAI,OAAO,CAAC,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;QACpC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACxD,CAAC;IACD,OAAO,CAAC,SAAS,EAAE,CAAC;IAEpB,mDAAmD;IACnD,OAAO,CAAC,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;IAC7C,QAAQ,CAAC,SAAS,EAAE,CAAC;AACzB,CAAC","sourcesContent":["import { CameraMovement } from \"./cameraMovement\";\r\nimport { Epsilon } from \"../Maths/math.constants\";\r\nimport type { GeospatialLimits } from \"./Limits/geospatialLimits\";\r\nimport { Matrix, TmpVectors, Vector3 } from \"../Maths/math.vector\";\r\nimport type { MeshPredicate } from \"../Culling/ray.core\";\r\nimport { Plane } from \"../Maths/math.plane\";\r\nimport { Ray } from \"../Culling/ray\";\r\nimport type { Scene } from \"../scene\";\r\nimport { Vector3Distance } from \"../Maths/math.vector.functions\";\r\nimport type { PickingInfo } from \"../Collisions/pickingInfo\";\r\nimport type { Nullable } from \"../types\";\r\n\r\n/**\r\n * @experimental\r\n * This class is subject to change as the geospatial camera evolves.\r\n *\r\n * Geospatial-specific camera movement system that extends the base movement with\r\n * raycasting and altitude-aware zoom constraints.\r\n *\r\n * This class encapsulates geospatial camera movement logic:\r\n * - Dragging in a way which keeps cursor anchored to globe\r\n * - Latitude-based pan speed dampening\r\n * - Zoom speed scaling based on distance to center\r\n * - Raycasting to determine zoom constraints based on terrain/globe\r\n * - Altitude-based zoom clamping\r\n * - Zoom direction calculation (towards cursor vs along look vector)\r\n */\r\nexport class GeospatialCameraMovement extends CameraMovement {\r\n /** Predicate function to determine which meshes to pick against (e.g., globe mesh) */\r\n public pickPredicate?: MeshPredicate;\r\n public computedPerFrameZoomVector: Vector3 = new Vector3();\r\n\r\n public zoomToCursor: boolean = true;\r\n\r\n /**\r\n * Enables rotation around a specific point, instead of default rotation around center\r\n * @internal\r\n */\r\n public alternateRotationPt?: Vector3;\r\n\r\n private _tempPickingRay: Ray;\r\n private _storedZoomPickDistance: number | undefined;\r\n\r\n private _hitPointRadius?: number = undefined;\r\n private _dragPlane: Plane = new Plane(0, 0, 0, 0);\r\n private _dragPlaneNormal: Vector3 = Vector3.Zero();\r\n private _dragPlaneOriginPointEcef: Vector3 = Vector3.Zero();\r\n private _dragPlaneHitPointLocal: Vector3 = Vector3.Zero();\r\n private _previousDragPlaneHitPointLocal: Vector3 = Vector3.Zero();\r\n\r\n constructor(\r\n scene: Scene,\r\n public limits: GeospatialLimits,\r\n cameraPosition: Vector3,\r\n private _cameraCenter: Vector3,\r\n private _cameraLookAt: Vector3,\r\n pickPredicate?: MeshPredicate\r\n ) {\r\n super(scene, cameraPosition);\r\n this.computedPerFrameZoomVector.copyFrom(this._cameraLookAt);\r\n this.pickPredicate = pickPredicate;\r\n this._tempPickingRay = new Ray(this._cameraPosition, this._cameraLookAt);\r\n this.panInertia = 0;\r\n this.rotationInertia = 0;\r\n this.rotationXSpeed = Math.PI / 500; // Move 1/500th of a half circle per pixel\r\n this.rotationYSpeed = Math.PI / 500; // Move 1/500th of a half circle per pixel\r\n }\r\n\r\n public startDrag(pointerX: number, pointerY: number) {\r\n const pickResult = this._scene.pick(pointerX, pointerY, this.pickPredicate);\r\n if (pickResult.pickedPoint && pickResult.ray) {\r\n // Store radius from earth center to pickedPoint, used when calculating drag plane\r\n this._hitPointRadius = pickResult.pickedPoint.length();\r\n\r\n this._recalculateDragPlaneHitPoint(this._hitPointRadius, pickResult.ray, TmpVectors.Matrix[0]);\r\n this._previousDragPlaneHitPointLocal.copyFrom(this._dragPlaneHitPointLocal);\r\n } else {\r\n this._hitPointRadius = undefined; // can't drag without a hit on the globe\r\n }\r\n }\r\n\r\n public stopDrag() {\r\n this._hitPointRadius = undefined;\r\n }\r\n\r\n /**\r\n * The previous drag plane hit point in local space is stored to compute the movement delta.\r\n * As the drag movement occurs, we will continuously recalculate this point. The delta between the previous and current hit points is the delta we will apply to the camera's localtranslation\r\n * @param hitPointRadius The distance between the world origin (center of globe) and the initial drag hit point\r\n * @param ray The ray from the camera to the new cursor location\r\n * @param localToEcefResult The matrix to convert from local to ECEF space\r\n */\r\n private _recalculateDragPlaneHitPoint(hitPointRadius: number, ray: Ray, localToEcefResult: Matrix): void {\r\n // Use the camera's geocentric normal to find the dragPlaneOriginPoint which lives at hitPointRadius along the camera's geocentric normal\r\n this._cameraPosition.normalizeToRef(this._dragPlaneNormal);\r\n this._dragPlaneNormal.scaleToRef(hitPointRadius, this._dragPlaneOriginPointEcef);\r\n\r\n // The dragPlaneOffsetVector will later be recalculated when drag occurs, and the delta between the offset vectors will be applied to localTranslation\r\n ComputeLocalBasisToRefs(this._dragPlaneOriginPointEcef, TmpVectors.Vector3[0], TmpVectors.Vector3[1], TmpVectors.Vector3[2]);\r\n const localToEcef = Matrix.FromXYZAxesToRef(TmpVectors.Vector3[0], TmpVectors.Vector3[1], TmpVectors.Vector3[2], localToEcefResult);\r\n localToEcef.setTranslationFromFloats(this._dragPlaneOriginPointEcef.x, this._dragPlaneOriginPointEcef.y, this._dragPlaneOriginPointEcef.z);\r\n const ecefToLocal = localToEcef.invertToRef(TmpVectors.Matrix[1]);\r\n\r\n // Now create a plane at that point, perpendicular to the camera's geocentric normal\r\n Plane.FromPositionAndNormalToRef(this._dragPlaneOriginPointEcef, this._dragPlaneNormal, this._dragPlane);\r\n\r\n // Lastly, find the _dragPlaneHitPoint where the ray intersects the _dragPlane.\r\n if (IntersectRayWithPlaneToRef(ray, this._dragPlane, this._dragPlaneHitPointLocal)) {\r\n // If hit, convert the drag plane hit point into the local space.\r\n Vector3.TransformCoordinatesToRef(this._dragPlaneHitPointLocal, ecefToLocal, this._dragPlaneHitPointLocal);\r\n }\r\n }\r\n\r\n public handleDrag(pointerX: number, pointerY: number) {\r\n if (this._hitPointRadius) {\r\n const pickResult = this._scene.pick(pointerX, pointerY);\r\n if (pickResult.ray) {\r\n const localToEcef = TmpVectors.Matrix[0];\r\n this._recalculateDragPlaneHitPoint(this._hitPointRadius, pickResult.ray, localToEcef);\r\n\r\n const delta = this._dragPlaneHitPointLocal.subtractToRef(this._previousDragPlaneHitPointLocal, TmpVectors.Vector3[6]);\r\n this._previousDragPlaneHitPointLocal.copyFrom(this._dragPlaneHitPointLocal);\r\n\r\n Vector3.TransformNormalToRef(delta, localToEcef, delta);\r\n this._dragPlaneOriginPointEcef.addInPlace(delta);\r\n\r\n this.panAccumulatedPixels.subtractInPlace(delta);\r\n }\r\n }\r\n }\r\n\r\n /** @override */\r\n public override computeCurrentFrameDeltas(): void {\r\n const cameraCenter = this._cameraCenter;\r\n\r\n // If a pan drag is occurring, stop zooming.\r\n const isDragging = this._hitPointRadius !== undefined;\r\n if (isDragging) {\r\n this._zoomSpeedMultiplier = 0;\r\n this._zoomVelocity = 0;\r\n } else {\r\n // Scales zoom movement speed based on camera distance to origin (so long as no active pan is occurring)\r\n this._zoomSpeedMultiplier = Vector3Distance(this._cameraPosition, cameraCenter) * 0.01;\r\n }\r\n\r\n // Before zero-ing out pixel deltas, capture if we have any active zoom in this frame (compared to zoom from inertia)\r\n const activeZoom = Math.abs(this.zoomAccumulatedPixels) > 0;\r\n super.computeCurrentFrameDeltas();\r\n\r\n this._handleZoom(activeZoom);\r\n }\r\n\r\n private _handleZoom(activeZoom: boolean) {\r\n if (Math.abs(this.zoomDeltaCurrentFrame) > Epsilon) {\r\n let pickDistance: number | undefined;\r\n\r\n if (!activeZoom) {\r\n // During inertia, use the previously stored pick distance\r\n // TODO fix this to work with raycasting\r\n pickDistance = this._storedZoomPickDistance;\r\n } else {\r\n // Active zoom - pick and store the distance\r\n const pickResult = this._scene.pick(this._scene.pointerX, this._scene.pointerY, this.pickPredicate);\r\n\r\n if (pickResult.hit && pickResult.pickedPoint && pickResult.ray && this.zoomToCursor) {\r\n // Store both the zoom direction and the pick distance for use during inertia\r\n pickResult.ray.direction.normalizeToRef(this.computedPerFrameZoomVector);\r\n pickDistance = pickResult.distance;\r\n this._storedZoomPickDistance = pickDistance;\r\n } else {\r\n // If no hit under cursor, zoom along lookVector instead\r\n this._cameraLookAt.normalizeToRef(this.computedPerFrameZoomVector);\r\n const lookPickResult = this.pickAlongVector(this.computedPerFrameZoomVector);\r\n pickDistance = lookPickResult?.distance;\r\n this._storedZoomPickDistance = pickDistance;\r\n }\r\n }\r\n\r\n // Clamp distance based on limits and update center\r\n this._clampZoomDistance(this.zoomDeltaCurrentFrame, pickDistance);\r\n }\r\n }\r\n\r\n private _clampZoomDistance(requestedDistance: number, pickResultDistance: number | undefined): number {\r\n // If pickResult is defined\r\n if (requestedDistance > 0) {\r\n if (pickResultDistance !== undefined) {\r\n // If there is a pick, allow movement up to pick - minAltitude\r\n if (pickResultDistance - this.limits.altitudeMin < 0) {\r\n this.zoomDeltaCurrentFrame = 0;\r\n }\r\n this.zoomDeltaCurrentFrame = Math.min(requestedDistance, pickResultDistance - this.limits.altitudeMin);\r\n } else {\r\n this.zoomDeltaCurrentFrame = requestedDistance;\r\n }\r\n }\r\n\r\n if (requestedDistance < 0) {\r\n const maxZoomOut = this.limits.radiusMax ? this.limits.radiusMax - this._cameraPosition.length() : Number.POSITIVE_INFINITY;\r\n this.zoomDeltaCurrentFrame = Math.max(requestedDistance, -maxZoomOut);\r\n }\r\n\r\n return this.zoomDeltaCurrentFrame;\r\n }\r\n\r\n public pickAlongVector(vector: Vector3): Nullable<PickingInfo> {\r\n this._tempPickingRay.origin.copyFrom(this._cameraPosition);\r\n this._tempPickingRay.direction.copyFrom(vector);\r\n return this._scene.pickWithRay(this._tempPickingRay, this.pickPredicate);\r\n }\r\n}\r\n\r\nfunction IntersectRayWithPlaneToRef(ray: Ray, plane: Plane, ref: Vector3): boolean {\r\n // Distance along the ray to the plane; null if no hit\r\n const dist = ray.intersectsPlane(plane);\r\n\r\n if (dist !== null && dist >= 0) {\r\n ray.origin.addToRef(ray.direction.scaleToRef(dist, TmpVectors.Vector3[0]), ref);\r\n return true;\r\n }\r\n\r\n return false;\r\n}\r\n\r\n/**\r\n * Helper to build east/north/up basis vectors at a world position.\r\n * @internal\r\n */\r\nexport function ComputeLocalBasisToRefs(worldPos: Vector3, refEast: Vector3, refNorth: Vector3, refUp: Vector3) {\r\n // up = normalized position (geocentric normal)\r\n refUp.copyFrom(worldPos).normalize();\r\n\r\n // east = normalize(worldNorth × up)\r\n // (cross product of Earth rotation axis with up gives east except near poles)\r\n const worldNorth = Vector3.LeftHandedForwardReadOnly; // (0,0,1)\r\n Vector3.CrossToRef(worldNorth, refUp, refEast);\r\n\r\n // at poles, cross with worldRight instead\r\n if (refEast.lengthSquared() < Epsilon) {\r\n Vector3.CrossToRef(Vector3.Right(), refUp, refEast);\r\n }\r\n refEast.normalize();\r\n\r\n // north = up × east (completes right-handed basis)\r\n Vector3.CrossToRef(refUp, refEast, refNorth);\r\n refNorth.normalize();\r\n}\r\n"]}
@@ -329,15 +329,23 @@ interface INativeDataStreamConstructor {
329
329
  readonly VALIDATION_NATIVE_DATA: number;
330
330
  readonly VALIDATION_BOOLEAN: number;
331
331
  }
332
+ export declare enum NativeTraceLevel {
333
+ Mark = 1,
334
+ Log = 2
335
+ }
332
336
  /** @internal */
333
337
  export interface INative {
334
338
  Engine: INativeEngineConstructor;
335
- Camera: INativeCameraConstructor;
336
- Canvas: INativeCanvasConstructor;
337
- Image: INativeImageConstructor;
338
- Path2D: INativePath2DConstructor;
339
- XMLHttpRequest: any;
340
- DeviceInputSystem: IDeviceInputSystemConstructor;
341
339
  NativeDataStream: INativeDataStreamConstructor;
340
+ Camera?: INativeCameraConstructor;
341
+ Canvas?: INativeCanvasConstructor;
342
+ Image?: INativeImageConstructor;
343
+ Path2D?: INativePath2DConstructor;
344
+ XMLHttpRequest?: typeof XMLHttpRequest;
345
+ DeviceInputSystem?: IDeviceInputSystemConstructor;
346
+ enablePerformanceLogging?(level?: NativeTraceLevel): void;
347
+ disablePerformanceLogging?(): void;
348
+ startPerformanceCounter?(counter: string): unknown;
349
+ endPerformanceCounter?(counter: unknown): void;
342
350
  }
343
351
  export {};
@@ -1,2 +1,7 @@
1
- export {};
1
+ // Note: These values need to match those in Babylon Native's NativeTracing plugin.
2
+ export var NativeTraceLevel;
3
+ (function (NativeTraceLevel) {
4
+ NativeTraceLevel[NativeTraceLevel["Mark"] = 1] = "Mark";
5
+ NativeTraceLevel[NativeTraceLevel["Log"] = 2] = "Log";
6
+ })(NativeTraceLevel || (NativeTraceLevel = {}));
2
7
  //# sourceMappingURL=nativeInterfaces.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"nativeInterfaces.js","sourceRoot":"","sources":["../../../../../dev/core/src/Engines/Native/nativeInterfaces.ts"],"names":[],"mappings":"","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { DeviceType } from \"../../DeviceInput/InputDevices/deviceEnums\";\r\nimport type { IDeviceInputSystem } from \"../../DeviceInput/inputInterfaces\";\r\nimport type { InternalTexture } from \"../../Materials/Textures/internalTexture\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { ICanvas, IImage, IPath2D } from \"../ICanvas\";\r\nimport type { NativeData, NativeDataStream } from \"./nativeDataStream\";\r\n\r\nexport type NativeTexture = NativeData;\r\nexport type NativeFramebuffer = NativeData;\r\nexport type NativeVertexArrayObject = NativeData;\r\nexport type NativeProgram = NativeData;\r\nexport type NativeUniform = NativeData;\r\n\r\n/** @internal */\r\nexport type NativeFrameStats = {\r\n /** @internal */\r\n gpuTimeNs: number;\r\n};\r\n\r\n/** @internal */\r\nexport interface INativeEngine {\r\n dispose(): void;\r\n\r\n requestAnimationFrame(callback: () => void): void;\r\n setDeviceLostCallback(callback: () => void): void;\r\n\r\n createVertexArray(): NativeData;\r\n\r\n createIndexBuffer(dataBuffer: ArrayBuffer, dataByteOffset: number, dataByteLength: number, is32Bits: boolean, dynamic: boolean): NativeData;\r\n recordIndexBuffer(vertexArray: NativeData, indexBuffer: NativeData): void;\r\n updateDynamicIndexBuffer(indexBuffer: NativeData, data: ArrayBuffer, dataByteOffset: number, dataByteLength: number, startIndex: number): void;\r\n\r\n createVertexBuffer(dataBuffer: ArrayBuffer, dataByteOffset: number, dataByteLength: number, dynamic: boolean): NativeData;\r\n recordVertexBuffer(\r\n vertexArray: NativeData,\r\n vertexBuffer: NativeData,\r\n location: number,\r\n byteOffset: number,\r\n byteStride: number,\r\n numElements: number,\r\n type: number,\r\n normalized: boolean,\r\n instanceDivisor: number\r\n ): void;\r\n updateDynamicVertexBuffer(vertexBuffer: NativeData, dataBuffer: ArrayBuffer, dataByteOffset: number, dataByteLength: number, vertexByteOffset?: number): void;\r\n\r\n createProgram(vertexShader: string, fragmentShader: string): NativeProgram;\r\n createProgramAsync(vertexShader: string, fragmentShader: string, onSuccess: () => void, onError: (error: Error) => void): NativeProgram;\r\n getUniforms(shaderProgram: NativeProgram, uniformsNames: string[]): WebGLUniformLocation[];\r\n getAttributes(shaderProgram: NativeProgram, attributeNames: string[]): number[];\r\n\r\n createTexture(): NativeTexture;\r\n initializeTexture(texture: NativeTexture, width: number, height: number, hasMips: boolean, format: number, renderTarget: boolean, srgb: boolean, samples: number): void;\r\n loadTexture(texture: NativeTexture, data: ArrayBufferView, generateMips: boolean, invertY: boolean, srgb: boolean, onSuccess: () => void, onError: () => void): void;\r\n loadRawTexture(texture: NativeTexture, data: ArrayBufferView, width: number, height: number, format: number, generateMips: boolean, invertY: boolean): void;\r\n loadRawTexture2DArray(\r\n texture: NativeTexture,\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n depth: number,\r\n format: number,\r\n generateMipMaps: boolean,\r\n invertY: boolean\r\n ): void;\r\n loadCubeTexture(texture: NativeTexture, data: Array<ArrayBufferView>, generateMips: boolean, invertY: boolean, srgb: boolean, onSuccess: () => void, onError: () => void): void;\r\n loadCubeTextureWithMips(texture: NativeTexture, data: Array<Array<ArrayBufferView>>, invertY: boolean, srgb: boolean, onSuccess: () => void, onError: () => void): void;\r\n getTextureWidth(texture: NativeTexture): number;\r\n getTextureHeight(texture: NativeTexture): number;\r\n deleteTexture(texture: NativeTexture): void;\r\n readTexture(\r\n texture: NativeTexture,\r\n mipLevel: number,\r\n x: number,\r\n y: number,\r\n width: number,\r\n height: number,\r\n buffer: Nullable<ArrayBuffer>,\r\n bufferOffset: number,\r\n bufferLength: number\r\n ): Promise<ArrayBuffer>;\r\n\r\n createImageBitmap(data: ArrayBuffer | IImage): ImageBitmap;\r\n resizeImageBitmap(image: ImageBitmap, bufferWidth: number, bufferHeight: number): Uint8Array;\r\n\r\n createFrameBuffer(\r\n texture: Nullable<NativeTexture>,\r\n width: number,\r\n height: number,\r\n generateStencilBuffer: boolean,\r\n generateDepthBuffer: boolean,\r\n samples: number\r\n ): NativeFramebuffer;\r\n\r\n getRenderWidth(): number;\r\n getRenderHeight(): number;\r\n\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 populateFrameStats(stats: NativeFrameStats): void;\r\n}\r\n\r\n/** @internal */\r\ninterface INativeEngineInfo {\r\n version: string;\r\n nonFloatVertexBuffers: true;\r\n}\r\n\r\n/** @internal */\r\ninterface INativeEngineConstructor {\r\n prototype: INativeEngine;\r\n new (info: INativeEngineInfo): INativeEngine;\r\n\r\n readonly PROTOCOL_VERSION: number;\r\n\r\n readonly CAPS_LIMITS_MAX_TEXTURE_SIZE: number;\r\n readonly CAPS_LIMITS_MAX_TEXTURE_LAYERS: number;\r\n\r\n readonly TEXTURE_NEAREST_NEAREST: number;\r\n readonly TEXTURE_LINEAR_LINEAR: number;\r\n readonly TEXTURE_LINEAR_LINEAR_MIPLINEAR: number;\r\n readonly TEXTURE_NEAREST_NEAREST_MIPNEAREST: number;\r\n readonly TEXTURE_NEAREST_LINEAR_MIPNEAREST: number;\r\n readonly TEXTURE_NEAREST_LINEAR_MIPLINEAR: number;\r\n readonly TEXTURE_NEAREST_LINEAR: number;\r\n readonly TEXTURE_NEAREST_NEAREST_MIPLINEAR: number;\r\n readonly TEXTURE_LINEAR_NEAREST_MIPNEAREST: number;\r\n readonly TEXTURE_LINEAR_NEAREST_MIPLINEAR: number;\r\n readonly TEXTURE_LINEAR_LINEAR_MIPNEAREST: number;\r\n readonly TEXTURE_LINEAR_NEAREST: number;\r\n\r\n readonly DEPTH_TEST_LESS: number;\r\n readonly DEPTH_TEST_LEQUAL: number;\r\n readonly DEPTH_TEST_EQUAL: number;\r\n readonly DEPTH_TEST_GEQUAL: number;\r\n readonly DEPTH_TEST_GREATER: number;\r\n readonly DEPTH_TEST_NOTEQUAL: number;\r\n readonly DEPTH_TEST_NEVER: number;\r\n readonly DEPTH_TEST_ALWAYS: number;\r\n\r\n readonly ADDRESS_MODE_WRAP: number;\r\n readonly ADDRESS_MODE_MIRROR: number;\r\n readonly ADDRESS_MODE_CLAMP: number;\r\n readonly ADDRESS_MODE_BORDER: number;\r\n readonly ADDRESS_MODE_MIRROR_ONCE: number;\r\n\r\n readonly TEXTURE_FORMAT_BC1: number;\r\n readonly TEXTURE_FORMAT_BC2: number;\r\n readonly TEXTURE_FORMAT_BC3: number;\r\n readonly TEXTURE_FORMAT_BC4: number;\r\n readonly TEXTURE_FORMAT_BC5: number;\r\n readonly TEXTURE_FORMAT_BC6H: number;\r\n readonly TEXTURE_FORMAT_BC7: number;\r\n readonly TEXTURE_FORMAT_ETC1: number;\r\n readonly TEXTURE_FORMAT_ETC2: number;\r\n readonly TEXTURE_FORMAT_ETC2A: number;\r\n readonly TEXTURE_FORMAT_ETC2A1: number;\r\n readonly TEXTURE_FORMAT_PTC12: number;\r\n readonly TEXTURE_FORMAT_PTC14: number;\r\n readonly TEXTURE_FORMAT_PTC12A: number;\r\n readonly TEXTURE_FORMAT_PTC14A: number;\r\n readonly TEXTURE_FORMAT_PTC22: number;\r\n readonly TEXTURE_FORMAT_PTC24: number;\r\n readonly TEXTURE_FORMAT_ATC: number;\r\n readonly TEXTURE_FORMAT_ATCE: number;\r\n readonly TEXTURE_FORMAT_ATCI: number;\r\n readonly TEXTURE_FORMAT_ASTC4x4: number;\r\n readonly TEXTURE_FORMAT_ASTC5x4: number;\r\n readonly TEXTURE_FORMAT_ASTC5x5: number;\r\n readonly TEXTURE_FORMAT_ASTC6x5: number;\r\n readonly TEXTURE_FORMAT_ASTC6x6: number;\r\n readonly TEXTURE_FORMAT_ASTC8x5: number;\r\n readonly TEXTURE_FORMAT_ASTC8x6: number;\r\n readonly TEXTURE_FORMAT_ASTC8x8: number;\r\n readonly TEXTURE_FORMAT_ASTC10x5: number;\r\n readonly TEXTURE_FORMAT_ASTC10x6: number;\r\n readonly TEXTURE_FORMAT_ASTC10x8: number;\r\n readonly TEXTURE_FORMAT_ASTC10x10: number;\r\n readonly TEXTURE_FORMAT_ASTC12x10: number;\r\n readonly TEXTURE_FORMAT_ASTC12x12: number;\r\n\r\n readonly TEXTURE_FORMAT_R1: number;\r\n readonly TEXTURE_FORMAT_A8: number;\r\n readonly TEXTURE_FORMAT_R8: number;\r\n readonly TEXTURE_FORMAT_R8I: number;\r\n readonly TEXTURE_FORMAT_R8U: number;\r\n readonly TEXTURE_FORMAT_R8S: number;\r\n readonly TEXTURE_FORMAT_R16: number;\r\n readonly TEXTURE_FORMAT_R16I: number;\r\n readonly TEXTURE_FORMAT_R16U: number;\r\n readonly TEXTURE_FORMAT_R16F: number;\r\n readonly TEXTURE_FORMAT_R16S: number;\r\n readonly TEXTURE_FORMAT_R32I: number;\r\n readonly TEXTURE_FORMAT_R32U: number;\r\n readonly TEXTURE_FORMAT_R32F: number;\r\n readonly TEXTURE_FORMAT_RG8: number;\r\n readonly TEXTURE_FORMAT_RG8I: number;\r\n readonly TEXTURE_FORMAT_RG8U: number;\r\n readonly TEXTURE_FORMAT_RG8S: number;\r\n readonly TEXTURE_FORMAT_RG16: number;\r\n readonly TEXTURE_FORMAT_RG16I: number;\r\n readonly TEXTURE_FORMAT_RG16U: number;\r\n readonly TEXTURE_FORMAT_RG16F: number;\r\n readonly TEXTURE_FORMAT_RG16S: number;\r\n readonly TEXTURE_FORMAT_RG32I: number;\r\n readonly TEXTURE_FORMAT_RG32U: number;\r\n readonly TEXTURE_FORMAT_RG32F: number;\r\n readonly TEXTURE_FORMAT_RGB8: number;\r\n readonly TEXTURE_FORMAT_RGB8I: number;\r\n readonly TEXTURE_FORMAT_RGB8U: number;\r\n readonly TEXTURE_FORMAT_RGB8S: number;\r\n readonly TEXTURE_FORMAT_RGB9E5F: number;\r\n readonly TEXTURE_FORMAT_BGRA8: number;\r\n readonly TEXTURE_FORMAT_RGBA8: number;\r\n readonly TEXTURE_FORMAT_RGBA8I: number;\r\n readonly TEXTURE_FORMAT_RGBA8U: number;\r\n readonly TEXTURE_FORMAT_RGBA8S: number;\r\n readonly TEXTURE_FORMAT_RGBA16: number;\r\n readonly TEXTURE_FORMAT_RGBA16I: number;\r\n readonly TEXTURE_FORMAT_RGBA16U: number;\r\n readonly TEXTURE_FORMAT_RGBA16F: number;\r\n readonly TEXTURE_FORMAT_RGBA16S: number;\r\n readonly TEXTURE_FORMAT_RGBA32I: number;\r\n readonly TEXTURE_FORMAT_RGBA32U: number;\r\n readonly TEXTURE_FORMAT_RGBA32F: number;\r\n readonly TEXTURE_FORMAT_B5G6R5: number;\r\n readonly TEXTURE_FORMAT_R5G6B5: number;\r\n readonly TEXTURE_FORMAT_BGRA4: number;\r\n readonly TEXTURE_FORMAT_RGBA4: number;\r\n readonly TEXTURE_FORMAT_BGR5A1: number;\r\n readonly TEXTURE_FORMAT_RGB5A1: number;\r\n readonly TEXTURE_FORMAT_RGB10A2: number;\r\n readonly TEXTURE_FORMAT_RG11B10F: number;\r\n\r\n readonly TEXTURE_FORMAT_D16: number;\r\n readonly TEXTURE_FORMAT_D24: number;\r\n readonly TEXTURE_FORMAT_D24S8: number;\r\n readonly TEXTURE_FORMAT_D32: number;\r\n readonly TEXTURE_FORMAT_D16F: number;\r\n readonly TEXTURE_FORMAT_D24F: number;\r\n readonly TEXTURE_FORMAT_D32F: number;\r\n readonly TEXTURE_FORMAT_D0S8: 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_UNSETTEXTURE: NativeData;\r\n readonly COMMAND_DISCARDALLTEXTURES: 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_DRAWINDEXEDINSTANCED: NativeData;\r\n readonly COMMAND_DRAW: NativeData;\r\n readonly COMMAND_DRAWINSTANCED: NativeData;\r\n readonly COMMAND_CLEAR: NativeData;\r\n readonly COMMAND_SETSTENCIL: NativeData;\r\n readonly COMMAND_SETVIEWPORT: NativeData;\r\n readonly COMMAND_SETSCISSOR: NativeData;\r\n readonly COMMAND_COPYTEXTURE: NativeData;\r\n}\r\n\r\n/** @internal */\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/** @internal */\r\ninterface INativeCameraConstructor {\r\n prototype: INativeCamera;\r\n new (): INativeCamera;\r\n}\r\n\r\n/** @internal */\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/** @internal */\r\ninterface INativeImageConstructor {\r\n prototype: IImage;\r\n new (): IImage;\r\n}\r\n\r\n/** @internal */\r\ninterface INativePath2DConstructor {\r\n prototype: IPath2D;\r\n new (d?: string): IPath2D;\r\n}\r\n\r\n/** @internal */\r\ninterface IDeviceInputSystemConstructor {\r\n prototype: IDeviceInputSystem;\r\n new (\r\n onDeviceConnected: (deviceType: DeviceType, deviceSlot: number) => void,\r\n onDeviceDisconnected: (deviceType: DeviceType, deviceSlot: number) => void,\r\n onInputChanged: (deviceType: DeviceType, deviceSlot: number, inputIndex: number, currentState: number) => void\r\n ): IDeviceInputSystem;\r\n}\r\n\r\n/** @internal */\r\nexport interface INativeDataStream {\r\n writeBuffer(buffer: ArrayBuffer, length: number): void;\r\n}\r\n\r\n/** @internal */\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/** @internal */\r\nexport interface INative {\r\n Engine: INativeEngineConstructor;\r\n Camera: INativeCameraConstructor;\r\n Canvas: INativeCanvasConstructor;\r\n Image: INativeImageConstructor;\r\n Path2D: INativePath2DConstructor;\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":["../../../../../dev/core/src/Engines/Native/nativeInterfaces.ts"],"names":[],"mappings":"AAgaA,mFAAmF;AACnF,MAAM,CAAN,IAAkB,gBAGjB;AAHD,WAAkB,gBAAgB;IAC9B,uDAAQ,CAAA;IACR,qDAAO,CAAA;AACX,CAAC,EAHiB,gBAAgB,KAAhB,gBAAgB,QAGjC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { DeviceType } from \"../../DeviceInput/InputDevices/deviceEnums\";\r\nimport type { IDeviceInputSystem } from \"../../DeviceInput/inputInterfaces\";\r\nimport type { InternalTexture } from \"../../Materials/Textures/internalTexture\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { ICanvas, IImage, IPath2D } from \"../ICanvas\";\r\nimport type { NativeData, NativeDataStream } from \"./nativeDataStream\";\r\n\r\nexport type NativeTexture = NativeData;\r\nexport type NativeFramebuffer = NativeData;\r\nexport type NativeVertexArrayObject = NativeData;\r\nexport type NativeProgram = NativeData;\r\nexport type NativeUniform = NativeData;\r\n\r\n/** @internal */\r\nexport type NativeFrameStats = {\r\n /** @internal */\r\n gpuTimeNs: number;\r\n};\r\n\r\n/** @internal */\r\nexport interface INativeEngine {\r\n dispose(): void;\r\n\r\n requestAnimationFrame(callback: () => void): void;\r\n setDeviceLostCallback(callback: () => void): void;\r\n\r\n createVertexArray(): NativeData;\r\n\r\n createIndexBuffer(dataBuffer: ArrayBuffer, dataByteOffset: number, dataByteLength: number, is32Bits: boolean, dynamic: boolean): NativeData;\r\n recordIndexBuffer(vertexArray: NativeData, indexBuffer: NativeData): void;\r\n updateDynamicIndexBuffer(indexBuffer: NativeData, data: ArrayBuffer, dataByteOffset: number, dataByteLength: number, startIndex: number): void;\r\n\r\n createVertexBuffer(dataBuffer: ArrayBuffer, dataByteOffset: number, dataByteLength: number, dynamic: boolean): NativeData;\r\n recordVertexBuffer(\r\n vertexArray: NativeData,\r\n vertexBuffer: NativeData,\r\n location: number,\r\n byteOffset: number,\r\n byteStride: number,\r\n numElements: number,\r\n type: number,\r\n normalized: boolean,\r\n instanceDivisor: number\r\n ): void;\r\n updateDynamicVertexBuffer(vertexBuffer: NativeData, dataBuffer: ArrayBuffer, dataByteOffset: number, dataByteLength: number, vertexByteOffset?: number): void;\r\n\r\n createProgram(vertexShader: string, fragmentShader: string): NativeProgram;\r\n createProgramAsync(vertexShader: string, fragmentShader: string, onSuccess: () => void, onError: (error: Error) => void): NativeProgram;\r\n getUniforms(shaderProgram: NativeProgram, uniformsNames: string[]): WebGLUniformLocation[];\r\n getAttributes(shaderProgram: NativeProgram, attributeNames: string[]): number[];\r\n\r\n createTexture(): NativeTexture;\r\n initializeTexture(texture: NativeTexture, width: number, height: number, hasMips: boolean, format: number, renderTarget: boolean, srgb: boolean, samples: number): void;\r\n loadTexture(texture: NativeTexture, data: ArrayBufferView, generateMips: boolean, invertY: boolean, srgb: boolean, onSuccess: () => void, onError: () => void): void;\r\n loadRawTexture(texture: NativeTexture, data: ArrayBufferView, width: number, height: number, format: number, generateMips: boolean, invertY: boolean): void;\r\n loadRawTexture2DArray(\r\n texture: NativeTexture,\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n depth: number,\r\n format: number,\r\n generateMipMaps: boolean,\r\n invertY: boolean\r\n ): void;\r\n loadCubeTexture(texture: NativeTexture, data: Array<ArrayBufferView>, generateMips: boolean, invertY: boolean, srgb: boolean, onSuccess: () => void, onError: () => void): void;\r\n loadCubeTextureWithMips(texture: NativeTexture, data: Array<Array<ArrayBufferView>>, invertY: boolean, srgb: boolean, onSuccess: () => void, onError: () => void): void;\r\n getTextureWidth(texture: NativeTexture): number;\r\n getTextureHeight(texture: NativeTexture): number;\r\n deleteTexture(texture: NativeTexture): void;\r\n readTexture(\r\n texture: NativeTexture,\r\n mipLevel: number,\r\n x: number,\r\n y: number,\r\n width: number,\r\n height: number,\r\n buffer: Nullable<ArrayBuffer>,\r\n bufferOffset: number,\r\n bufferLength: number\r\n ): Promise<ArrayBuffer>;\r\n\r\n createImageBitmap(data: ArrayBuffer | IImage): ImageBitmap;\r\n resizeImageBitmap(image: ImageBitmap, bufferWidth: number, bufferHeight: number): Uint8Array;\r\n\r\n createFrameBuffer(\r\n texture: Nullable<NativeTexture>,\r\n width: number,\r\n height: number,\r\n generateStencilBuffer: boolean,\r\n generateDepthBuffer: boolean,\r\n samples: number\r\n ): NativeFramebuffer;\r\n\r\n getRenderWidth(): number;\r\n getRenderHeight(): number;\r\n\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 populateFrameStats(stats: NativeFrameStats): void;\r\n}\r\n\r\n/** @internal */\r\ninterface INativeEngineInfo {\r\n version: string;\r\n nonFloatVertexBuffers: true;\r\n}\r\n\r\n/** @internal */\r\ninterface INativeEngineConstructor {\r\n prototype: INativeEngine;\r\n new (info: INativeEngineInfo): INativeEngine;\r\n\r\n readonly PROTOCOL_VERSION: number;\r\n\r\n readonly CAPS_LIMITS_MAX_TEXTURE_SIZE: number;\r\n readonly CAPS_LIMITS_MAX_TEXTURE_LAYERS: number;\r\n\r\n readonly TEXTURE_NEAREST_NEAREST: number;\r\n readonly TEXTURE_LINEAR_LINEAR: number;\r\n readonly TEXTURE_LINEAR_LINEAR_MIPLINEAR: number;\r\n readonly TEXTURE_NEAREST_NEAREST_MIPNEAREST: number;\r\n readonly TEXTURE_NEAREST_LINEAR_MIPNEAREST: number;\r\n readonly TEXTURE_NEAREST_LINEAR_MIPLINEAR: number;\r\n readonly TEXTURE_NEAREST_LINEAR: number;\r\n readonly TEXTURE_NEAREST_NEAREST_MIPLINEAR: number;\r\n readonly TEXTURE_LINEAR_NEAREST_MIPNEAREST: number;\r\n readonly TEXTURE_LINEAR_NEAREST_MIPLINEAR: number;\r\n readonly TEXTURE_LINEAR_LINEAR_MIPNEAREST: number;\r\n readonly TEXTURE_LINEAR_NEAREST: number;\r\n\r\n readonly DEPTH_TEST_LESS: number;\r\n readonly DEPTH_TEST_LEQUAL: number;\r\n readonly DEPTH_TEST_EQUAL: number;\r\n readonly DEPTH_TEST_GEQUAL: number;\r\n readonly DEPTH_TEST_GREATER: number;\r\n readonly DEPTH_TEST_NOTEQUAL: number;\r\n readonly DEPTH_TEST_NEVER: number;\r\n readonly DEPTH_TEST_ALWAYS: number;\r\n\r\n readonly ADDRESS_MODE_WRAP: number;\r\n readonly ADDRESS_MODE_MIRROR: number;\r\n readonly ADDRESS_MODE_CLAMP: number;\r\n readonly ADDRESS_MODE_BORDER: number;\r\n readonly ADDRESS_MODE_MIRROR_ONCE: number;\r\n\r\n readonly TEXTURE_FORMAT_BC1: number;\r\n readonly TEXTURE_FORMAT_BC2: number;\r\n readonly TEXTURE_FORMAT_BC3: number;\r\n readonly TEXTURE_FORMAT_BC4: number;\r\n readonly TEXTURE_FORMAT_BC5: number;\r\n readonly TEXTURE_FORMAT_BC6H: number;\r\n readonly TEXTURE_FORMAT_BC7: number;\r\n readonly TEXTURE_FORMAT_ETC1: number;\r\n readonly TEXTURE_FORMAT_ETC2: number;\r\n readonly TEXTURE_FORMAT_ETC2A: number;\r\n readonly TEXTURE_FORMAT_ETC2A1: number;\r\n readonly TEXTURE_FORMAT_PTC12: number;\r\n readonly TEXTURE_FORMAT_PTC14: number;\r\n readonly TEXTURE_FORMAT_PTC12A: number;\r\n readonly TEXTURE_FORMAT_PTC14A: number;\r\n readonly TEXTURE_FORMAT_PTC22: number;\r\n readonly TEXTURE_FORMAT_PTC24: number;\r\n readonly TEXTURE_FORMAT_ATC: number;\r\n readonly TEXTURE_FORMAT_ATCE: number;\r\n readonly TEXTURE_FORMAT_ATCI: number;\r\n readonly TEXTURE_FORMAT_ASTC4x4: number;\r\n readonly TEXTURE_FORMAT_ASTC5x4: number;\r\n readonly TEXTURE_FORMAT_ASTC5x5: number;\r\n readonly TEXTURE_FORMAT_ASTC6x5: number;\r\n readonly TEXTURE_FORMAT_ASTC6x6: number;\r\n readonly TEXTURE_FORMAT_ASTC8x5: number;\r\n readonly TEXTURE_FORMAT_ASTC8x6: number;\r\n readonly TEXTURE_FORMAT_ASTC8x8: number;\r\n readonly TEXTURE_FORMAT_ASTC10x5: number;\r\n readonly TEXTURE_FORMAT_ASTC10x6: number;\r\n readonly TEXTURE_FORMAT_ASTC10x8: number;\r\n readonly TEXTURE_FORMAT_ASTC10x10: number;\r\n readonly TEXTURE_FORMAT_ASTC12x10: number;\r\n readonly TEXTURE_FORMAT_ASTC12x12: number;\r\n\r\n readonly TEXTURE_FORMAT_R1: number;\r\n readonly TEXTURE_FORMAT_A8: number;\r\n readonly TEXTURE_FORMAT_R8: number;\r\n readonly TEXTURE_FORMAT_R8I: number;\r\n readonly TEXTURE_FORMAT_R8U: number;\r\n readonly TEXTURE_FORMAT_R8S: number;\r\n readonly TEXTURE_FORMAT_R16: number;\r\n readonly TEXTURE_FORMAT_R16I: number;\r\n readonly TEXTURE_FORMAT_R16U: number;\r\n readonly TEXTURE_FORMAT_R16F: number;\r\n readonly TEXTURE_FORMAT_R16S: number;\r\n readonly TEXTURE_FORMAT_R32I: number;\r\n readonly TEXTURE_FORMAT_R32U: number;\r\n readonly TEXTURE_FORMAT_R32F: number;\r\n readonly TEXTURE_FORMAT_RG8: number;\r\n readonly TEXTURE_FORMAT_RG8I: number;\r\n readonly TEXTURE_FORMAT_RG8U: number;\r\n readonly TEXTURE_FORMAT_RG8S: number;\r\n readonly TEXTURE_FORMAT_RG16: number;\r\n readonly TEXTURE_FORMAT_RG16I: number;\r\n readonly TEXTURE_FORMAT_RG16U: number;\r\n readonly TEXTURE_FORMAT_RG16F: number;\r\n readonly TEXTURE_FORMAT_RG16S: number;\r\n readonly TEXTURE_FORMAT_RG32I: number;\r\n readonly TEXTURE_FORMAT_RG32U: number;\r\n readonly TEXTURE_FORMAT_RG32F: number;\r\n readonly TEXTURE_FORMAT_RGB8: number;\r\n readonly TEXTURE_FORMAT_RGB8I: number;\r\n readonly TEXTURE_FORMAT_RGB8U: number;\r\n readonly TEXTURE_FORMAT_RGB8S: number;\r\n readonly TEXTURE_FORMAT_RGB9E5F: number;\r\n readonly TEXTURE_FORMAT_BGRA8: number;\r\n readonly TEXTURE_FORMAT_RGBA8: number;\r\n readonly TEXTURE_FORMAT_RGBA8I: number;\r\n readonly TEXTURE_FORMAT_RGBA8U: number;\r\n readonly TEXTURE_FORMAT_RGBA8S: number;\r\n readonly TEXTURE_FORMAT_RGBA16: number;\r\n readonly TEXTURE_FORMAT_RGBA16I: number;\r\n readonly TEXTURE_FORMAT_RGBA16U: number;\r\n readonly TEXTURE_FORMAT_RGBA16F: number;\r\n readonly TEXTURE_FORMAT_RGBA16S: number;\r\n readonly TEXTURE_FORMAT_RGBA32I: number;\r\n readonly TEXTURE_FORMAT_RGBA32U: number;\r\n readonly TEXTURE_FORMAT_RGBA32F: number;\r\n readonly TEXTURE_FORMAT_B5G6R5: number;\r\n readonly TEXTURE_FORMAT_R5G6B5: number;\r\n readonly TEXTURE_FORMAT_BGRA4: number;\r\n readonly TEXTURE_FORMAT_RGBA4: number;\r\n readonly TEXTURE_FORMAT_BGR5A1: number;\r\n readonly TEXTURE_FORMAT_RGB5A1: number;\r\n readonly TEXTURE_FORMAT_RGB10A2: number;\r\n readonly TEXTURE_FORMAT_RG11B10F: number;\r\n\r\n readonly TEXTURE_FORMAT_D16: number;\r\n readonly TEXTURE_FORMAT_D24: number;\r\n readonly TEXTURE_FORMAT_D24S8: number;\r\n readonly TEXTURE_FORMAT_D32: number;\r\n readonly TEXTURE_FORMAT_D16F: number;\r\n readonly TEXTURE_FORMAT_D24F: number;\r\n readonly TEXTURE_FORMAT_D32F: number;\r\n readonly TEXTURE_FORMAT_D0S8: 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_UNSETTEXTURE: NativeData;\r\n readonly COMMAND_DISCARDALLTEXTURES: 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_DRAWINDEXEDINSTANCED: NativeData;\r\n readonly COMMAND_DRAW: NativeData;\r\n readonly COMMAND_DRAWINSTANCED: NativeData;\r\n readonly COMMAND_CLEAR: NativeData;\r\n readonly COMMAND_SETSTENCIL: NativeData;\r\n readonly COMMAND_SETVIEWPORT: NativeData;\r\n readonly COMMAND_SETSCISSOR: NativeData;\r\n readonly COMMAND_COPYTEXTURE: NativeData;\r\n}\r\n\r\n/** @internal */\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/** @internal */\r\ninterface INativeCameraConstructor {\r\n prototype: INativeCamera;\r\n new (): INativeCamera;\r\n}\r\n\r\n/** @internal */\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/** @internal */\r\ninterface INativeImageConstructor {\r\n prototype: IImage;\r\n new (): IImage;\r\n}\r\n\r\n/** @internal */\r\ninterface INativePath2DConstructor {\r\n prototype: IPath2D;\r\n new (d?: string): IPath2D;\r\n}\r\n\r\n/** @internal */\r\ninterface IDeviceInputSystemConstructor {\r\n prototype: IDeviceInputSystem;\r\n new (\r\n onDeviceConnected: (deviceType: DeviceType, deviceSlot: number) => void,\r\n onDeviceDisconnected: (deviceType: DeviceType, deviceSlot: number) => void,\r\n onInputChanged: (deviceType: DeviceType, deviceSlot: number, inputIndex: number, currentState: number) => void\r\n ): IDeviceInputSystem;\r\n}\r\n\r\n/** @internal */\r\nexport interface INativeDataStream {\r\n writeBuffer(buffer: ArrayBuffer, length: number): void;\r\n}\r\n\r\n/** @internal */\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// Note: These values need to match those in Babylon Native's NativeTracing plugin.\r\nexport const enum NativeTraceLevel {\r\n Mark = 1,\r\n Log = 2,\r\n}\r\n\r\n/** @internal */\r\nexport interface INative {\r\n // NativeEngine plugin\r\n Engine: INativeEngineConstructor;\r\n NativeDataStream: INativeDataStreamConstructor;\r\n\r\n // NativeCamera plugin\r\n Camera?: INativeCameraConstructor;\r\n\r\n // NativeCanvas plugin\r\n Canvas?: INativeCanvasConstructor;\r\n Image?: INativeImageConstructor;\r\n Path2D?: INativePath2DConstructor;\r\n\r\n // Native XMLHttpRequest polyfill\r\n XMLHttpRequest?: typeof XMLHttpRequest;\r\n\r\n // NativeInput plugin\r\n DeviceInputSystem?: IDeviceInputSystemConstructor;\r\n\r\n // NativeTracing plugin\r\n enablePerformanceLogging?(level?: NativeTraceLevel): void;\r\n disablePerformanceLogging?(): void;\r\n startPerformanceCounter?(counter: string): unknown;\r\n endPerformanceCounter?(counter: unknown): void;\r\n}\r\n"]}
@@ -2052,7 +2052,7 @@ export class NativeEngine extends Engine {
2052
2052
  * @returns IImage interface
2053
2053
  */
2054
2054
  createCanvasImage() {
2055
- if (!_native.Canvas) {
2055
+ if (!_native.Image) {
2056
2056
  throw new Error("Native Canvas plugin not available.");
2057
2057
  }
2058
2058
  const image = new _native.Image();
@@ -2064,7 +2064,7 @@ export class NativeEngine extends Engine {
2064
2064
  * @param d SVG path string
2065
2065
  */
2066
2066
  createCanvasPath2D(d) {
2067
- if (!_native.Canvas) {
2067
+ if (!_native.Path2D) {
2068
2068
  throw new Error("Native Canvas plugin not available.");
2069
2069
  }
2070
2070
  const path2d = new _native.Path2D(d);