Update csharp; add Tool

This commit is contained in:
Cory Petkovsek 2025-12-16 22:13:56 +07:00
parent 9413986c0c
commit ca7a4c4276
11 changed files with 171 additions and 12 deletions

View File

@ -8,6 +8,7 @@ using Godot.Collections;
namespace TokisanGames;
[Tool]
public partial class Terrain3D : Node3D
{
@ -150,15 +151,21 @@ public partial class Terrain3D : Node3D
public new static readonly StringName CollisionMode = "collision_mode";
public new static readonly StringName CollisionShapeSize = "collision_shape_size";
public new static readonly StringName CollisionRadius = "collision_radius";
public new static readonly StringName CollisionTarget = "collision_target";
public new static readonly StringName CollisionLayer = "collision_layer";
public new static readonly StringName CollisionMask = "collision_mask";
public new static readonly StringName CollisionPriority = "collision_priority";
public new static readonly StringName PhysicsMaterial = "physics_material";
public new static readonly StringName CollisionTarget = "collision_target";
public new static readonly StringName ClipmapTarget = "clipmap_target";
public new static readonly StringName MeshLods = "mesh_lods";
public new static readonly StringName MeshSize = "mesh_size";
public new static readonly StringName VertexSpacing = "vertex_spacing";
public new static readonly StringName ClipmapTarget = "clipmap_target";
public new static readonly StringName TessellationLevel = "tessellation_level";
public new static readonly StringName Displacement = "Displacement";
public new static readonly StringName DisplacementScale = "displacement_scale";
public new static readonly StringName DisplacementSharpness = "displacement_sharpness";
public new static readonly StringName BufferShaderOverrideEnabled = "buffer_shader_override_enabled";
public new static readonly StringName BufferShaderOverride = "buffer_shader_override";
public new static readonly StringName RenderLayers = "render_layers";
public new static readonly StringName MouseLayer = "mouse_layer";
public new static readonly StringName CastShadows = "cast_shadows";
@ -182,9 +189,13 @@ public partial class Terrain3D : Node3D
public new static readonly StringName ShowControlScale = "show_control_scale";
public new static readonly StringName ShowColormap = "show_colormap";
public new static readonly StringName ShowRoughmap = "show_roughmap";
public new static readonly StringName ShowDisplacementBuffer = "show_displacement_buffer";
public new static readonly StringName Pbr = "PBR";
public new static readonly StringName ShowTextureAlbedo = "show_texture_albedo";
public new static readonly StringName ShowTextureHeight = "show_texture_height";
public new static readonly StringName ShowTextureNormal = "show_texture_normal";
public new static readonly StringName ShowTextureRough = "show_texture_rough";
public new static readonly StringName ShowTextureAo = "show_texture_ao";
}
public new string Version
@ -279,6 +290,12 @@ public partial class Terrain3D : Node3D
set => Set(GDExtensionPropertyName.CollisionRadius, value);
}
public new Node3D CollisionTarget
{
get => Get(GDExtensionPropertyName.CollisionTarget).As<Node3D>();
set => Set(GDExtensionPropertyName.CollisionTarget, value);
}
public new long CollisionLayer
{
get => Get(GDExtensionPropertyName.CollisionLayer).As<long>();
@ -303,10 +320,10 @@ public partial class Terrain3D : Node3D
set => Set(GDExtensionPropertyName.PhysicsMaterial, value);
}
public new Node3D CollisionTarget
public new Node3D ClipmapTarget
{
get => Get(GDExtensionPropertyName.CollisionTarget).As<Node3D>();
set => Set(GDExtensionPropertyName.CollisionTarget, value);
get => Get(GDExtensionPropertyName.ClipmapTarget).As<Node3D>();
set => Set(GDExtensionPropertyName.ClipmapTarget, value);
}
public new long MeshLods
@ -327,10 +344,34 @@ public partial class Terrain3D : Node3D
set => Set(GDExtensionPropertyName.VertexSpacing, value);
}
public new Node3D ClipmapTarget
public new long TessellationLevel
{
get => Get(GDExtensionPropertyName.ClipmapTarget).As<Node3D>();
set => Set(GDExtensionPropertyName.ClipmapTarget, value);
get => Get(GDExtensionPropertyName.TessellationLevel).As<long>();
set => Set(GDExtensionPropertyName.TessellationLevel, value);
}
public new double DisplacementScale
{
get => Get(GDExtensionPropertyName.DisplacementScale).As<double>();
set => Set(GDExtensionPropertyName.DisplacementScale, value);
}
public new double DisplacementSharpness
{
get => Get(GDExtensionPropertyName.DisplacementSharpness).As<double>();
set => Set(GDExtensionPropertyName.DisplacementSharpness, value);
}
public new bool BufferShaderOverrideEnabled
{
get => Get(GDExtensionPropertyName.BufferShaderOverrideEnabled).As<bool>();
set => Set(GDExtensionPropertyName.BufferShaderOverrideEnabled, value);
}
public new Shader BufferShaderOverride
{
get => Get(GDExtensionPropertyName.BufferShaderOverride).As<Shader>();
set => Set(GDExtensionPropertyName.BufferShaderOverride, value);
}
public new long RenderLayers
@ -471,6 +512,18 @@ public partial class Terrain3D : Node3D
set => Set(GDExtensionPropertyName.ShowRoughmap, value);
}
public new bool ShowDisplacementBuffer
{
get => Get(GDExtensionPropertyName.ShowDisplacementBuffer).As<bool>();
set => Set(GDExtensionPropertyName.ShowDisplacementBuffer, value);
}
public new bool ShowTextureAlbedo
{
get => Get(GDExtensionPropertyName.ShowTextureAlbedo).As<bool>();
set => Set(GDExtensionPropertyName.ShowTextureAlbedo, value);
}
public new bool ShowTextureHeight
{
get => Get(GDExtensionPropertyName.ShowTextureHeight).As<bool>();
@ -489,6 +542,12 @@ public partial class Terrain3D : Node3D
set => Set(GDExtensionPropertyName.ShowTextureRough, value);
}
public new bool ShowTextureAo
{
get => Get(GDExtensionPropertyName.ShowTextureAo).As<bool>();
set => Set(GDExtensionPropertyName.ShowTextureAo, value);
}
public new static class GDExtensionMethodName
{
public new static readonly StringName SetEditor = "set_editor";

View File

@ -8,6 +8,7 @@ using Godot.Collections;
namespace TokisanGames;
[Tool]
public partial class Terrain3DAssets : Resource
{
@ -148,10 +149,12 @@ public partial class Terrain3DAssets : Resource
public new static readonly StringName GetTextureColors = "get_texture_colors";
public new static readonly StringName GetTextureNormalDepths = "get_texture_normal_depths";
public new static readonly StringName GetTextureAoStrengths = "get_texture_ao_strengths";
public new static readonly StringName GetTextureAoLightAffects = "get_texture_ao_light_affects";
public new static readonly StringName GetTextureRoughnessMods = "get_texture_roughness_mods";
public new static readonly StringName GetTextureUvScales = "get_texture_uv_scales";
public new static readonly StringName GetTextureVerticalProjections = "get_texture_vertical_projections";
public new static readonly StringName GetTextureDetiles = "get_texture_detiles";
public new static readonly StringName GetTextureDisplacements = "get_texture_displacements";
public new static readonly StringName ClearTextures = "clear_textures";
public new static readonly StringName UpdateTextureList = "update_texture_list";
public new static readonly StringName SetMeshAsset = "set_mesh_asset";
@ -186,6 +189,9 @@ public partial class Terrain3DAssets : Resource
public new float[] GetTextureAoStrengths() =>
Call(GDExtensionMethodName.GetTextureAoStrengths, []).As<float[]>();
public new float[] GetTextureAoLightAffects() =>
Call(GDExtensionMethodName.GetTextureAoLightAffects, []).As<float[]>();
public new float[] GetTextureRoughnessMods() =>
Call(GDExtensionMethodName.GetTextureRoughnessMods, []).As<float[]>();
@ -198,6 +204,9 @@ public partial class Terrain3DAssets : Resource
public new Vector2[] GetTextureDetiles() =>
Call(GDExtensionMethodName.GetTextureDetiles, []).As<Vector2[]>();
public new Vector2[] GetTextureDisplacements() =>
Call(GDExtensionMethodName.GetTextureDisplacements, []).As<Vector2[]>();
public new void ClearTextures(bool update = false) =>
Call(GDExtensionMethodName.ClearTextures, [update]);

View File

@ -8,6 +8,7 @@ using Godot.Collections;
namespace TokisanGames;
[Tool]
public partial class Terrain3DCollision : GodotObject
{

View File

@ -8,6 +8,7 @@ using Godot.Collections;
namespace TokisanGames;
[Tool]
public partial class Terrain3DData : GodotObject
{

View File

@ -8,6 +8,7 @@ using Godot.Collections;
namespace TokisanGames;
[Tool]
public partial class Terrain3DEditor : GodotObject
{

View File

@ -8,6 +8,7 @@ using Godot.Collections;
namespace TokisanGames;
[Tool]
public partial class Terrain3DInstancer : GodotObject
{

View File

@ -8,6 +8,7 @@ using Godot.Collections;
namespace TokisanGames;
[Tool]
public partial class Terrain3DMaterial : Resource
{
@ -87,6 +88,10 @@ public partial class Terrain3DMaterial : Resource
public new static readonly StringName ShowVertexGrid = "show_vertex_grid";
public new static readonly StringName ShowContours = "show_contours";
public new static readonly StringName ShowNavigation = "show_navigation";
public new static readonly StringName DisplacementScale = "displacement_scale";
public new static readonly StringName DisplacementSharpness = "displacement_sharpness";
public new static readonly StringName BufferShaderOverrideEnabled = "buffer_shader_override_enabled";
public new static readonly StringName BufferShaderOverride = "buffer_shader_override";
public new static readonly StringName ShowCheckered = "show_checkered";
public new static readonly StringName ShowGrey = "show_grey";
public new static readonly StringName ShowHeightmap = "show_heightmap";
@ -98,9 +103,12 @@ public partial class Terrain3DMaterial : Resource
public new static readonly StringName ShowControlScale = "show_control_scale";
public new static readonly StringName ShowColormap = "show_colormap";
public new static readonly StringName ShowRoughmap = "show_roughmap";
public new static readonly StringName ShowTextureAlbedo = "show_texture_albedo";
public new static readonly StringName ShowTextureHeight = "show_texture_height";
public new static readonly StringName ShowTextureNormal = "show_texture_normal";
public new static readonly StringName ShowTextureAo = "show_texture_ao";
public new static readonly StringName ShowTextureRough = "show_texture_rough";
public new static readonly StringName ShowDisplacementBuffer = "show_displacement_buffer";
}
public new Godot.Collections.Dictionary ShaderParameters
@ -175,6 +183,30 @@ public partial class Terrain3DMaterial : Resource
set => Set(GDExtensionPropertyName.ShowNavigation, value);
}
public new double DisplacementScale
{
get => Get(GDExtensionPropertyName.DisplacementScale).As<double>();
set => Set(GDExtensionPropertyName.DisplacementScale, value);
}
public new double DisplacementSharpness
{
get => Get(GDExtensionPropertyName.DisplacementSharpness).As<double>();
set => Set(GDExtensionPropertyName.DisplacementSharpness, value);
}
public new bool BufferShaderOverrideEnabled
{
get => Get(GDExtensionPropertyName.BufferShaderOverrideEnabled).As<bool>();
set => Set(GDExtensionPropertyName.BufferShaderOverrideEnabled, value);
}
public new Variant BufferShaderOverride
{
get => Get(GDExtensionPropertyName.BufferShaderOverride).As<Variant>();
set => Set(GDExtensionPropertyName.BufferShaderOverride, value);
}
public new bool ShowCheckered
{
get => Get(GDExtensionPropertyName.ShowCheckered).As<bool>();
@ -241,6 +273,12 @@ public partial class Terrain3DMaterial : Resource
set => Set(GDExtensionPropertyName.ShowRoughmap, value);
}
public new bool ShowTextureAlbedo
{
get => Get(GDExtensionPropertyName.ShowTextureAlbedo).As<bool>();
set => Set(GDExtensionPropertyName.ShowTextureAlbedo, value);
}
public new bool ShowTextureHeight
{
get => Get(GDExtensionPropertyName.ShowTextureHeight).As<bool>();
@ -253,24 +291,38 @@ public partial class Terrain3DMaterial : Resource
set => Set(GDExtensionPropertyName.ShowTextureNormal, value);
}
public new bool ShowTextureAo
{
get => Get(GDExtensionPropertyName.ShowTextureAo).As<bool>();
set => Set(GDExtensionPropertyName.ShowTextureAo, value);
}
public new bool ShowTextureRough
{
get => Get(GDExtensionPropertyName.ShowTextureRough).As<bool>();
set => Set(GDExtensionPropertyName.ShowTextureRough, value);
}
public new bool ShowDisplacementBuffer
{
get => Get(GDExtensionPropertyName.ShowDisplacementBuffer).As<bool>();
set => Set(GDExtensionPropertyName.ShowDisplacementBuffer, value);
}
public new static class GDExtensionMethodName
{
public new static readonly StringName Update = "update";
public new static readonly StringName GetMaterialRid = "get_material_rid";
public new static readonly StringName GetShaderRid = "get_shader_rid";
public new static readonly StringName GetBufferMaterialRid = "get_buffer_material_rid";
public new static readonly StringName GetBufferShaderRid = "get_buffer_shader_rid";
public new static readonly StringName SetShaderParam = "set_shader_param";
public new static readonly StringName GetShaderParam = "get_shader_param";
public new static readonly StringName Save = "save";
}
public new void Update() =>
Call(GDExtensionMethodName.Update, []);
public new void Update(bool full = false) =>
Call(GDExtensionMethodName.Update, [full]);
public new Rid GetMaterialRid() =>
Call(GDExtensionMethodName.GetMaterialRid, []).As<Rid>();
@ -278,6 +330,12 @@ public partial class Terrain3DMaterial : Resource
public new Rid GetShaderRid() =>
Call(GDExtensionMethodName.GetShaderRid, []).As<Rid>();
public new Rid GetBufferMaterialRid() =>
Call(GDExtensionMethodName.GetBufferMaterialRid, []).As<Rid>();
public new Rid GetBufferShaderRid() =>
Call(GDExtensionMethodName.GetBufferShaderRid, []).As<Rid>();
public new void SetShaderParam(StringName name, Variant value) =>
Call(GDExtensionMethodName.SetShaderParam, [name, value]);

View File

@ -8,6 +8,7 @@ using Godot.Collections;
namespace TokisanGames;
[Tool]
public partial class Terrain3DMeshAsset : Resource
{

View File

@ -8,6 +8,7 @@ using Godot.Collections;
namespace TokisanGames;
[Tool]
public partial class Terrain3DRegion : Resource
{
@ -158,6 +159,7 @@ public partial class Terrain3DRegion : Resource
public new static class GDExtensionMethodName
{
public new static readonly StringName Clear = "clear";
public new static readonly StringName SetMap = "set_map";
public new static readonly StringName GetMap = "get_map";
public new static readonly StringName SetMaps = "set_maps";
@ -175,6 +177,9 @@ public partial class Terrain3DRegion : Resource
public new static readonly StringName Dump = "dump";
}
public new void Clear() =>
Call(GDExtensionMethodName.Clear, []);
public new void SetMap(Terrain3DRegion.MapType mapType, Image map) =>
Call(GDExtensionMethodName.SetMap, [Variant.From(mapType), map]);

View File

@ -8,6 +8,7 @@ using Godot.Collections;
namespace TokisanGames;
[Tool]
public partial class Terrain3DTextureAsset : Resource
{
@ -148,7 +149,10 @@ public partial class Terrain3DTextureAsset : Resource
public new static readonly StringName NormalTexture = "normal_texture";
public new static readonly StringName NormalDepth = "normal_depth";
public new static readonly StringName AoStrength = "ao_strength";
public new static readonly StringName AoLightAffect = "ao_light_affect";
public new static readonly StringName Roughness = "roughness";
public new static readonly StringName DisplacementScale = "displacement_scale";
public new static readonly StringName DisplacementOffset = "displacement_offset";
public new static readonly StringName UvScale = "uv_scale";
public new static readonly StringName VerticalProjection = "vertical_projection";
public new static readonly StringName DetilingRotation = "detiling_rotation";
@ -197,12 +201,30 @@ public partial class Terrain3DTextureAsset : Resource
set => Set(GDExtensionPropertyName.AoStrength, value);
}
public new double AoLightAffect
{
get => Get(GDExtensionPropertyName.AoLightAffect).As<double>();
set => Set(GDExtensionPropertyName.AoLightAffect, value);
}
public new double Roughness
{
get => Get(GDExtensionPropertyName.Roughness).As<double>();
set => Set(GDExtensionPropertyName.Roughness, value);
}
public new double DisplacementScale
{
get => Get(GDExtensionPropertyName.DisplacementScale).As<double>();
set => Set(GDExtensionPropertyName.DisplacementScale, value);
}
public new double DisplacementOffset
{
get => Get(GDExtensionPropertyName.DisplacementOffset).As<double>();
set => Set(GDExtensionPropertyName.DisplacementOffset, value);
}
public new double UvScale
{
get => Get(GDExtensionPropertyName.UvScale).As<double>();

View File

@ -8,6 +8,7 @@ using Godot.Collections;
namespace TokisanGames;
[Tool]
public partial class Terrain3DUtil : GodotObject
{
@ -166,8 +167,8 @@ public partial class Terrain3DUtil : GodotObject
public new static Image LoadImage(string fileName, long cacheMode = 0, Vector2 r16HeightRange = default, Vector2I r16Size = default) =>
ClassDB.ClassCallStatic(NativeName, GDExtensionMethodName.LoadImage, [fileName, cacheMode, r16HeightRange, r16Size]).As<Image>();
public new static Image PackImage(Image srcRgb, Image srcA, bool invertGreen = false, bool invertAlpha = false, bool normalizeAlpha = false, long alphaChannel = 0) =>
ClassDB.ClassCallStatic(NativeName, GDExtensionMethodName.PackImage, [srcRgb, srcA, invertGreen, invertAlpha, normalizeAlpha, alphaChannel]).As<Image>();
public new static Image PackImage(Image srcRgb, Image srcA, Image srcAo, bool invertGreen = false, bool invertAlpha = false, bool normalizeAlpha = false, long alphaChannel = 0, long aoChannel = 0) =>
ClassDB.ClassCallStatic(NativeName, GDExtensionMethodName.PackImage, [srcRgb, srcA, srcAo, invertGreen, invertAlpha, normalizeAlpha, alphaChannel, aoChannel]).As<Image>();
public new static Image LuminanceToHeight(Image srcRgb) =>
ClassDB.ClassCallStatic(NativeName, GDExtensionMethodName.LuminanceToHeight, [srcRgb]).As<Image>();