rj-action-library/Runtime/Shading/Generators/Generic/ShaderRawModule.cs

49 lines
893 B
C#
Raw Normal View History

using Godot;
using System.Reflection;
using System.Collections.Generic;
using System.IO;
namespace Rokojori
{
[Tool]
[GlobalClass]
public partial class ShaderRawModule:ShaderGenerationModule
{
2025-09-17 08:25:03 +00:00
[Export]
public string value;
[Export]
public ShaderPhase phase;
[Export]
public bool matchPhase = false;
public ShaderRawModule( string value, ShaderPhase? phase = null )
{
2025-09-17 08:25:03 +00:00
sortableCode = false;
if ( phase != null )
{
phase = (ShaderPhase) phase;
matchPhase = true;
}
else
{
matchPhase = false;
}
this.value = value;
}
2025-09-17 08:25:03 +00:00
public override List<ShaderVariant> GetVariants( ShaderGenerationContext context )
{
if ( matchPhase && context.phase != phase )
{
return null;
}
2025-09-17 08:25:03 +00:00
return ToVariants( ToCode( value ) );
}
}
}