ncannasse 9 лет назад
Родитель
Сommit
2fcd79c7cf
2 измененных файлов с 7 добавлено и 7 удалено
  1. 2 2
      h3d/prim/Polygon.hx
  2. 5 5
      h3d/scene/Box.hx

+ 2 - 2
h3d/prim/Polygon.hx

@@ -179,8 +179,8 @@ class Polygon extends Primitive {
 	}
 
 	override function getCollider() : h3d.col.RayCollider {
-		var vertexes = new haxe.ds.Vector(points.length * 3);
-		var indexes = new haxe.ds.Vector(idx.length);
+		var vertexes = new haxe.ds.Vector<hxd.impl.Float32>(points.length * 3);
+		var indexes = new haxe.ds.Vector<hxd.impl.UInt16>(idx.length);
 		var vid = 0;
 		for( p in points ) {
 			vertexes[vid++] = p.x;

+ 5 - 5
h3d/scene/Box.hx

@@ -4,15 +4,15 @@ class Box extends Graphics {
 
 	public var color : Int;
 
-	public function new( ?color = 0xFFFF0000, ?depth = true, ?parent) {
+	public function new( ?color = 0xFFFF0000, ?bounds : h3d.col.Bounds, ?depth = true, ?parent) {
 		super(parent);
 		this.color = color;
 		if( !depth ) material.mainPass.depth(true, Always);
 
-		var dx = new h3d.col.Point(1, 0, 0);
-		var dy = new h3d.col.Point(0, 1, 0);
-		var dz = new h3d.col.Point(0, 0, 1);
-		var p = new h3d.col.Point(-0.5,-0.5,-0.5);
+		var dx = new h3d.col.Point(bounds == null ? 1 : bounds.xMax - bounds.xMin, 0, 0);
+		var dy = new h3d.col.Point(0, bounds == null ? 1 : bounds.yMax - bounds.yMin, 0);
+		var dz = new h3d.col.Point(0, 0, bounds == null ? 1 : bounds.zMax - bounds.zMin);
+		var p = bounds == null ? new h3d.col.Point(-0.5,-0.5,-0.5) : bounds.getMin();
 
 		lineStyle(1, color);
 		drawLine(p, p.add(dx));