2026-02-26 14:06:27 +00:00
|
|
|
using Godot;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
|
|
namespace Rokojori;
|
|
|
|
|
|
|
|
|
|
[Tool,GlobalClass]
|
|
|
|
|
public partial class CustomLineMaterialPreset:LineMaterialPreset
|
|
|
|
|
{
|
2026-03-20 13:31:31 +00:00
|
|
|
[Export( PropertyHint.Range, "0.001,128")]
|
|
|
|
|
public float lodBias = 1;
|
|
|
|
|
|
2026-02-26 14:06:27 +00:00
|
|
|
[Export]
|
|
|
|
|
public Material material;
|
|
|
|
|
|
|
|
|
|
[Export]
|
|
|
|
|
public GeometryInstance3D.ShadowCastingSetting shadows = GeometryInstance3D.ShadowCastingSetting.On;
|
|
|
|
|
|
|
|
|
|
[Export]
|
|
|
|
|
public LineVFXShaderSetup shaderSetup;
|
|
|
|
|
|
|
|
|
|
public override void CreateMaterial( LineVFX lineVFX, MeshInstance3D mi )
|
|
|
|
|
{
|
2026-03-20 13:31:31 +00:00
|
|
|
for ( int i = 0; i < mi.GetSurfaceOverrideMaterialCount(); i++ )
|
|
|
|
|
{
|
|
|
|
|
mi.SetSurfaceOverrideMaterial( i, material );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mi.LodBias = lodBias;
|
2026-02-26 14:06:27 +00:00
|
|
|
mi.CastShadow = shadows;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void SetPointData( LineVFX lineVFX, MeshInstance3D mi, LinePointData data, bool start )
|
|
|
|
|
{
|
|
|
|
|
if ( start )
|
|
|
|
|
{
|
|
|
|
|
shaderSetup.start.Set( mi, data );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
shaderSetup.end.Set( mi, data );
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-03-20 13:31:31 +00:00
|
|
|
|
|
|
|
|
public override void SetLineLength( LineVFX lineVFX, MeshInstance3D mi, float length )
|
|
|
|
|
{
|
|
|
|
|
shaderSetup.lineLength.SetInstance( mi, length );
|
|
|
|
|
}
|
2026-02-26 14:06:27 +00:00
|
|
|
}
|