46 lines
875 B
C#
46 lines
875 B
C#
using Godot;
|
|
using System.Reflection;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
|
|
namespace Rokojori
|
|
{
|
|
[Tool]
|
|
[GlobalClass]
|
|
public partial class ShaderRawModule:ShaderGenerationModule
|
|
{
|
|
[Export]
|
|
public string value;
|
|
|
|
[Export]
|
|
public ShaderPhase phase;
|
|
|
|
[Export]
|
|
public bool matchPhase = false;
|
|
|
|
public ShaderRawModule( string value, ShaderPhase? phase = null )
|
|
{
|
|
if ( phase != null )
|
|
{
|
|
phase = (ShaderPhase) phase;
|
|
matchPhase = true;
|
|
}
|
|
else
|
|
{
|
|
matchPhase = false;
|
|
}
|
|
|
|
this.value = value;
|
|
}
|
|
|
|
public override List<ShaderCode> GetCode( ShaderGenerationContext context )
|
|
{
|
|
if ( matchPhase && context.phase != phase )
|
|
{
|
|
return null;
|
|
}
|
|
|
|
return Lists.From( (ShaderCode) new StringShaderCode( value ) );
|
|
}
|
|
}
|
|
} |