|
@@ -7,7 +7,7 @@
|
7
|
7
|
/* Usage of the indicated versions is encouraged */
|
8
|
8
|
__THIS_PLUGIN_HAS_BEEN_TESTED_WITH__({
|
9
|
9
|
'encantar.js': { version: '0.4.0' },
|
10
|
|
- 'babylon.js': { version: '7.29.0' }
|
|
10
|
+ 'babylon.js': { version: '7.38.0' }
|
11
|
11
|
});
|
12
|
12
|
|
13
|
13
|
/**
|
|
@@ -325,18 +325,29 @@ function encantar(demo)
|
325
|
325
|
|
326
|
326
|
ar._session = session;
|
327
|
327
|
|
328
|
|
- ar._engine = new BABYLON.Engine(session.viewport.canvas, false, {
|
329
|
|
- premultipliedAlpha: true
|
330
|
|
- });
|
331
|
|
- ar._engine.resize = function(forceSetSize = false) {
|
|
328
|
+ BABYLON.Engine.prototype.resize = function(forceSetSize = false) {
|
332
|
329
|
// make babylon.js respect the resolution of the viewport
|
333
|
330
|
const size = session.viewport.virtualSize;
|
334
|
331
|
this.setSize(size.width, size.height, forceSetSize);
|
335
|
332
|
};
|
|
333
|
+ ar._engine = new BABYLON.Engine(session.viewport.canvas, false, {
|
|
334
|
+ premultipliedAlpha: true
|
|
335
|
+ });
|
336
|
336
|
|
337
|
337
|
ar._scene = new BABYLON.Scene(ar._engine);
|
338
|
338
|
ar._scene.useRightHandedSystem = true;
|
339
|
|
- ar._scene.clearColor.set(0, 0, 0, 0);
|
|
339
|
+ ar._scene.clearColor = new BABYLON.Color4(0, 0, 0, 0);
|
|
340
|
+ ar._scene._inputManager._updatePointerPosition = function(evt) {
|
|
341
|
+ // adjust babylon.js pointers to the resolution of the viewport
|
|
342
|
+ const engine = this._scene.getEngine();
|
|
343
|
+ const canvasRect = engine.getInputElementClientRect();
|
|
344
|
+ if(!canvasRect)
|
|
345
|
+ return;
|
|
346
|
+ this._pointerX = (evt.clientX - canvasRect.left) * (engine.getRenderWidth() / canvasRect.width);
|
|
347
|
+ this._pointerY = (evt.clientY - canvasRect.top) * (engine.getRenderHeight() / canvasRect.height);
|
|
348
|
+ this._unTranslatedPointerX = this._pointerX;
|
|
349
|
+ this._unTranslatedPointerY = this._pointerY;
|
|
350
|
+ };
|
340
|
351
|
|
341
|
352
|
ar._origin = new BABYLON.TransformNode('ar-origin', ar._scene);
|
342
|
353
|
ar._root = new BABYLON.TransformNode('ar-root', ar._scene);
|