Ver Fonte

Fix MeshBatch getBoundsRec as primitive pos is already transformed.

clandrin há 3 anos atrás
pai
commit
d99863be63
1 ficheiros alterados com 11 adições e 0 exclusões
  1. 11 0
      h3d/scene/MeshBatch.hx

+ 11 - 0
h3d/scene/MeshBatch.hx

@@ -257,6 +257,17 @@ class MeshBatch extends MultiMaterial {
 		needUpload = true;
 		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() {
 	public function emitInstance() {
 		if( worldPosition == null ) syncPos();
 		if( worldPosition == null ) syncPos();
 		var ps = primitiveSubPart;
 		var ps = primitiveSubPart;