-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Connor greene
committed
Sep 22, 2021
1 parent
950c22c
commit 9b448f6
Showing
30 changed files
with
191 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"configurations": [ | ||
|
||
{ | ||
"type": "godot", | ||
"request": "launch", | ||
"project": "", | ||
"port": 6007, | ||
"address": "127.0.0.1", | ||
"launch_game_instance": true, | ||
"launch_scene": false | ||
} | ||
] | ||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
extends ColorRect | ||
|
||
|
||
func _ready(): | ||
self.get_viewport().connect("change_filter_size",self,"size_changed") | ||
pass # Replace with function body. | ||
|
||
func _process(delta): | ||
|
||
if(self.get_parent().get_parent().is_in_water()): | ||
self.set_size(self.get_viewport().size) | ||
self.material.set_shader_param ( "use_shader", true ) | ||
else: | ||
self.material.set_shader_param ( "use_shader", false ) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
[remap] | ||
|
||
importer="texture" | ||
type="StreamTexture" | ||
path="res://.import/vignette.png-d139b46f79c1712950634ae6916e799a.stex" | ||
metadata={ | ||
"vram_texture": false | ||
} | ||
|
||
[deps] | ||
|
||
source_file="res://Resources/vignette.png" | ||
dest_files=[ "res://.import/vignette.png-d139b46f79c1712950634ae6916e799a.stex" ] | ||
|
||
[params] | ||
|
||
compress/mode=0 | ||
compress/lossy_quality=0.7 | ||
compress/hdr_mode=0 | ||
compress/bptc_ldr=0 | ||
compress/normal_map=2 | ||
flags/repeat=0 | ||
flags/filter=true | ||
flags/mipmaps=false | ||
flags/anisotropic=false | ||
flags/srgb=2 | ||
process/fix_alpha_border=true | ||
process/premult_alpha=false | ||
process/HDR_as_SRGB=false | ||
process/invert_color=false | ||
stream=false | ||
size_limit=0 | ||
detect_3d=false | ||
svg/scale=1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
using Godot; | ||
using System; | ||
|
||
public class IslandTerrainCreator : Spatial | ||
{ | ||
const int SIZE = 320; | ||
|
||
public override void _Ready() | ||
{ | ||
generate_island(); | ||
} | ||
|
||
public void generate_island(){ | ||
GD.Print("Starting Making Island"); | ||
GD.Randomize(); | ||
|
||
//Setup Tools needed | ||
SurfaceTool surface_tool = new SurfaceTool(); | ||
MeshDataTool mesh_data_tool = new MeshDataTool(); | ||
OpenSimplexNoise noise = new OpenSimplexNoise(); | ||
//Setup Plane Mesh | ||
PlaneMesh plane_mesh = new PlaneMesh(); | ||
plane_mesh.Size = new Vector2(SIZE,SIZE); | ||
plane_mesh.SubdivideDepth = SIZE / 2; | ||
plane_mesh.SubdivideWidth = SIZE / 2; | ||
//Setup Noise | ||
Random rng = new Random(); | ||
noise.Seed = rng.Next(0,2147483640); | ||
noise.Octaves = 5; | ||
noise.Period = 120; | ||
//TODO find out what this code does again | ||
surface_tool.CreateFrom(plane_mesh,0); | ||
ArrayMesh array_mesh = surface_tool.Commit(); | ||
mesh_data_tool.CreateFromSurface(array_mesh,0); | ||
|
||
//Do some CRAZY math to make the hilly terrain a island | ||
Vector2 radius = (new Vector2(1.0f - SIZE - 1,1.0f - SIZE - 1)) / 2; | ||
float ratio = (SIZE-1 / SIZE-1); | ||
|
||
//Make Terrain | ||
for(int i = 0;i <= mesh_data_tool.GetVertexCount() - 1; i++){ | ||
Vector3 vertux = mesh_data_tool.GetVertex(i); | ||
float value = noise.GetNoise3d(vertux.x,vertux.y,vertux.z); | ||
|
||
float dist = new Vector2(0,0).DistanceTo(new Vector2(vertux.x, vertux.z)); | ||
float ofs = dist / radius.y; | ||
|
||
value += ofs; | ||
|
||
vertux.y = (value * 50); | ||
|
||
vertux.y -= 23; | ||
|
||
|
||
|
||
mesh_data_tool.SetVertex(i,vertux); | ||
|
||
} | ||
|
||
for(int s = 0; s <= array_mesh.GetSurfaceCount();s++){ | ||
array_mesh.SurfaceRemove(s); | ||
} | ||
mesh_data_tool.CommitToSurface(array_mesh); | ||
surface_tool.Begin(Mesh.PrimitiveType.Triangles); | ||
surface_tool.CreateFrom(array_mesh,0); | ||
surface_tool.GenerateNormals(); | ||
|
||
SpatialMaterial material = new SpatialMaterial(); | ||
MeshInstance meshInstance = new MeshInstance(); | ||
meshInstance.Mesh = surface_tool.Commit(); | ||
meshInstance.CreateTrimeshCollision(); | ||
material.AlbedoColor = new Color(0x640000); | ||
meshInstance.MaterialOverride = material; | ||
|
||
this.AddChild(meshInstance); | ||
|
||
//this.GetNode("WaterLevel"). | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters