Editor Terrain Size Options #1

Merged
kayomn merged 12 commits from editor-terrain-size-options into main 2023-01-12 02:36:57 +01:00
2 changed files with 7 additions and 5 deletions
Showing only changes of commit a20c7ff70d - Show all commits

BIN
editor.scn (Stored with Git LFS)

Binary file not shown.

View File

@ -1,6 +1,8 @@
@tool @tool
class_name TerrainInstance3D extends GeometryInstance3D class_name TerrainInstance3D extends GeometryInstance3D
const _DETAIL := 2
var _mesh := PlaneMesh.new() var _mesh := PlaneMesh.new()
var _material := ShaderMaterial.new() var _material := ShaderMaterial.new()
@ -22,14 +24,14 @@ var size: Vector2i = Vector2i.ZERO:
RenderingServer.instance_set_base(self.get_instance(), RID()) RenderingServer.instance_set_base(self.get_instance(), RID())
else: else:
self._mesh.subdivide_width = width self._mesh.subdivide_width = width * _DETAIL
self._mesh.subdivide_depth = height self._mesh.subdivide_depth = height * _DETAIL
self._mesh.size = value self._mesh.size = value
self._material.set_shader_parameter("SIZE", Vector2(value)) self._material.set_shader_parameter("SIZE", Vector2(value))
RenderingServer.instance_set_base(self.get_instance(), self._mesh) RenderingServer.instance_set_base(self.get_instance(), self._mesh)
size = Vector2i(width, height) size = value
## ##
## ##