Example #1
0
        public CubeModifier(VoxelTree control, Vector3 worldPosition, Vector3 worldDimensions, VoxelHolder value, bool updateMesh)
            : base(control, updateMesh)
        {
            this.value = value.toVoxel();
            Vector3 dimensions = worldDimensions / control.voxelSize();

            min = control.transform.InverseTransformPoint(worldPosition) / control.voxelSize() - dimensions / 2 - Vector3.one * 0.5f;
            max = min + dimensions;
            setMinMax(min, max);
//			apply();
        }
Example #2
0
        public BlurModifier(VoxelTree control, Vector3 worldPosition, float worldRadius, float strength, bool updateMesh)
            : base(control, updateMesh)
        {
            this.strength = strength;
            Vector3 radiusCube = new Vector3(worldRadius, worldRadius, worldRadius) / control.voxelSize();
            Vector3 min        = control.transform.InverseTransformPoint(worldPosition) / control.voxelSize() - radiusCube - Vector3.one * 0.5f;
            Vector3 max        = min + radiusCube * 2;

            center = (min + max) / 2;
            radius = center.x - min.x;
            setMinMax(min, max);
            setOriginal();
//			MonoBehaviour.print (min);
//			apply();
        }
        public SphereModifier(VoxelTree control, Vector3 worldPosition, float worldRadius, VoxelHolder value, bool updateMesh)
            : base(control, updateMesh)
        {
            this.value = value;
            Vector3 radiusCube = new Vector3(worldRadius, worldRadius, worldRadius) / control.voxelSize();
            Vector3 min        = control.transform.InverseTransformPoint(worldPosition) / control.voxelSize() - radiusCube - Vector3.one * 0.5f;
            Vector3 max        = min + radiusCube * 2;

            center = (min + max) / 2;
            radius = center.x - min.x;
            minDis = (radius - 1);
            maxDis = (radius + 1);
            setMinMax(min, max);
//			apply();
        }