示例#1
0
 // Token: 0x060000D7 RID: 215 RVA: 0x0000A8CC File Offset: 0x00008ACC
 private void InitType()
 {
     ShaderPropColor[] colProps = this.type.colProps;
     this.editColors = new EditColor[colProps.Length];
     this.pickers    = new ColorPicker[colProps.Length];
     for (int i = 0; i < colProps.Length; i++)
     {
         ShaderPropColor shaderPropColor = colProps[i];
         Color           val             = (this.material != null) ? this.material.GetColor(shaderPropColor.propId) : shaderPropColor.defaultVal;
         EditColor       editColor       = new EditColor(val, shaderPropColor.colorType, shaderPropColor.composition);
         this.editColors[i] = editColor;
         ColorPicker colorPicker = new ColorPicker(ACCMaterial.presetMgr)
         {
             ColorTex = new Texture2D(16, 16, TextureFormat.RGB24, false)
         };
         colorPicker.SetTexColor(ref val);
         this.pickers[i] = colorPicker;
     }
     ShaderPropFloat[] fProps = this.type.fProps;
     this.editVals = new EditValue[fProps.Length];
     for (int j = 0; j < fProps.Length; j++)
     {
         float val2 = fProps[j].defaultVal;
         if (this.material != null)
         {
             val2 = this.material.GetFloat(fProps[j].propId);
         }
         this.editVals[j] = new EditValue(val2, fProps[j].range);
     }
 }
示例#2
0
 // Token: 0x060000DC RID: 220 RVA: 0x0000ADC8 File Offset: 0x00008FC8
 public void SetColor(string propName, Color c)
 {
     try
     {
         PropKey propKey = (PropKey)Enum.Parse(typeof(PropKey), propName);
         for (int i = 0; i < this.type.colProps.Length; i++)
         {
             ShaderPropColor shaderPropColor = this.type.colProps[i];
             if (shaderPropColor.key == propKey)
             {
                 this.editColors[i].Set(c);
                 this.pickers[i].SetTexColor(ref c);
                 return;
             }
         }
         LogUtil.Debug(new object[]
         {
             "propName mismatched:",
             propName
         });
     }
     catch (Exception ex)
     {
         LogUtil.Debug(new object[]
         {
             "unsupported propName found:",
             propName,
             ex
         });
     }
 }
