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)); }
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); } }
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); }
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] }; }
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 ? }
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); }
public static bool IsKeywordEnabled(this VrmMaterial m, string key) { bool enable; if (m.keywordMap.TryGetValue(key, out enable)) { return(enable); } return(false); }
public static float GetFloat(this VrmMaterial m, string key) { float value; if (m.floatProperties.TryGetValue(key, out value)) { return(value); } return(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); }
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); }
private static OutlineColorMode GetOutlineColorMode(VrmMaterial material) { if (material.IsKeywordEnabled(KeyOutlineColorFixed)) { return(OutlineColorMode.FixedColor); } if (material.IsKeywordEnabled(KeyOutlineColorMixed)) { return(OutlineColorMode.MixedLighting); } return(OutlineColorMode.FixedColor); }
private static OutlineWidthMode GetOutlineWidthMode(VrmMaterial material) { if (material.IsKeywordEnabled(KeyOutlineWidthWorld)) { return(OutlineWidthMode.WorldCoordinates); } if (material.IsKeywordEnabled(KeyOutlineWidthScreen)) { return(OutlineWidthMode.ScreenCoordinates); } return(OutlineWidthMode.None); }
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); } }
private static float GetValue(VrmMaterial material, string propertyName) { return(material.GetFloat(propertyName)); }
private static RenderMode GetRenderQueueOriginMode(VrmMaterial material) { return(GetBlendMode(material)); }
private static Texture2D GetTexture(VrmMaterial material, string propertyName, List <VrmLib.Texture> textures) { return((Texture2D)material.GetTexture(propertyName, textures)); }
public static void SetColor(this VrmMaterial m, string key, Vector4 value) { m.vectorProperties[key] = new float[] { value.X, value.Y, value.Z, value.W }; }
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))
public static BlendMode GetBlendMode(this VrmMaterial m) { throw new NotImplementedException(); }
public static void EnableKeyword(this VrmMaterial m, string key) { m.keywordMap[key] = true; }
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)); }
public static void SetFloat(this VrmMaterial m, string key, float value) { m.floatProperties[key] = value; }
public static void DisableKeyword(this VrmMaterial m, string key) { m.keywordMap[key] = false; }
public static void SetOverrideTag(this VrmMaterial m, string key, string value) { m.tagMap[key] = value; }