Reduced glitch textures when pressing generate button.
Still some glitches remain when changing the resolution, though.WorldChunkRefactoring
parent
f21db2ac4f
commit
b672d4556a
|
@ -202,7 +202,7 @@ public class Game : Spatial
|
||||||
|
|
||||||
Transform cameraTransform = _camera.Transform;
|
Transform cameraTransform = _camera.Transform;
|
||||||
cameraTransform.origin = _player.GlobalTranslation + _cameraOffset;
|
cameraTransform.origin = _player.GlobalTranslation + _cameraOffset;
|
||||||
// _camera.Transform = cameraTransform;
|
_camera.Transform = cameraTransform;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0096302, 0, 0 )
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
|
|
||||||
[node name="Mesh" type="MeshInstance" parent="."]
|
[node name="Mesh" type="MeshInstance" parent="."]
|
||||||
transform = Transform( -4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 0, -5, 0 )
|
transform = Transform( -4.24e-08, 0, 0.97, 0, 1, 0, -0.97, 0, -4.24e-08, 0, -5, 0 )
|
||||||
mesh = SubResource( 6 )
|
mesh = SubResource( 6 )
|
||||||
material/0 = ExtResource( 2 )
|
material/0 = ExtResource( 2 )
|
||||||
|
|
||||||
|
|
|
@ -159,6 +159,7 @@ public class TileWorld : Spatial
|
||||||
private void OnHeightMapChanged()
|
private void OnHeightMapChanged()
|
||||||
{
|
{
|
||||||
_currentGenerationState = GenerationState.Heightmap;
|
_currentGenerationState = GenerationState.Heightmap;
|
||||||
|
_heightmapOffscreenViewport.RenderTargetUpdateMode = Viewport.UpdateMode.Once;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnMapGenerationComplete()
|
private void OnMapGenerationComplete()
|
||||||
|
@ -232,6 +233,7 @@ public class TileWorld : Spatial
|
||||||
imageTexture.CreateFromImage(Heightmap);
|
imageTexture.CreateFromImage(Heightmap);
|
||||||
imageTexture.Flags = 0;
|
imageTexture.Flags = 0;
|
||||||
_worldOffscreenTextureRect.Texture = imageTexture;
|
_worldOffscreenTextureRect.Texture = imageTexture;
|
||||||
|
_worldOffscreenViewport.RenderTargetUpdateMode = Viewport.UpdateMode.Once;
|
||||||
}
|
}
|
||||||
else if (_currentGenerationState == GenerationState.Color)
|
else if (_currentGenerationState == GenerationState.Color)
|
||||||
{
|
{
|
||||||
|
@ -317,7 +319,7 @@ public class TileWorld : Spatial
|
||||||
|
|
||||||
// TODO: coordinates do not match for bigger maps
|
// TODO: coordinates do not match for bigger maps
|
||||||
return new Vector3(
|
return new Vector3(
|
||||||
tileCenter.x - Size * 0.75f * 0.5f,
|
tileCenter.x - Mathf.Round(Size * 0.75f * 0.5f),
|
||||||
GetHeightAtOffset(offsetCoord),
|
GetHeightAtOffset(offsetCoord),
|
||||||
tileCenter.y + (Mathf.Sqrt(3) / 2) * Size * 0.5f);
|
tileCenter.y + (Mathf.Sqrt(3) / 2) * Size * 0.5f);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ hdr = false
|
||||||
disable_3d = true
|
disable_3d = true
|
||||||
usage = 0
|
usage = 0
|
||||||
render_target_v_flip = true
|
render_target_v_flip = true
|
||||||
render_target_update_mode = 3
|
render_target_update_mode = 1
|
||||||
|
|
||||||
[node name="TextureRect" type="TextureRect" parent="WorldOffscreenViewport"]
|
[node name="TextureRect" type="TextureRect" parent="WorldOffscreenViewport"]
|
||||||
material = ExtResource( 3 )
|
material = ExtResource( 3 )
|
||||||
|
@ -41,7 +41,7 @@ hdr = false
|
||||||
disable_3d = true
|
disable_3d = true
|
||||||
usage = 0
|
usage = 0
|
||||||
render_target_v_flip = true
|
render_target_v_flip = true
|
||||||
render_target_update_mode = 3
|
render_target_update_mode = 1
|
||||||
|
|
||||||
[node name="TextureRect" type="TextureRect" parent="HeightmapOffscreenViewport"]
|
[node name="TextureRect" type="TextureRect" parent="HeightmapOffscreenViewport"]
|
||||||
material = ExtResource( 4 )
|
material = ExtResource( 4 )
|
||||||
|
|
Loading…
Reference in New Issue