public Task buildTask(string name, VoxelStruct vs, GeometryResult cb) { VoxelGeometry.MeshData data = null; TaskPack tp = new TaskPack(delegate(){ vs.arrange(); string md5 = VoxelFormater.GetMd5(vs); data = this.LoadFromFile(GetKey(md5)); if (data == null) { return(buildData(vs, delegate(VoxelGeometry.MeshData result) { data = result; // Debug.Log(md5); this.SaveToFile(GetKey(md5), data); })); } return(new Task()); }); TaskManager.PushBack(tp, delegate { if (this.gameObject.GetComponent <VoxelMesh>() == null) { this.gameObject.AddComponent <VoxelMesh>(); } VoxelMesh mesh = VoxelGeometry.Draw(name, data, this.gameObject, this._material); mesh.vs = vs; cb(mesh); }); return(tp); }
//public List public Task task(string name, VoxelData[] datas, GeometryResult cb) { Task task = new TaskPack(delegate { return(task_(name, datas, cb)); }); return(task); }
//public List public Task task(string name, VoxelData[] datas, GeometryResult cb) { Task task = new TaskPack (delegate { return task_(name, datas, cb); }); return task; }
static public Task Task(VoxelMeshBuild vmb, VoxelProduct product) { TaskPack tp = new TaskPack(delegate() { if (product.sub != null) { TaskList tl = new TaskList(); for (int i = 0; i < product.sub.Length; ++i) { tl.push(Build.Task(vmb, product.sub[i], product.main.voxels)); } return(tl); } else { return(Build.Task(vmb, product.main, product.main.voxels)); } }); return(tp); }
static public Task Task(VoxelRemoveFace vrf, VoxelProduct product) { TaskPack tp = new TaskPack(delegate() { if (product.sub != null) { TaskList tl = new TaskList(); for (int i = 0; i < product.sub.Length; ++i) { tl.push(Build.Task(vrf, product.sub[i])); } return(tl); } else { return(Build.Task(vrf, product.main)); } }); return(tp); }