45 lines
865 B
C#
45 lines
865 B
C#
using Godot;
|
|
using System.Reflection;
|
|
using System.Collections.Generic;
|
|
|
|
namespace Rokojori
|
|
{
|
|
[Tool]
|
|
[GlobalClass]
|
|
public partial class UVModule:ShaderGenerationModule
|
|
{
|
|
[Export]
|
|
public UVScaleOffset uvScaleOffset = new UVScaleOffset();
|
|
|
|
[Export]
|
|
public UVModifier[] modifiers = [];
|
|
|
|
public override List<ShaderCode> GetCode( ShaderGenerationContext context )
|
|
{
|
|
var list = new List<ShaderCode>();
|
|
|
|
var allModifiers = Lists.From( modifiers ).FilterNulls();
|
|
|
|
if ( uvScaleOffset != null )
|
|
{
|
|
allModifiers.Insert( 0, uvScaleOffset );
|
|
}
|
|
|
|
allModifiers.ForEach(
|
|
( m )=>
|
|
{
|
|
var code = m.GetCode( context );
|
|
|
|
if ( code == null )
|
|
{
|
|
return;
|
|
}
|
|
|
|
list.Add( code );
|
|
}
|
|
);
|
|
|
|
return list;
|
|
}
|
|
}
|
|
} |