소스 검색

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 )