rj-action-library/Runtime/Shading/Generators/Spatial/Varyings/MeshAttributVarying.cs

35 lines
657 B
C#
Raw Normal View History

2025-09-26 12:00:59 +00:00
using Godot;
using System.Reflection;
using System.Collections.Generic;
namespace Rokojori
{
[Tool]
[GlobalClass]
public partial class MeshAttributVarying: SpatialVaryingSource
{
public enum MeshAttribute
{
COLOR,
CUSTOM0,
CUSTOM1,
CUSTOM2,
CUSTOM3,
INSTANCE_CUSTOM
}
[Export]
public MeshAttribute meshAttribute;
public override List<ShaderCode> GetVaryingSource( ShaderGenerationContext context, string varyingName )
{
if ( ! context.isVertexPhase )
{
return null;
}
return ToCode( $"{varyingName} = {meshAttribute + ""};\n");
}
}
}