[gd_scene load_steps=19 format=2]

[ext_resource path="res://TryingOutSomethingNew.gd" type="Script" id=1]
[ext_resource path="res://Node2D.gd" type="Script" id=2]
[ext_resource path="res://icon.png" type="Texture" id=3]
[ext_resource path="res://addons/summer_day/display/display.gd" type="Script" id=4]
[ext_resource path="res://Bullshit/Main.gd" type="Script" id=5]
[ext_resource path="res://addons/summer_day/user_interface/canvas/rendering/space_camera.gd" type="Script" id=6]
[ext_resource path="res://Mult Test.gd" type="Script" id=7]

[sub_resource type="Shader" id=1]
code = "shader_type spatial;
render_mode blend_mix,depth_draw_opaque,cull_disabled,skip_vertex_transform;

uniform vec4 albedo : hint_color;
uniform sampler2D texture_albedo : hint_albedo;
uniform mat4 ha;


void vertex() {
	vec4 row0 = vec4(0.25, 0.0, 0.0, -0.5);
	vec4 row1 = vec4(0.0, 0.25, 0.0, 0.0);
	vec4 row2 = vec4(0.0, 0.0, 0.25, -3.0);
	vec4 row3 = vec4(0.0, 0.0, 0.00, 3.5);
	mat4 crank_matrix = mat4(row0, row1, row2, row3);
	vec4 pre = vec4(VERTEX, 1.0) * crank_matrix;
	POSITION = pre;
}


void fragment() {
	vec2 base_uv = UV;
	vec4 albedo_tex = texture(texture_albedo,base_uv);
	ALBEDO = albedo.rgb;
}"

[sub_resource type="ShaderMaterial" id=2]
shader = SubResource( 1 )
shader_param/albedo = Color( 0.768627, 0.231373, 0.231373, 1 )
shader_param/ha = null

[sub_resource type="Image" id=16]
data = {
"data": PoolByteArray( 0, 0, 128, 62, 0, 0, 0, 0, 0, 0, 0, 0, 154, 153, 25, 62, 0, 0, 0, 0, 0, 0, 128, 62, 0, 0, 0, 0, 154, 153, 25, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 128, 62, 0, 0, 0, 0, 0, 0, 0, 0, 154, 153, 25, 190, 0, 0, 0, 0, 0, 0, 128, 62, 0, 0, 0, 0, 154, 153, 25, 190, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 63 ),
"format": "RGBAFloat",
"height": 1,
"mipmaps": false,
"width": 8
}

[sub_resource type="ImageTexture" id=15]
flags = 0
flags = 0
image = SubResource( 16 )
size = Vector2( 8, 1 )

[sub_resource type="CapsuleMesh" id=5]
radius = 0.9
mid_height = 2.0
radial_segments = 16
rings = 2

[sub_resource type="Shader" id=6]
code = "shader_type spatial;
render_mode blend_mix,depth_draw_opaque,cull_disabled,skip_vertex_transform;


uniform mat3 canvas_transform;
uniform sampler2D table : hint_albedo;


vec4 indx(int i) {
	//return vec4(1.0, 1.0, 0.0, 1.0);
	return textureLod(table, vec2(float(i) * 0.125 + 0.0625), 0);
}

void vertex() {
	vec4 row0;
	vec4 row1;
	vec4 row2;
	vec4 row3;
	
	if (VERTEX.z >= 0.0) {
		row0 = vec4(indx(0).x, indx(0).y, indx(0).z, indx(0).w);
		row1 = vec4(indx(1).x, indx(1).y, indx(1).z, indx(1).w);
		row2 = vec4(indx(2).x, indx(2).y, indx(2).z, indx(2).w);
		row3 = vec4(indx(3).x, indx(3).y, indx(3).z, indx(3).w);
	}
	else {
		row0 = vec4(indx(4).x, indx(4).y, indx(4).z, indx(4).w);
		row1 = vec4(indx(5).x, indx(5).y, indx(5).z, indx(5).w);
		row2 = vec4(indx(6).x, indx(6).y, indx(6).z, indx(6).w);
		row3 = vec4(indx(7).x, indx(7).y, indx(7).z, indx(7).w);
	}
	mat4 crank_matrix = mat4(row0, row1, row2, row3);
	
	
	vec4 pre = vec4(VERTEX, 1.0) * crank_matrix;
	vec3 transformed_xy = vec3(pre.xy, 1.0) * transpose(canvas_transform);
	vec4 post = vec4(transformed_xy.x, transformed_xy.y, pre.z, pre.w);
	POSITION = post;
	VERTEX = (post / post.w).xyz;
}

