Browse Source

draft sea

develop
Non0w 3 years ago
parent
commit
32efbe304b
10 changed files with 138 additions and 68 deletions
  1. +6
    -3
      jrpg/misc/jrpg_env.tres
  2. +13
    -0
      jrpg/models/nature/river/WaterPlane.tscn
  3. BIN
      jrpg/models/nature/river/ground_riverOpen.glb
  4. BIN
      jrpg/models/nature/river/water.material
  5. +44
    -0
      jrpg/models/nature/river/water.shader
  6. +9
    -0
      jrpg/models/nature/river/water.tres
  7. +57
    -61
      jrpg/scenes/TestLVL.tscn
  8. +1
    -0
      jrpg/scenes/entities/Player.tscn
  9. +8
    -3
      jrpg/scripts/entities/player.gd
  10. +0
    -1
      project.godot

+ 6
- 3
jrpg/misc/jrpg_env.tres View File

@@ -2,11 +2,14 @@

[sub_resource type="ProceduralSky" id=1]
sky_top_color = Color( 0.862745, 0.286275, 0.984314, 1 )
sky_horizon_color = Color( 0.188235, 0.901961, 0.956863, 1 )
ground_bottom_color = Color( 0.109804, 0.556863, 0.0823529, 1 )
ground_horizon_color = Color( 0.188235, 0.901961, 0.956863, 1 )
sky_horizon_color = Color( 0.0588235, 0.964706, 0.572549, 1 )
ground_bottom_color = Color( 0.0117647, 0.364706, 0.411765, 1 )
ground_horizon_color = Color( 0.384314, 0.298039, 0.811765, 1 )
ground_curve = 0.0984918

[resource]
background_mode = 2
background_sky = SubResource( 1 )
fog_enabled = true
fog_color = Color( 0.384314, 0.298039, 0.811765, 1 )
fog_sun_color = Color( 0.862745, 0.286275, 0.984314, 1 )

+ 13
- 0
jrpg/models/nature/river/WaterPlane.tscn View File

@@ -0,0 +1,13 @@
[gd_scene load_steps=3 format=2]

[ext_resource path="res://jrpg/models/nature/river/water.tres" type="Material" id=1]

[sub_resource type="PlaneMesh" id=1]
material = ExtResource( 1 )
size = Vector2( 100, 100 )
subdivide_width = 50
subdivide_depth = 50

[node name="WaterPlane" type="MeshInstance"]
mesh = SubResource( 1 )
material/0 = null

BIN
jrpg/models/nature/river/ground_riverOpen.glb View File


BIN
jrpg/models/nature/river/water.material View File


+ 44
- 0
jrpg/models/nature/river/water.shader View File

@@ -0,0 +1,44 @@
shader_type spatial;

uniform vec4 out_color : hint_color = vec4(0.0, 0.2, 1.0, 1.0);
uniform float amount : hint_range(0.2, 1.5) = 0.8;
uniform float beer_factor : hint_range(0.01, 1.5) = 0.2;

float generate_offset(float x, float z, float val1, float val2, float time) {
float speed = 1.0;
float radiansx = ((mod(x + z * x * val1, amount) / amount) + (time * speed) * mod(x * 0.8 + z, 1.5)) * 2.0 * 3.14;
float radiansz = ((mod(val2 * (z * x + z * x), amount) / amount) + (time * speed) * 2.0 * mod(x, 2.0)) * 2.0 * 3.14;
return amount * 0.5 * (sin(radiansz) + cos(radiansx));
}

vec3 apply_distortion(vec3 vertex, float time) {
float xd = generate_offset(vertex.x, vertex.z, 0.2, 0.1, time);
float yd = generate_offset(vertex.x, vertex.z, 0.1, 0.3, time);
float zd = generate_offset(vertex.x, vertex.z, 0.15, 0.2, time);
return vertex + vec3(xd, yd, zd);
}

void vertex() {
VERTEX = apply_distortion(VERTEX, TIME * 0.1);
}

void fragment() {
NORMAL = normalize(cross(dFdx(VERTEX), dFdy(VERTEX)));
METALLIC = 0.6;
SPECULAR = 0.5;
ROUGHNESS = 0.2;
ALBEDO = out_color.xyz;
float depth = texture(DEPTH_TEXTURE, SCREEN_UV).r;
depth = depth * 2.0 - 1.0;
depth = PROJECTION_MATRIX[3][2] / (depth + PROJECTION_MATRIX[2][2]);
depth = depth + VERTEX.z;
depth = exp(-depth * beer_factor);
ALPHA = clamp(1.0 - depth, 0.0, 1.0);
}

