forked from funnymemellama/funnymemellama
Started adding interaction, worked a bit on cardboard shader
This commit is contained in:
parent
abf6db2d37
commit
b833aac9ff
4 changed files with 52 additions and 12 deletions
|
@ -69,3 +69,11 @@ func _input(event):
|
|||
camera.transform.basis = Basis() # reset rotation
|
||||
camera.rotate_object_local(Vector3(0, 1, 0), rot_x) # first rotate in Y
|
||||
camera.rotate_object_local(Vector3(1, 0, 0), rot_y) # then rotate in X
|
||||
|
||||
if event.is_action_pressed("interact"):
|
||||
var space_state = get_world_3d().direct_space_state
|
||||
# use global coordinates, not local to node
|
||||
print(camera.basis)
|
||||
var query = PhysicsRayQueryParameters3D.create(camera.position, camera.position + camera.basis.z * 2.0)
|
||||
var result = space_state.intersect_ray(query)
|
||||
print(result)
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
[gd_resource type="VisualShader" load_steps=11 format=3 uid="uid://dwd2vgoqby6rd"]
|
||||
[gd_resource type="VisualShader" load_steps=13 format=3 uid="uid://dwd2vgoqby6rd"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://cffsdo4cit4i1" path="res://kreb.png" id="1_mkqvf"]
|
||||
[ext_resource type="Texture2D" uid="uid://d0l1mjrgq6wrq" path="res://paper_tex/paper_0025_color_1k.jpg" id="2_1g1lb"]
|
||||
[ext_resource type="Texture2D" uid="uid://dke8hdaqyfnsn" path="res://paper_tex/paper_0025_normal_opengl_1k.png" id="3_qtx1j"]
|
||||
|
||||
[sub_resource type="VisualShaderNodeVectorOp" id="VisualShaderNodeVectorOp_xrdx0"]
|
||||
default_input_values = [0, Vector3(0, 0, 0), 1, Vector3(2, 2, 2)]
|
||||
operator = 2
|
||||
|
||||
[sub_resource type="VisualShaderNodeTexture" id="VisualShaderNodeTexture_o5oup"]
|
||||
expanded_output_ports = [0]
|
||||
texture = ExtResource("1_mkqvf")
|
||||
|
@ -13,6 +17,8 @@ texture_type = 1
|
|||
texture = ExtResource("2_1g1lb")
|
||||
|
||||
[sub_resource type="VisualShaderNodeTexture" id="VisualShaderNodeTexture_kox8j"]
|
||||
output_port_for_preview = 1
|
||||
expanded_output_ports = [0]
|
||||
texture = ExtResource("3_qtx1j")
|
||||
texture_type = 2
|
||||
|
||||
|
@ -29,13 +35,16 @@ op_type = 4
|
|||
[sub_resource type="VisualShaderNodeInput" id="VisualShaderNodeInput_6nghl"]
|
||||
input_name = "front_facing"
|
||||
|
||||
[sub_resource type="VisualShaderNodeVectorOp" id="VisualShaderNodeVectorOp_mvcqe"]
|
||||
operator = 2
|
||||
|
||||
[resource]
|
||||
code = "shader_type spatial;
|
||||
render_mode blend_mix, depth_draw_opaque, cull_disabled, diffuse_lambert, specular_schlick_ggx;
|
||||
|
||||
uniform sampler2D tex_frg_2 : source_color;
|
||||
uniform sampler2D tex_frg_3;
|
||||
uniform sampler2D tex_frg_4 : hint_normal;
|
||||
uniform sampler2D tex_frg_3;
|
||||
|
||||
|
||||
|
||||
|
@ -49,6 +58,20 @@ void fragment() {
|
|||
float n_out2p4 = n_out2p0.a;
|
||||
|
||||
|
||||
// VectorOp:10
|
||||
vec3 n_in10p1 = vec3(2.00000, 2.00000, 2.00000);
|
||||
vec3 n_out10p0 = vec3(n_out2p0.xyz) * n_in10p1;
|
||||
|
||||
|
||||
// Texture2D:4
|
||||
vec4 n_out4p0 = texture(tex_frg_4, UV);
|
||||
float n_out4p1 = n_out4p0.r;
|
||||
|
||||
|
||||
// VectorOp:9
|
||||
vec3 n_out9p0 = n_out10p0 * vec3(n_out4p1);
|
||||
|
||||
|
||||
// Texture2D:3
|
||||
vec4 n_out3p0 = texture(tex_frg_3, UV);
|
||||
|
||||
|
@ -59,11 +82,7 @@ void fragment() {
|
|||
|
||||
vec3 n_out7p0;
|
||||
// Switch:7
|
||||
n_out7p0 = mix(n_out5p0, vec3(n_out2p0.xyz), float(n_out8p0));
|
||||
|
||||
|
||||
// Texture2D:4
|
||||
vec4 n_out4p0 = texture(tex_frg_4, UV);
|
||||
n_out7p0 = mix(n_out5p0, n_out9p0, float(n_out8p0));
|
||||
|
||||
|
||||
// VectorOp:6
|
||||
|
@ -73,12 +92,12 @@ void fragment() {
|
|||
// Output:0
|
||||
ALBEDO = n_out7p0;
|
||||
ALPHA = n_out2p4;
|
||||
NORMAL = n_out6p0;
|
||||
NORMAL_MAP = n_out6p0;
|
||||
|
||||
|
||||
}
|
||||
"
|
||||
graph_offset = Vector2(-111.967, -22.6899)
|
||||
graph_offset = Vector2(-400.806, 286.904)
|
||||
modes/cull = 2
|
||||
nodes/fragment/0/position = Vector2(800, 100)
|
||||
nodes/fragment/2/node = SubResource("VisualShaderNodeTexture_o5oup")
|
||||
|
@ -95,4 +114,8 @@ nodes/fragment/7/node = SubResource("VisualShaderNodeSwitch_fvm22")
|
|||
nodes/fragment/7/position = Vector2(540, 240)
|
||||
nodes/fragment/8/node = SubResource("VisualShaderNodeInput_6nghl")
|
||||
nodes/fragment/8/position = Vector2(200, 120)
|
||||
nodes/fragment/connections = PackedInt32Array(2, 4, 5, 0, 3, 0, 5, 1, 4, 0, 6, 1, 2, 4, 6, 0, 2, 0, 7, 1, 5, 0, 7, 2, 7, 0, 0, 0, 8, 0, 7, 0, 2, 4, 0, 1, 6, 0, 0, 8)
|
||||
nodes/fragment/9/node = SubResource("VisualShaderNodeVectorOp_mvcqe")
|
||||
nodes/fragment/9/position = Vector2(480, 460)
|
||||
nodes/fragment/10/node = SubResource("VisualShaderNodeVectorOp_xrdx0")
|
||||
nodes/fragment/10/position = Vector2(520, 640)
|
||||
nodes/fragment/connections = PackedInt32Array(2, 4, 5, 0, 3, 0, 5, 1, 4, 0, 6, 1, 2, 4, 6, 0, 5, 0, 7, 2, 8, 0, 7, 0, 2, 4, 0, 1, 7, 0, 0, 0, 6, 0, 0, 9, 9, 0, 7, 1, 4, 1, 9, 1, 10, 0, 9, 0, 2, 0, 10, 0)
|
||||
|
|
|
@ -42,3 +42,8 @@ jump={
|
|||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
interact={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":69,"key_label":0,"unicode":101,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue