rj-action-library/Runtime/Shading/Generators/Spatial/Vertex/VertexModule.cs

46 lines
841 B
C#
Raw Normal View History

using Godot;
using System.Reflection;
using System.Collections.Generic;
namespace Rokojori
{
[Tool]
[GlobalClass]
public partial class VertexModule:ShaderGenerationModule
{
[Export]
public VertexWind wind = new VertexWind();
[Export]
public VertexModifier[] modifiers = [];
public override List<ShaderCode> GetCode( ShaderGenerationContext context )
{
var list = new List<ShaderCode>();
var allModifiers = Lists.From( modifiers ).FilterNulls();
if ( wind != null )
{
allModifiers.Insert( 0, wind );
}
allModifiers.ForEach(
( m )=>
{
var code = m.GetCode( context );
if ( code == null )
{
return;
}
list.Add( code );
}
);
return list;
}
}
}