Contains variables used in voxel terrain shader program.
Beispiel #1
0
        private void numericUpDownDiffuseIntensity3_ValueChanged(object sender, EventArgs e)
        {
            VoxelMeshSettings settings = voxelTerrain.Container.Settings;

            settings.DiffuseIntensity.Z     = (float)numericUpDownDiffuseIntensity3.Value;
            voxelTerrain.Container.Settings = settings;
        }
Beispiel #2
0
        /// <summary>
        /// Initializes application.
        /// </summary>
        public override void Initialize()
        {
            base.Initialize();

            TexturePack pack = new TexturePack();

            pack.Color = LoadTexture(@"Textures\tex_detail_color.dds");
            pack.Bump  = LoadTexture(@"Textures\tex_detail_bump.dds");
            textures.Add(pack);

            for (int i = 1; i <= 19; i++)
            {
                pack       = new TexturePack();
                pack.Color = LoadTexture(@"Textures\tex_" + i + @"_color.dds");
                pack.Bump  = LoadTexture(@"Textures\tex_" + i + @"_bump.dds");
                pack.Disp  = LoadTexture(@"Textures\tex_" + i + @"_disp.dds");
                textures.Add(pack);
            }

            voxelTerrain = new VoxelMesh(graphicsDevice, camera);

            VoxelMeshSettings settings = voxelTerrain.Container.Settings;

            settings.DetailTexture          = textures[0];
            settings.Texture1               = textures[1];
            settings.Texture2               = textures[2];
            settings.Texture3               = textures[3];
            voxelTerrain.Container.Settings = settings;

            skyCube = new SkyCube(graphicsDevice, camera);
        }
Beispiel #3
0
        private void numericUpDownSpecularRange3_ValueChanged(object sender, EventArgs e)
        {
            VoxelMeshSettings settings = voxelTerrain.Container.Settings;

            settings.SpecularRange.Z        = (float)numericUpDownSpecularRange3.Value;
            voxelTerrain.Container.Settings = settings;
        }
Beispiel #4
0
        private void numericUpDownTessellationMaximum_ValueChanged(object sender, EventArgs e)
        {
            VoxelMeshSettings settings = voxelTerrain.Container.Settings;

            settings.TessellationFactor.Y   = (float)numericUpDownTessellationMaximum.Value;
            voxelTerrain.Container.Settings = settings;
        }
Beispiel #5
0
        private void buttonTerrainGenerate_Click(object sender, EventArgs e)
        {
            int width  = (int)numericUpDownTerrainWidth.Value;
            int height = (int)numericUpDownTerrainHeight.Value;
            int depth  = (int)numericUpDownTerrainDepth.Value;

            VoxelMeshSettings settings = voxelTerrain.Container.Settings;

            settings.LevelOfDetail          = (int)numericUpDownTerrainLevelOfDetail.Value;
            voxelTerrain.Container.Settings = settings;

            switch (comboBoxTerrainType.SelectedIndex)
            {
            case 0:
                voxelTerrain.Generator.GenerateFromFormula(width, height, depth);
                break;

            case 1:
                voxelTerrain.Generator.GenerateFromNoiseCube(width, height, depth);
                break;

            case 2:
                voxelTerrain.Generator.GenerateFromNoiseCubeWithWarp(width, height, depth);
                break;
            }
        }
Beispiel #6
0
        private void numericUpDownBumpPowerDetail_ValueChanged(object sender, EventArgs e)
        {
            VoxelMeshSettings settings = voxelTerrain.Container.Settings;

            settings.BumpPower.W            = (float)numericUpDownBumpPowerDetail.Value;
            voxelTerrain.Container.Settings = settings;
        }
Beispiel #7
0
        private void numericUpDownDispPower3_ValueChanged(object sender, EventArgs e)
        {
            VoxelMeshSettings settings = voxelTerrain.Container.Settings;

            settings.DisplacementPower.Z    = (float)numericUpDownDispPower3.Value;
            voxelTerrain.Container.Settings = settings;
        }
Beispiel #8
0
        private void numericUpDownTextureCoordinatesDetail_ValueChanged(object sender, EventArgs e)
        {
            VoxelMeshSettings settings = voxelTerrain.Container.Settings;

            settings.TextureCoordinates.W   = (float)numericUpDownTextureCoordinatesDetail.Value;
            voxelTerrain.Container.Settings = settings;
        }
Beispiel #9
0
        private void numericUpDownTexturePackDetail_ValueChanged(object sender, EventArgs e)
        {
            VoxelMeshSettings settings = voxelTerrain.Container.Settings;

            settings.DetailTexture          = textures[(int)numericUpDownTexturePackDetail.Value];
            voxelTerrain.Container.Settings = settings;
        }
Beispiel #10
0
        /// <summary>
        /// Renders frame on the screen.
        /// </summary>
        public override void RenderFrame(double deltaTime)
        {
            base.RenderFrame(deltaTime);

            if (checkBoxUseEffects.Checked)
            {
                postProcess.GetRenderTarget(4).SetRenderTarget(depthStencilView);
                postProcess.GetRenderTarget(4).ClearRenderTarget(depthStencilView, new Color4(Color.Black));

                skyCube.Render();

                postProcess.GetRenderTarget(5).SetRenderTarget(depthStencilView);
                postProcess.GetRenderTarget(5).ClearRenderTarget(depthStencilView, new Color4(Color.Black));

                VoxelMeshSettings settings = voxelTerrain.Container.Settings;
                settings.FogTexture             = postProcess.GetRenderTarget(4).GetShaderResourceView();
                voxelTerrain.Container.Settings = settings;

                voxelTerrain.Renderer.Render();

                SetBackBufferRenderTarget();

                quadRenderer.Render(postProcess.MakeBloomEffect(postProcess.AddFogTexture()), 1.0f);
            }
            else
            {
                ClearScreen(new Color4(Color.Black));

                skyCube.Render();
                voxelTerrain.Renderer.Render();
            }

            ShowFrame();
        }
Beispiel #11
0
        private void numericUpDownFogMaximumDistance_ValueChanged(object sender, EventArgs e)
        {
            if (numericUpDownFogMaximumDistance.Value < numericUpDownFogMinimumDistance.Value)
            {
                numericUpDownFogMaximumDistance.Value = numericUpDownFogMinimumDistance.Value;
            }

            VoxelMeshSettings settings = voxelTerrain.Container.Settings;

            settings.FogSettings.Y          = (float)numericUpDownFogMaximumDistance.Value;
            voxelTerrain.Container.Settings = settings;
        }