Prechádzať zdrojové kódy

Fix MeshBatch getBoundsRec as primitive pos is already transformed.

clandrin 3 rokov pred
rodič
commit
d99863be63
1 zmenil súbory, kde vykonal 11 pridanie a 0 odobranie
  1. 11 0
      h3d/scene/MeshBatch.hx

+ 11 - 0
h3d/scene/MeshBatch.hx

@@ -257,6 +257,17 @@ class MeshBatch extends MultiMaterial {
 		needUpload = true;
 	}
 
+	override function getBoundsRec( b : h3d.col.Bounds ) {
+		var old = primitive;
+		primitive = null;
+		b = super.getBoundsRec(b);
+		primitive = old;
+		if( primitive == null || flags.has(FIgnoreBounds) )
+			return b;
+		b.add(primitive.getBounds());
+		return b;
+	}
+
 	public function emitInstance() {
 		if( worldPosition == null ) syncPos();
 		var ps = primitiveSubPart;