// Token: 0x0600018F RID: 399 RVA: 0x0000E7B8 File Offset: 0x0000C9B8
 public ACCTexture(Texture tex, Material mate, ShaderPropTex texProp, ShaderType type) : this(texProp.key)
 {
     if (tex == null)
     {
         tex = new Texture2D(2, 2)
         {
             name = string.Empty
         };
     }
     this.tex      = tex;
     this.type     = type;
     this.prop     = texProp;
     this.editname = tex.name;
     if (tex is Texture2D)
     {
         this.texOffset = mate.GetTextureOffset(this.prop.propId);
         this.texScale  = mate.GetTextureScale(this.prop.propId);
         return;
     }
     LogUtil.DebugF("propName({0}): texture type:{1}", new object[]
     {
         this.propName,
         tex.GetType()
     });
 }
        public ACCTexture(Texture tex, Material mate, ShaderPropTex texProp, ShaderType type) : this(texProp.key)
        {
            this.tex  = tex;
            this.type = type;
            this.prop = texProp;

            this.editname = tex.name;
            if (tex is Texture2D)
            {
                texOffset = mate.GetTextureOffset(propName);
                texScale  = mate.GetTextureScale(propName);
            }
            else
            {
                LogUtil.DebugF("propName({0}): texture type:{1}", propName, tex.GetType());
            }

//            } else {
//                // シェーダ切り替えなどで、元々存在しないテクスチャの場合
//                LogUtil.DebugF("texture not found. propname={0}, material={1}", propName, mate.name);
//                // 空のテクスチャは作成しない
////                this.tex = new Texture2D(2, 2);
////                this.tex.name = string.Empty;
////                // テクスチャを追加セット
////                mate.SetTexture(propName, this.tex);
//            }
        }
Beispiel #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];
 }
        public static ACCTexture Create(Material mate, ShaderPropTex texProp, ShaderType type)
        {
            var tex = mate.GetTexture(texProp.propId);

            if (tex == null)
            {
                LogUtil.Debug("tex is null. ", texProp.key);
            }
            return(new ACCTexture(tex, mate, texProp, type));
        }
 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: 0x06000190 RID: 400 RVA: 0x0000E870 File Offset: 0x0000CA70
        public static ACCTexture Create(Material mate, ShaderPropTex texProp, ShaderType type)
        {
            Texture texture = mate.GetTexture(texProp.propId);

            if (texture == null)
            {
                LogUtil.Debug(new object[]
                {
                    "tex is null. ",
                    texProp.key
                });
            }
            return(new ACCTexture(texture, mate, texProp, type));
        }
        public ACCTexture(ACCTexture src)
        {
            original = src;
            propName = src.propName;
            type     = src.type;
            prop     = src.prop;
            propKey  = src.propKey;

            editname  = src.editname;
            filepath  = src.filepath;
            texOffset = src.texOffset;
            texScale  = src.texScale;

            toonType = src.toonType;
        }
//        public ACCTexture(Material mate, string propName, MaterialType type) :this(propName) {
//            this.type = type;
//            this.tex = mate.GetTexture(propName);
//
//            if (tex != null) {
//                this.editname = tex.name;
//                if (tex is Texture2D) {
//                   texOffset = mate.GetTextureOffset(propName);
//                   texScale  = mate.GetTextureScale(propName);
//                } else {
//                    LogUtil.DebugF("propName({0}): texture type:{1}", propName, tex.GetType());
//                }
//            } else {
//                // シェーダ切り替えなどで、元々存在しないテクスチャの場合
//                LogUtil.DebugF("texture not found. propname={0}, material={1}", propName, mate.name);
//                // 空のテクスチャは作成しない
////                this.tex = new Texture2D(2, 2);
////                this.tex.name = string.Empty;
////                // テクスチャを追加セット
////                mate.SetTexture(propName, this.tex);
//            }
//        }

        public ACCTexture(ACCTexture src)
        {
            this.original = src;
            this.propName = src.propName;
            this.type     = src.type;
            this.prop     = src.prop;
            this.propKey  = src.propKey;

            this.editname  = src.editname;
            this.filepath  = src.filepath;
            this.texOffset = src.texOffset;
            this.texScale  = src.texScale;

            this.toonType = src.toonType;
        }
        public ACCTexture(Texture tex, Material mate, ShaderPropTex texProp, ShaderType type) :this(texProp.key) {
            this.tex = tex;
            this.type = type;
            this.prop = texProp;

            this.editname = tex.name;
            if (tex is Texture2D) {
               texOffset = mate.GetTextureOffset(propName);
               texScale  = mate.GetTextureScale(propName);
            } else {
                LogUtil.DebugF("propName({0}): texture type:{1}", propName, tex.GetType());
            }
            
//            } else {
//                // シェーダ切り替えなどで、元々存在しないテクスチャの場合
//                LogUtil.DebugF("texture not found. propname={0}, material={1}", propName, mate.name);
//                // 空のテクスチャは作成しない
////                this.tex = new Texture2D(2, 2);
////                this.tex.name = string.Empty;
////                // テクスチャを追加セット
////                mate.SetTexture(propName, this.tex);
//            }
        }
        // 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";
        }
Beispiel #11
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("/", "__");
            }
            ;
        }
 public static ACCTexture Create(Material mate, ShaderPropTex texProp, ShaderType type) {
     var tex = mate.GetTexture(texProp.propId);
     
     return tex == null ? null : new ACCTexture(tex, mate, texProp, type);
 }
 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];
 }
        public static ACCTexture Create(Material mate, ShaderPropTex texProp, ShaderType type)
        {
            var tex = mate.GetTexture(texProp.propId);

            return(tex == null ? null : new ACCTexture(tex, mate, texProp, type));
        }
//        public ACCTexture(Material mate, string propName, MaterialType type) :this(propName) {
//            this.type = type;
//            this.tex = mate.GetTexture(propName);
//
//            if (tex != null) {
//                this.editname = tex.name;
//                if (tex is Texture2D) {
//                   texOffset = mate.GetTextureOffset(propName);
//                   texScale  = mate.GetTextureScale(propName);
//                } else {
//                    LogUtil.DebugF("propName({0}): texture type:{1}", propName, tex.GetType());
//                }
//            } else {
//                // シェーダ切り替えなどで、元々存在しないテクスチャの場合
//                LogUtil.DebugF("texture not found. propname={0}, material={1}", propName, mate.name);
//                // 空のテクスチャは作成しない
////                this.tex = new Texture2D(2, 2);
////                this.tex.name = string.Empty;
////                // テクスチャを追加セット
////                mate.SetTexture(propName, this.tex);
//            }
//        }

        public ACCTexture(ACCTexture src) {
            this.original  = src;
            this.propName  = src.propName;
            this.type      = src.type;
            this.prop      = src.prop;
            this.propKey   = src.propKey;

            this.editname  = src.editname;
            this.filepath  = src.filepath;
            this.texOffset = src.texOffset;
            this.texScale  = src.texScale;

            this.toonType  = src.toonType;
        }
        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";
        }