+ 9
- 0
jrpg/models/nature/river/water.tres View File

@@ -0,0 +1,9 @@
[gd_resource type="ShaderMaterial" load_steps=2 format=2]

[ext_resource path="res://jrpg/models/nature/river/water.shader" type="Shader" id=1]

[resource]
shader = ExtResource( 1 )
shader_param/out_color = Color( 0, 0.2, 1, 1 )
shader_param/amount = 0.6
shader_param/beer_factor = 1.5

+ 57
- 61
jrpg/scenes/TestLVL.tscn View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=30 format=2]
[gd_scene load_steps=31 format=2]

[ext_resource path="res://jrpg/scripts/levels/spawner.gd" type="Script" id=1]
[ext_resource path="res://jrpg/yarn_scripts/test_start.yarn" type="Resource" id=2]
@@ -13,25 +13,14 @@
[ext_resource path="res://jrpg/scripts/levels/script_trigger.gd" type="Script" id=11]
[ext_resource path="res://jrpg/characters/basic_enemy.tres" type="Resource" id=12]
[ext_resource path="res://jrpg/yarn_scripts/all_coins_picked_up_script.yarn" type="Resource" id=13]
[ext_resource path="res://jrpg/models/nature/river/WaterPlane.tscn" type="PackedScene" id=14]
[ext_resource path="res://jrpg/scripts/misc/test_level.gd" type="Script" id=15]
[ext_resource path="res://jrpg/models/nature/river/water.tres" type="Material" id=16]

[sub_resource type="ArrayMesh" id=1]
resource_name = "ground_grass"
surfaces/0 = {
"aabb": AABB( -0.5, 0, -0.5, 1.00001, 1e-05, 1.00001 ),
"array_data": PoolByteArray( 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, 0, 63, 0, 127, 0, 0, 127, 0, 0, 127, 235, 76, 43, 77, 0, 0, 0, 191, 0, 0, 0, 0, 0, 0, 0, 63, 0, 127, 0, 0, 127, 0, 0, 127, 235, 204, 43, 77, 0, 0, 0, 191, 0, 0, 0, 0, 0, 0, 0, 191, 0, 127, 0, 0, 127, 0, 0, 127, 235, 204, 171, 204, 0, 0, 0, 191, 0, 0, 0, 0, 0, 0, 0, 191, 0, 127, 0, 0, 127, 0, 0, 127, 235, 204, 171, 204, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, 0, 191, 0, 127, 0, 0, 127, 0, 0, 127, 235, 76, 171, 204, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, 0, 63, 0, 127, 0, 0, 127, 0, 0, 127, 235, 76, 43, 77 ),
"array_index_data": PoolByteArray( ),
"blend_shape_data": [ ],
"format": 97303,
"index_count": 0,
"material": ExtResource( 9 ),
"primitive": 4,
"skeleton_aabb": [ ],
"vertex_count": 6
}

[sub_resource type="ConcavePolygonShape" id=2]
data = PoolVector3Array( 0.5, 0, 0.5, -0.5, 0, 0.5, -0.5, 0, -0.5, -0.5, 0, -0.5, 0.5, 0, -0.5, 0.5, 0, 0.5 )
[sub_resource type="PlaneMesh" id=16]
size = Vector2( 600, 600 )
subdivide_width = 200
subdivide_depth = 200

[sub_resource type="ArrayMesh" id=3]
resource_name = "rock_smallFlatC"
@@ -251,48 +240,55 @@ environment = ExtResource( 7 )
transform = Transform( 0.422618, -0.742404, 0.519837, 0, 0.573576, 0.819152, -0.906308, -0.346189, 0.242404, 0, 0, 0 )
shadow_enabled = true

