Esempio n. 1
0
        private static Color GetColor(VrmMaterial material, string propertyName)
        {
            // TODO
            var color = material.GetColor(propertyName);

            return(VrmLib.LinearColor.FromLiner(color.X, color.Y, color.Z, color.W));
        }
Esempio n. 2
0
        private static RenderMode GetBlendMode(VrmMaterial material)
        {
            if (material.IsKeywordEnabled(KeyAlphaTestOn))
            {
                return(RenderMode.Cutout);
            }
            else if (material.IsKeywordEnabled(KeyAlphaBlendOn))
            {
                switch (material.GetInt(PropZWrite))
                {
                case EnabledIntValue:
                    return(RenderMode.TransparentWithZWrite);

                case DisabledIntValue:
                    return(RenderMode.Transparent);

                default:
                    Console.WriteLine("[GetBlendMode] Invalid ZWrite Int Value.");
                    return(RenderMode.Transparent);
                }
            }
            else
            {
                return(RenderMode.Opaque);
            }
        }
Esempio n. 3
0
 public static Vector2 GetTextureOffset(this VrmMaterial m, string key)
 {
     float[] value;
     if (m.vectorProperties.TryGetValue(key, out value))
     {
         return(new Vector2(value[0], value[1]));
     }
     return(Vector2.Zero);
 }
Esempio n. 4
0
 public static void SetTextureOffset(this VrmMaterial m, string key, Vector2 value)
 {
     float[] old;
     if (!m.vectorProperties.TryGetValue(key, out old))
     {
         old = new float[] { 0, 0, 1, 1 };
     }
     m.vectorProperties[key] = new float[] { value.X, value.Y, old[2], old[3] };
 }
Esempio n. 5
0
 public static Vector4 GetColor(this VrmMaterial m, string key)
 {
     float[] value;
     if (m.vectorProperties.TryGetValue(key, out value))
     {
         return(new Vector4(value[0], value[1], value[2], value[3]));
     }
     return(Vector4.Zero); // black ?
 }
Esempio n. 6
0
 public static Vector2 GetTextureScale(this VrmMaterial m, string key)
 {
     float[] value;
     if (m.vectorProperties.TryGetValue(key, out value))
     {
         return(new Vector2(value[2], value[3]));
     }
     return(Vector2.One);
 }
Esempio n. 7
0
        public static bool IsKeywordEnabled(this VrmMaterial m, string key)
        {
            bool enable;

            if (m.keywordMap.TryGetValue(key, out enable))
            {
                return(enable);
            }
            return(false);
        }
Esempio n. 8
0
        public static float GetFloat(this VrmMaterial m, string key)
        {
            float value;

            if (m.floatProperties.TryGetValue(key, out value))
            {
                return(value);
            }
            return(0);
        }
Esempio n. 9
0
        public static MToonMaterial Load(VrmMaterial mp, List <Texture> textures)
        {
            var mtoon = new MToonMaterial(mp.name);

            if (mp.floatProperties.TryGetValue(Utils.PropDebugMode, out float value))
            {
                mtoon._DebugMode = value;
            }
            mtoon.Definition = MToon.Utils.FromVrm0x(mp, textures);
            return(mtoon);
        }
Esempio n. 10
0
        private static int GetRenderQueueOffset(VrmMaterial material, RenderMode originMode)
        {
            var rawValue    = material.renderQueue;
            var requirement = GetRenderQueueRequirement(originMode);

            if (rawValue < requirement.MinValue || rawValue > requirement.MaxValue)
            {
                return(0);
            }
            return(rawValue - requirement.DefaultValue);
        }
Esempio n. 11
0
        private static OutlineColorMode GetOutlineColorMode(VrmMaterial material)
        {
            if (material.IsKeywordEnabled(KeyOutlineColorFixed))
            {
                return(OutlineColorMode.FixedColor);
            }
            if (material.IsKeywordEnabled(KeyOutlineColorMixed))
            {
                return(OutlineColorMode.MixedLighting);
            }

            return(OutlineColorMode.FixedColor);
        }
Esempio n. 12
0
        private static OutlineWidthMode GetOutlineWidthMode(VrmMaterial material)
        {
            if (material.IsKeywordEnabled(KeyOutlineWidthWorld))
            {
                return(OutlineWidthMode.WorldCoordinates);
            }
            if (material.IsKeywordEnabled(KeyOutlineWidthScreen))
            {
                return(OutlineWidthMode.ScreenCoordinates);
            }

            return(OutlineWidthMode.None);
        }
Esempio n. 13
0
        private static CullMode GetCullMode(VrmMaterial material)
        {
            switch ((CullMode)material.GetInt(PropCullMode))
            {
            case CullMode.Off:
                return(CullMode.Off);

            case CullMode.Front:
                return(CullMode.Front);

            case CullMode.Back:
                return(CullMode.Back);

            default:
                Console.WriteLine("[GetCullMode]: Invalid CullMode.");
                return(CullMode.Back);
            }
        }
Esempio n. 14
0
 private static float GetValue(VrmMaterial material, string propertyName)
 {
     return(material.GetFloat(propertyName));
 }
Esempio n. 15
0
 private static RenderMode GetRenderQueueOriginMode(VrmMaterial material)
 {
     return(GetBlendMode(material));
 }
Esempio n. 16
0
 private static Texture2D GetTexture(VrmMaterial material, string propertyName, List <VrmLib.Texture> textures)
 {
     return((Texture2D)material.GetTexture(propertyName, textures));
 }
Esempio n. 17
0
 public static void SetColor(this VrmMaterial m, string key, Vector4 value)
 {
     m.vectorProperties[key] = new float[] { value.X, value.Y, value.Z, value.W };
 }
Esempio n. 18
0
 public static TextureInfo GetTexture(this VrmMaterial m, string key, List <Texture> textures)
 {
     if (m.textureProperties.TryGetValue(key, out int value))
     {
         var texture = new TextureInfo(textures[value]);
         if (m.vectorProperties.TryGetValue(key, out float[] offsetScaling))
Esempio n. 19
0
 public static BlendMode GetBlendMode(this VrmMaterial m)
 {
     throw new NotImplementedException();
 }
Esempio n. 20
0
 public static void EnableKeyword(this VrmMaterial m, string key)
 {
     m.keywordMap[key] = true;
 }
Esempio n. 21
0
 public static void SetColor(this VrmMaterial m, string key, VrmLib.LinearColor color)
 {
     m.SetColor(key, new Vector4(color.RGBA.X, color.RGBA.Y, color.RGBA.Z, color.RGBA.W));
 }
Esempio n. 22
0
 public static void SetFloat(this VrmMaterial m, string key, float value)
 {
     m.floatProperties[key] = value;
 }
Esempio n. 23
0
 public static void DisableKeyword(this VrmMaterial m, string key)
 {
     m.keywordMap[key] = false;
 }
Esempio n. 24
0
 public static void SetOverrideTag(this VrmMaterial m, string key, string value)
 {
     m.tagMap[key] = value;
 }