Пример #1
0
        /// <summary>
        /// Creates splatmaps for the currently active terrain gameobject. Does not apply
        /// the splats.
        /// </summary>
        /// <returns>List of splat textures if SplatSettings is not null and
        /// more than 0 splats were generated. Null otherwise.</returns>
        private List <Texture2D> CreateSplats()
        {
            if (Settings.SplatSettings != null)
            {
                if (Paint == null)
                {
                    Paint = new TerrainPaint(Settings.gameObject);
                }

                List <Texture2D> splats = Paint.GenerateSplatmaps(false);
                return(splats.Count > 0 ? splats : null);
            }

            return(null);
        }
Пример #2
0
        /// <summary>
        /// Updates only the materials preview. Only performs update if
        /// <c>Settings.DisplayPreview</c> is true
        /// </summary>
        public void TriggerMaterialsUpdate()
        {
            if (Settings.DisplayPreview)
            {
                //Remove old splats
                Splats = null;
                Paint  = null;

                if (Settings.GetComponent <MeshRenderer>() != null)
                {
                    Object.DestroyImmediate(Settings.GetComponent <MeshRenderer>());
                }

                AddMaterialComponent();
            }
        }