Skip to content

Commit

Permalink
feat: add API to provide which kind of information is provided by Sha…
Browse files Browse the repository at this point in the history
…derInformation
  • Loading branch information
anatawa12 committed Oct 17, 2024
1 parent 1835d1f commit 232ef78
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
26 changes: 26 additions & 0 deletions API-Editor/ShaderInformation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@ protected ShaderInformation()
/// </summary>
internal virtual bool IsInternalInformation => false;

/// <summary>
/// The kind of information provided by this class.
/// </summary>
public abstract ShaderInformationKind SupportedInformationKind { get; }

/// <summary>
/// Gets the texture usage information for the material.
///
Expand All @@ -153,6 +158,27 @@ protected ShaderInformation()
// note for future this class update: this class is extandable public abstract class so you must not add new abstract method to this class.
}

/// <summary>
/// The flags to express which information is provided by the ShaderInformation.
///
/// It's recommended to provide as much information as possible.
/// </summary>
[Flags]
[PublicAPI]
public enum ShaderInformationKind
{
/// <summary>
/// No information
/// </summary>
None = 0,
/// <summary>
/// The texture and UV usage information
///
/// Providing this information will allow Avatar Optimizer to optimize the texture usage like UV Packing.
/// </summary>
TextureAndUVUsage = 1,
}

/// <summary>
/// The callback for the texture usage information.
/// </summary>
Expand Down
3 changes: 3 additions & 0 deletions Editor/APIInternal/ShaderInformation.Liltoon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ internal class LiltoonShaderInformation : ShaderInformation
{
internal override bool IsInternalInformation => true;

public override ShaderInformationKind SupportedInformationKind =>
ShaderInformationKind.TextureAndUVUsage;

static LiltoonShaderInformation()
{
Register();
Expand Down

0 comments on commit 232ef78

Please sign in to comment.