Ejemplo n.º 1
0
        /// <overloads>
        /// <summary>
        /// Initializes a new instance of the <see cref="TerrainRoadLayer"/> class.
        /// </summary>
        /// </overloads>
        ///
        /// <summary>
        /// Initializes a new instance of the <see cref="TerrainRoadLayer"/> class with the default
        /// material.
        /// </summary>
        /// <param name="graphicService">The graphic service.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="graphicService"/> is <see langword="null"/>.
        /// </exception>
        public TerrainRoadLayer(IGraphicsService graphicService)
        {
            if (graphicService == null)
            {
                throw new ArgumentNullException("graphicService");
            }

            var effect = graphicService.Content.Load <Effect>("DigitalRune/Terrain/TerrainRoadLayer");

            Material = new Material
            {
                { "Detail", new EffectBinding(graphicService, effect, null, EffectParameterHint.Material) }
            };

            FadeOutStart       = int.MaxValue;
            FadeOutEnd         = int.MaxValue;
            TileSize           = 1;
            DiffuseColor       = new Vector3(1, 1, 1);
            SpecularColor      = new Vector3(1, 1, 1);
            SpecularPower      = 10;
            Alpha              = 1;
            DiffuseTexture     = graphicService.GetDefaultTexture2DWhite();
            SpecularTexture    = graphicService.GetDefaultTexture2DBlack();
            NormalTexture      = graphicService.GetDefaultNormalTexture();
            HeightTextureScale = 1;
            HeightTexture      = graphicService.GetDefaultTexture2DBlack();
            RoadLength         = 1;
        }
Ejemplo n.º 2
0
        /// <overloads>
        /// <summary>
        /// Initializes a new instance of the <see cref="TerrainDecalLayer"/> class.
        /// </summary>
        /// </overloads>
        ///
        /// <summary>
        /// Initializes a new instance of the <see cref="TerrainDecalLayer"/> class with the default
        /// material.
        /// </summary>
        /// <param name="graphicService">The graphic service.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="graphicService"/> is <see langword="null"/>.
        /// </exception>
        public TerrainDecalLayer(IGraphicsService graphicService)
        {
            if (graphicService == null)
            {
                throw new ArgumentNullException("graphicService");
            }

            // Use a down orientation per default.
            Pose = new Pose(Matrix.CreateRotationX(-ConstantsF.PiOver2));

            var effect = graphicService.Content.Load <Effect>("DigitalRune/Terrain/TerrainDecalLayer");

            Material = new Material
            {
                { "Detail", new EffectBinding(graphicService, effect, null, EffectParameterHint.Material) }
            };

            FadeOutStart       = int.MaxValue;
            FadeOutEnd         = int.MaxValue;
            Width              = 1;
            Height             = 1;
            DiffuseColor       = new Vector3(1, 1, 1);
            SpecularColor      = new Vector3(1, 1, 1);
            SpecularPower      = 10;
            Alpha              = 1;
            DiffuseTexture     = graphicService.GetDefaultTexture2DWhite();
            SpecularTexture    = graphicService.GetDefaultTexture2DBlack();
            NormalTexture      = graphicService.GetDefaultNormalTexture();
            HeightTextureScale = 1;
            HeightTexture      = graphicService.GetDefaultTexture2DBlack();

            UpdateAabb();
        }
