forked from godotengine/godot
-
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.
cleanup build warnings and code formatting issues
- Loading branch information
Showing
62 changed files
with
5,864 additions
and
129 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
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 @@ | ||
.import/ |
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,22 @@ | ||
MIT License | ||
|
||
Copyright (c) 2018 Roujel Williams | ||
Copyright (c) 2019 Jon Ring | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,64 @@ | ||
# HydroSimpleDemo | ||
|
||
Simple Godot 3.1+ project to demonstrate the HydroRigidBody node from https://gitlab.com/ringtechsolutions/godot-tools/hydro/hydro | ||
|
||
Contains three cubes of various weights, and two very simple boats that will automatically drive in a circle. One has debugging enabled, so you can see the forces acting upon the | ||
boat. | ||
|
||
The ocean was shamelessly stolen from https://github.com/SIsilicon/Godot-Ocean-Demo and you can adjust the wave parameters to see the effect on the objects. You can also collide | ||
with the objects to push them around, attempt to sink them, or play water polo. | ||
|
||
Ocean demo readme follows below: | ||
|
||
# Godot-Ocean-Demo | ||
An ocean demo in Godot 3.0. | ||
I am very proud of this demo and I want to thank you for trying it out. | ||
|
||
## How to customize the ocean | ||
The ocean demo uses what's known as Gerstner waves. A constant collection of them is used to create that *wavy* feel of the waters. It also uses a lil bit of noise to really sell the effect. Both of these features are customizable with almost self-explanatory parameters. | ||
|
||
### Main wave parameters | ||
|
||
-**Amplitude** defines how high your waves will be. | ||
|
||
-**Wavelength** defines how long your waves will be. | ||
|
||
-**Steepness** defines how 'choppy' your waves will be. Don't set this too high or else your waves will start self-intersecting. | ||
|
||
-**Wind Direction** controls the direction the overall waves would go. | ||
|
||
-**Wind Align** also determines each wave's individual direction. A value of *one* means they all go in the exact same direction. A value of *zero* means waves go in completely random directions. | ||
|
||
-**Speed** controls how fast the waves propagates. | ||
|
||
-**Seed** determines the final parameters of each wave. Find the seed that you like the best. | ||
|
||
### Noise parameters | ||
|
||
-**Noise Enabled**. Yeah. Whether to use noise at all. | ||
|
||
-**Noise Amp** controls how high the noise looks. | ||
|
||
-**Noise Freq** controls the smoothness/granularity of the noise. Higher values make it smoother and less granular. | ||
|
||
-**Noise Speed** controls how fast the waves propagate. | ||
|
||
## First Person Control | ||
|
||
When running the project(sorry if it's slow to load. I'm looking into that.) You can fly around. Look at your ocean from every angle. And you can do so like this. | ||
|
||
-Use your **mouse** to look around. | ||
|
||
-**W key** go forward. | ||
|
||
-**S key** go backward. | ||
|
||
-**A key** go left. | ||
|
||
-**D key** go right. | ||
|
||
-**Q key** toggle between fly and edit mode. You cant play with the ocean parameters and fly at the same time. | ||
|
||
# Credits | ||
|
||
The flying code is from Jeremy Bullock's youtube tutorial series on first person control. |
238 changes: 238 additions & 0 deletions
238
modules/gdextensions/_projects/hydro_demo/hydro/art/OceanShader.tres
Large diffs are not rendered by default.
Oops, something went wrong.
13 changes: 13 additions & 0 deletions
13
modules/gdextensions/_projects/hydro_demo/hydro/art/hydro_env.tres
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,13 @@ | ||
[gd_resource type="Environment" load_steps=2 format=2] | ||
|
||
[sub_resource type="ProceduralSky" id=1] | ||
sky_top_color = Color( 0.0470588, 0.454902, 0.976471, 1 ) | ||
sky_horizon_color = Color( 0.556863, 0.823529, 0.909804, 1 ) | ||
sky_curve = 0.25 | ||
ground_bottom_color = Color( 0.101961, 0.145098, 0.188235, 1 ) | ||
ground_horizon_color = Color( 0.482353, 0.788235, 0.952941, 1 ) | ||
ground_curve = 0.01 | ||
|
||
[resource] | ||
background_mode = 2 | ||
background_sky = SubResource( 1 ) |
Binary file added
BIN
+62.3 KB
modules/gdextensions/_projects/hydro_demo/hydro/art/noise_tileable.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions
26
modules/gdextensions/_projects/hydro_demo/hydro/core/CubeCamera.gd
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,26 @@ | ||
tool | ||
extends Spatial | ||
|
||
func ready(): | ||
for i in get_children(): | ||
i.size = Vector2(256, 256) | ||
i.own_world = true | ||
|
||
func update_cube_map(): | ||
var images = { | ||
'left': CubeMap.SIDE_LEFT, | ||
'right': CubeMap.SIDE_RIGHT, | ||
'front': CubeMap.SIDE_FRONT, | ||
'back': CubeMap.SIDE_BACK, | ||
'top': CubeMap.SIDE_TOP, | ||
'bottom': CubeMap.SIDE_BOTTOM | ||
} | ||
var cube_map = CubeMap.new() | ||
|
||
for i in get_children(): | ||
if i.name in images: | ||
var img = Image.new() | ||
img.copy_from(i.get_texture().get_data()) | ||
cube_map.set_side(images[i.name], img) | ||
|
||
return cube_map |
82 changes: 82 additions & 0 deletions
82
modules/gdextensions/_projects/hydro_demo/hydro/core/CubeCamera.tscn
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,82 @@ | ||
[gd_scene load_steps=2 format=2] | ||
|
||
[ext_resource path="res://hydro/core/CubeCamera.gd" type="Script" id=1] | ||
|
||
[node name="CubeCamera" type="Spatial"] | ||
script = ExtResource( 1 ) | ||
|
||
[node name="left" type="Viewport" parent="."] | ||
size = Vector2( 512, 512 ) | ||
render_target_v_flip = true | ||
render_target_clear_mode = 1 | ||
render_target_update_mode = 1 | ||
|
||
[node name="Camera" type="Camera" parent="left"] | ||
transform = Transform( -4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 0, 0, 0 ) | ||
current = true | ||
fov = 90.0 | ||
near = 0.95 | ||
far = 1.0 | ||
|
||
[node name="right" type="Viewport" parent="."] | ||
size = Vector2( 512, 512 ) | ||
render_target_v_flip = true | ||
render_target_clear_mode = 1 | ||
render_target_update_mode = 1 | ||
|
||
[node name="Camera" type="Camera" parent="right"] | ||
transform = Transform( -4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 0, 0, 0 ) | ||
current = true | ||
fov = 90.0 | ||
near = 0.95 | ||
far = 1.0 | ||
|
||
[node name="front" type="Viewport" parent="."] | ||
size = Vector2( 512, 512 ) | ||
render_target_v_flip = true | ||
render_target_clear_mode = 1 | ||
render_target_update_mode = 1 | ||
|
||
[node name="Camera" type="Camera" parent="front"] | ||
current = true | ||
fov = 90.0 | ||
near = 0.95 | ||
far = 1.0 | ||
|
||
[node name="back" type="Viewport" parent="."] | ||
size = Vector2( 512, 512 ) | ||
render_target_v_flip = true | ||
render_target_clear_mode = 1 | ||
render_target_update_mode = 1 | ||
|
||
[node name="Camera" type="Camera" parent="back"] | ||
transform = Transform( -1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, 0 ) | ||
current = true | ||
fov = 90.0 | ||
near = 0.95 | ||
far = 1.0 | ||
|
||
[node name="top" type="Viewport" parent="."] | ||
size = Vector2( 512, 512 ) | ||
render_target_clear_mode = 1 | ||
render_target_update_mode = 1 | ||
|
||
[node name="Camera" type="Camera" parent="top"] | ||
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0 ) | ||
current = true | ||
fov = 90.0 | ||
near = 0.95 | ||
far = 1.0 | ||
|
||
[node name="bottom" type="Viewport" parent="."] | ||
size = Vector2( 512, 512 ) | ||
render_target_v_flip = true | ||
render_target_clear_mode = 1 | ||
render_target_update_mode = 1 | ||
|
||
[node name="Camera" type="Camera" parent="bottom"] | ||
transform = Transform( 1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0 ) | ||
current = true | ||
fov = 90.0 | ||
near = 0.95 | ||
far = 1.0 |
77 changes: 77 additions & 0 deletions
77
modules/gdextensions/_projects/hydro_demo/hydro/core/Gary.gd
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,77 @@ | ||
extends KinematicBody | ||
|
||
var camera_angle = 0 | ||
var mouse_sensitivity = 0.3 | ||
var camera_change = Vector2() | ||
|
||
var velocity = Vector3() | ||
var direction = Vector3() | ||
|
||
#fly variables | ||
const FLY_SPEED = 20 | ||
const FLY_ACCEL = 4 | ||
|
||
var mouse_captured = true | ||
|
||
signal free_look_toggled | ||
|
||
func _ready(): | ||
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) | ||
|
||
func _physics_process(delta): | ||
|
||
if mouse_captured: | ||
aim() | ||
fly(delta) | ||
|
||
if Input.is_action_just_pressed('toggle_mouse'): | ||
if mouse_captured: | ||
mouse_captured = false | ||
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) | ||
emit_signal("free_look_toggled", false) | ||
else: | ||
mouse_captured = true | ||
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) | ||
emit_signal("free_look_toggled", true) | ||
|
||
func _input(event): | ||
if event is InputEventMouseMotion: | ||
camera_change = event.relative | ||
|
||
func fly(delta): | ||
# reset the direction of the player | ||
direction = Vector3() | ||
|
||
# get the rotation of the camera | ||
var aim = $Head/Camera.get_global_transform().basis | ||
|
||
# check input and change direction | ||
if Input.is_action_pressed("move_forward"): | ||
direction -= aim.z | ||
if Input.is_action_pressed("move_backward"): | ||
direction += aim.z | ||
if Input.is_action_pressed("move_left"): | ||
direction -= aim.x | ||
if Input.is_action_pressed("move_right"): | ||
direction += aim.x | ||
|
||
direction = direction.normalized() | ||
|
||
# where would the player go at max speed | ||
var target = direction * FLY_SPEED | ||
|
||
# calculate a portion of the distance to go | ||
velocity = velocity.linear_interpolate(target, FLY_ACCEL * delta) | ||
|
||
# move | ||
move_and_slide(velocity) | ||
|
||
func aim(): | ||
if camera_change.length() > 0: | ||
$Head.rotate_y(deg2rad(-camera_change.x * mouse_sensitivity)) | ||
|
||
var change = -camera_change.y * mouse_sensitivity | ||
if change + camera_angle < 90 and change + camera_angle > -90: | ||
$Head/Camera.rotate_x(deg2rad(change)) | ||
camera_angle += change | ||
camera_change = Vector2() |
53 changes: 53 additions & 0 deletions
53
modules/gdextensions/_projects/hydro_demo/hydro/core/Gary.tscn
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,53 @@ | ||
[gd_scene load_steps=3 format=2] | ||
|
||
[ext_resource path="res://hydro/core/Gary.gd" type="Script" id=1] | ||
|
||
[sub_resource type="CapsuleShape" id=1] | ||
|
||
radius = 0.6 | ||
height = 2.0 | ||
|
||
[node name="Gary" type="KinematicBody" index="0"] | ||
|
||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 3.52113, 0.98772 ) | ||
input_ray_pickable = true | ||
input_capture_on_drag = false | ||
collision_layer = 1 | ||
collision_mask = 1 | ||
axis_lock_linear_x = false | ||
axis_lock_linear_y = false | ||
axis_lock_linear_z = false | ||
axis_lock_angular_x = false | ||
axis_lock_angular_y = false | ||
axis_lock_angular_z = false | ||
collision/safe_margin = 0.001 | ||
script = ExtResource( 1 ) | ||
|
||
[node name="Capsule" type="CollisionShape" parent="." index="0"] | ||
|
||
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0 ) | ||
shape = SubResource( 1 ) | ||
disabled = false | ||
_sections_unfolded = [ "Transform" ] | ||
|
||
[node name="Head" type="Spatial" parent="." index="1"] | ||
|
||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.5, 0 ) | ||
_sections_unfolded = [ "Transform" ] | ||
|
||
[node name="Camera" type="Camera" parent="Head" index="0"] | ||
|
||
keep_aspect = 1 | ||
cull_mask = 1048575 | ||
environment = null | ||
h_offset = 0.0 | ||
v_offset = 0.0 | ||
doppler_tracking = 0 | ||
projection = 0 | ||
current = false | ||
fov = 70.0 | ||
size = 1.0 | ||
near = 0.05 | ||
far = 10000.0 | ||
|
||
|
7 changes: 7 additions & 0 deletions
7
modules/gdextensions/_projects/hydro_demo/hydro/core/MeshInstance.gd
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,7 @@ | ||
tool | ||
extends MeshInstance | ||
|
||
func _process(delta): | ||
var ocean = get_parent().get_node('Ocean') | ||
|
||
translation = ocean.get_displace(Vector2()) |
29 changes: 29 additions & 0 deletions
29
modules/gdextensions/_projects/hydro_demo/hydro/core/OceanEditor.gd
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,29 @@ | ||
extends Panel | ||
|
||
onready var ocean = $"../Ocean" | ||
|
||
var wind_direction = Vector2() | ||
|
||
func _process(delta): | ||
for i in $Settings.get_children(): | ||
match i.name: | ||
"Seed": ocean.set_seed(hash($Settings/Seed/LineEdit.text)) | ||
"Amplitude": ocean.set_amplitude($Settings/Amplitude/HSlider.value) | ||
"Wavelength": ocean.set_wavelength($Settings/Wavelength/HSlider.value) | ||
"Steepness": ocean.set_steepness($Settings/Steepness/HSlider.value) | ||
"WindDirectionX": wind_direction.x = $Settings/WindDirectionX/HSlider.value | ||
"WindDirectionY": wind_direction.y = $Settings/WindDirectionY/HSlider.value | ||
"WindAlign": ocean.set_wind_align($Settings/WindAlign/HSlider.value) | ||
"Speed": ocean.set_speed($Settings/Speed/HSlider.value) | ||
"Noise": ocean.set_noise_enabled($Settings/Noise/CheckBox.pressed) | ||
"NoiseAmp": ocean.set_noise_amplitude($Settings/NoiseAmp/HSlider.value) | ||
"NoiseFreq": ocean.set_noise_frequency($Settings/NoiseFreq/HSlider.value) | ||
"NoiseSpeed": ocean.set_noise_speed($Settings/NoiseSpeed/HSlider.value) | ||
|
||
func set_free_look(status): | ||
if status: | ||
$EditMode.hide() | ||
$FreeLook.show() | ||
else: | ||
$FreeLook.hide() | ||
$EditMode.show() |
Oops, something went wrong.