示例#3
0
 private ShaderType()
 {
     this.idx = -1;
     name     = string.Empty;
     dispName = string.Empty;
     texProps = new ShaderPropTex[0];
     colProps = new ShaderPropColor[0];
     fProps   = new ShaderPropFloat[0];
 }
 static void Init() {
     var texTypeEmpty = new ShaderPropTex[0];
     var texTypeR  = new ShaderPropTex[]{ShaderPropType.RenderTex,};
     var texType0  = new ShaderPropTex[]{ShaderPropType.MainTex,};
     var texType0a = new ShaderPropTex[]{ShaderPropType.MainTex_a,};
     var texType1  = new ShaderPropTex[]{ShaderPropType.MainTex, ShaderPropType.ToonRamp, ShaderPropType.ShadowTex, ShaderPropType.ShadowRateToon, };//ShaderPropType.MultiColTex, };
     var texType1a = new ShaderPropTex[]{ShaderPropType.MainTex_a, ShaderPropType.ToonRamp, ShaderPropType.ShadowTex, ShaderPropType.ShadowRateToon,};// ShaderPropType.MultiColTex, };
     var texTypeH  = new ShaderPropTex[]{ShaderPropType.MainTex, ShaderPropType.ToonRamp, ShaderPropType.ShadowTex, ShaderPropType.ShadowRateToon, ShaderPropType.HiTex,};// ShaderPropType.MultiColTex, };
     
     var colEmpty  = new ShaderPropColor[0];
     var colC      = new ShaderPropColor[]{ShaderPropType.Color, };
     var colCa     = new ShaderPropColor[]{ShaderPropType.ColorA, };
     var colL      = new ShaderPropColor[]{ShaderPropType.Color, ShaderPropType.ShadowColor, };
     var colLa     = new ShaderPropColor[]{ShaderPropType.ColorA,ShaderPropType.ShadowColor, };
     var colTL     = new ShaderPropColor[]{ShaderPropType.Color, ShaderPropType.ShadowColor, ShaderPropType.RimColor, };
     var colTLa    = new ShaderPropColor[]{ShaderPropType.ColorA, ShaderPropType.ShadowColor, ShaderPropType.RimColor, };
     var colTLO    = new ShaderPropColor[]{ShaderPropType.Color, ShaderPropType.ShadowColor, ShaderPropType.RimColor, ShaderPropType.OutlineColor,  };
     var colTLOa   = new ShaderPropColor[]{ShaderPropType.ColorA, ShaderPropType.ShadowColor, ShaderPropType.RimColor, ShaderPropType.OutlineColor,  };
     
     var propEmpty = new ShaderPropFloat[0];
     var propL     = new ShaderPropFloat[]{ShaderPropType.Shininess, };
     var propTL    = new ShaderPropFloat[]{ShaderPropType.Shininess, ShaderPropType.RimPower, ShaderPropType.RimShift, };
     var propTLO   = new ShaderPropFloat[]{ShaderPropType.Shininess, ShaderPropType.OutlineWidth, ShaderPropType.RimPower, ShaderPropType.RimShift, };
     var propTLH   = new ShaderPropFloat[]{ShaderPropType.Shininess, ShaderPropType.RimPower, ShaderPropType.RimShift, ShaderPropType.HiRate, ShaderPropType.HiPow};
     var propTLHO  = new ShaderPropFloat[]{ShaderPropType.Shininess, ShaderPropType.OutlineWidth, ShaderPropType.RimPower, ShaderPropType.RimShift, ShaderPropType.HiRate, ShaderPropType.HiPow};
     
     ShaderType.count = 0;
     shaders = new ShaderType[] {
         new ShaderType("CM3D2/Toony_Lighted", "トゥーン",                          texType1,  colTL,   propTL ),
         new ShaderType("CM3D2/Toony_Lighted_Trans", "トゥーン 透過",              texType1a, colTLa,  propTL, true ),
         new ShaderType("CM3D2/Toony_Lighted_Trans_NoZ", "トゥーン 透過 NoZ",      texType1a, colTLa,  propTL, true ),
         new ShaderType("CM3D2/Toony_Lighted_Outline","トゥーン 輪郭線",            texType1,  colTLO,  propTLO ),
         new ShaderType("CM3D2/Toony_Lighted_Outline_Trans","トゥーン 輪郭線 透過", texType1a, colTLOa, propTLO, true ),
         new ShaderType("CM3D2/Toony_Lighted_Hair","トゥーン 髪",                   texTypeH,  colTL,   propTLH ),
         new ShaderType("CM3D2/Toony_Lighted_Hair_Outline","トゥーン 髪 輪郭線",    texTypeH,  colTLO,  propTLHO ),
         new ShaderType("CM3D2/Lighted","非トゥーン",            texType0,  colL,     propL ),
         new ShaderType("CM3D2/Lighted_Trans","透過",            texType0a, colLa,    propL, true ),
         new ShaderType("Unlit/Texture","発光",                  texType0,  colEmpty, propEmpty ),
         new ShaderType("Unlit/Transparent","発光 透過",         texType0a, colEmpty, propEmpty, true ), 
         new ShaderType("Diffuse","リアル",                      texType0,  colC,     propEmpty ),
         new ShaderType("Transparent/Diffuse","リアル 透過",     texType0a, colCa,     propEmpty, true ),
         new ShaderType("CM3D2/Mosaic","モザイク",               texTypeR, colEmpty, new ShaderPropFloat[]{ShaderPropType.FloatValue1}),
         new ShaderType("CM3D2/Man","ご主人様",                  texTypeEmpty, colC, new ShaderPropFloat[]{ShaderPropType.FloatValue2, ShaderPropType.FloatValue3}),
         new ShaderType("CM3D2_Debug/Debug_CM3D2_Normal2Color","法線", texTypeEmpty, colC, propEmpty), // Emission
     };
     shaderMap = new Dictionary<string, ShaderType>(shaders.Length);
     foreach (var s in shaders) {
         shaderMap[s.name] = s;
     };
     shader2Map = new Dictionary<string, string>(shaders.Length);
     foreach (var s in shaders) {
         shader2Map[s.name] = s.name.Replace("/", "__");
     };
 }
        // Token: 0x060000E3 RID: 227 RVA: 0x0000B2C4 File Offset: 0x000094C4
        public static void Write(BinaryWriter writer, ACCMaterialEx mate)
        {
            writer.Write(FileConst.HEAD_MATE);
            writer.Write(1000);
            writer.Write(mate.name1);
            writer.Write(mate.name2);
            string name = mate.type.name;

            writer.Write(name);
            string mateName = ShaderType.GetMateName(name);

            writer.Write(mateName);
            foreach (ShaderPropTex shaderPropTex in mate.type.texProps)
            {
                if (shaderPropTex.key == PropKey._RenderTex)
                {
                    writer.Write("null");
                }
                else
                {
                    writer.Write("tex2d");
                    ACCTextureEx acctextureEx = mate.texDic[shaderPropTex.key];
                    writer.Write(acctextureEx.editname);
                    writer.Write(acctextureEx.txtpath);
                    ACCMaterialEx.OUT_UTIL.Write(writer, acctextureEx.texOffset);
                    ACCMaterialEx.OUT_UTIL.Write(writer, acctextureEx.texScale);
                }
            }
            for (int j = 0; j < mate.editColors.Length; j++)
            {
                ShaderPropColor shaderPropColor = mate.type.colProps[j];
                EditColor       editColor       = mate.editColors[j];
                writer.Write(shaderPropColor.type.ToString());
                writer.Write(shaderPropColor.keyName);
                ACCMaterialEx.OUT_UTIL.Write(writer, editColor.val);
            }
            for (int k = 0; k < mate.editVals.Length; k++)
            {
                ShaderPropFloat shaderPropFloat = mate.type.fProps[k];
                EditValue       editValue       = mate.editVals[k];
                writer.Write(shaderPropFloat.type.ToString());
                writer.Write(shaderPropFloat.keyName);
                writer.Write(editValue.val);
            }
        }
        // Token: 0x06000202 RID: 514 RVA: 0x00012558 File Offset: 0x00010758
        static ShaderType()
        {
            ShaderPropTex[] array  = new ShaderPropTex[0];
            ShaderPropTex[] array2 = new ShaderPropTex[]
            {
                ShaderPropType.RenderTex
            };
            ShaderPropTex[] array3 = new ShaderPropTex[]
            {
                ShaderPropType.MainTex
            };
            ShaderPropTex[] array4 = new ShaderPropTex[]
            {
                ShaderPropType.MainTexA
            };
            ShaderPropTex[] array5 = new ShaderPropTex[]
            {
                ShaderPropType.MainTex,
                ShaderPropType.ToonRamp,
                ShaderPropType.ShadowTex,
                ShaderPropType.ShadowRateToon
            };
            ShaderPropTex[] array6 = new ShaderPropTex[]
            {
                ShaderPropType.MainTex,
                ShaderPropType.ToonRamp,
                ShaderPropType.ShadowTex,
                ShaderPropType.ShadowRateToon,
                ShaderPropType.OutlineTex,
                ShaderPropType.OutlineToonRamp
            };
            ShaderPropTex[] array7 = new ShaderPropTex[]
            {
                ShaderPropType.MainTexA,
                ShaderPropType.ToonRamp,
                ShaderPropType.ShadowTex,
                ShaderPropType.ShadowRateToon
            };
            ShaderPropTex[] array8 = new ShaderPropTex[]
            {
                ShaderPropType.MainTex,
                ShaderPropType.ToonRamp,
                ShaderPropType.ShadowTex,
                ShaderPropType.ShadowRateToon,
                ShaderPropType.HiTex
            };
            ShaderPropTex[] array9 = new ShaderPropTex[]
            {
                ShaderPropType.MainTex,
                ShaderPropType.ToonRamp,
                ShaderPropType.ShadowTex,
                ShaderPropType.ShadowRateToon,
                ShaderPropType.HiTex,
                ShaderPropType.OutlineTex,
                ShaderPropType.OutlineToonRamp
            };
            ShaderPropTex[] array10 = new ShaderPropTex[]
            {
                ShaderPropType.MainTexA,
                ShaderPropType.OcclusionMap,
                ShaderPropType.MetallicGlossMap,
                ShaderPropType.BumpMap,
                ShaderPropType.ParallaxMap,
                ShaderPropType.EmissionMap,
                ShaderPropType.DetailMask,
                ShaderPropType.DetailAlbedoMap,
                ShaderPropType.DetailNormalMap,
                ShaderPropType.SpecGlossMap
            };
            ShaderPropColor[] array11 = new ShaderPropColor[0];
            ShaderPropColor[] array12 = new ShaderPropColor[]
            {
                ShaderPropType.Color
            };
            ShaderPropColor[] array13 = new ShaderPropColor[]
            {
                ShaderPropType.ColorA
            };
            ShaderPropColor[] array14 = new ShaderPropColor[]
            {
                ShaderPropType.Color,
                ShaderPropType.ShadowColor
            };
            ShaderPropColor[] array15 = new ShaderPropColor[]
            {
                ShaderPropType.ColorA,
                ShaderPropType.ShadowColor
            };
            ShaderPropColor[] array16 = new ShaderPropColor[]
            {
                ShaderPropType.Color,
                ShaderPropType.ShadowColor,
                ShaderPropType.RimColor
            };
            ShaderPropColor[] array17 = new ShaderPropColor[]
            {
                ShaderPropType.ColorA,
                ShaderPropType.ShadowColor,
                ShaderPropType.RimColor
            };
            ShaderPropColor[] array18 = new ShaderPropColor[]
            {
                ShaderPropType.Color,
                ShaderPropType.ShadowColor,
                ShaderPropType.RimColor,
                ShaderPropType.OutlineColor
            };
            ShaderPropColor[] array19 = new ShaderPropColor[]
            {
                ShaderPropType.ColorA,
                ShaderPropType.ShadowColor,
                ShaderPropType.RimColor,
                ShaderPropType.OutlineColor
            };
            ShaderPropFloat[] props  = new ShaderPropFloat[0];
            ShaderPropFloat[] props2 = new ShaderPropFloat[]
            {
                ShaderPropType.Shininess
            };
            ShaderPropFloat[] props3 = new ShaderPropFloat[]
            {
                ShaderPropType.Shininess,
                ShaderPropType.Cutoff
            };
            ShaderPropFloat[] props4 = new ShaderPropFloat[]
            {
                ShaderPropType.Shininess,
                ShaderPropType.RimPower,
                ShaderPropType.RimShift
            };
            ShaderPropFloat[] props5 = new ShaderPropFloat[]
            {
                ShaderPropType.Shininess,
                ShaderPropType.RimPower,
                ShaderPropType.RimShift,
                ShaderPropType.ZTest,
                ShaderPropType.ZTest2,
                ShaderPropType.ZTest2Alpha
            };
            ShaderPropFloat[] props6 = new ShaderPropFloat[]
            {
                ShaderPropType.Shininess,
                ShaderPropType.RimPower,
                ShaderPropType.RimShift,
                ShaderPropType.Cutoff
            };
            ShaderPropFloat[] props7 = new ShaderPropFloat[]
            {
                ShaderPropType.Shininess,
                ShaderPropType.OutlineWidth,
                ShaderPropType.RimPower,
                ShaderPropType.RimShift
            };
            ShaderPropFloat[] props8 = new ShaderPropFloat[]
            {
                ShaderPropType.Shininess,
                ShaderPropType.RimPower,
                ShaderPropType.RimShift,
                ShaderPropType.HiRate,
                ShaderPropType.HiPow
            };
            ShaderPropFloat[] props9 = new ShaderPropFloat[]
            {
                ShaderPropType.Shininess,
                ShaderPropType.OutlineWidth,
                ShaderPropType.RimPower,
                ShaderPropType.RimShift,
                ShaderPropType.HiRate,
                ShaderPropType.HiPow
            };
            ShaderPropFloat[] props10 = new ShaderPropFloat[]
            {
                ShaderPropType.Cutoff,
                ShaderPropType.OcclusionStrength,
                ShaderPropType.Glossiness,
                ShaderPropType.GlossMapScale,
                ShaderPropType.SpecularHeighlights,
                ShaderPropType.GlossyReflections,
                ShaderPropType.BumpScale,
                ShaderPropType.DetailNormalMapScale
            };
            ShaderType.count = 0;
            List <ShaderType> list = new List <ShaderType>
            {
                new ShaderType("CM3D2/Toony_Lighted", "トゥーン", array5, array16, props4, false),
                new ShaderType("CM3D2/Toony_Lighted_Trans", "トゥーン 透過", array7, array17, props6, true),
                new ShaderType("CM3D2/Toony_Lighted_Trans_NoZ", "トゥーン 透過 NoZ", array7, array17, props4, true),
                new ShaderType("CM3D2/Toony_Lighted_Trans_NoZTest", "トゥーン 透過 NoZTest", array7, array17, props5, true),
                new ShaderType("CM3D2/Toony_Lighted_Outline", "トゥーン 輪郭線", array5, array18, props7, false),
                new ShaderType("CM3D2/Toony_Lighted_Outline_Trans", "トゥーン 輪郭線 透過", array7, array19, props7, true),
                new ShaderType("CM3D2/Toony_Lighted_Outline_Tex", "トゥーン 輪郭線 Tex", array6, array18, props7, false),
                new ShaderType("CM3D2/Toony_Lighted_Hair", "トゥーン 髪", array8, array16, props8, false),
                new ShaderType("CM3D2/Toony_Lighted_Hair_Outline", "トゥーン 髪 輪郭線", array8, array18, props9, false),
                new ShaderType("CM3D2/Toony_Lighted_Hair_Outline_Tex", "トゥーン 髪 輪郭線 Tex", array9, array18, props9, false),
                new ShaderType("CM3D2/Toony_Lighted_Cutout_AtC", "トゥーン Cutout", array7, array17, props6, true),
                new ShaderType("CM3D2/Lighted", "非トゥーン", array3, array14, props2, false),
                new ShaderType("CM3D2/Lighted_Cutout_AtC", "非トゥーン Cutout", array4, array15, props3, false),
                new ShaderType("CM3D2/Lighted_Trans", "透過", array4, array15, props2, true),
                new ShaderType("Unlit/Texture", "発光", array3, array11, props, false),
                new ShaderType("Unlit/Transparent", "発光 透過", array4, array11, props, true),
                new ShaderType("Diffuse", "リアル", array3, array12, props, false),
                new ShaderType("Transparent/Diffuse", "リアル 透過", array4, array13, props, true),
                new ShaderType("CM3D2/Mosaic", "モザイク", array2, array11, new ShaderPropFloat[]
                {
                    ShaderPropType.FloatValue1
                }, false),
                new ShaderType("CM3D2/Man", "ご主人様", array, array12, new ShaderPropFloat[]
                {
                    ShaderPropType.FloatValue2,
                    ShaderPropType.FloatValue3
                }, false),
                new ShaderType("CM3D2_Debug/Debug_CM3D2_Normal2Color", "法線", array, array12, props, false),
                new ShaderType("Standard", "Standard", array10, array12, props10, false)
            };
            IList <ShaderType> list2 = null;

            ShaderType.STANDARD = list[list.Count - 1];
            foreach (ShaderType shaderType in list)
            {
                Shader x = Shader.Find(shaderType.name);
                if (x == null)
                {
                    if (list2 == null)
                    {
                        list2 = new List <ShaderType>();
                    }
                    list2.Add(shaderType);
                }
            }
            if (!Settings.Instance.enableStandard)
            {
                list.Remove(ShaderType.STANDARD);
            }
            if (list2 != null)
            {
                foreach (ShaderType item in list2)
                {
                    list.Remove(item);
                }
            }
            ShaderType.shaders = list.ToArray();
            for (int i = 0; i < ShaderType.shaders.Length; i++)
            {
                ShaderType.shaders[i].idx = i;
            }
            int num = list.IndexOf(ShaderType.STANDARD);

            if (num != -1)
            {
                ShaderType.SHADER_TYPE_STANDARD  = num;
                ShaderType.SHADER_TYPE_CM3D2_MAX = ShaderType.SHADER_TYPE_STANDARD - 1;
            }
            ShaderType.shaderMap = new Dictionary <string, ShaderType>(ShaderType.shaders.Length + 2);
            foreach (ShaderType shaderType2 in ShaderType.shaders)
            {
                ShaderType.shaderMap[shaderType2.name] = shaderType2;
            }
            ShaderType.shaderMap["Legacy Shaders/Transparent/Diffuse"] = ShaderType.shaderMap["Transparent/Diffuse"];
            ShaderType.shaderMap["Legacy Shaders/Diffuse"]             = ShaderType.shaderMap["Diffuse"];
            ShaderType.shader2Map = new Dictionary <string, string>(ShaderType.shaders.Length + 1);
            foreach (ShaderType shaderType3 in ShaderType.shaders)
            {
                ShaderType.shader2Map[shaderType3.name] = shaderType3.name.Replace("/", "__");
            }
            ShaderType.shader2Map["CM3D2/Toony_Lighted_Hair_Outline_Tex"] = "CM3D2__Toony_Lighted_Hair_Outline";
        }