[node name="ground_grass" type="Spatial" parent="."]
transform = Transform( 50.0874, 0, 0, 0, 5.00874, 0, 0, 0, 50.0874, 0, 0.204079, 0 )
[node name="WaterPlane" parent="." instance=ExtResource( 14 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -2.47593, 0 )
mesh = SubResource( 16 )
material/0 = ExtResource( 16 )

[node name="rock_smallFlatC2" type="Spatial" parent="."]
transform = Transform( 262.983, 0, 0, 0, 87.6103, 0, 0, 0, 262.983, 0, 0, 0 )

[node name="tmpParent" type="Spatial" parent="ground_grass"]
[node name="tmpParent" type="Spatial" parent="rock_smallFlatC2"]
transform = Transform( 1, 0, 0, 0, 0.452005, 0, 0, 0, 1, 0, -0.0247138, 0 )

[node name="ground_grass" type="MeshInstance" parent="ground_grass/tmpParent"]
[node name="rock_smallFlatC" type="MeshInstance" parent="rock_smallFlatC2/tmpParent"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.05, 0 )
use_in_baked_light = true
mesh = SubResource( 1 )
mesh = SubResource( 3 )
material/0 = null
material/1 = null

[node name="StaticBody" type="StaticBody" parent="ground_grass/tmpParent/ground_grass"]
[node name="StaticBody" type="StaticBody" parent="rock_smallFlatC2/tmpParent/rock_smallFlatC"]

[node name="CollisionShape" type="CollisionShape" parent="ground_grass/tmpParent/ground_grass/StaticBody"]
shape = SubResource( 2 )
[node name="CollisionShape" type="CollisionShape" parent="rock_smallFlatC2/tmpParent/rock_smallFlatC/StaticBody"]
shape = SubResource( 4 )

[node name="Rocks" type="Spatial" parent="ground_grass"]
transform = Transform( 0.1, 0, 0, 0, 1, 0, 0, 0, 0.1, 1.5, 0, -1.5 )
[node name="Rocks" type="Spatial" parent="rock_smallFlatC2"]
transform = Transform( 0.0190459, 0, 0, 0, 0.0571707, 0, 0, 0, 0.0190459, 0.285688, -0.0144457, -0.285688 )

[node name="rock_smallFlatC" type="Spatial" parent="ground_grass/Rocks"]
[node name="rock_smallFlatC" type="Spatial" parent="rock_smallFlatC2/Rocks"]
transform = Transform( 5.65286, 0, 0, 0, 5.65286, 0, 0, 0, 5.65286, -12.9201, 0.207275, 18.4097 )

[node name="tmpParent" type="Spatial" parent="ground_grass/Rocks/rock_smallFlatC"]
[node name="tmpParent" type="Spatial" parent="rock_smallFlatC2/Rocks/rock_smallFlatC"]

[node name="rock_smallFlatC" type="MeshInstance" parent="ground_grass/Rocks/rock_smallFlatC/tmpParent"]
[node name="rock_smallFlatC" type="MeshInstance" parent="rock_smallFlatC2/Rocks/rock_smallFlatC/tmpParent"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.05, 0 )
use_in_baked_light = true
mesh = SubResource( 3 )
material/0 = null
material/1 = null

[node name="StaticBody" type="StaticBody" parent="ground_grass/Rocks/rock_smallFlatC/tmpParent/rock_smallFlatC"]
[node name="StaticBody" type="StaticBody" parent="rock_smallFlatC2/Rocks/rock_smallFlatC/tmpParent/rock_smallFlatC"]

[node name="CollisionShape" type="CollisionShape" parent="ground_grass/Rocks/rock_smallFlatC/tmpParent/rock_smallFlatC/StaticBody"]
[node name="CollisionShape" type="CollisionShape" parent="rock_smallFlatC2/Rocks/rock_smallFlatC/tmpParent/rock_smallFlatC/StaticBody"]
shape = SubResource( 4 )

[node name="rock_tallB" type="Spatial" parent="ground_grass/Rocks"]
[node name="rock_tallB" type="Spatial" parent="rock_smallFlatC2/Rocks"]
transform = Transform( 5.65286, 0, 0, 0, 5.65286, 0, 0, 0, 5.65286, -14.2025, 0.258005, 11.2607 )

[node name="tmpParent" type="Spatial" parent="ground_grass/Rocks/rock_tallB"]
[node name="tmpParent" type="Spatial" parent="rock_smallFlatC2/Rocks/rock_tallB"]

[node name="rock_tallB" type="MeshInstance" parent="ground_grass/Rocks/rock_tallB/tmpParent"]
[node name="rock_tallB" type="MeshInstance" parent="rock_smallFlatC2/Rocks/rock_tallB/tmpParent"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.05, 0 )
use_in_baked_light = true
mesh = SubResource( 5 )
@@ -300,51 +296,51 @@ material/0 = null
material/1 = null
material/2 = null

[node name="StaticBody" type="StaticBody" parent="ground_grass/Rocks/rock_tallB/tmpParent/rock_tallB"]
[node name="StaticBody" type="StaticBody" parent="rock_smallFlatC2/Rocks/rock_tallB/tmpParent/rock_tallB"]

[node name="CollisionShape" type="CollisionShape" parent="ground_grass/Rocks/rock_tallB/tmpParent/rock_tallB/StaticBody"]
[node name="CollisionShape" type="CollisionShape" parent="rock_smallFlatC2/Rocks/rock_tallB/tmpParent/rock_tallB/StaticBody"]
shape = SubResource( 6 )

[node name="rock_smallE" type="Spatial" parent="ground_grass/Rocks"]
[node name="rock_smallE" type="Spatial" parent="rock_smallFlatC2/Rocks"]
transform = Transform( 6.85371, 0, 0, 0, 6.85371, 0, 0, 0, 6.85371, -18.3314, 2.34693e-07, 17.6131 )

[node name="tmpParent" type="Spatial" parent="ground_grass/Rocks/rock_smallE"]
[node name="tmpParent" type="Spatial" parent="rock_smallFlatC2/Rocks/rock_smallE"]

[node name="rock_smallE" type="MeshInstance" parent="ground_grass/Rocks/rock_smallE/tmpParent"]
[node name="rock_smallE" type="MeshInstance" parent="rock_smallFlatC2/Rocks/rock_smallE/tmpParent"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.05, 0 )
use_in_baked_light = true
mesh = SubResource( 7 )
material/0 = null
material/1 = null

[node name="StaticBody" type="StaticBody" parent="ground_grass/Rocks/rock_smallE/tmpParent/rock_smallE"]
[node name="StaticBody" type="StaticBody" parent="rock_smallFlatC2/Rocks/rock_smallE/tmpParent/rock_smallE"]

[node name="CollisionShape" type="CollisionShape" parent="ground_grass/Rocks/rock_smallE/tmpParent/rock_smallE/StaticBody"]
[node name="CollisionShape" type="CollisionShape" parent="rock_smallFlatC2/Rocks/rock_smallE/tmpParent/rock_smallE/StaticBody"]
shape = SubResource( 8 )

[node name="rock_smallA" type="Spatial" parent="ground_grass/Rocks"]
[node name="rock_smallA" type="Spatial" parent="rock_smallFlatC2/Rocks"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -18.5467, -3.72529e-09, 13.5098 )

[node name="tmpParent" type="Spatial" parent="ground_grass/Rocks/rock_smallA"]
[node name="tmpParent" type="Spatial" parent="rock_smallFlatC2/Rocks/rock_smallA"]

[node name="rock_smallA" type="MeshInstance" parent="ground_grass/Rocks/rock_smallA/tmpParent"]
[node name="rock_smallA" type="MeshInstance" parent="rock_smallFlatC2/Rocks/rock_smallA/tmpParent"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.05, 0 )
use_in_baked_light = true
mesh = SubResource( 9 )
material/0 = null
material/1 = null

[node name="StaticBody" type="StaticBody" parent="ground_grass/Rocks/rock_smallA/tmpParent/rock_smallA"]
[node name="StaticBody" type="StaticBody" parent="rock_smallFlatC2/Rocks/rock_smallA/tmpParent/rock_smallA"]

[node name="CollisionShape" type="CollisionShape" parent="ground_grass/Rocks/rock_smallA/tmpParent/rock_smallA/StaticBody"]
[node name="CollisionShape" type="CollisionShape" parent="rock_smallFlatC2/Rocks/rock_smallA/tmpParent/rock_smallA/StaticBody"]
shape = SubResource( 10 )

[node name="rock_largeD" type="Spatial" parent="ground_grass/Rocks"]
[node name="rock_largeD" type="Spatial" parent="rock_smallFlatC2/Rocks"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -17.8118, 1.11759e-08, 11.9321 )

[node name="tmpParent" type="Spatial" parent="ground_grass/Rocks/rock_largeD"]
[node name="tmpParent" type="Spatial" parent="rock_smallFlatC2/Rocks/rock_largeD"]

[node name="rock_largeD" type="MeshInstance" parent="ground_grass/Rocks/rock_largeD/tmpParent"]
[node name="rock_largeD" type="MeshInstance" parent="rock_smallFlatC2/Rocks/rock_largeD/tmpParent"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.05, 0 )
use_in_baked_light = true
mesh = SubResource( 11 )
@@ -352,32 +348,32 @@ material/0 = null
material/1 = null
material/2 = null

[node name="StaticBody" type="StaticBody" parent="ground_grass/Rocks/rock_largeD/tmpParent/rock_largeD"]
[node name="StaticBody" type="StaticBody" parent="rock_smallFlatC2/Rocks/rock_largeD/tmpParent/rock_largeD"]

[node name="CollisionShape" type="CollisionShape" parent="ground_grass/Rocks/rock_largeD/tmpParent/rock_largeD/StaticBody"]
[node name="CollisionShape" type="CollisionShape" parent="rock_smallFlatC2/Rocks/rock_largeD/tmpParent/rock_largeD/StaticBody"]
shape = SubResource( 12 )

[node name="rock_largeC" type="Spatial" parent="ground_grass/Rocks"]
[node name="rock_largeC" type="Spatial" parent="rock_smallFlatC2/Rocks"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -10.9969, -2.27243e-07, 12.2947 )

[node name="tmpParent" type="Spatial" parent="ground_grass/Rocks/rock_largeC"]
[node name="tmpParent" type="Spatial" parent="rock_smallFlatC2/Rocks/rock_largeC"]

[node name="rock_largeC" type="MeshInstance" parent="ground_grass/Rocks/rock_largeC/tmpParent"]
[node name="rock_largeC" type="MeshInstance" parent="rock_smallFlatC2/Rocks/rock_largeC/tmpParent"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.05, 0 )
use_in_baked_light = true
mesh = SubResource( 13 )
material/0 = null
material/1 = null

[node name="StaticBody" type="StaticBody" parent="ground_grass/Rocks/rock_largeC/tmpParent/rock_largeC"]
[node name="StaticBody" type="StaticBody" parent="rock_smallFlatC2/Rocks/rock_largeC/tmpParent/rock_largeC"]

[node name="CollisionShape" type="CollisionShape" parent="ground_grass/Rocks/rock_largeC/tmpParent/rock_largeC/StaticBody"]
[node name="CollisionShape" type="CollisionShape" parent="rock_smallFlatC2/Rocks/rock_largeC/tmpParent/rock_largeC/StaticBody"]
shape = SubResource( 14 )

[node name="Spawners" type="Spatial" parent="."]

[node name="Coins" type="Spatial" parent="Spawners"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.43111, 0 )
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.630669, 0 )
script = ExtResource( 5 )
coin_scene = ExtResource( 3 )
all_coins_picked_up_script = ExtResource( 13 )
@@ -400,12 +396,12 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.330003, 4.60946, -9.86923 )
[node name="CoinSpawn6" type="Spatial" parent="Spawners/Coins"]

