Просмотр исходного кода

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 год назад
Родитель
Сommit
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 )