Example #1
0
        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);
        }
Example #2
0
        //public List
        public Task task(string name, VoxelData[] datas, GeometryResult cb)
        {
            Task task = new TaskPack(delegate {
                return(task_(name, datas, cb));
            });

            return(task);
        }
Example #3
0
        //public List
        public Task task(string name, VoxelData[] datas, GeometryResult cb)
        {
            Task task = new TaskPack (delegate {
                return 	task_(name, datas, cb);
            });

            return task;
        }
Example #4
0
        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);
        }
Example #5
0
        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);
        }