[node name="Kiley" type="Spatial" parent="Spawners"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 3.42834, 0, 8.41565 )
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 3.42834, -1.29737, 8.41565 )
script = ExtResource( 1 )
character_data = ExtResource( 12 )

[node name="Player" type="Spatial" parent="Spawners"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.218717, 0, -1.84536 )
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.218717, 1.98511, -1.84536 )
script = ExtResource( 1 )
character_data = ExtResource( 6 )



+ 1
- 0
jrpg/scenes/entities/Player.tscn View File

@@ -24,6 +24,7 @@ script = ExtResource( 3 )
[node name="Camera" type="Camera" parent="CameraOrbit"]
transform = Transform( -1, 0, -3.25841e-07, 0, 1, 0, 3.25841e-07, 0, -1, -1, 1, -5 )
current = true
far = 329.0

[node name="InteractRayCast" type="RayCast" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.3, 1, 0.2 )


+ 8
- 3
jrpg/scripts/entities/player.gd View File

@@ -48,9 +48,9 @@ func _physics_process (delta):
var dir := (transform.basis.z * input.z + transform.basis.x * input.x)
# apply the direction to our velocity
if not is_on_floor():
vel.x = lerp(vel.x, dir.x * airborneSpeed, .5 * delta)
vel.z = lerp(vel.z, dir.z * airborneSpeed, .5 * delta)
if not is_on_floor() and dir.length_squared() == 0:
vel.x = lerp(vel.x, 0, 0.02)
vel.z = lerp(vel.z, 0, 0.02)
elif Input.is_action_pressed("run"):
vel.x = dir.x * runSpeed
vel.z = dir.z * runSpeed
@@ -81,6 +81,11 @@ func _physics_process (delta):
var previous_vel = vel
vel = move_and_slide(vel, Vector3.UP, true, 4, deg2rad(30))
"debug for water"
if translation.y <= -5.75:
translation.y = -5.75
vel.y = 0
if is_on_wall():
vel.y = min(previous_vel.y, vel.y)



+ 0
- 1
project.godot View File

@@ -167,7 +167,6 @@ run={

[rendering]

quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false
environment/default_environment="res://default_env.tres"

Loading…
Cancel
Save