private void OnDestroy()
    {
        // since the material is shared our settings will persist; loaded scenes should have full transition alpha
        for (int materialIndex = 0; materialIndex < materials.Length; ++materialIndex)
        {
            if (materials[materialIndex] != null && settings != null)
            {
                MaterialSettings matset = settings[materialIndex];
                if (matset.material != null)
                {
                    matset.material.SetFloat("_TransitionAlpha", 1.0f);

                    if (matset.originalSourceBlend != -1)
                    {
                        matset.material.SetInt("_SRCBLEND", matset.originalSourceBlend);
                    }

                    if (matset.originalDestinationBlend != -1)
                    {
                        matset.material.SetInt("_DSTBLEND", matset.originalDestinationBlend);
                    }
                }
            }
        }
    }
Exemple #2
0
        // This void sets the shader properties from MaterialSettings previously taken in the inspector
        public void SetTransitionSettingsToShader(MaterialSettings _settings)
        {
            if (WorldManager.worldInstance.shaderType == eShaderType.Shader_OriginalMode)
            {
                material.SetFloat("_Transition1", _settings.transitionLength1);
                material.SetFloat("_Transition2", _settings.transitionLength2);
                material.SetFloat("_TransitionPos1", _settings.transitionPos1);
                material.SetFloat("_TransitionPos2", _settings.transitionPos2);
                material.SetFloat("_TransitionType1", _settings.transitionType1);
                material.SetFloat("_TransitionType2", _settings.transitionType2);
                material.SetFloat("_LimitMin", _settings.limitMin);
                material.SetFloat("_LimitMax", _settings.limitMax);

                material.SetTexture("_TransitionTex1", _settings.tex11);
                material.SetTexture("_TransitionTex2", _settings.tex12);
                material.SetTexture("_TransitionTex3", _settings.tex13);
                material.SetTexture("_TransitionTex4", _settings.tex14);
                material.SetTexture("_TransitionTex11", _settings.tex21);
                material.SetTexture("_TransitionTex12", _settings.tex22);
                material.SetTexture("_TransitionTex13", _settings.tex23);
                material.SetTexture("_TransitionTex14", _settings.tex24);
            }

            settings = _settings;
        }
Exemple #3
0
 private void MaterialSettings_OnMaterialUpdated(MaterialSettings sender)
 {
     if (sender == materialSettings)
     {
         Invalidate();
     }
 }
 public bool TryGetScreenClearColor(ref Color color)
 {
     return(MaterialSettings.TryGetScreenClearColor(ref color) ||
            RenderingSettings.TryGetScreenClearColor(ref color) ||
            LightingSettings.TryGetScreenClearColor(ref color) ||
            ValidationSettings.TryGetScreenClearColor(ref color));
 }
Exemple #5
0
        private void materialFloatingActionButton1_Click(object sender, EventArgs e)
        {
            MaterialSettings objSettings = new MaterialSettings(this);

            objSettings.ShowThemeSettings = true;
            objSettings.Show();
        }
Exemple #6
0
        // This void sets the shader properties from MaterialSettings previously taken in the inspector
        public void SetMaterialSettingsToShader(MaterialSettings _settings)
        {
            material.SetFloat("_Tex2Height", _settings.tex2h);
            material.SetFloat("_Tex2Blend", _settings.tex2b);
            material.SetFloat("_Tex3Height", _settings.tex3h);
            material.SetFloat("_Tex3Blend", _settings.tex3b);
            material.SetFloat("_Tex4Height", _settings.tex4h);
            material.SetFloat("_Tex4Blend", _settings.tex4b);

            if (WorldManager.worldInstance.shaderType == eShaderType.Shader_NoTransition)
            {
                material.SetFloat("_Tex5Height", _settings.tex5h);
                material.SetFloat("_Tex5Blend", _settings.tex5b);
            }

            material.SetColor("_Color", _settings.color);
            material.SetFloat("_Metallic", _settings.metallic);
            material.SetFloat("_Glossiness", _settings.glossines);
            material.SetFloat("_Scale", _settings.scale);

            material.SetTextureScale("_Cliff", new Vector2(_settings.cliffScale.x, _settings.cliffScale.y));
            material.SetFloat("_CliffFade", _settings.cliffFade);
            material.SetFloat("_CliffBlend", _settings.cliffB);
            material.SetFloat("_CliffMinH", _settings.cliffMin);
            material.SetFloat("_CliffMaxH", _settings.cliffMax);
            material.SetFloat("_CliffFadeBottom", _settings.cliffFadeBottom);
            material.SetFloat("_CliffFadeTop", _settings.cliffFadeTop);
            material.SetFloat("_SteepNes", _settings.steepnes);
            material.SetFloat("_SteepNesBlend", _settings.steepnesBlend);
            material.SetFloat("_CliffFadeTreshold", _settings.cliffFadeTreshold);

            material.SetTexture("_NormalTex0", _settings.nrm1);
            material.SetTexture("_NormalTex1", _settings.nrm2);
            material.SetTexture("_NormalTex2", _settings.nrm3);
            material.SetTexture("_NormalTex3", _settings.nrm4);
            material.SetTexture("_NormalTex4", _settings.nrm5);
            material.SetTexture("_CliffBump", _settings.nrmCliff);

            if (withoutTextures)
            {
                return;
            }

            material.SetTexture("_Texture0", _settings.tex1);
            material.SetTexture("_Texture1", _settings.tex2);
            material.SetTexture("_Texture2", _settings.tex3);
            material.SetTexture("_Texture3", _settings.tex4);

            if (WorldManager.worldInstance.shaderType == eShaderType.Shader_NoTransition)
            {
                material.SetTexture("_Texture4", _settings.tex5);
            }

            material.SetTexture("_Cliff", _settings.texCliff);


            settings = _settings;
        }
