Esempio n. 1
0
        public Schematic ApplyShader(Schematic schematic, ShaderStep shaderStep)
        {
            List <Voxel> allVoxels = schematic.GetAllVoxels();

            int index = 0;

            using (ProgressBar progressBar = new ProgressBar())
            {
                foreach (Voxel voxel in allVoxels)
                {
                    int x = voxel.X;
                    int y = voxel.Y;
                    int z = voxel.Z;

                    if (x == 0 || y == 0 || z == 0)
                    {
                        continue;
                    }

                    if (schematic.GetColorAtVoxelIndex(x - 1, y, z) == 0 &&
                        schematic.GetColorAtVoxelIndex(x + 1, y, z) == 0 &&
                        schematic.GetColorAtVoxelIndex(x, y - 1, z) == 0 &&
                        schematic.GetColorAtVoxelIndex(x, y + 1, z) == 0 &&
                        schematic.GetColorAtVoxelIndex(x, y, z - 1) == 0 &&
                        schematic.GetColorAtVoxelIndex(x, y, z + 1) == 0)
                    {
                        schematic.RemoveVoxel(x, y, z);
                    }

                    progressBar.Report(index++ / (float)allVoxels.Count);
                }
            }
            Console.WriteLine("[INFO] Done.");
            return(schematic);
        }
Esempio n. 2
0
        public Schematic ApplyShader(Schematic schematic, ShaderStep shaderStep)
        {
            ShaderFill shaderFill = shaderStep as ShaderFill;

            if (shaderFill.TargetColorIndex == -1)
            {
                schematic = ProcessSchematicInDeleteMode(schematic, shaderFill);
            }
            else
            {
                switch (shaderFill.RotationMode)
                {
                case RotationMode.X:
                    schematic = ProcessSchematicInXAxis(schematic, shaderFill);
                    break;

                case RotationMode.Y:
                    schematic = ProcessSchematicInYAxis(schematic, shaderFill);
                    break;

                case RotationMode.Z:
                    schematic = ProcessSchematicInZAxis(schematic, shaderFill);
                    break;
                }
            }

            return(schematic);
        }
Esempio n. 3
0
 public Schematic ApplyShader(Schematic schematic, ShaderStep shaderStep)
 {
     mShaderCase = shaderStep as ShaderCase;
     for (int i = 0; i < mShaderCase.Iterations; i++)
     {
         Console.WriteLine("[INFO] Process iteration: " + i);
         schematic = ProcessShaderCase(schematic, mShaderCase);
     }
     Console.WriteLine("[INFO] Done.");
     return(schematic);
 }
Esempio n. 4
0
        public Schematic ApplyShader(Schematic schematic, ShaderStep shaderStep)
        {
            mShaderPatina = shaderStep as ShaderPatina;
            for (int i = 0; i < mShaderPatina.Iterations; i++)
            {
                Console.WriteLine("[INFO] Process iteration: " + i);
                schematic = ProcessShaderPatina(schematic);
                if (mShouldBreak)
                {
                    break;
                }
            }

            Console.WriteLine("[INFO] Done.");
            return(schematic);
        }
Esempio n. 5
0
        public Schematic ApplyShader(Schematic schematic, ShaderStep shaderStep)
        {
            ShaderFixHoles shaderFixHoles = shaderStep as ShaderFixHoles;

            for (int i = 0; i < shaderFixHoles.Iterations; i++)
            {
                Console.WriteLine("[INFO] Process iteration: " + i);
                schematic = ProcessShaderFixHoles(schematic);
                if (mShouldBreak)
                {
                    break;
                }
            }

            return(schematic);
        }
Esempio n. 6
0
        public Schematic WriteSchematic()
        {
            if (mSchematic == null)
            {
                Console.WriteLine("[WARNING] Current schematic is null");
                mSchematic = new Schematic();
            }

            Console.WriteLine("[INFO] Count steps: " + mShaderData.Steps.Length);
            for (int index = 0; index < mShaderData.Steps.Length; index++)
            {
                Console.WriteLine("[INFO] Start parse shader for step : " + index);
                ShaderStep step = mShaderData.Steps[index];
                step.ValidateSettings();
                step.DisplayInfo();

                mSchematic = ShaderUtils.ApplyShader(mSchematic, step);
            }

            return(mSchematic);
        }
        public Schematic ApplyShader(Schematic schematic, ShaderStep shaderStep)
        {
            ShaderColorDenoiser shaderColorDenoiser = shaderStep as ShaderColorDenoiser;

            for (int i = 0; i < shaderColorDenoiser.Iterations; i++)
            {
                Console.WriteLine("[INFO] Process iteration: " + i);
                if (shaderColorDenoiser.StrictMode)
                {
                    schematic = ProcessShaderColorDenoiserWithStrictMode(schematic);
                }
                else
                {
                    schematic = ProcessShaderColorDenoiserWithColorRange(schematic, shaderColorDenoiser.ColorRange);
                }
                if (mShouldBreak)
                {
                    break;
                }
            }

            return(schematic);
        }
Esempio n. 8
0
        public static Schematic ApplyShader(Schematic schematic, ShaderStep shaderStep)
        {
            IShaderGenerator shaderGenerator;

            switch (shaderStep.ShaderType)
            {
            case ShaderType.FIX_HOLES:
                shaderGenerator = new ApplyShaderFixHoles();
                break;

            case ShaderType.FIX_LONELY:
                shaderGenerator = new ApplyShaderFixLonely();
                break;

            case ShaderType.CASE:
                shaderGenerator = new ApplyShaderCase();
                break;

            case ShaderType.PATINA:
                shaderGenerator = new ApplyShaderPatina();
                break;

            case ShaderType.COLOR_DENOISER:
                shaderGenerator = new ApplyShaderColorDenoiser();
                break;

            case ShaderType.FILL:
                shaderGenerator = new ApplyShaderFill();
                break;

            default:
                throw new NotImplementedException();
            }

            return(shaderGenerator.ApplyShader(schematic, shaderStep));
        }