示例#7
0
        static void Init()
        {
            var texTypeEmpty = new ShaderPropTex[0];
            var texTypeR     = new ShaderPropTex[] { ShaderPropType.RenderTex, };
            var texType0     = new ShaderPropTex[] { ShaderPropType.MainTex, };
            var texType0a    = new ShaderPropTex[] { ShaderPropType.MainTex_a, };
            var texType1     = new ShaderPropTex[] { ShaderPropType.MainTex, ShaderPropType.ToonRamp, ShaderPropType.ShadowTex, ShaderPropType.ShadowRateToon, };                       //ShaderPropType.MultiColTex, };
            var texType1a    = new ShaderPropTex[] { ShaderPropType.MainTex_a, ShaderPropType.ToonRamp, ShaderPropType.ShadowTex, ShaderPropType.ShadowRateToon, };                     // ShaderPropType.MultiColTex, };
            var texTypeH     = new ShaderPropTex[] { ShaderPropType.MainTex, ShaderPropType.ToonRamp, ShaderPropType.ShadowTex, ShaderPropType.ShadowRateToon, ShaderPropType.HiTex, }; // ShaderPropType.MultiColTex, };

            var colEmpty = new ShaderPropColor[0];
            var colC     = new ShaderPropColor[] { ShaderPropType.Color, };
            var colCa    = new ShaderPropColor[] { ShaderPropType.ColorA, };
            var colL     = new ShaderPropColor[] { ShaderPropType.Color, ShaderPropType.ShadowColor, };
            var colLa    = new ShaderPropColor[] { ShaderPropType.ColorA, ShaderPropType.ShadowColor, };
            var colTL    = new ShaderPropColor[] { ShaderPropType.Color, ShaderPropType.ShadowColor, ShaderPropType.RimColor, };
            var colTLa   = new ShaderPropColor[] { ShaderPropType.ColorA, ShaderPropType.ShadowColor, ShaderPropType.RimColor, };
            var colTLO   = new ShaderPropColor[] { ShaderPropType.Color, ShaderPropType.ShadowColor, ShaderPropType.RimColor, ShaderPropType.OutlineColor, };
            var colTLOa  = new ShaderPropColor[] { ShaderPropType.ColorA, ShaderPropType.ShadowColor, ShaderPropType.RimColor, ShaderPropType.OutlineColor, };

            var propEmpty = new ShaderPropFloat[0];
            var propL     = new ShaderPropFloat[] { ShaderPropType.Shininess, };
            var propTL    = new ShaderPropFloat[] { ShaderPropType.Shininess, ShaderPropType.RimPower, ShaderPropType.RimShift, };
            var propTLC   = new ShaderPropFloat[] { ShaderPropType.Shininess, ShaderPropType.RimPower, ShaderPropType.RimShift, ShaderPropType.Cutoff, };
            var propTLO   = new ShaderPropFloat[] { ShaderPropType.Shininess, ShaderPropType.OutlineWidth, ShaderPropType.RimPower, ShaderPropType.RimShift, };
            var propTLH   = new ShaderPropFloat[] { ShaderPropType.Shininess, ShaderPropType.RimPower, ShaderPropType.RimShift, ShaderPropType.HiRate, ShaderPropType.HiPow };
            var propTLHO  = new ShaderPropFloat[] { ShaderPropType.Shininess, ShaderPropType.OutlineWidth, ShaderPropType.RimPower, ShaderPropType.RimShift, ShaderPropType.HiRate, ShaderPropType.HiPow };

            ShaderType.count = 0;
            shaders          = new ShaderType[] {
                new ShaderType("CM3D2/Toony_Lighted", "トゥーン", texType1, colTL, propTL),
                new ShaderType("CM3D2/Toony_Lighted_Trans",   "トゥーン 透過", texType1a, colTLa, propTLC, true),
                new ShaderType("CM3D2/Toony_Lighted_Trans_NoZ",   "トゥーン 透過 NoZ", texType1a, colTLa, propTL, true),
                new ShaderType("CM3D2/Toony_Lighted_Outline", "トゥーン 輪郭線", texType1, colTLO, propTLO),
                new ShaderType("CM3D2/Toony_Lighted_Outline_Trans", "トゥーン 輪郭線 透過", texType1a, colTLOa, propTLO, true),
                new ShaderType("CM3D2/Toony_Lighted_Hair", "トゥーン 髪", texTypeH, colTL, propTLH),
                new ShaderType("CM3D2/Toony_Lighted_Hair_Outline", "トゥーン 髪 輪郭線", texTypeH, colTLO, propTLHO),
                new ShaderType("CM3D2/Lighted", "非トゥーン", texType0, colL, propL),
                new ShaderType("CM3D2/Lighted_Trans", "透過", texType0a, colLa, propL, true),
                new ShaderType("Unlit/Texture", "発光", texType0, colEmpty, propEmpty),
                new ShaderType("Unlit/Transparent", "発光 透過", texType0a, colEmpty, propEmpty, true),
                new ShaderType("Diffuse", "リアル", texType0, colC, propEmpty),
                new ShaderType("Transparent/Diffuse", "リアル 透過", texType0a, colCa, propEmpty, true),
                new ShaderType("CM3D2/Mosaic", "モザイク", texTypeR, colEmpty, new ShaderPropFloat[] { ShaderPropType.FloatValue1 }),
                new ShaderType("CM3D2/Man", "ご主人様", texTypeEmpty, colC, new ShaderPropFloat[] { ShaderPropType.FloatValue2, ShaderPropType.FloatValue3 }),
                new ShaderType("CM3D2_Debug/Debug_CM3D2_Normal2Color", "法線", texTypeEmpty, colC, propEmpty), // Emission
            };
            shaderMap = new Dictionary <string, ShaderType>(shaders.Length);
            foreach (var s in shaders)
            {
                shaderMap[s.name] = s;
            }
            ;
            shaderMap["Legacy Shaders/Transparent/Diffuse"] = shaderMap["Transparent/Diffuse"];
            shaderMap["Legacy Shaders/Diffuse"]             = shaderMap["Diffuse"];
            shader2Map = new Dictionary <string, string>(shaders.Length);
            foreach (var s in shaders)
            {
                shader2Map[s.name] = s.name.Replace("/", "__");
            }
            ;
        }
 internal ShaderType(string name, string dispName, ShaderPropTex[] texProps,
                   ShaderPropColor[] colProps, ShaderPropFloat[] props, bool isTrans = false) {
     this.name = name;
     this.dispName = dispName;
     this.texProps = texProps;
     this.colProps = colProps;
     this.fProps    = props;
     this.isTrans  = isTrans;
     
     if (colProps != null) {
         foreach (var colProp in colProps) {
             if (colProp == ShaderPropType.ShadowColor) {
                 hasShadow = true;
                 break;
             }
         }
     }
     this.idx = count++;
 }
 private ShaderType() {
     this.idx = -1;
     name = string.Empty;
     dispName = string.Empty;
     texProps = new ShaderPropTex[0];
     colProps = new ShaderPropColor[0];
     fProps = new ShaderPropFloat[0];
 }
        static ShaderType()
        {
            var texTypeEmpty = new ShaderPropTex[0];
            var texTypeR     = new [] { ShaderPropType.RenderTex, };
            var texType0     = new [] { ShaderPropType.MainTex, };
            var texType0a    = new [] { ShaderPropType.MainTexA, };
            var texType1     = new [] { ShaderPropType.MainTex, ShaderPropType.ToonRamp, ShaderPropType.ShadowTex, ShaderPropType.ShadowRateToon, };                       //ShaderPropType.MultiColTex, };
            var texType1t    = new [] { ShaderPropType.MainTex, ShaderPropType.ToonRamp, ShaderPropType.ShadowTex, ShaderPropType.ShadowRateToon, ShaderPropType.OutlineTex, ShaderPropType.OutlineToonRamp };
            var texType1a    = new [] { ShaderPropType.MainTexA, ShaderPropType.ToonRamp, ShaderPropType.ShadowTex, ShaderPropType.ShadowRateToon, };                      // ShaderPropType.MultiColTex, };
            var texTypeH     = new [] { ShaderPropType.MainTex, ShaderPropType.ToonRamp, ShaderPropType.ShadowTex, ShaderPropType.ShadowRateToon, ShaderPropType.HiTex, }; // ShaderPropType.MultiColTex, };
            var texTypeHt    = new [] { ShaderPropType.MainTex, ShaderPropType.ToonRamp, ShaderPropType.ShadowTex, ShaderPropType.ShadowRateToon, ShaderPropType.HiTex, ShaderPropType.OutlineTex, ShaderPropType.OutlineToonRamp };
            var texTypeStd   = new [] { ShaderPropType.MainTexA, ShaderPropType.OcclusionMap,
                                        ShaderPropType.MetallicGlossMap, ShaderPropType.BumpMap, ShaderPropType.ParallaxMap, ShaderPropType.EmissionMap,
                                        ShaderPropType.DetailMask, ShaderPropType.DetailAlbedoMap, ShaderPropType.DetailNormalMap,
                                        ShaderPropType.SpecGlossMap };
            // var texTypeMir  = new []{ShaderPropType.MainTex, ShaderPropType.ReflectionTex};

            var colEmpty = new ShaderPropColor[0];
            var colC     = new [] { ShaderPropType.Color, };
            var colCa    = new [] { ShaderPropType.ColorA, };
            var colL     = new [] { ShaderPropType.Color, ShaderPropType.ShadowColor, };
            var colLa    = new [] { ShaderPropType.ColorA, ShaderPropType.ShadowColor, };
            var colTL    = new [] { ShaderPropType.Color, ShaderPropType.ShadowColor, ShaderPropType.RimColor, };
            var colTLa   = new [] { ShaderPropType.ColorA, ShaderPropType.ShadowColor, ShaderPropType.RimColor, };
            var colTLO   = new [] { ShaderPropType.Color, ShaderPropType.ShadowColor, ShaderPropType.RimColor, ShaderPropType.OutlineColor, };
            var colTLOa  = new [] { ShaderPropType.ColorA, ShaderPropType.ShadowColor, ShaderPropType.RimColor, ShaderPropType.OutlineColor, };

            var propEmpty = new ShaderPropFloat[0];
            var propL     = new [] { ShaderPropType.Shininess, };
            var propLC1   = new [] { ShaderPropType.Shininess, ShaderPropType.Cutoff };
            var propTL    = new [] { ShaderPropType.Shininess, ShaderPropType.RimPower, ShaderPropType.RimShift, };
            var propTLZ   = new [] { ShaderPropType.Shininess, ShaderPropType.RimPower, ShaderPropType.RimShift, ShaderPropType.ZTest, ShaderPropType.ZTest2, ShaderPropType.ZTest2Alpha };
            var propTLC1  = new [] { ShaderPropType.Shininess, ShaderPropType.RimPower, ShaderPropType.RimShift, ShaderPropType.Cutoff };
            var propTLO   = new [] { ShaderPropType.Shininess, ShaderPropType.OutlineWidth, ShaderPropType.RimPower, ShaderPropType.RimShift, };
            var propTLH   = new [] { ShaderPropType.Shininess, ShaderPropType.RimPower, ShaderPropType.RimShift, ShaderPropType.HiRate, ShaderPropType.HiPow };
            var propTLHO  = new [] { ShaderPropType.Shininess, ShaderPropType.OutlineWidth, ShaderPropType.RimPower, ShaderPropType.RimShift, ShaderPropType.HiRate, ShaderPropType.HiPow };
//            var propStd   = new [] {
//                ShaderPropType.Cutoff, ShaderPropType.Glossiness, ShaderPropType.GlossMapScale, ShaderPropType.SmoothnessTexChannel, ShaderPropType.Metallic, ShaderPropType.BumpScale,
//                ShaderPropType.Parallax, ShaderPropType.OcclusionStrength, ShaderPropType.DetailNormalMapScale,
//                ShaderPropType.UVSec, ShaderPropType.Mode, ShaderPropType.SrcBlend, ShaderPropType.DstBlend, ShaderPropType.ZWrite,
//            };
            var propStd = new [] {
                ShaderPropType.Cutoff, ShaderPropType.OcclusionStrength,
                ShaderPropType.Glossiness, ShaderPropType.GlossMapScale,
                ShaderPropType.SpecularHeighlights, ShaderPropType.GlossyReflections,
                ShaderPropType.BumpScale, ShaderPropType.DetailNormalMapScale,
            };

            count = 0;
            var shaderList = new List <ShaderType> {
                new ShaderType("CM3D2/Toony_Lighted", "トゥーン", texType1, colTL, propTL),
                new ShaderType("CM3D2/Toony_Lighted_Trans", "トゥーン 透過", texType1a, colTLa, propTLC1, true),
                new ShaderType("CM3D2/Toony_Lighted_Trans_NoZ", "トゥーン 透過 NoZ", texType1a, colTLa, propTL, true),
#if COM3D2
                new ShaderType("CM3D2/Toony_Lighted_Trans_NoZTest", "トゥーン 透過 NoZTest", texType1a, colTLa, propTLZ, true),
#endif
                new ShaderType("CM3D2/Toony_Lighted_Outline", "トゥーン 輪郭線", texType1, colTLO, propTLO),
                new ShaderType("CM3D2/Toony_Lighted_Outline_Trans", "トゥーン 輪郭線 透過", texType1a, colTLOa, propTLO, true),
#if COM3D2
                new ShaderType("CM3D2/Toony_Lighted_Outline_Tex", "トゥーン 輪郭線 Tex", texType1t, colTLO, propTLO),
#endif
                new ShaderType("CM3D2/Toony_Lighted_Hair", "トゥーン 髪", texTypeH, colTL, propTLH),
                new ShaderType("CM3D2/Toony_Lighted_Hair_Outline", "トゥーン 髪 輪郭線", texTypeH, colTLO, propTLHO),
#if COM3D2
                new ShaderType("CM3D2/Toony_Lighted_Hair_Outline_Tex", "トゥーン 髪 輪郭線 Tex", texTypeHt, colTLO, propTLHO),
                new ShaderType("CM3D2/Toony_Lighted_Cutout_AtC", "トゥーン Cutout", texType1a, colTLa, propTLC1, true),
#endif
                new ShaderType("CM3D2/Lighted", "非トゥーン", texType0, colL, propL),
#if COM3D2
                new ShaderType("CM3D2/Lighted_Cutout_AtC", "非トゥーン Cutout", texType0a, colLa, propLC1),
#endif
                new ShaderType("CM3D2/Lighted_Trans", "透過", texType0a, colLa, propL, true),
                new ShaderType("Unlit/Texture", "発光", texType0, colEmpty, propEmpty),
                new ShaderType("Unlit/Transparent", "発光 透過", texType0a, colEmpty, propEmpty, true),
                new ShaderType("Diffuse", "リアル", texType0, colC, propEmpty),
                new ShaderType("Transparent/Diffuse", "リアル 透過", texType0a, colCa, propEmpty, true),
                new ShaderType("CM3D2/Mosaic", "モザイク", texTypeR, colEmpty, new[] { ShaderPropType.FloatValue1 }),
                new ShaderType("CM3D2/Man", "ご主人様", texTypeEmpty, colC, new[] { ShaderPropType.FloatValue2, ShaderPropType.FloatValue3 }),
                new ShaderType("CM3D2_Debug/Debug_CM3D2_Normal2Color", "法線", texTypeEmpty, colC, propEmpty), // Emission
                new ShaderType("Standard", "Standard", texTypeStd, colC, propStd),
            };
            IList <ShaderType> toRemoves = null;

            STANDARD = shaderList[shaderList.Count - 1];
            // ゲーム中で参照できるシェーダに限定
            foreach (var shaderType in shaderList)
            {
                var shader = Shader.Find(shaderType.name);
                if (shader == null)
                {
                    if (toRemoves == null)
                    {
                        toRemoves = new List <ShaderType>();
                    }
                    toRemoves.Add(shaderType);
                }
            }

            if (!Settings.Instance.enableStandard)
            {
                shaderList.Remove(STANDARD);
            }
            if (toRemoves != null)
            {
                foreach (var toRemove in toRemoves)
                {
                    shaderList.Remove(toRemove);
                }
            }

            shaders = shaderList.ToArray();
            for (var i = 0; i < shaders.Length; i++)
            {
                shaders[i].idx = i;
            }

            var idx = shaderList.IndexOf(STANDARD);

            if (idx != -1)
            {
                SHADER_TYPE_STANDARD  = idx;
                SHADER_TYPE_CM3D2_MAX = SHADER_TYPE_STANDARD - 1;
            }

            shaderMap = new Dictionary <string, ShaderType>(shaders.Length + 2);
            foreach (var s in shaders)
            {
                shaderMap[s.name] = s;
            }
            ;
            shaderMap["Legacy Shaders/Transparent/Diffuse"] = shaderMap["Transparent/Diffuse"];
            shaderMap["Legacy Shaders/Diffuse"]             = shaderMap["Diffuse"];

            shader2Map = new Dictionary <string, string>(shaders.Length + 1);
            foreach (var s in shaders)
            {
                shader2Map[s.name] = s.name.Replace("/", "__");
            }
            ;
            shader2Map["CM3D2/Toony_Lighted_Hair_Outline_Tex"] = "CM3D2__Toony_Lighted_Hair_Outline";
        }
