Prechádzať zdrojové kódy

Fix polygons on static platforms

trethaller 7 rokov pred
rodič
commit
7b69da0085
1 zmenil súbory, kde vykonal 4 pridanie a 1 odobranie
  1. 4 1
      hide/prefab/l3d/Polygon.hx

+ 4 - 1
hide/prefab/l3d/Polygon.hx

@@ -82,7 +82,10 @@ class Polygon extends Object3D {
 			var poly2d = new h2d.col.Polygon(points);
 			var indices = poly2d.fastTriangulate();
 			var verts = [for(p in points) new h3d.col.Point(p.x, p.y, 0.)];
-			primitive = new h3d.prim.Polygon(verts, cast indices);
+			var idx = new hxd.IndexBuffer(indices.length);
+			for(i in indices)
+				idx.push(i);
+			primitive = new h3d.prim.Polygon(verts, idx);
 			primitive.normals = [for(p in points) new h3d.col.Point(0, 0, 1.)];
 			primitive.tangents = [for(p in points) new h3d.col.Point(1., 0, 0.)];
 			primitive.uvs = [for(p in points) new h3d.prim.UV(p.y + 0.5, -p.x + 0.5)];  // Setup UVs so that image up (Y) is aligned with forward axis (X)