Ejemplo n.º 3
0
        /// <overloads>
        /// <summary>
        /// Initializes a new instance of the <see cref="TerrainMaterialLayer"/> class.
        /// </summary>
        /// </overloads>
        ///
        /// <summary>
        /// Initializes a new instance of the <see cref="TerrainMaterialLayer"/> class with the default
        /// material.
        /// </summary>
        /// <param name="graphicService">The graphic service.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="graphicService"/> is <see langword="null"/>.
        /// </exception>
        public TerrainMaterialLayer(IGraphicsService graphicService)
        {
            if (graphicService == null)
            {
                throw new ArgumentNullException("graphicService");
            }

            var effect = graphicService.Content.Load <Effect>("DigitalRune/Terrain/TerrainMaterialLayer");

            Material = new Material
            {
                { "Detail", new EffectBinding(graphicService, effect, null, EffectParameterHint.Material) }
            };

            FadeOutStart            = int.MaxValue;
            FadeOutEnd              = int.MaxValue;
            TileSize                = 1;
            DiffuseColor            = new Vector3(1, 1, 1);
            SpecularColor           = new Vector3(1, 1, 1);
            SpecularPower           = 10;
            Alpha                   = 1;
            DiffuseTexture          = graphicService.GetDefaultTexture2DWhite();
            SpecularTexture         = graphicService.GetDefaultTexture2DBlack();
            NormalTexture           = graphicService.GetDefaultNormalTexture();
            HeightTextureScale      = 1;
            HeightTextureBias       = 0;
            HeightTexture           = graphicService.GetDefaultTexture2DBlack();
            TriplanarTightening     = -1;
            TintStrength            = 1;
            TintTexture             = graphicService.GetDefaultTexture2DWhite();
            BlendThreshold          = 0.5f;
            BlendRange              = 1f;
            BlendHeightInfluence    = 0;
            BlendNoiseInfluence     = 0;
            BlendTextureChannel     = 0;
            BlendTexture            = graphicService.GetDefaultTexture2DWhite();
            NoiseTileSize           = 1;
            TerrainHeightMin        = -1e20f;
            TerrainHeightMax        = +1e20f;
            TerrainHeightBlendRange = 1f;
            TerrainSlopeMin         = -ConstantsF.Pi;
            TerrainSlopeMax         = ConstantsF.Pi;
            TerrainSlopeBlendRange  = MathHelper.ToRadians(10);
        }
Ejemplo n.º 4
0
        public void DefaultTextures()
        {
            Assert.AreEqual(_graphicsService0.GetDefaultTexture2DBlack(), _graphicsService0.GetDefaultTexture2DBlack());
            Assert.AreNotEqual(_graphicsService0.GetDefaultTexture2DBlack(), _graphicsService1.GetDefaultTexture2DBlack());

            var t = _graphicsService1.GetDefaultTexture2DWhite();

            _graphicsDevice1.Dispose();

            // Note: Since the graphics device is also disposed and re-created when the game is
            // moved between screens - we must not auto-dispose our textures.
            //Assert.IsTrue(t.IsDisposed);
        }
Ejemplo n.º 5
0
        private void InitializeBillboards(IGraphicsService graphicsService)
        {
            _debugTexture = new PackedTexture(graphicsService.GetDefaultTexture2DWhite());

            var graphicsDevice = GraphicsService.GraphicsDevice;

            _hiDef = (graphicsDevice.GraphicsProfile == GraphicsProfile.HiDef);

            if (_hiDef)
            {
                // ----- HiDef profile
                _billboardEffect         = GraphicsService.Content.Load <Effect>("DigitalRune/Billboard");
                _parameterView           = _billboardEffect.Parameters["View"];
                _parameterViewInverse    = _billboardEffect.Parameters["ViewInverse"];
                _parameterViewProjection = _billboardEffect.Parameters["ViewProjection"];
                _parameterProjection     = _billboardEffect.Parameters["Projection"];
                _parameterCameraPosition = _billboardEffect.Parameters["CameraPosition"];
                _parameterViewportSize   = _billboardEffect.Parameters["ViewportSize"];
                _parameterDepthBuffer    = _billboardEffect.Parameters["DepthBuffer"];
                _parameterCameraNear     = _billboardEffect.Parameters["CameraNear"];
                _parameterCameraFar      = _billboardEffect.Parameters["CameraFar"];
                _parameterTexture        = _billboardEffect.Parameters["Texture"];

                _techniqueHardLinear = _billboardEffect.Techniques["HardLinear"];
                _techniqueHardGamma  = _billboardEffect.Techniques["HardGamma"];
                _techniqueSoftLinear = _billboardEffect.Techniques["SoftLinear"];
                _techniqueSoftGamma  = _billboardEffect.Techniques["SoftGamma"];

                _billboardBatch = new BillboardBatchHiDef(graphicsDevice, BufferSize);
            }
            else
            {
                // ----- Reach profile
                _billboardEffect = new BasicEffect(graphicsDevice)
                {
                    FogEnabled         = false,
                    LightingEnabled    = false,
                    TextureEnabled     = true,
                    VertexColorEnabled = true,
                    World = Matrix.Identity,
                };

                _billboardBatch = new BillboardBatchReach(graphicsDevice, BufferSize);
            }
        }