示例#11
0
        // Token: 0x060000DA RID: 218 RVA: 0x0000AAE8 File Offset: 0x00008CE8
        public void Update(ShaderType sdrType)
        {
            if (this.type == sdrType)
            {
                return;
            }
            ShaderPropColor[] colProps = sdrType.colProps;
            EditColor[]       array    = new EditColor[colProps.Length];
            ColorPicker[]     array2   = new ColorPicker[colProps.Length];
            int itemHeight             = UIParams.Instance.itemHeight;

            for (int i = 0; i < colProps.Length; i++)
            {
                ShaderPropColor shaderPropColor = colProps[i];
                if (i < this.editColors.Length)
                {
                    if (this.editColors[i].type == shaderPropColor.colorType)
                    {
                        array[i] = this.editColors[i];
                    }
                    else
                    {
                        array[i] = new EditColor(this.editColors[i].val, shaderPropColor.colorType, shaderPropColor.composition);
                    }
                    array2[i] = this.pickers[i];
                }
                else
                {
                    Color val;
                    if (this.material != null)
                    {
                        val = this.material.GetColor(shaderPropColor.propId);
                    }
                    else
                    {
                        val = ((this.Original != null) ? this.Original.GetColor(i) : shaderPropColor.defaultVal);
                    }
                    array[i]  = new EditColor(val, shaderPropColor.colorType, shaderPropColor.composition);
                    array2[i] = new ColorPicker(ACCMaterial.presetMgr)
                    {
                        ColorTex = new Texture2D(itemHeight, itemHeight, TextureFormat.RGB24, false)
                    };
                    array2[i].SetTexColor(ref array[i].val);
                }
            }
            this.editColors = array;
            this.pickers    = array2;
            ShaderPropFloat[] fProps = sdrType.fProps;
            EditValue[]       array3 = new EditValue[fProps.Length];
            for (int j = 0; j < fProps.Length; j++)
            {
                float val2 = (this.material != null) ? this.material.GetFloat(fProps[j].propId) : fProps[j].defaultVal;
                array3[j] = new EditValue(val2, fProps[j].range);
            }
            this.editVals = array3;
            foreach (ShaderPropTex shaderPropTex in sdrType.texProps)
            {
                if (this.material != null && !this.material.HasProperty(shaderPropTex.keyName))
                {
                    this.material.SetTexture(shaderPropTex.propId, new Texture());
                }
            }
            this.type = sdrType;
        }