private void initModel() { if (_model == null) { _model = this.gameObject.GetComponent <VoxelModel>(); } if (_model == null) { this._model = this.gameObject.AddComponent <VoxelModelCache>(); } }
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); }
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; }
public VoxelMesh create(VoxelModel model) { return create(model.data, model.gameObject.GetComponent<VoxelFunctionManager>()); }
public VoxelMesh create(VoxelModel model) { return(create(model.data, model.gameObject.GetComponent <VoxelFunctionManager>())); }