Przeglądaj źródła

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 rok temu
rodzic
commit
05ee4935cd
1 zmienionych plików z 2 dodań i 2 usunięć
  1. 2 2
      h3d/prim/Instanced.hx

+ 2 - 2
h3d/prim/Instanced.hx

@@ -22,7 +22,7 @@ class Instanced extends Primitive {
 		}
 		}
 		primitive = m;
 		primitive = m;
 		baseBounds = m.getBounds();
 		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
 			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 ) {
 	override function render( engine : h3d.Engine ) {
-		if( primitive.buffer == null || primitive.buffer.isDisposed() )
+		if( primitive.indexes == null || primitive.buffer.isDisposed() )
 			primitive.alloc(engine);
 			primitive.alloc(engine);
 		@:privateAccess engine.flushTarget();
 		@:privateAccess engine.flushTarget();
 		@:privateAccess if( primitive.buffers == null )
 		@:privateAccess if( primitive.buffers == null )