浏览代码

Minor change for meshspray

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

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

@@ -850,6 +850,10 @@ class MeshSpray extends Object3D {
 
 
 	#else
 	#else
 
 
+	function getMaterial( o : h3d.scene.Mesh ) {
+		return o.material;
+	}
+
 	override function makeInstance( ctx : Context ) {
 	override function makeInstance( ctx : Context ) {
 		ctx = super.makeInstance(ctx);
 		ctx = super.makeInstance(ctx);
 		var batches = new Map();
 		var batches = new Map();
@@ -861,7 +865,7 @@ class MeshSpray extends Object3D {
 			var batch = batches.get(c.source);
 			var batch = batches.get(c.source);
 			if( batch  == null ) {
 			if( batch  == null ) {
 				var obj = ctx.loadModel(c.source).toMesh();
 				var obj = ctx.loadModel(c.source).toMesh();
-				batch = new h3d.scene.MeshBatch(cast(obj.primitive,h3d.prim.MeshPrimitive), obj.material, ctx.local3d);
+				batch = new h3d.scene.MeshBatch(cast(obj.primitive,h3d.prim.MeshPrimitive), getMaterial(obj), ctx.local3d);
 				batch.begin();
 				batch.begin();
 				batches.set(c.source, batch);
 				batches.set(c.source, batch);
 			}
 			}