Ejemplo n.º 1
0
        private void initModel()
        {
            if (_model == null)
            {
                _model = this.gameObject.GetComponent <VoxelModel>();
            }

            if (_model == null)
            {
                this._model = this.gameObject.AddComponent <VoxelModelCache>();
            }
        }
Ejemplo n.º 2
0
		public void addFile(VoxelModel model, VectorInt3 offset){

			for (int i = 0; i < model.data.Length; ++i) {
				VoxelData data = model.data [i];
				VectorInt3 p = new VectorInt3 (data.pos.x, data.pos.y, data.pos.z) + offset;
				if (!dictionary_.ContainsKey (p)) {
					dictionary_ [p] = data;
				}
			}

			Debug.Log (dictionary_.Count);
		}
Ejemplo n.º 3
0
        public void change(int index)
        {
            Debug.Log(index);
            VoxelModel model = _model [index];

            VoxelData[] datas  = model.data;
            Color[]     colors = _voxelMesh._mesh.mesh.colors;
            Debug.LogWarning("datas" + datas);
            for (int i = 0; i < datas.Length; ++i)
            {
                VoxelHandler handler = _voxelMesh.getVoxel(new VectorInt3(datas[i].pos.x, datas[i].pos.y, datas[i].pos.z));
                if (handler != null)
                {
                    foreach (VectorInt4 vertice in handler.vertices)
                    {
                        colors[vertice.x] = datas[i].color;
                        colors[vertice.y] = datas[i].color;
                        colors[vertice.z] = datas[i].color;
                        colors[vertice.w] = datas[i].color;
                    }
                }
            }
            _voxelMesh._mesh.mesh.colors = colors;
        }
Ejemplo n.º 4
0
 public VoxelMesh create(VoxelModel model)
 {
     return create(model.data, model.gameObject.GetComponent<VoxelFunctionManager>());
 }
Ejemplo n.º 5
0
 public VoxelMesh create(VoxelModel model)
 {
     return(create(model.data, model.gameObject.GetComponent <VoxelFunctionManager>()));
 }