public override void DrawFeatureGUI(Material mat)
 {
     geoTexture = EditorGUILayout.Toggle(CShaderGeoTexture, geoTexture);
     if (geoTexture)
     {
         EditorGUI.indentLevel++;
         geoRange = EditorGUILayout.Toggle(CShaderGeoRange, geoRange);
         geoCurve = EditorGUILayout.Toggle(CShaderGeoCurve, geoCurve);
         EditorGUI.indentLevel--;
     }
     tintBlendMode   = (BlendMode)EditorGUILayout.EnumPopup(CShaderTint, tintBlendMode);
     normalBlendMode = (NormalBlendMode)EditorGUILayout.EnumPopup(CShaderGlobalNormal, normalBlendMode);
     SAOMBlend       = (SAOMBlendMode)EditorGUILayout.EnumPopup(CShaderGlobalSAOM, SAOMBlend);
     emisBlend       = (SAOMBlendMode)EditorGUILayout.EnumPopup(CShaderGlobalEmis, emisBlend);
 }
示例#2
0
        public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties)
        {
            _target     = materialEditor.target as Material;
            _editor     = materialEditor;
            _properties = properties;

            DrawTextureSingleLine("_MaskTex", "_MaskMultiplier");
            EditorGUILayout.Space();

            DrawTextureSingleLine("_MainTex", "_Color");
            EditorGUI.indentLevel += 2;
            DecalBlendMode blendMode = (DecalBlendMode)_target.GetFloat("_DecalBlendMode");

            blendMode = (DecalBlendMode)EditorGUILayout.EnumPopup(new GUIContent("Blend Mode"), blendMode);
            ApplyBlendMode(blendMode);
            EditorGUI.indentLevel -= 2;

            if (_target.HasProperty("_NormalTex"))
            {
                EditorGUILayout.Space();
                DrawTextureSingleLine("_NormalTex", "_NormalMultiplier");
            }
            if (_target.HasProperty("_NormalBlendMode"))
            {
                EditorGUI.indentLevel += 2;
                NormalBlendMode normalBlendMode = (NormalBlendMode)_target.GetFloat("_NormalBlendMode");
                normalBlendMode = (NormalBlendMode)EditorGUILayout.EnumPopup(new GUIContent("Blend Mode"), normalBlendMode);
                _target.SetFloat("_NormalBlendMode", (float)normalBlendMode);
                bool maskNormals = (_target.GetInt("_MaskNormals") != 0);
                maskNormals = EditorGUILayout.Toggle(new GUIContent("Mask Normals?"), maskNormals);
                _target.SetFloat("_MaskNormals", (maskNormals ? 1.0f : 0.0f));
                EditorGUI.indentLevel -= 2;
                EditorGUILayout.Space();
            }

            DrawTextureSingleLine("_SpecularTex", "_SpecularMultiplier");
            DrawTextureSingleLine("_SmoothnessTex", "_SmoothnessMultiplier");
            EditorGUILayout.Space();

            DrawTextureSingleLine("_EmissionMap", "_EmissionColor");
            EditorGUILayout.Space();

            _editor.TextureScaleOffsetProperty(FindProperty("_MainTex", _properties));

            EditorGUILayout.Space();

            _editor.FloatProperty(FindProperty("_AngleLimit", _properties), "Angle Limit");
        }
        public override void Unpack(string[] keywords)
        {
            geoTexture = HasFeature(keywords, DefineFeature._GEOMAP);
            if (geoTexture)
            {
                perTexGeoStr = HasFeature(keywords, DefineFeature._PERTEXGEO);
                geoRange     = HasFeature(keywords, DefineFeature._GEORANGE);
                geoCurve     = HasFeature(keywords, DefineFeature._GEOCURVE);
            }

            perTexTintStr = HasFeature(keywords, DefineFeature._PERTEXGLOBALTINTSTRENGTH);

            tintBlendMode = BlendMode.Off;
            if (HasFeature(keywords, DefineFeature._GLOBALTINT))
            {
                tintBlendMode = BlendMode.Multiply2X;
            }
            if (HasFeature(keywords, DefineFeature._GLOBALTINTOVERLAY))
            {
                tintBlendMode = BlendMode.Overlay;
            }
            if (HasFeature(keywords, DefineFeature._GLOBALTINTCROSSFADE))
            {
                tintBlendMode = BlendMode.CrossFade;
            }

            normalBlendMode = NormalBlendMode.Off;
            if (HasFeature(keywords, DefineFeature._GLOBALNORMALS))
            {
                normalBlendMode = NormalBlendMode.NormalBlend;
            }
            if (HasFeature(keywords, DefineFeature._GLOBALNORMALCROSSFADE))
            {
                normalBlendMode = NormalBlendMode.CrossFade;
            }

            SAOMBlend = HasFeature(keywords, DefineFeature._GLOBALSMOOTHAOMETAL) ? SAOMBlendMode.CrossFade : SAOMBlendMode.Off;

            emisBlend = HasFeature(keywords, DefineFeature._GLOBALEMIS) ? SAOMBlendMode.CrossFade : SAOMBlendMode.Off;

            perTexNormalStr = HasFeature(keywords, DefineFeature._PERTEXGLOBALNORMALSTRENGTH);
            perTexSAOMStr   = HasFeature(keywords, DefineFeature._PERTEXGLOBALSOAMSTRENGTH);
            perTexEmisStr   = HasFeature(keywords, DefineFeature._PERTEXGLOBALEMISSTRENGTH);
        }