浏览代码

make sure to rebuild shaders

Nicolas Cannasse 4 年之前
父节点
当前提交
7ca69c160c
共有 1 个文件被更改,包括 5 次插入3 次删除
  1. 5 3
      hrt/prefab/l3d/MeshSpray.hx

+ 5 - 3
hrt/prefab/l3d/MeshSpray.hx

@@ -151,9 +151,11 @@ class MeshSprayObject extends h3d.scene.Object {
 		super.emitRec(ctx);
 	}
 
-	public function redraw() {
-		for( b in batches )
+	public function redraw(updateShaders=false) {
+		for( b in batches ) {
+			if( updateShaders ) b.shadersChanged = true;
 			b.begin();
+		}
 		for( c in children ) {
 			c.culled = false;
 			if( c.alwaysSync ) continue;
@@ -901,7 +903,7 @@ class MeshSpray extends Object3D {
 			if( c.type != "model" )
 				makeChildren(ctx, c);
 		// rebuild to apply per instance shaders
-		cast(ctx.local3d, MeshSprayObject).redraw();
+		cast(ctx.local3d, MeshSprayObject).redraw(true);
 		return ctx;
 	}