Explorar o código

Add viewport.clone

Add method for cloning viewports
Simon Matt %!s(int64=8) %!d(string=hai) anos
pai
achega
cc1ce085b3
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  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
     }
-}
+}