Skip to content
This repository has been archived by the owner on May 11, 2024. It is now read-only.

Commit

Permalink
- [Core] Added shader flags.
Browse files Browse the repository at this point in the history
  • Loading branch information
Razmoth committed Feb 10, 2024
1 parent 5db1b59 commit 2e268e6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
5 changes: 4 additions & 1 deletion AssetStudio.Utility/ShaderConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,10 @@ private static string ConvertSerializedProperty(SerializedProperty m_Prop)
{
sb.Append($"[{m_Attribute}] ");
}
//TODO Flag
foreach (var flag in Enum.GetValues<SerializedPropertyFlag>().Where(x => m_Prop.m_Flags.HasFlag(x)))
{
sb.Append($"[{flag}] ");
}
sb.Append($"{m_Prop.m_Name} (\"{m_Prop.m_Description}\", ");
switch (m_Prop.m_Type)
{
Expand Down
18 changes: 16 additions & 2 deletions AssetStudio/Classes/Shader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,27 @@ public enum SerializedPropertyType
Int = 5
};

[Flags]
public enum SerializedPropertyFlag
{
HideInInspector = 1 << 0,
PerRendererData = 1 << 1,
NoScaleOffset = 1 << 2,
Normal = 1 << 3,
HDR = 1 << 4,
Gamma = 1 << 5,
NonModifiableTextureData = 1 << 6,
MainTexture = 1 << 7,
MainColor = 1 << 8,
}

public class SerializedProperty
{
public string m_Name;
public string m_Description;
public string[] m_Attributes;
public SerializedPropertyType m_Type;
public uint m_Flags;
public SerializedPropertyFlag m_Flags;
public float[] m_DefValue;
public SerializedTextureProperty m_DefTexture;

Expand All @@ -105,7 +119,7 @@ public SerializedProperty(EndianBinaryReader reader)
m_Description = reader.ReadAlignedString();
m_Attributes = reader.ReadStringArray();
m_Type = (SerializedPropertyType)reader.ReadInt32();
m_Flags = reader.ReadUInt32();
m_Flags = (SerializedPropertyFlag)reader.ReadUInt32();
m_DefValue = reader.ReadSingleArray(4);
m_DefTexture = new SerializedTextureProperty(reader);
}
Expand Down

0 comments on commit 2e268e6

Please sign in to comment.