浏览代码

Ensure primitive alloc is done in setMesh of Instanced.hx.

Previously, we were calling alloc if buffer was null.
However, if the primitive had its tangents or normals recomputed before, buffer was not null even if alloc hasn't been called before.

Now, we also call alloc if indexes are null.
benoit 1 年之前
父节点
当前提交
05ee4935cd
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      h3d/prim/Instanced.hx

+ 2 - 2
h3d/prim/Instanced.hx

@@ -22,7 +22,7 @@ class Instanced extends Primitive {
 		}
 		primitive = m;
 		baseBounds = m.getBounds();
-		if( m.buffer == null )
+		if( m.buffer == null || m.indexes == null )
 			m.alloc(h3d.Engine.getCurrent()); // make sure first alloc is done
 	}
 
@@ -57,7 +57,7 @@ class Instanced extends Primitive {
 	}
 
 	override function render( engine : h3d.Engine ) {
-		if( primitive.buffer == null || primitive.buffer.isDisposed() )
+		if( primitive.indexes == null || primitive.buffer.isDisposed() )
 			primitive.alloc(engine);
 		@:privateAccess engine.flushTarget();
 		@:privateAccess if( primitive.buffers == null )