Przeglądaj źródła

Canvas2D Reintroduce lost changes

 - Canvas2D: fix bug to hide the primitives of Tracked Nodes when they are out of the Camera's Frustum
nockawa 8 lat temu
rodzic
commit
cca13fec82

+ 4 - 0
canvas2D/src/Engine/babylon.canvas2d.ts

@@ -1286,6 +1286,10 @@
                 let worldMtx = node.getWorldMatrix();
 
                 let proj = Vector3.Project(Canvas2D._v, worldMtx, Canvas2D._m, v);
+
+                // Set the visibility state accordingly, if the position is outside the frustum (well on the Z planes only...) set the group to hidden
+                group.levelVisible = proj.z >= 0 && proj.z < 1.0;
+
                 let s = this.scale;
                 group.x = Math.round(proj.x/s);
                 group.y = Math.round((rh - proj.y)/s);

+ 2 - 0
dist/preview release/canvas2D/babylon.canvas2d.js

@@ -12830,6 +12830,8 @@ var BABYLON;
                 var node = group.trackedNode;
                 var worldMtx = node.getWorldMatrix();
                 var proj = BABYLON.Vector3.Project(Canvas2D_1._v, worldMtx, Canvas2D_1._m, v);
+                // Set the visibility state accordingly, if the position is outside the frustum (well on the Z planes only...) set the group to hidden
+                group.levelVisible = proj.z >= 0 && proj.z < 1.0;
                 var s = this.scale;
                 group.x = Math.round(proj.x / s);
                 group.y = Math.round((rh - proj.y) / s);

Plik diff jest za duży
+ 3 - 3
dist/preview release/canvas2D/babylon.canvas2d.min.js