using Godot; using System; using Rokojori.Extensions; namespace Rokojori { public class HeightMapRibbonShader { public static readonly CachedResource shader = new CachedResource( "res://addons/rokojori_action_library/Runtime/Procedural/HeightMaps/Shaders/HeightMapRibbon.gdshader" ); public static readonly Vector4PropertyName region = Vector4PropertyName.Create( "ribbon_region" ); } /** Material for HeightMapRibbon.gdshader. One per ribbon rather than one shared, because the region clip has to be per ribbon - see the shader. Everything else the pass writes comes off the mesh's own vertex attributes. */ [Tool] public partial class HeightMapRibbonMaterial:CustomMaterial { public readonly CustomMaterialProperty region; public HeightMapRibbonMaterial() { Shader = HeightMapRibbonShader.shader.Get(); region = new CustomMaterialProperty( this, HeightMapRibbonShader.region ); } public void SetRegion( Rect2I rect ) { region.Set( new Vector4( rect.Position.X, rect.Position.Y, rect.Size.X, rect.Size.Y ) ); } } }