Răsfoiți Sursa

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 an în urmă
părinte
comite
05ee4935cd
1 a modificat fișierele cu 2 adăugiri și 2 ștergeri
  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 )