Exemple #7
0
        private void SetMaterialSettings(MaterialSettings settings)
        {
            waterMaterial.SetFloat(waveHeight, settings.amplitude);
            waterMaterial.SetFloat(waveLength, settings.frequency);

            waterMaterial.SetFloat(waveSpeed, settings.speed);

            waterMaterial.SetColor(color, settings.waterColor);
        }
 void InitializeSettings()
 {
     if (settingsInitialized == false)
     {
         Debug.Log("Initializing MaterialSettings");
         MatS                = new MaterialSettings();
         myColorTexture      = new Texture2D(1, 1, TextureFormat.ARGB32, false);
         settingsInitialized = true;
     }
 }
Exemple #9
0
 private void InitializeSettings()
 {
     if (_settingsInitialized)
     {
         return;
     }
     Debug.Log("Initializing MaterialSettings");
     _materialSettings    = new MaterialSettings();
     _myColorTexture      = new Texture2D(1, 1, TextureFormat.ARGB32, false);
     _settingsInitialized = true;
 }
 public void SetValues(ProjectObject projectObject)
 {
     InitializeSettings();
     if (projectObject.MatS != null)
     {
         MatS = projectObject.MatS;
     }
     else
     {
         settingsInitialized = false;
         InitializeSettings();
     }
 }
Exemple #11
0
 public void SetValues(ProjectObject projectObject)
 {
     InitializeSettings();
     if (projectObject.MaterialSettings != null)
     {
         _materialSettings = projectObject.MaterialSettings;
     }
     else
     {
         _settingsInitialized = false;
         InitializeSettings();
     }
 }
Exemple #12
0
        public UI3DPreview()
        {
            HdriManager.Scan();
            HdriManager.OnHdriLoaded += HdriManager_OnHdriLoaded;
            InitializeComponent();
            previewRenderMode = PreviewRenderMode.FullShading;
            Instance          = this;

            materialSettings = new MaterialSettings();
            materialSettings.Load();
            materialSettings.OnMaterialUpdated += MaterialSettings_OnMaterialUpdated;

            lightSettings = new LightingSettings();
            lightSettings.OnLightingUpdated += LightSettings_OnLightingUpdated;

            InitGL();
            Log.Info("3d view inited");
        }
        public MainWindow()
        {
            BuildingsSettings.Load("../../Game/Settings/BuildingsSettings.xml");
            ResourceSettings.Load("../../Game/Settings/ResourceSettings.xml");
            MaterialSettings.Load("../../Game/Settings/MaterialSettings.xml");
            InitializeComponent();
            initComboBuild();
            initMaterialList();
            this.KeyDown    += Arrows;
            this.MouseWheel += Zoom;
            if (System.IO.File.Exists("../../Mapa.xml"))
            {
                loadMap("../../Mapa.xml");
            }

            // Canv.Key
            // Canv.key
        }
Exemple #14
0
 /// <summary>
 /// Zwraca typ surowca odpowiadający danemu typowi zasobu.
 /// </summary>
 /// <param name="type">Typ zasobu</param>
 /// <returns>Odpowiadający typ surowca</returns>
 public static MaterialType GetTypeOfMaterial(ResourceType type)
 {
     return(MaterialSettings.GetMaterialFromResource(type));
 }
Exemple #15
0
 private void InitSettings()
 {
     _Settings = new MaterialSettings(this);
     _Settings.ShowThemeSettings = true;
     _Settings.FormClosing      += SaveSettings;
 }
Exemple #16
0
 public MaterialChange(DistanceField field, MaterialSettings materialSettings)
 {
     Field            = field;
     MaterialSettings = materialSettings;
 }