Hide WorldChunk Texture overlays by default.

WorldChunkRefactoring
Martin Felis 2023-10-27 22:56:49 +02:00
parent d70d9cd682
commit c808739b78
2 changed files with 23 additions and 2 deletions

View File

@ -19,10 +19,25 @@ public class WorldChunk : Spatial
[Export] public Texture NavigationMap;
[Export] public Texture HeightMap;
[Export] public int Size = 32;
[Export] public Vector2 ChunkAddress;
// [Export] public Vector2 Size = new Vector2(1, 1);
[Export]
public bool ShowTextureOverlay
{
get
{
return _showTextureOverlay;
}
set
{
if (PlaneRectMesh != null)
{
PlaneRectMesh.Visible = value;
}
}
}
// signals
// delegate void OnCoordClicked(Vector2 world_pos);
@ -34,6 +49,7 @@ public class WorldChunk : Spatial
private TextureRect _heightmapRect;
private SpatialMaterial _rectMaterial = new SpatialMaterial();
private bool _showTextureOverlay = false;
public WorldChunk()
{
@ -78,6 +94,10 @@ public class WorldChunk : Spatial
{
PlaneRectMesh = (MeshInstance)FindNode("PlaneRectMesh");
Debug.Assert(PlaneRectMesh != null);
if (PlaneRectMesh.Visible)
{
_showTextureOverlay = true;
}
Transform planeRectTransform = Transform.Identity;
planeRectTransform =

View File

@ -32,6 +32,7 @@ script = ExtResource( 1 )
[node name="PlaneRectMesh" type="MeshInstance" parent="."]
transform = Transform( 2, 0, 0, 0, 0.125, 0, 0, 0, 2, 0, -0.1, 0 )
visible = false
mesh = SubResource( 27 )
material/0 = SubResource( 28 )