Pārlūkot izejas kodu

allocPos propagation for h2d.Graphics

ncannasse 6 gadi atpakaļ
vecāks
revīzija
c898db4944
1 mainītis faili ar 6 papildinājumiem un 4 dzēšanām
  1. 6 4
      h2d/Graphics.hx

+ 6 - 4
h2d/Graphics.hx

@@ -28,9 +28,11 @@ private class GraphicsContent extends h3d.prim.Primitive {
 	var buffers : Array<{ buf : hxd.FloatBuffer, vbuf : h3d.Buffer, idx : hxd.IndexBuffer, ibuf : h3d.Indexes }>;
 	var buffers : Array<{ buf : hxd.FloatBuffer, vbuf : h3d.Buffer, idx : hxd.IndexBuffer, ibuf : h3d.Indexes }>;
 	var bufferDirty : Bool;
 	var bufferDirty : Bool;
 	var indexDirty : Bool;
 	var indexDirty : Bool;
+	var allocPos : h3d.impl.AllocPos;
 
 
-	public function new() {
+	public function new(allocPos) {
 		buffers = [];
 		buffers = [];
+		this.allocPos = allocPos;
 	}
 	}
 
 
 	public inline function addIndex(i) {
 	public inline function addIndex(i) {
@@ -63,7 +65,7 @@ private class GraphicsContent extends h3d.prim.Primitive {
 
 
 	override function alloc( engine : h3d.Engine ) {
 	override function alloc( engine : h3d.Engine ) {
 		if (index.length <= 0) return ;
 		if (index.length <= 0) return ;
-		buffer = h3d.Buffer.ofFloats(tmp, 8, [RawFormat]);
+		buffer = h3d.Buffer.ofFloats(tmp, 8, [RawFormat], allocPos);
 		indexes = h3d.Indexes.alloc(index);
 		indexes = h3d.Indexes.alloc(index);
 		for( b in buffers ) {
 		for( b in buffers ) {
 			if( b.vbuf == null || b.vbuf.isDisposed() ) b.vbuf = h3d.Buffer.ofFloats(b.buf, 8, [RawFormat]);
 			if( b.vbuf == null || b.vbuf.isDisposed() ) b.vbuf = h3d.Buffer.ofFloats(b.buf, 8, [RawFormat]);
@@ -149,9 +151,9 @@ class Graphics extends Drawable {
 	public var tile : h2d.Tile;
 	public var tile : h2d.Tile;
 	public var bevel = 0.25; //0 = not beveled, 1 = always beveled
 	public var bevel = 0.25; //0 = not beveled, 1 = always beveled
 
 
-	public function new(?parent) {
+	public function new(?parent,?allocPos) {
 		super(parent);
 		super(parent);
-		content = new GraphicsContent();
+		content = new GraphicsContent(allocPos);
 		tile = h2d.Tile.fromColor(0xFFFFFF);
 		tile = h2d.Tile.fromColor(0xFFFFFF);
 		clear();
 		clear();
 	}
 	}