void fragment() {
	ALBEDO = texture(table, UV).rgb;
}"

[sub_resource type="ShaderMaterial" id=7]
shader = SubResource( 6 )
shader_param/canvas_transform = Basis( 0.0018018, 0, -1, 0, -0.00289436, 1, 0, 0, 1 )
shader_param/table = SubResource( 15 )

[sub_resource type="QuadMesh" id=8]

[sub_resource type="Shader" id=9]
code = "shader_type spatial;
render_mode blend_mix,depth_draw_opaque,cull_disabled,unshaded;


void vertex() {
	vec4 row0;
	vec4 row1;
	vec4 row2;
	vec4 row3;
	
	row0 = vec4(0.2, 0.2, 0.0, 0.0);
	row1 = vec4(-0.2, 0.2, 0.0, 0.0);
	row2 = vec4(0.0, 0.0, 1.0, 0.0);
	row3 = vec4(0.0, 0.0, 0.0, 1.0);
	
	mat4 crank_matrix = mat4(row0, row1, row2, row3);
	vec4 pre = vec4(VERTEX, 1.0) * crank_matrix;
	POSITION = pre;
	VERTEX = VERTEX;
}

void fragment() {
	ALBEDO = vec3(0.0, 1.0, 0.0);
}"

[sub_resource type="ShaderMaterial" id=10]
shader = SubResource( 9 )

[sub_resource type="Animation" id=13]

[node name="Main" type="Node"]
script = ExtResource( 5 )

[node name="CSGCylinder" type="CSGCylinder" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 3.03888, -0.0140027, -0.205594 )
height = 3.586
material = SubResource( 2 )
script = ExtResource( 1 )

[node name="CSGCylinder2" type="CSGCylinder" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -25.8122, 0, 0 )

[node name="Camera" type="Camera" parent="."]
size = 2.0
script = ExtResource( 6 )

[node name="Sprite" type="Sprite" parent="."]
visible = false
position = Vector2( 619.786, 73.103 )
texture = SubResource( 15 )
centered = false

[node name="Sprite3D" type="Sprite3D" parent="."]
visible = false
opacity = 0.15
texture = ExtResource( 3 )

[node name="CSGBox" type="CSGMesh" parent="." groups=["SummerDaySpatialTransform"]]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.401247, 0.829002, -0.735263 )
mesh = SubResource( 5 )
material = SubResource( 7 )

[node name="Node2D" type="Node2D" parent="."]
script = ExtResource( 2 )

[node name="CSGBox2" type="CSGBox" parent="."]
visible = false

[node name="CSGMesh" type="CSGMesh" parent="."]
visible = false
mesh = SubResource( 8 )
material = SubResource( 10 )

[node name="DirectionalLight" type="DirectionalLight" parent="."]
transform = Transform( 0.398693, -0.714769, -0.574586, 0.450925, 0.698355, -0.555848, 0.798568, -0.0374829, 0.600737, -4.26558, 5.43131, 5.80283 )

[node name="SDDisplay" type="Control" parent="."]
margin_right = 40.0
margin_bottom = 40.0
script = ExtResource( 4 )
__meta__ = {
"_edit_use_anchors_": false
}
scene = SubResource( 13 )

[node name="Mult Test" type="Button" parent="."]
margin_right = 12.0
margin_bottom = 20.0
text = "Mat4rix Mult"
script = ExtResource( 7 )
__meta__ = {
"_edit_use_anchors_": false
}

[connection signal="pressed" from="Mult Test" to="Mult Test" method="_on_Mult_Test_pressed"]
