Beispiel #1
0
        public VoxelGeometry build(VoxelData[] datas, GameObject obj = null)
        {
            if (obj == null)
            {
                obj = this.gameObject;
            }

            VoxelProduct product = new VoxelProduct();

            begin_.init();
            begin_.setup(datas);
            begin_.build(product);


            for (int i = 0; i < list_.Count; ++i)
            {
                list_ [i].init();
                list_[i].build(product);
            }



            VoxelGeometry geometry = new VoxelGeometry();

            geometry.draw("Mesh", product, obj, this._material);
            return(geometry);
        }
Beispiel #2
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);
        }
Beispiel #3
0
        private Task task_(string name, VoxelData[] datas, GeometryResult cb)
        {
            if (list_.Count == 0)
            {
                init();
            }

            VoxelProduct product = new VoxelProduct();

            begin_.setup(datas);

            TaskList tl = new TaskList();


            tl.push(begin_.task(product));
            for (int i = 0; i < list_.Count; ++i)
            {
                tl.push(list_[i].task(product));
            }

            TaskManager.PushBack(tl, delegate {
                VoxelGeometry geometry = new VoxelGeometry();
                geometry.draw(name, product, this.gameObject, this._material);;
                cb(geometry);
            });
            return(tl);
        }
Beispiel #4
0
		public void build (VoxelData[] datas)
		{
			if (empty) {

				this._product = new VoxelProduct();

				VoxelData2Point vd2p = new VoxelData2Point(datas);
				vd2p.build(this._product);

				VoxelShadowBuild vsb = new VoxelShadowBuild ();
				vsb.build(this._product);


				VoxelMeshBuild vmb = new VoxelMeshBuild ();
				vmb.build(this._product);

				VoxelRemoveSameVertices rsv = new VoxelRemoveSameVertices ();
				rsv.build(this._product);

				//VoxelRemoveFace vrf = new VoxelRemoveFace ();
				//vrf.build(this._product);

				/*
				VoxelRemoveFace vrf = new VoxelRemoveFace ();
				vrf.build(this._product);
				*/

				_geometry = new VoxelGeometry();
				_geometry.draw (this._product, this.gameObject, this._material);
			}

		}
Beispiel #5
0
        public VoxelMesh draw(string name, VoxelStruct vs, VoxelGeometry.MeshData data, GameObject obj = null)
        {
            if (obj == null)
            {
                obj = this.gameObject;
            }
            VoxelMesh mesh = VoxelGeometry.Draw(name, data, obj, this._material);

            mesh.vs = vs;
            return(mesh);
        }
Beispiel #6
0
        public VoxelMesh build(VoxelStruct vs, GameObject obj = null)
        {
            //VoxelData[] datas = vs.datas.ToArray ();
            if (obj == null)
            {
                obj = this.gameObject;
            }
            VoxelGeometry.MeshData data = BuildMeshData(vs);
            VoxelMesh mesh = VoxelGeometry.Draw("Mesh", data, obj, this._material);

            mesh.vs = vs;
            return(mesh);
        }
Beispiel #7
0
        public VoxelGeometry build(VoxelData[] datas, GameObject obj = null)
        {
            if (obj == null) {
                obj = this.gameObject;
            }

            VoxelProduct product = new VoxelProduct();
            begin_.init ();
            begin_.setup (datas);
            begin_.build(product);

            for (int i = 0; i < list_.Count; ++i) {
                list_ [i].init ();
                list_[i].build (product);
            }

            VoxelGeometry geometry = new VoxelGeometry();
            geometry.draw ("Mesh", product, obj, this._material);
            return geometry;
        }
Beispiel #8
0
        private Task task_(string name, VoxelData[] datas, GeometryResult cb)
        {
            if (list_.Count == 0) {
                init ();
            }

            VoxelProduct product = new VoxelProduct ();

            begin_.setup (datas);

            TaskList tl = new TaskList ();

            tl.push(begin_.task (product));
            for (int i = 0; i < list_.Count; ++i) {

                tl.push(list_[i].task (product));
            }

            TaskManager.PushBack (tl, delegate {
                VoxelGeometry geometry = new VoxelGeometry ();
                geometry.draw (name, product, this.gameObject, this._material);;
                cb(geometry);
            });
            return tl;
        }