瀏覽代碼

Add AddUVs() for Polygon and load() for h2d.col.Point

ShiroSmith 6 年之前
父節點
當前提交
d0053e7d47
共有 2 個文件被更改,包括 8 次插入1 次删除
  1. 5 0
      h2d/col/Point.hx
  2. 3 1
      h3d/prim/Polygon.hx

+ 5 - 0
h2d/col/Point.hx

@@ -77,6 +77,11 @@ class Point {
 		this.y = y;
 	}
 
+	public inline function load( p : h2d.col.Point ) {
+		this.x = p.x;
+		this.y = p.y;
+	}
+
 	public inline function scale( f : Float ) {
 		x *= f;
 		y *= f;

+ 3 - 1
h3d/prim/Polygon.hx

@@ -231,7 +231,9 @@ class Polygon extends MeshPrimitive {
 	}
 
 	public function addUVs() {
-		throw "Not implemented for this polygon";
+		uvs = [];
+		for( i in 0 ... points.length )
+			uvs[i] = new UV(points[i].x, points[i].y);
 	}
 
 	public function uvScale( su : Float, sv : Float ) {