Ejemplo n.º 6
0
        private EffectParameterBinding CreateSpecularTextureBinding <T>(Effect effect,
                                                                        EffectParameter parameter, IDictionary <string, object> opaqueData) where T : Texture
        {
            object value = null;

            if (opaqueData != null)
            {
                opaqueData.TryGetValue(parameter.Name, out value);
            }

            var texture = value as T;

            if (texture == null)
            {
                texture = _graphicsService.GetDefaultTexture2DWhite() as T;
            }

            return(new ConstParameterBinding <T>(effect, parameter, texture));
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Creates a graphics mesh with the triangle mesh data of the given shape and the given
        /// diffuse and specular material properties.
        /// </summary>
        /// <param name="contentManager">The contentManager manager.</param>
        /// <param name="graphicsService">The graphics service.</param>
        /// <param name="submesh">The submesh.</param>
        /// <param name="diffuse">The diffuse material color.</param>
        /// <param name="specular">The specular material color.</param>
        /// <param name="specularPower">The specular power of the material.</param>
        /// <returns>The graphics mesh.</returns>
        /// <remarks>
        /// This method does not set the bounding shape of the mesh. (The default is an infinite shape
        /// which is not optimal for performance.)
        /// </remarks>
        public static Mesh CreateMesh(ContentManager contentManager, IGraphicsService graphicsService, Submesh submesh,
                                      Vector3 diffuse, Vector3 specular, float specularPower)
        {
            Mesh mesh = new Mesh();

            mesh.Submeshes.Add(submesh);

            // Build material.
            // We could load a predefined material (*.drmat file)
            // with the content manager.
            //var material = contentManager.Load<Material>("MyMaterialName");

            // Alternatively, we can load some effects and build the material here:
            Material material = new Material();

            // We need an EffectBinding for each render pass.
            // The "Default" pass uses a BasicEffectBinding (which is an EffectBinding
            // for the XNA BasicEffect).
            // Note: The "Default" pass is not used by the DeferredLightingScreen, so
            // we could ignore this pass in this sample project.
            BasicEffectBinding defaultEffectBinding = new BasicEffectBinding(graphicsService, null)
            {
                LightingEnabled    = true,
                TextureEnabled     = true,
                VertexColorEnabled = false
            };

            defaultEffectBinding.Set("Texture", graphicsService.GetDefaultTexture2DWhite());
            defaultEffectBinding.Set("DiffuseColor", new Vector4((Vector3)diffuse, 1));
            defaultEffectBinding.Set("SpecularColor", (Vector3)specular);
            defaultEffectBinding.Set("SpecularPower", specularPower);
            material.Add("Default", defaultEffectBinding);

            // EffectBinding for the "ShadowMap" pass.
            // Note: EffectBindings which are used in a Material must be marked with
            // the EffectParameterHint Material.
            EffectBinding shadowMapEffectBinding = new EffectBinding(
                graphicsService,
                contentManager.Load <Effect>("DigitalRune\\Materials\\ShadowMap"),
                null,
                EffectParameterHint.Material);

            material.Add("ShadowMap", shadowMapEffectBinding);

            // EffectBinding for the "GBuffer" pass.
            EffectBinding gBufferEffectBinding = new EffectBinding(
                graphicsService,
                contentManager.Load <Effect>("DigitalRune\\Materials\\GBuffer"),
                null,
                EffectParameterHint.Material);

            gBufferEffectBinding.Set("SpecularPower", specularPower);
            material.Add("GBuffer", gBufferEffectBinding);

            // EffectBinding for the "Material" pass.
            EffectBinding materialEffectBinding = new EffectBinding(
                graphicsService,
                contentManager.Load <Effect>("DigitalRune\\Materials\\Material"),
                null,
                EffectParameterHint.Material);

            materialEffectBinding.Set("DiffuseTexture", graphicsService.GetDefaultTexture2DWhite());
            materialEffectBinding.Set("DiffuseColor", (Vector3)diffuse);
            materialEffectBinding.Set("SpecularColor", (Vector3)specular);
            material.Add("Material", materialEffectBinding);

            // Assign this material to the submesh.
            submesh.SetMaterial(material);

            return(mesh);
        }
    private static void SetDefaultBinding(IGraphicsService graphicsService, EffectEx effectEx, EffectParameter parameter, EffectParameterDescription usage, EffectParameterBindingCollection bindings)
    {
      Debug.Assert(!bindings.Contains(parameter), "Effect binding already contains a binding for the given effect parameter.");

      if (parameter.ParameterClass == EffectParameterClass.Struct)
      {
        if (parameter.Elements.Count > 0)
        {
          // ----- Effect parameter is an array of structs. --> Recursively process elements of array.
          foreach (EffectParameter element in parameter.Elements)
            SetDefaultBinding(graphicsService, effectEx, element, usage, bindings);
        }
        else
        {
          // ----- Effect parameter is a struct. --> Recursively process members of struct.
          foreach (EffectParameter member in parameter.StructureMembers)
            SetDefaultBinding(graphicsService, effectEx, member, usage, bindings);
        }

        return;
      }

      // Set ConstParameterBinding using the default value stored in .fx file.
      var effect = effectEx.Resource;
      object originalValue;
      effectEx.OriginalParameterValues.TryGetValue(parameter, out originalValue);
      EffectParameterBinding binding = null;
      if (parameter.Elements.Count == 0)
      {
        // ----- Parameter is not an array.

        if (parameter.ParameterClass == EffectParameterClass.Scalar)
        {
          // Scalar values.
          if (parameter.ParameterType == EffectParameterType.Bool)
            binding = new ConstParameterBinding<bool>(effect, parameter, (bool)originalValue);
          else if (parameter.ParameterType == EffectParameterType.Int32)
            binding = new ConstParameterBinding<int>(effect, parameter, (int)originalValue);
          else if (parameter.ParameterType == EffectParameterType.Single)
            binding = new ConstParameterBinding<float>(effect, parameter, (float)originalValue);
        }
        else if (parameter.ParameterClass == EffectParameterClass.Vector
                 && parameter.ParameterType == EffectParameterType.Single)
        {
          // Vector values.
          if (parameter.ColumnCount == 2 || parameter.RowCount == 2)
            binding = new ConstParameterBinding<Vector2>(effect, parameter, (Vector2)originalValue);
          else if (parameter.ColumnCount == 3 || parameter.RowCount == 3)
            binding = new ConstParameterBinding<Vector3>(effect, parameter, (Vector3)originalValue);
          else if (parameter.ColumnCount == 4 || parameter.RowCount == 4)
            binding = new ConstParameterBinding<Vector4>(effect, parameter, (Vector4)originalValue);
        }
        else if (parameter.ParameterClass == EffectParameterClass.Matrix
                 && parameter.ParameterType == EffectParameterType.Single)
        {
          // Matrix value.
          binding = new ConstParameterBinding<Matrix>(effect, parameter, (Matrix)originalValue);
        }
        else if (parameter.ParameterClass == EffectParameterClass.Object)
        {
          // Object values.
          if (parameter.ParameterType == EffectParameterType.String)
          {
            binding = new ConstParameterBinding<string>(effect, parameter, (string)originalValue);
          }
          else if (parameter.ParameterType == EffectParameterType.Texture)
          {
            // A texture type but we are not sure which exact type. --> Try different types.
            try
            {
              binding = new ConstParameterBinding<Texture2D>(effect, parameter, graphicsService.GetDefaultTexture2DWhite());
            }
            catch (Exception)
            {
              try
              {
                binding = new ConstParameterBinding<Texture3D>(effect, parameter, graphicsService.GetDefaultTexture3DWhite());
              }
              catch (Exception)
              {
                try
                {
                  binding = new ConstParameterBinding<TextureCube>(effect, parameter, graphicsService.GetDefaultTextureCubeWhite());
                }
                catch (Exception)
                {
                  // Default value for a parameter of type Texture could not be read from Effect.
                }
              }
            }
          }
          else if (parameter.ParameterType == EffectParameterType.Texture1D)
          {
            // NOTE: 1D textures are not supported in XNA.
          }
          else if (parameter.ParameterType == EffectParameterType.Texture2D)
          {
            binding = new ConstParameterBinding<Texture2D>(effect, parameter, graphicsService.GetDefaultTexture2DWhite());
          }
          else if (parameter.ParameterType == EffectParameterType.Texture3D)
          {
            binding = new ConstParameterBinding<Texture3D>(effect, parameter, graphicsService.GetDefaultTexture3DWhite());
          }
          else if (parameter.ParameterType == EffectParameterType.TextureCube)
          {
            binding = new ConstParameterBinding<TextureCube>(effect, parameter, graphicsService.GetDefaultTextureCubeWhite());
          }
        }
      }
      else
      {
        // ----- Parameter is array.
        int length = parameter.Elements.Count;
        Debug.Assert(length > 0, "Effect parameter should be an array.");

        // Note: In XNA originalValue is valid. In MonoGame originalValue is null and we have to
        // create a new array!

        if (parameter.ParameterClass == EffectParameterClass.Scalar)
        {
          // Scalar value bindings.
          if (parameter.ParameterType == EffectParameterType.Bool)
            binding = new ConstParameterArrayBinding<bool>(effect, parameter, (bool[])originalValue ?? new bool[parameter.Elements.Count]);
          else if (parameter.ParameterType == EffectParameterType.Int32)
            binding = new ConstParameterArrayBinding<int>(effect, parameter, (int[])originalValue ?? new int[parameter.Elements.Count]);
          else if (parameter.ParameterType == EffectParameterType.Single)
            binding = new ConstParameterArrayBinding<float>(effect, parameter, (float[])originalValue ?? new float[parameter.Elements.Count]);
        }
        else if (parameter.ParameterClass == EffectParameterClass.Vector && parameter.ParameterType == EffectParameterType.Single)
        {
          if (parameter.ColumnCount == 2 || parameter.RowCount == 2)
            binding = new ConstParameterArrayBinding<Vector2>(effect, parameter, (Vector2[])originalValue ?? new Vector2[parameter.Elements.Count]);
          else if (parameter.ColumnCount == 3 || parameter.RowCount == 3)
            binding = new ConstParameterArrayBinding<Vector3>(effect, parameter, (Vector3[])originalValue ?? new Vector3[parameter.Elements.Count]);
          else if (parameter.ColumnCount == 4 || parameter.RowCount == 4)
            binding = new ConstParameterArrayBinding<Vector4>(effect, parameter, (Vector4[])originalValue ?? new Vector4[parameter.Elements.Count]);
        }
        else if (parameter.ParameterClass == EffectParameterClass.Matrix && parameter.ParameterType == EffectParameterType.Single)
        {
          binding = new ConstParameterArrayBinding<Matrix>(effect, parameter, (Matrix[])originalValue ?? new Matrix[parameter.Elements.Count]);
        }
        else if (parameter.ParameterClass == EffectParameterClass.Object)
        {
          // Note: Arrays of strings or textures are not supported in XNA.
        }
      }

      if (binding != null)
        bindings.Add(binding);
    }
Ejemplo n.º 9
0
        //--------------------------------------------------------------
        /// <overloads>
        /// <summary>
        /// Initializes a new instance of the <see cref="TerrainRoadLayer"/> class.
        /// </summary>
        /// </overloads>
        /// 
        /// <summary>
        /// Initializes a new instance of the <see cref="TerrainRoadLayer"/> class with the default
        /// material.
        /// </summary>
        /// <param name="graphicService">The graphic service.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="graphicService"/> is <see langword="null"/>.
        /// </exception>
        public TerrainRoadLayer(IGraphicsService graphicService)
        {
            if (graphicService == null)
            throw new ArgumentNullException("graphicService");

              var effect = graphicService.Content.Load<Effect>("DigitalRune/Terrain/TerrainRoadLayer");
              Material = new Material
              {
            { "Detail", new EffectBinding(graphicService, effect, null, EffectParameterHint.Material) }
              };

              FadeOutStart = int.MaxValue;
              FadeOutEnd = int.MaxValue;
              TileSize = 1;
              DiffuseColor = new Vector3F(1, 1, 1);
              SpecularColor = new Vector3F(1, 1, 1);
              SpecularPower = 10;
              Alpha = 1;
              DiffuseTexture = graphicService.GetDefaultTexture2DWhite();
              SpecularTexture = graphicService.GetDefaultTexture2DBlack();
              NormalTexture = graphicService.GetDefaultNormalTexture();
              HeightTextureScale = 1;
              HeightTexture = graphicService.GetDefaultTexture2DBlack();
              RoadLength = 1;
        }
Ejemplo n.º 10
0
        //--------------------------------------------------------------
        /// <overloads>
        /// <summary>
        /// Initializes a new instance of the <see cref="TerrainMaterialLayer"/> class.
        /// </summary>
        /// </overloads>
        /// 
        /// <summary>
        /// Initializes a new instance of the <see cref="TerrainMaterialLayer"/> class with the default
        /// material.
        /// </summary>
        /// <param name="graphicService">The graphic service.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="graphicService"/> is <see langword="null"/>.
        /// </exception>
        public TerrainMaterialLayer(IGraphicsService graphicService)
        {
            if (graphicService == null)
            throw new ArgumentNullException("graphicService");

              var effect = graphicService.Content.Load<Effect>("DigitalRune/Terrain/TerrainMaterialLayer");
              Material = new Material
              {
            { "Detail", new EffectBinding(graphicService, effect, null, EffectParameterHint.Material) }
              };

              FadeOutStart = int.MaxValue;
              FadeOutEnd = int.MaxValue;
              TileSize = 1;
              DiffuseColor = new Vector3F(1, 1, 1);
              SpecularColor = new Vector3F(1, 1, 1);
              SpecularPower = 10;
              Alpha = 1;
              DiffuseTexture = graphicService.GetDefaultTexture2DWhite();
              SpecularTexture = graphicService.GetDefaultTexture2DBlack();
              NormalTexture = graphicService.GetDefaultNormalTexture();
              HeightTextureScale = 1;
              HeightTextureBias = 0;
              HeightTexture = graphicService.GetDefaultTexture2DBlack();
              TriplanarTightening = -1;
              TintStrength = 1;
              TintTexture = graphicService.GetDefaultTexture2DWhite();
              BlendThreshold = 0.5f;
              BlendRange = 1f;
              BlendHeightInfluence = 0;
              BlendNoiseInfluence = 0;
              BlendTextureChannel = 0;
              BlendTexture = graphicService.GetDefaultTexture2DWhite();
              NoiseTileSize = 1;
              TerrainHeightMin = -1e20f;
              TerrainHeightMax = +1e20f;
              TerrainHeightBlendRange = 1f;
              TerrainSlopeMin = -ConstantsF.Pi;
              TerrainSlopeMax = ConstantsF.Pi;
              TerrainSlopeBlendRange = MathHelper.ToRadians(10);
        }
Ejemplo n.º 11
0
        //--------------------------------------------------------------
        /// <overloads>
        /// <summary>
        /// Initializes a new instance of the <see cref="TerrainDecalLayer"/> class.
        /// </summary>
        /// </overloads>
        /// 
        /// <summary>
        /// Initializes a new instance of the <see cref="TerrainDecalLayer"/> class with the default
        /// material.
        /// </summary>
        /// <param name="graphicService">The graphic service.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="graphicService"/> is <see langword="null"/>.
        /// </exception>
        public TerrainDecalLayer(IGraphicsService graphicService)
        {
            if (graphicService == null)
            throw new ArgumentNullException("graphicService");

              // Use a down orientation per default.
              Pose = new Pose(Matrix33F.CreateRotationX(-ConstantsF.PiOver2));

              var effect = graphicService.Content.Load<Effect>("DigitalRune/Terrain/TerrainDecalLayer");
              Material = new Material
              {
            { "Detail", new EffectBinding(graphicService, effect, null, EffectParameterHint.Material) }
              };

              FadeOutStart = int.MaxValue;
              FadeOutEnd = int.MaxValue;
              Width = 1;
              Height = 1;
              DiffuseColor = new Vector3F(1, 1, 1);
              SpecularColor = new Vector3F(1, 1, 1);
              SpecularPower = 10;
              Alpha = 1;
              DiffuseTexture = graphicService.GetDefaultTexture2DWhite();
              SpecularTexture = graphicService.GetDefaultTexture2DBlack();
              NormalTexture = graphicService.GetDefaultNormalTexture();
              HeightTextureScale = 1;
              HeightTexture = graphicService.GetDefaultTexture2DBlack();

              UpdateAabb();
        }