diff options
| author | Daniel Weipert <git@mail.dweipert.de> | 2024-10-22 22:36:05 +0200 | 
|---|---|---|
| committer | Daniel Weipert <git@mail.dweipert.de> | 2024-10-22 22:36:05 +0200 | 
| commit | 257127aa7f0fbb66ddd2600dd3d6a6aca60e56b8 (patch) | |
| tree | 27f8d1916c0b0f06d806787d1a6226b2cd6bee71 | |
initial commit
| -rw-r--r-- | .gitattributes | 2 | ||||
| -rw-r--r-- | .gitignore | 3 | ||||
| -rw-r--r-- | Spritesheet.PNG~ | bin | 0 -> 6856 bytes | |||
| -rw-r--r-- | Spritesheet.png | bin | 0 -> 6658 bytes | |||
| -rw-r--r-- | Spritesheet.png.import | 34 | ||||
| -rw-r--r-- | Spritesheet_array.png | bin | 0 -> 6613 bytes | |||
| -rw-r--r-- | Spritesheet_array.png.import | 26 | ||||
| -rw-r--r-- | Spritesheet_array.png~ | bin | 0 -> 6708 bytes | |||
| -rw-r--r-- | camera.gd | 21 | ||||
| -rw-r--r-- | free-look-camera.gd | 122 | ||||
| -rw-r--r-- | icon.svg | 1 | ||||
| -rw-r--r-- | icon.svg.import | 37 | ||||
| -rw-r--r-- | main.gd | 225 | ||||
| -rw-r--r-- | main.tscn | 38 | ||||
| -rw-r--r-- | new_atlas_texture.tres | 6 | ||||
| -rw-r--r-- | new_shader.gdshader | 20 | ||||
| -rw-r--r-- | new_shader_material.tres | 9 | ||||
| -rw-r--r-- | project.godot | 38 | 
18 files changed, 582 insertions, 0 deletions
| diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..8ad74f7 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Normalize EOL for all files that Git considers text files. +* text=auto eol=lf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0af181c --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +# Godot 4+ specific ignores +.godot/ +/android/ diff --git a/Spritesheet.PNG~ b/Spritesheet.PNG~Binary files differ new file mode 100644 index 0000000..cd09561 --- /dev/null +++ b/Spritesheet.PNG~ diff --git a/Spritesheet.png b/Spritesheet.pngBinary files differ new file mode 100644 index 0000000..4310748 --- /dev/null +++ b/Spritesheet.png diff --git a/Spritesheet.png.import b/Spritesheet.png.import new file mode 100644 index 0000000..40cfa24 --- /dev/null +++ b/Spritesheet.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://ld8e4g6oef3x" +path="res://.godot/imported/Spritesheet.png-a2c2115bda14ee20f2c9865f0f7efe52.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Spritesheet.png" +dest_files=["res://.godot/imported/Spritesheet.png-a2c2115bda14ee20f2c9865f0f7efe52.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=true +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/Spritesheet_array.png b/Spritesheet_array.pngBinary files differ new file mode 100644 index 0000000..25a41fb --- /dev/null +++ b/Spritesheet_array.png diff --git a/Spritesheet_array.png.import b/Spritesheet_array.png.import new file mode 100644 index 0000000..e57e820 --- /dev/null +++ b/Spritesheet_array.png.import @@ -0,0 +1,26 @@ +[remap] + +importer="2d_array_texture" +type="CompressedTexture2DArray" +uid="uid://demlxku183noo" +path="res://.godot/imported/Spritesheet_array.png-b464987ec03e046de8f8f5a4dfa8844e.ctexarray" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Spritesheet_array.png" +dest_files=["res://.godot/imported/Spritesheet_array.png-b464987ec03e046de8f8f5a4dfa8844e.ctexarray"] + +[params] + +compress/mode=3 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/channel_pack=0 +mipmaps/generate=true +mipmaps/limit=-1 +slices/horizontal=6 +slices/vertical=3 diff --git a/Spritesheet_array.png~ b/Spritesheet_array.png~Binary files differ new file mode 100644 index 0000000..984cb86 --- /dev/null +++ b/Spritesheet_array.png~ diff --git a/camera.gd b/camera.gd new file mode 100644 index 0000000..4a14865 --- /dev/null +++ b/camera.gd @@ -0,0 +1,21 @@ +class_name FreeCamera +extends Camera3D + + +# Called when the node enters the scene tree for the first time. +func _ready() -> void: +	pass # Replace with function body. + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta: float) -> void: +	if Input.is_action_pressed("camera_move"): +		if Input.is_key_pressed(KEY_SHIFT): +			rotate_y(delta) +		else: +			rotate_y(-delta) +	 +	if Input.is_action_just_released("camera_zoom_out"): +		global_position -= project_ray_normal(get_viewport().get_mouse_position()) +	elif Input.is_action_just_released("camera_zoom_in"): +		global_position += project_ray_normal(get_viewport().get_mouse_position()) diff --git a/free-look-camera.gd b/free-look-camera.gd new file mode 100644 index 0000000..e35485f --- /dev/null +++ b/free-look-camera.gd @@ -0,0 +1,122 @@ +class_name FreeLookCamera +extends Camera3D + +# Modifier keys' speed multiplier +const SHIFT_MULTIPLIER = 2.5 +const ALT_MULTIPLIER = 1.0 / SHIFT_MULTIPLIER + + +@export_range(0.0, 1.0) var sensitivity: float = 0.25 + +# Mouse state +var _mouse_position = Vector2(0.0, 0.0) +var _total_pitch = 0.0 + +# Movement state +var _direction = Vector3(0.0, 0.0, 0.0) +var _velocity = Vector3(0.0, 0.0, 0.0) +var _acceleration = 30 +var _deceleration = -10 +var _vel_multiplier = 4 + +# Keyboard state +var _w = false +var _s = false +var _a = false +var _d = false +var _q = false +var _e = false +var _shift = false +var _alt = false + +func _input(event): +	# Receives mouse motion +	if event is InputEventMouseMotion: +		_mouse_position = event.relative +	 +	# Receives mouse button input +	if event is InputEventMouseButton: +		match event.button_index: +			MOUSE_BUTTON_RIGHT: # Only allows rotation if right click down +				Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED if event.pressed else Input.MOUSE_MODE_VISIBLE) +			MOUSE_BUTTON_WHEEL_UP: # Increases max velocity +				_vel_multiplier = clamp(_vel_multiplier * 1.1, 0.2, 20) +			MOUSE_BUTTON_WHEEL_DOWN: # Decereases max velocity +				_vel_multiplier = clamp(_vel_multiplier / 1.1, 0.2, 20) + +	# Receives key input +	if event is InputEventKey: +		match event.keycode: +			KEY_W: +				_w = event.pressed +			KEY_S: +				_s = event.pressed +			KEY_A: +				_a = event.pressed +			KEY_D: +				_d = event.pressed +			KEY_Q: +				_q = event.pressed +			KEY_E: +				_e = event.pressed +			KEY_CTRL: +				_shift = event.pressed +			KEY_ALT: +				_alt = event.pressed + +# Updates mouselook and movement every frame +func _process(delta): +	_update_mouselook() +	_update_movement(delta) + +# Updates camera movement +func _update_movement(delta): +	# Computes desired direction from key states +	_direction = Vector3( +		(_d as float) - (_a as float),  +		(_e as float) - (_q as float), +		(_s as float) - (_w as float) +	) +	 +	if Input.is_key_pressed(KEY_SPACE): +		_direction.y += 1.0 +	elif Input.is_key_pressed(KEY_SHIFT): +		_direction.y -= 1.0 +	 +	# Computes the change in velocity due to desired direction and "drag" +	# The "drag" is a constant acceleration on the camera to bring it's velocity to 0 +	var offset = _direction.normalized() * _acceleration * _vel_multiplier * delta \ +		+ _velocity.normalized() * _deceleration * _vel_multiplier * delta +	 +	# Compute modifiers' speed multiplier +	var speed_multi = 10 +	if _shift: speed_multi *= SHIFT_MULTIPLIER +	if _alt: speed_multi *= ALT_MULTIPLIER +	 +	# Checks if we should bother translating the camera +	if _direction == Vector3.ZERO and offset.length_squared() > _velocity.length_squared(): +		# Sets the velocity to 0 to prevent jittering due to imperfect deceleration +		_velocity = Vector3.ZERO +	else: +		# Clamps speed to stay within maximum value (_vel_multiplier) +		_velocity.x = clamp(_velocity.x + offset.x, -_vel_multiplier, _vel_multiplier) +		_velocity.y = clamp(_velocity.y + offset.y, -_vel_multiplier, _vel_multiplier) +		_velocity.z = clamp(_velocity.z + offset.z, -_vel_multiplier, _vel_multiplier) +	 +		translate(_velocity * delta * speed_multi) + +# Updates mouse look  +func _update_mouselook(): +	# Only rotates mouse if the mouse is captured +	if Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED: +		_mouse_position *= sensitivity +		var yaw = _mouse_position.x +		var pitch = _mouse_position.y +		_mouse_position = Vector2(0, 0) +		 +		# Prevents looking up/down too far +		pitch = clamp(pitch, -90 - _total_pitch, 90 - _total_pitch) +		_total_pitch += pitch +	 +		rotate_y(deg_to_rad(-yaw)) +		rotate_object_local(Vector3(1,0,0), deg_to_rad(-pitch)) diff --git a/icon.svg b/icon.svg new file mode 100644 index 0000000..9d8b7fa --- /dev/null +++ b/icon.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128"><rect width="124" height="124" x="2" y="2" fill="#363d52" stroke="#212532" stroke-width="4" rx="14"/><g fill="#fff" transform="translate(12.322 12.322)scale(.101)"><path d="M105 673v33q407 354 814 0v-33z"/><path fill="#478cbf" d="m105 673 152 14q12 1 15 14l4 67 132 10 8-61q2-11 15-15h162q13 4 15 15l8 61 132-10 4-67q3-13 15-14l152-14V427q30-39 56-81-35-59-83-108-43 20-82 47-40-37-88-64 7-51 8-102-59-28-123-42-26 43-46 89-49-7-98 0-20-46-46-89-64 14-123 42 1 51 8 102-48 27-88 64-39-27-82-47-48 49-83 108 26 42 56 81zm0 33v39c0 276 813 276 814 0v-39l-134 12-5 69q-2 10-14 13l-162 11q-12 0-16-11l-10-65H446l-10 65q-4 11-16 11l-162-11q-12-3-14-13l-5-69z"/><path d="M483 600c0 34 58 34 58 0v-86c0-34-58-34-58 0z"/><circle cx="725" cy="526" r="90"/><circle cx="299" cy="526" r="90"/></g><g fill="#414042" transform="translate(12.322 12.322)scale(.101)"><circle cx="307" cy="532" r="60"/><circle cx="717" cy="532" r="60"/></g></svg>
\ No newline at end of file diff --git a/icon.svg.import b/icon.svg.import new file mode 100644 index 0000000..2e7d965 --- /dev/null +++ b/icon.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dv842eajslxyw" +path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://icon.svg" +dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 +svg/scale=1.0 +editor/scale_with_editor_scale=false +editor/convert_colors_with_editor_theme=false @@ -0,0 +1,225 @@ +extends Node3D + + +var chunk_size := Vector3(16, 16, 16) + +@onready var noise := FastNoiseLite.new() + +var face_corners = [ +	Vector2(0, 0), Vector2(1, 0), +	Vector2(0, 1), Vector2(1, 1), +] + +enum BlockFace { +	FRONT, +	BACK, +	LEFT, +	RIGHT, +	TOP, +	BOTTOM, +} +var block_faces = [ +	[ # FRONT +		[Vector3(-1.0, 1.0, 1.0), Vector3(1.0, -1.0, 1.0), Vector3(-1.0, -1.0, 1.0)], +		[Vector3(-1.0, 1.0, 1.0), Vector3(1.0, 1.0, 1.0), Vector3(1.0, -1.0, 1.0)], +	], +	[ # BACK +		[Vector3(1.0, 1.0, -1.0), Vector3(-1.0, -1.0, -1.0), Vector3(1.0, -1.0, -1.0)], +		[Vector3(1.0, 1.0, -1.0), Vector3(-1.0, 1.0, -1.0), Vector3(-1.0, -1.0, -1.0)], +	], +	[ # LEFT +		[Vector3(-1.0, 1.0, -1.0), Vector3(-1.0, -1.0, 1.0), Vector3(-1.0, -1.0, -1.0)], +		[Vector3(-1.0, 1.0, -1.0), Vector3(-1.0, 1.0, 1.0), Vector3(-1.0, -1.0, 1.0)], +	], +	[ # RIGHT +		[Vector3(1.0, 1.0, 1.0), Vector3(1.0, -1.0, -1.0), Vector3(1.0, -1.0, 1.0)], +		[Vector3(1.0, 1.0, 1.0), Vector3(1.0, 1.0, -1.0), Vector3(1.0, -1.0, -1.0)], +	], +	[ # TOP +		[Vector3(-1.0, 1.0, -1.0), Vector3(1.0, 1.0, 1.0), Vector3(-1.0, 1.0, 1.0)], +		[Vector3(-1.0, 1.0, -1.0), Vector3(1.0, 1.0, -1.0), Vector3(1.0, 1.0, 1.0)], +	], +	[ # BOTTOM +		[Vector3(-1.0, -1.0, 1.0), Vector3(1.0, -1.0, -1.0), Vector3(-1.0, -1.0, -1.0)], +		[Vector3(-1.0, -1.0, 1.0), Vector3(1.0, -1.0, 1.0), Vector3(1.0, -1.0, -1.0)], +	], +] + +enum BlockType { +	GRASS, +} +var block_types = { +	BlockType.GRASS: { +		"uvs": [ +			[ # FRONT +				[Vector2(0.0, 0.0), Vector2(1.0, 1.0), Vector2(0.0, 1.0)], +				[Vector2(0.0, 0.0), Vector2(1.0, 0.0), Vector2(1.0, 1.0)], +			], +			[ # BACK +				[Vector2(0.0, 0.0), Vector2(1.0, 1.0), Vector2(0.0, 1.0)], +				[Vector2(0.0, 0.0), Vector2(1.0, 0.0), Vector2(1.0, 1.0)], +			], +			[ # LEFT +				[Vector2(0.0, 0.0), Vector2(1.0, 1.0), Vector2(0.0, 1.0)], +				[Vector2(0.0, 0.0), Vector2(1.0, 0.0), Vector2(1.0, 1.0)], +			], +			[ # RIGHT +				[Vector2(0.0, 0.0), Vector2(1.0, 1.0), Vector2(0.0, 1.0)], +				[Vector2(0.0, 0.0), Vector2(1.0, 0.0), Vector2(1.0, 1.0)], +			], +			[ # TOP +				[Vector2(0.0, 1.0), Vector2(1.0, 2.0), Vector2(0.0, 2.0)], +				[Vector2(0.0, 1.0), Vector2(1.0, 1.0), Vector2(1.0, 2.0)], +			], +			[ # BOTTOM +				[Vector2(1.0, 0.0), Vector2(2.0, 1.0), Vector2(1.0, 1.0)], +				[Vector2(1.0, 0.0), Vector2(2.0, 0.0), Vector2(2.0, 1.0)], +			], +		], +	}, +} + + +func _ready() -> void: +	brrr() + + +class OtherThread extends Thread: +	func _exit_tree(): +		wait_to_finish() + + +func brrr(): +	noise.seed = randi() +	 +	var thread = OtherThread.new() +	var rrrb = func(): +		for row in range(0, 2): +			for column in range(0, 2): +				for depth in range(0, 2): +					generate_chunk(row, column, depth) +	 +	thread.start(rrrb) +	#thread.wait_to_finish() + + +func generate_chunk(row, column, depth): +	#var material := StandardMaterial3D.new() +	#material.albedo_texture = preload("res://new_atlas_texture.tres") +	#material.vertex_color_use_as_albedo = true +	var material := preload("res://new_shader_material.tres") +	var st = SurfaceTool.new() +	st.begin(Mesh.PRIMITIVE_TRIANGLES) +	st.set_material(material) +	 +	var blocks = [] +	 +	for x in chunk_size.x: +		#blocks[x] = [] +		blocks.append([]) +		for y in chunk_size.y: +			#blocks[x][y] = [] +			blocks[x].append([]) +			for z in chunk_size.z: +				var block_position = Vector3( +					row*chunk_size.x + x, +					depth*chunk_size.y + y, +					column*chunk_size.z + z +					#x, +					#y, +					#z +				) * 2 +				var value = noise.get_noise_3d(block_position.x, block_position.y, block_position.z) +				 +				#blocks[x][y][z] = block_position +				blocks[x][y].append({ +					"position": block_position, +					"set": abs(value) > 0.2, +				}) +							 +	for x in blocks.size(): +		for y in blocks[x].size(): +			for z in blocks[x][y].size(): +				var block = blocks[x][y][z] +				var block_position = block.position +				 +				if block.set: +					var rng = RandomNumberGenerator.new() +					rng.seed = randi() +					st.set_color(Color(rng.randf(), rng.randf(), rng.randf())) +					 +					st.set_uv(Vector2(0, 0)) +					 +					if (blocks[x][y].size() > z+1 and not blocks[x][y][z + 1].set) or blocks[x][y].size() == z+1: +						add_face(st, BlockFace.FRONT, block_position) +					 +					if (blocks.size() > x+1 and not blocks[x + 1][y][z].set) or blocks.size() == x+1: +						add_face(st, BlockFace.RIGHT, block_position) +					 +					if blocks[x][y].size() > z-1 and (not blocks[x][y][z - 1].set or z == 0): +						add_face(st, BlockFace.BACK, block_position) +					 +					if blocks.size() > x-1 and (not blocks[x - 1][y][z].set or x == 0): +						add_face(st, BlockFace.LEFT, block_position) +					 +					if (blocks[x].size() > y+1 and not blocks[x][y + 1][z].set) or blocks[x].size() == y+1: +						add_face(st, BlockFace.TOP, block_position) +					 +					if blocks[x].size() > y-1 and (not blocks[x][y - 1][z].set or y == 0): +						add_face(st, BlockFace.BOTTOM, block_position) +	 +	 +	#st.generate_normals() +	var mesh = MeshInstance3D.new() +	mesh.mesh = st.commit() +	#mesh.create_trimesh_collision() +	add_child.call_deferred(mesh) + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(_delta: float) -> void: +	pass + + +func add_face(surface_tool: SurfaceTool, face: BlockFace, block_position: Vector3): +	var uv2 = [] +	uv2.resize(3) +	var normals = [] +	normals.resize(3) +	if face == BlockFace.FRONT: +		uv2.fill(Vector2(0, 0)) +		normals.fill(Vector3(0, 0, 1)) +	elif face == BlockFace.BACK: +		uv2.fill(Vector2(0, 0)) +		normals.fill(Vector3(0, 0, -1)) +	elif face == BlockFace.LEFT: +		uv2.fill(Vector2(0, 0)) +		normals.fill(Vector3(-1, 0, 0)) +	elif face == BlockFace.RIGHT: +		uv2.fill(Vector2(0, 0)) +		normals.fill(Vector3(1, 0, 0)) +	elif face == BlockFace.TOP: +		uv2.fill(Vector2(6, 0)) +		normals.fill(Vector3(0, 1, 0)) +	elif face == BlockFace.BOTTOM: +		uv2.fill(Vector2(1, 0)) +		normals.fill(Vector3(0, -1, 0)) +	 +	for idx in block_faces[face].size(): +		var triangle = block_faces[face][idx] +		var triangle_positions = triangle.map(func(item): +			return item + block_position +		) +		 +		var uvs = block_types[BlockType.GRASS].uvs[face][idx].map(func(item): +			return item +			#return Vector2(item.x / 6.0, item.y / 3.0) +		) +		 +		surface_tool.add_triangle_fan( +			PackedVector3Array(triangle_positions), +			PackedVector2Array(uvs), +			PackedColorArray(), +			PackedVector2Array(uv2), +			PackedVector3Array(normals) +		) diff --git a/main.tscn b/main.tscn new file mode 100644 index 0000000..c7ff15b --- /dev/null +++ b/main.tscn @@ -0,0 +1,38 @@ +[gd_scene load_steps=7 format=3 uid="uid://b7k6l3bm1f0db"] + +[ext_resource type="Script" path="res://main.gd" id="1_g4bmv"] +[ext_resource type="Script" path="res://free-look-camera.gd" id="2_rja7k"] + +[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_vv2it"] +sky_horizon_color = Color(0.64625, 0.65575, 0.67075, 1) +ground_horizon_color = Color(0.64625, 0.65575, 0.67075, 1) + +[sub_resource type="Sky" id="Sky_fy05j"] +sky_material = SubResource("ProceduralSkyMaterial_vv2it") + +[sub_resource type="Environment" id="Environment_ldfjq"] +background_mode = 2 +sky = SubResource("Sky_fy05j") +tonemap_mode = 2 +glow_enabled = true + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_2vt34"] + +[node name="Main" type="Node3D"] +script = ExtResource("1_g4bmv") + +[node name="WorldEnvironment" type="WorldEnvironment" parent="."] +environment = SubResource("Environment_ldfjq") + +[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."] +transform = Transform3D(-0.787627, -0.259754, -0.558724, -0.288733, -0.645471, 0.707107, -0.544314, 0.718258, 0.433391, 0, 41, 0) +light_energy = 0.5 +shadow_enabled = true +directional_shadow_max_distance = 400.0 + +[node name="Camera3D" type="Camera3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 0.767031, 0.64161, 0, -0.64161, 0.767031, 0.387164, 18.7811, 29.7854) +script = ExtResource("2_rja7k") + +[node name="MeshInstance3D" type="MeshInstance3D" parent="."] +material_override = SubResource("StandardMaterial3D_2vt34") diff --git a/new_atlas_texture.tres b/new_atlas_texture.tres new file mode 100644 index 0000000..2f69038 --- /dev/null +++ b/new_atlas_texture.tres @@ -0,0 +1,6 @@ +[gd_resource type="AtlasTexture" load_steps=2 format=3 uid="uid://dhbmbeeja3pa2"] + +[ext_resource type="Texture2D" uid="uid://ld8e4g6oef3x" path="res://Spritesheet.png" id="1_s234r"] + +[resource] +atlas = ExtResource("1_s234r") diff --git a/new_shader.gdshader b/new_shader.gdshader new file mode 100644 index 0000000..32b1f7c --- /dev/null +++ b/new_shader.gdshader @@ -0,0 +1,20 @@ +shader_type spatial; + +uniform sampler2DArray textures : filter_nearest, source_color; + +void vertex() { +	// Called for every vertex the material is visible on. +	//vec4 element = texture(textures, vec3(UV, UV2.x)); +	//COLOR = element.rgba; +} + +void fragment() { +	// Called for every pixel the material is visible on. +	vec4 element = texture(textures, vec3(UV, UV2.x)); +	ALBEDO = element.rgb; +} + +//void light() { +	// Called for every pixel for every light affecting the material. +	// Uncomment to replace the default light processing function with this one. +//} diff --git a/new_shader_material.tres b/new_shader_material.tres new file mode 100644 index 0000000..544517f --- /dev/null +++ b/new_shader_material.tres @@ -0,0 +1,9 @@ +[gd_resource type="ShaderMaterial" load_steps=3 format=3 uid="uid://13gixtegdfat"] + +[ext_resource type="Shader" path="res://new_shader.gdshader" id="1_ux1ye"] +[ext_resource type="CompressedTexture2DArray" uid="uid://demlxku183noo" path="res://Spritesheet_array.png" id="2_delqc"] + +[resource] +render_priority = 0 +shader = ExtResource("1_ux1ye") +shader_parameter/textures = ExtResource("2_delqc") diff --git a/project.godot b/project.godot new file mode 100644 index 0000000..1d2e0cb --- /dev/null +++ b/project.godot @@ -0,0 +1,38 @@ +; Engine configuration file. +; It's best edited using the editor UI and not directly, +; since the parameters that go here are not all obvious. +; +; Format: +;   [section] ; section goes between [] +;   param=value ; assign values to parameters + +config_version=5 + +[application] + +config/name="Minecraft" +run/main_scene="res://main.tscn" +config/features=PackedStringArray("4.3", "GL Compatibility") +config/icon="res://icon.svg" + +[input] + +camera_move={ +"deadzone": 0.5, +"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":4,"position":Vector2(266, 19),"global_position":Vector2(275, 65),"factor":1.0,"button_index":3,"canceled":false,"pressed":true,"double_click":false,"script":null) +] +} +camera_zoom_out={ +"deadzone": 0.5, +"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":16,"position":Vector2(365, 16),"global_position":Vector2(374, 62),"factor":0.6,"button_index":5,"canceled":false,"pressed":true,"double_click":false,"script":null) +] +} +camera_zoom_in={ +"deadzone": 0.5, +"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":8,"position":Vector2(147, 18),"global_position":Vector2(156, 64),"factor":0.533333,"button_index":4,"canceled":false,"pressed":true,"double_click":false,"script":null) +] +} + +[rendering] + +textures/default_filters/use_nearest_mipmap_filter=true | 
