Beispiel #1
0
 public VoxelMesh create(VoxelData[] data, VoxelFunctionManager vf)
 {
     VoxelMesh vm = _create();
     vm.build (data);
     if (vf != null) {
         vf.build(vm);
     }
     vm.showMesh();
     return vm;
 }
Beispiel #2
0
        public VoxelMesh create(VoxelData[] data, VoxelFunctionManager vf)
        {
            VoxelMesh vm = _create();

            vm.build(data);
            if (vf != null)
            {
                vf.build(vm);
            }
            vm.showMesh();
            return(vm);
        }
        // Update is called once per frame
        void Update()
        {
            if (_model == null)
            {
                initModel();
            }


            if (_loader == null)
            {
                initLoader();
            }


            if (_building && _loader.resource())
            {
                if (_mesh == null)
                {
                    initMesh();
                }



                _loader.read();

                if (_mesh.empty)
                {
                    _mesh.build(_model.data);

                    VoxelFunctionManager vf = _model.gameObject.GetComponent <VoxelFunctionManager>();
                    if (vf != null)
                    {
                        vf.build(_mesh);
                    }
                }
                _building = false;
                if (this._enableShadow)
                {
                    //this._enableShadow = false;
                    initShadow();
                    _shadow.build(_mesh.voxels, _mesh._mesh.transform.localPosition);
                }
            }

            if (_destroying)
            {
                if (!_mesh.empty)
                {
                    _mesh.clear();
                }

                if (_shadow != null && !_shadow.empty)
                {
                    _shadow.clear();
                }



                _destroying = false;
            }
        }