Преглед изворни кода

Object.setTransform: prevent Vector alloc

trethaller пре 6 година
родитељ
комит
69139b01df
1 измењених фајлова са 2 додато и 1 уклоњено
  1. 2 1
      h3d/scene/Object.hx

+ 2 - 1
h3d/scene/Object.hx

@@ -770,8 +770,9 @@ class Object implements hxd.impl.Serializable {
 		Set the position, scale and rotation of the object relative to its parent based on the specified transform matrix.
 		Set the position, scale and rotation of the object relative to its parent based on the specified transform matrix.
 	**/
 	**/
 	static var tmpMat = new h3d.Matrix();
 	static var tmpMat = new h3d.Matrix();
+	static var tmpVec = new h3d.Vector();
 	public function setTransform( mat : h3d.Matrix ) {
 	public function setTransform( mat : h3d.Matrix ) {
-		var s = mat.getScale();
+		var s = mat.getScale(tmpVec);
 		this.x = mat.tx;
 		this.x = mat.tx;
 		this.y = mat.ty;
 		this.y = mat.ty;
 		this.z = mat.tz;
 		this.z = mat.tz;