Browse Source

Add viewport.clone

Add method for cloning viewports
Simon Matt 8 năm trước cách đây
mục cha
commit
cc1ce085b3
1 tập tin đã thay đổi với 5 bổ sung1 xóa
  1. 5 1
      src/Math/babylon.math.ts

+ 5 - 1
src/Math/babylon.math.ts

@@ -4139,6 +4139,10 @@
         public toGlobal(renderWidth: number, renderHeight: number): Viewport {
             return new Viewport(this.x * renderWidth, this.y * renderHeight, this.width * renderWidth, this.height * renderHeight);
         }
+
+        public clone(): Viewport {
+            return new Viewport(this.x, this.y, this.width, this.height);
+        }
     }
 
     export class Frustum {
@@ -4834,4 +4838,4 @@
             Matrix.Zero(), Matrix.Zero(),
             Matrix.Zero(), Matrix.Zero()];                      // 6 temp Matrices at once should be enough
     }
-}
+}