From a98c19ad724e7337b9be6f63a7e9f9834fde7da6 Mon Sep 17 00:00:00 2001 From: mono Date: Sun, 9 Jan 2022 17:34:26 +0100 Subject: [PATCH] Freeform transformation is now functional again. --- Bullshit/THIS SHOULD FIX IThoefully.tres | 2 +- Main.tscn | 17 +++- Mult Test.gd | 38 ++++++++ Node2D.gd | 39 +++----- addons/summer_day/data/blueprint/editable.gd | 3 +- addons/summer_day/data/blueprint/quad.gd | 20 +++++ .../data/blueprint/template_editables/tube.gd | 27 +++++- addons/summer_day/data/document/document.gd | 7 ++ addons/summer_day/data/document/table.gd | 3 + addons/summer_day/data/document/track.gd | 2 +- addons/summer_day/main_screen.tscn | 11 +-- addons/summer_day/tools/canvas/zoom.gd | 2 +- .../user_interface/canvas/canvas.tscn | 6 +- .../user_interface/canvas/canvas_state.gd | 2 - .../user_interface/canvas/mesh_container.gd | 7 ++ addons/summer_day/utilities/matrix_4.gd | 4 + .../utilities/summer_day_globals.gd | 2 - production/ann.tres | 90 +++++++++++++++---- .../blueprints/mannequin/mannequin.tres | 6 +- production/blueprints/mannequin/mat.tres | 35 +++++--- project.godot | 6 ++ 21 files changed, 249 insertions(+), 80 deletions(-) create mode 100644 Mult Test.gd create mode 100644 addons/summer_day/data/blueprint/quad.gd diff --git a/Bullshit/THIS SHOULD FIX IThoefully.tres b/Bullshit/THIS SHOULD FIX IThoefully.tres index e13c8ae..90c4e87 100644 --- a/Bullshit/THIS SHOULD FIX IThoefully.tres +++ b/Bullshit/THIS SHOULD FIX IThoefully.tres @@ -2,7 +2,7 @@ [sub_resource type="Image" id=1] 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 ), +"data": PoolByteArray( 146, 121, 211, 61, 105, 86, 230, 188, 0, 0, 0, 0, 252, 152, 127, 63, 240, 63, 201, 188, 72, 62, 73, 62, 0, 0, 0, 0, 29, 23, 26, 63, 192, 134, 71, 189, 169, 77, 108, 187, 0, 0, 0, 0, 0, 0, 128, 63, 192, 134, 71, 189, 169, 77, 108, 187, 0, 0, 0, 0, 0, 0, 128, 63, 225, 221, 100, 62, 58, 251, 45, 189, 0, 0, 0, 0, 220, 162, 139, 62, 30, 240, 195, 188, 186, 74, 183, 62, 0, 0, 0, 0, 248, 30, 185, 62, 11, 245, 66, 60, 50, 221, 41, 189, 0, 0, 0, 0, 0, 0, 128, 191, 11, 245, 66, 188, 50, 221, 41, 61, 0, 0, 0, 0, 0, 0, 128, 63 ), "format": "RGBAFloat", "height": 1, "mipmaps": false, diff --git a/Main.tscn b/Main.tscn index a5d3b9d..7549cac 100644 --- a/Main.tscn +++ b/Main.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=18 format=2] +[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] @@ -6,6 +6,7 @@ [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; @@ -107,7 +108,7 @@ void fragment() { [sub_resource type="ShaderMaterial" id=7] shader = SubResource( 6 ) -shader_param/canvas_transform = Basis( 0.89779, 0.0130737, -0.857315, 0.0243171, -1.66989, 0.724701, 0, 0, 1 ) +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] @@ -160,6 +161,7 @@ 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 @@ -196,3 +198,14 @@ __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"] diff --git a/Mult Test.gd b/Mult Test.gd new file mode 100644 index 0000000..466c844 --- /dev/null +++ b/Mult Test.gd @@ -0,0 +1,38 @@ +extends Button + + +# Declare member variables here. Examples: +# var a = 2 +# var b = "text" + + +# Called when the node enters the scene tree for the first time. +func _ready(): + pass # Replace with function body. + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +#func _process(delta): +# pass + + +func _on_Mult_Test_pressed(): + var a = SummerDayMatrix4.new( [ + -0.7071, 0.7071, 0.0, 0.0, + -0.7071, 0.7071, 0.0, 0.0, + 0.0, 0.0, 1.0, 0.0, + 0.0, 0.0, 0.0, 1.0, + ] ) + + var b = SummerDayMatrix4.new( [ + -0.7071, 0.7071, 0.0, 0.0, + -0.7071, 0.7071, 0.0, 0.0, + 0.0, 0.0, 1.0, 0.0, + 0.0, 0.0, 0.0, 1.0, + ] ) + + var c = SummerDayMatrix4.mult( + a, b + ) + + c.print() diff --git a/Node2D.gd b/Node2D.gd index 2baf618..7c3b36d 100644 --- a/Node2D.gd +++ b/Node2D.gd @@ -1,8 +1,7 @@ tool extends Node2D -var image := Image.new() -var table := ImageTexture.new() +var table = SummerDayTable.new() onready var Util = preload("res://addons/summer_day/utilities/math_helper.gd") @@ -21,8 +20,8 @@ var corners = [ var picked_point = -1 -var rear_matrix := [] -var front_matrix := [] +var rear_matrix +var front_matrix var canvas_inv : Transform2D var canvas_trans : Transform2D @@ -31,18 +30,10 @@ var canvas_trans : Transform2D func _ready(): update_canvas_inv() - image.create(8, 1, false, Image.FORMAT_RGBAF) - table.create_from_image(image, 0) - #table.create(8, 1, Image.FORMAT_RGBAF, 0) - #image = table.get_data() - image.lock() - for i in range(8): - image.set_pixel(i, 0, - Color(1.0, 0.0, 0.0)) - image.unlock() - table.set_data(image) - $"../Sprite".texture = table - $"../CSGBox".material.set_shader_param("table", table) + table.allocation_size = 2 + table.create() + $"../Sprite".texture = table.texture + $"../CSGBox".material.set_shader_param("table", table.texture) _update_matrix() @@ -98,7 +89,7 @@ func _draw(): for i in range(4): draw_circle(corners[i + 4], 0.01, Color.purple) - draw_texture_rect(table, Rect2( + draw_texture_rect(table.texture, Rect2( Vector2(450.0, 50.0), Vector2(256.0, 32.0) ), false) @@ -147,14 +138,6 @@ func _update_matrix(): # 0.0, 0.0, 0.0, 8.5, # ] - image.lock() - for i in range(4): - image.set_pixel(i, 0, - Color(front_matrix[i * 4], front_matrix[i * 4 + 1], - front_matrix[i * 4 + 2], front_matrix[i * 4 + 3])) - for i in range(4): - image.set_pixel(i + 4, 0, - Color(rear_matrix[i * 4], rear_matrix[i * 4 + 1], - rear_matrix[i * 4 + 2], rear_matrix[i * 4 + 3])) - image.unlock() - table.set_data(image) + table.apply_matrix(front_matrix, 0, 0) + table.apply_matrix(rear_matrix, 0, 1) + table.flush() diff --git a/addons/summer_day/data/blueprint/editable.gd b/addons/summer_day/data/blueprint/editable.gd index 585c13e..f9d8438 100644 --- a/addons/summer_day/data/blueprint/editable.gd +++ b/addons/summer_day/data/blueprint/editable.gd @@ -3,6 +3,7 @@ extends Resource class_name SummerDayEditable +export(Resource) var table var preference_number = 0 @@ -15,7 +16,7 @@ func _interact(event: InputEvent) -> bool: # Virtual. return false -func _update_table(table: SummerDayTable): # Virtual. +func _update_table(): # Virtual. pass diff --git a/addons/summer_day/data/blueprint/quad.gd b/addons/summer_day/data/blueprint/quad.gd new file mode 100644 index 0000000..7b9d4a0 --- /dev/null +++ b/addons/summer_day/data/blueprint/quad.gd @@ -0,0 +1,20 @@ +extends Resource +class_name SummerDayQuad + + +export(PoolVector2Array) var vertices = PoolVector2Array([ + Vector2(-0.4, -0.4), + Vector2(0.1, -0.4), + Vector2(0.1, 0.1), + Vector2(-0.4, 0.1), +]) + + +# Called when the node enters the scene tree for the first time. +func _ready(): + pass # Replace with function body. + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +#func _process(delta): +# pass diff --git a/addons/summer_day/data/blueprint/template_editables/tube.gd b/addons/summer_day/data/blueprint/template_editables/tube.gd index 9482e58..d20b450 100644 --- a/addons/summer_day/data/blueprint/template_editables/tube.gd +++ b/addons/summer_day/data/blueprint/template_editables/tube.gd @@ -2,7 +2,6 @@ tool extends SummerDayEditable class_name SummerDayEditableTube - export(PoolVector2Array) var vertices = PoolVector2Array([ Vector2(-0.4, -0.4), Vector2(0.1, -0.4), @@ -38,13 +37,33 @@ func _interact(event: InputEvent) -> bool: # Virtual. if picked_point != -1: vertices[picked_point] = event.position - #_update_table() + _update_table() update_interaction_hint() return true -func _update_table(table: SummerDayTable): # Virtual. - pass +func _update_table(): # Virtual. + var rear_matrix = SummerDayMathHelper.plane_3d_to_xy( + Vector3(1.0, 1.0, 1.0), + Vector3(-1.0, 1.0, 1.0), + Vector3(-1.0, -1.0, 1.0), + Vector3(1.0, -1.0, 1.0), + + vertices[0], vertices[1], vertices[2], vertices[3] + ) + + var front_matrix = SummerDayMathHelper.plane_3d_to_xy( + Vector3(1.0, 1.0, -1.0), + Vector3(-1.0, 1.0, -1.0), + Vector3(-1.0, -1.0, -1.0), + Vector3(1.0, -1.0, -1.0), + + vertices[4], vertices[5], vertices[6], vertices[7] + ) + + table.apply_matrix(front_matrix, 0, 0) + table.apply_matrix(rear_matrix, 0, 1) + table.flush() func _is_point_included(point: Vector2) -> bool: # Private. diff --git a/addons/summer_day/data/document/document.gd b/addons/summer_day/data/document/document.gd index 0a5920b..6ef419c 100644 --- a/addons/summer_day/data/document/document.gd +++ b/addons/summer_day/data/document/document.gd @@ -25,7 +25,14 @@ func setup(): func add_track(blueprint: SummerDayBlueprint): var track = SummerDayTrack.new() + track.blueprint = blueprint + + var table := SummerDayTable.new() + table.allocation_size = blueprint.get_allocation_size() + table.create() + track.table = table + track.add_cell(0) tracks.append(track) selected_track = track diff --git a/addons/summer_day/data/document/table.gd b/addons/summer_day/data/document/table.gd index 2c59fc0..d3e32a5 100644 --- a/addons/summer_day/data/document/table.gd +++ b/addons/summer_day/data/document/table.gd @@ -11,7 +11,10 @@ var dirty_flag = false func create(): + print("created") var row_size = allocation_size * 4 + texture = ImageTexture.new() + image = Image.new() image.create(row_size, 1, false, Image.FORMAT_RGBAF) texture.create_from_image(image, 0) _presage_changes() diff --git a/addons/summer_day/data/document/track.gd b/addons/summer_day/data/document/track.gd index 2c9ab33..b744590 100644 --- a/addons/summer_day/data/document/track.gd +++ b/addons/summer_day/data/document/track.gd @@ -4,7 +4,7 @@ class_name SummerDayTrack # Don't mistake with SummerDaySceneTrack! export(Resource) var blueprint # SummerDayResource -export(Resource) var table = SummerDayTable.new() +export(Resource) var table export(Array, Resource) var cells diff --git a/addons/summer_day/main_screen.tscn b/addons/summer_day/main_screen.tscn index d9ef823..56193dd 100644 --- a/addons/summer_day/main_screen.tscn +++ b/addons/summer_day/main_screen.tscn @@ -1,8 +1,7 @@ -[gd_scene load_steps=4 format=2] +[gd_scene load_steps=3 format=2] [ext_resource path="res://addons/summer_day/user_interface/canvas/canvas.tscn" type="PackedScene" id=1] [ext_resource path="res://addons/summer_day/main_screen.gd" type="Script" id=2] -[ext_resource path="res://Buctton.gd" type="Script" id=3] [node name="MainScreen" type="Control"] anchor_right = 1.0 @@ -14,11 +13,3 @@ __meta__ = { } [node name="Canvas" parent="." instance=ExtResource( 1 )] - -[node name="Button" type="Button" parent="."] -margin_right = 63.0 -margin_bottom = 20.0 -text = "PRESS" -script = ExtResource( 3 ) - -[connection signal="pressed" from="Button" to="Button" method="_on_Button_pressed"] diff --git a/addons/summer_day/tools/canvas/zoom.gd b/addons/summer_day/tools/canvas/zoom.gd index f52bd9d..ad83424 100644 --- a/addons/summer_day/tools/canvas/zoom.gd +++ b/addons/summer_day/tools/canvas/zoom.gd @@ -29,7 +29,7 @@ func _check_for_use(event: InputEvent): zoom_activated = true else: zoom_activated = false - elif event.factor != 0.0: + elif event.factor != 0.0 and event.button_index >= 4: initial_transform = SummerDay.canvas_state.canvas_transform return true diff --git a/addons/summer_day/user_interface/canvas/canvas.tscn b/addons/summer_day/user_interface/canvas/canvas.tscn index f821e88..cc06236 100644 --- a/addons/summer_day/user_interface/canvas/canvas.tscn +++ b/addons/summer_day/user_interface/canvas/canvas.tscn @@ -51,7 +51,7 @@ void fragment() { [sub_resource type="ShaderMaterial" id=7] render_priority = 1 shader = SubResource( 6 ) -shader_param/canvas_transform = Basis( 0.587128, 0, -0.414469, 0, -0.943144, 0.393899, 0, 0, 1 ) +shader_param/canvas_transform = Basis( 0.715913, 0, -0.474076, 0, -1.32223, 0.449119, 0, 0, 1 ) [node name="Canvas" type="PanelContainer"] anchor_right = 1.0 @@ -106,6 +106,7 @@ script = ExtResource( 2 ) projection = 1 current = true near = 0.01 +far = 1100.0 [node name="BorderShadow" type="Polygon2D" parent="Render/RenderLayer" groups=["SummerDayCanvasPolygon"]] material = SubResource( 5 ) @@ -118,6 +119,9 @@ polygon = PoolVector2Array( 0, 0, 1.77778, 0, 1.77778, 1, 0, 1 ) material_override = SubResource( 7 ) script = ExtResource( 3 ) +[node name="DirectionalLight" type="DirectionalLight" parent="Render/RenderLayer"] +transform = Transform( -0.811452, 0, -0.58442, 0, 1, 0, 0.58442, 0, -0.811452, 7.79949, 3.24197, 8.59216 ) + [node name="ForegroundLayer" type="Viewport" parent="Render" groups=["SummerDayCanvasTransform"]] size = Vector2( 998, 574 ) transparent_bg = true diff --git a/addons/summer_day/user_interface/canvas/canvas_state.gd b/addons/summer_day/user_interface/canvas/canvas_state.gd index 16a1626..8b36431 100644 --- a/addons/summer_day/user_interface/canvas/canvas_state.gd +++ b/addons/summer_day/user_interface/canvas/canvas_state.gd @@ -7,8 +7,6 @@ signal view_transform_changed(view_transform, spatial_transform) signal canvas_polygon_changed(polygon) -var test = "Das ist im Canvas_State" - var rect_size: Vector2 var fill_transform := Transform2D.IDENTITY diff --git a/addons/summer_day/user_interface/canvas/mesh_container.gd b/addons/summer_day/user_interface/canvas/mesh_container.gd index e960d84..dd70a30 100644 --- a/addons/summer_day/user_interface/canvas/mesh_container.gd +++ b/addons/summer_day/user_interface/canvas/mesh_container.gd @@ -6,4 +6,11 @@ func _on_Document_add_track(track: SummerDayTrack): var instance = MeshInstance.new() instance.add_to_group("SummerDaySpatialTransform") instance.mesh = track.blueprint.model + + var mesh = instance.mesh + for i in range(mesh.get_surface_count()): + var mat = mesh.surface_get_material(i) + mat.set_shader_param("table", track.table.texture) + # I think this will bug with multiple meshes. Please fix, if so! + add_child(instance, true) diff --git a/addons/summer_day/utilities/matrix_4.gd b/addons/summer_day/utilities/matrix_4.gd index 65e517c..0796a8c 100644 --- a/addons/summer_day/utilities/matrix_4.gd +++ b/addons/summer_day/utilities/matrix_4.gd @@ -80,3 +80,7 @@ func get_values_as_colors() -> Array: ) ) return list + + +func print(): + print(values) diff --git a/addons/summer_day/utilities/summer_day_globals.gd b/addons/summer_day/utilities/summer_day_globals.gd index b3d41f0..e4c5bae 100644 --- a/addons/summer_day/utilities/summer_day_globals.gd +++ b/addons/summer_day/utilities/summer_day_globals.gd @@ -2,8 +2,6 @@ tool extends Node -var test = "Jojojawdfq" - var document: SummerDayDocument var canvas_state: SummerDayCanvasState var interaction_hint: SummerDayInteractionHint diff --git a/production/ann.tres b/production/ann.tres index 56585eb..10746c0 100644 --- a/production/ann.tres +++ b/production/ann.tres @@ -1,31 +1,89 @@ -[gd_resource type="Resource" load_steps=11 format=2] +[gd_resource type="Resource" load_steps=20 format=2] [ext_resource path="res://addons/summer_day/data/document/document.gd" type="Script" id=1] -[ext_resource path="res://addons/summer_day/data/document/table.gd" type="Script" id=2] -[ext_resource path="res://addons/summer_day/data/document/cell.gd" type="Script" id=3] -[ext_resource path="res://production/blueprints/mannequin/mannequin.tres" type="Resource" id=4] -[ext_resource path="res://addons/summer_day/data/document/track.gd" type="Script" id=5] +[ext_resource path="res://addons/summer_day/data/document/cell.gd" type="Script" id=2] +[ext_resource path="res://addons/summer_day/data/document/table.gd" type="Script" id=3] +[ext_resource path="res://addons/summer_day/data/document/track.gd" type="Script" id=4] +[ext_resource path="res://production/blueprints/mannequin/mannequin.tres" type="Resource" id=5] [ext_resource path="res://addons/summer_day/data/blueprint/template_editables/tube.gd" type="Script" id=6] +[ext_resource path="res://Bullshit/THIS SHOULD FIX IThoefully.tres" type="Texture" id=7] -[sub_resource type="Resource" id=1] -script = ExtResource( 6 ) -vertices = PoolVector2Array( -0.4, -0.4, 0.1, -0.4, 0.113769, -0.0876254, -0.4, 0.1, -0.1, -0.1, 0.4, -0.1, 0.4, 0.4, -0.1, 0.4 ) +[sub_resource type="Image" id=1] +data = { +"data": PoolByteArray( 232, 246, 173, 190, 47, 95, 49, 189, 0, 0, 0, 0, 246, 232, 104, 62, 58, 231, 73, 188, 112, 8, 93, 190, 0, 0, 0, 0, 123, 148, 148, 61, 8, 97, 252, 61, 251, 182, 221, 62, 0, 0, 0, 0, 0, 0, 128, 63, 8, 97, 252, 61, 251, 182, 221, 62, 0, 0, 0, 0, 0, 0, 128, 63, 149, 180, 151, 190, 60, 243, 217, 188, 0, 0, 0, 0, 206, 193, 28, 190, 104, 160, 139, 188, 17, 181, 131, 190, 0, 0, 0, 0, 95, 78, 11, 190, 159, 140, 27, 62, 126, 27, 96, 62, 0, 0, 0, 0, 0, 0, 128, 191, 159, 140, 27, 190, 126, 27, 96, 190, 0, 0, 0, 0, 0, 0, 128, 63 ), +"format": "RGBAFloat", +"height": 1, +"mipmaps": false, +"width": 8 +} [sub_resource type="Resource" id=2] script = ExtResource( 3 ) -editable_list = [ SubResource( 1 ) ] +allocation_size = 2 +texture = ExtResource( 7 ) +image = SubResource( 1 ) + +[sub_resource type="Resource" id=3] +script = ExtResource( 6 ) +table = SubResource( 2 ) +vertices = PoolVector2Array( -0.756447, -0.652097, 0.124979, -0.403235, 0.123889, 0.100852, -0.396248, 0.0976196, -0.1, -0.1, 0.4, -0.1, 1.3759, 0.677717, -0.1, 0.4 ) [sub_resource type="Resource" id=4] script = ExtResource( 2 ) -allocation_size = 0 +editable_list = [ SubResource( 3 ) ] -[sub_resource type="Resource" id=3] -script = ExtResource( 5 ) -blueprint = ExtResource( 4 ) -table = SubResource( 4 ) -cells = [ SubResource( 2 ) ] +[sub_resource type="Resource" id=5] +script = ExtResource( 4 ) +blueprint = ExtResource( 5 ) +table = SubResource( 2 ) +cells = [ SubResource( 4 ) ] + +[sub_resource type="Image" id=6] +data = { +"data": PoolByteArray( 232, 246, 173, 190, 47, 95, 49, 189, 0, 0, 0, 0, 246, 232, 104, 62, 58, 231, 73, 188, 112, 8, 93, 190, 0, 0, 0, 0, 123, 148, 148, 61, 8, 97, 252, 61, 251, 182, 221, 62, 0, 0, 0, 0, 0, 0, 128, 63, 8, 97, 252, 61, 251, 182, 221, 62, 0, 0, 0, 0, 0, 0, 128, 63, 149, 180, 151, 190, 60, 243, 217, 188, 0, 0, 0, 0, 206, 193, 28, 190, 104, 160, 139, 188, 17, 181, 131, 190, 0, 0, 0, 0, 95, 78, 11, 190, 159, 140, 27, 62, 126, 27, 96, 62, 0, 0, 0, 0, 0, 0, 128, 191, 159, 140, 27, 190, 126, 27, 96, 190, 0, 0, 0, 0, 0, 0, 128, 63 ), +"format": "RGBAFloat", +"height": 1, +"mipmaps": false, +"width": 8 +} + +[sub_resource type="Image" id=13] +data = { +"data": PoolByteArray( 232, 246, 173, 190, 47, 95, 49, 189, 0, 0, 0, 0, 246, 232, 104, 62, 58, 231, 73, 188, 112, 8, 93, 190, 0, 0, 0, 0, 123, 148, 148, 61, 8, 97, 252, 61, 251, 182, 221, 62, 0, 0, 0, 0, 0, 0, 128, 63, 8, 97, 252, 61, 251, 182, 221, 62, 0, 0, 0, 0, 0, 0, 128, 63, 149, 180, 151, 190, 60, 243, 217, 188, 0, 0, 0, 0, 206, 193, 28, 190, 104, 160, 139, 188, 17, 181, 131, 190, 0, 0, 0, 0, 95, 78, 11, 190, 159, 140, 27, 62, 126, 27, 96, 62, 0, 0, 0, 0, 0, 0, 128, 191, 159, 140, 27, 190, 126, 27, 96, 190, 0, 0, 0, 0, 0, 0, 128, 63 ), +"format": "RGBAFloat", +"height": 1, +"mipmaps": false, +"width": 8 +} + +[sub_resource type="ImageTexture" id=8] +flags = 0 +flags = 0 +image = SubResource( 13 ) +size = Vector2( 8, 1 ) + +[sub_resource type="Resource" id=9] +script = ExtResource( 3 ) +allocation_size = 2 +texture = SubResource( 8 ) +image = SubResource( 6 ) + +[sub_resource type="Resource" id=10] +script = ExtResource( 6 ) +table = SubResource( 9 ) +vertices = PoolVector2Array( -0.756447, -0.652097, 0.124979, -0.403235, 0.123889, 0.100852, -0.396248, 0.0976196, -0.1, -0.1, 0.4, -0.1, 1.3759, 0.677717, -0.1, 0.4 ) + +[sub_resource type="Resource" id=11] +script = ExtResource( 2 ) +editable_list = [ SubResource( 10 ) ] + +[sub_resource type="Resource" id=12] +script = ExtResource( 4 ) +blueprint = ExtResource( 5 ) +table = SubResource( 9 ) +cells = [ SubResource( 11 ) ] [resource] script = ExtResource( 1 ) resolution = Vector2( 1920, 1080 ) -tracks = [ SubResource( 3 ) ] +tracks = [ SubResource( 5 ), SubResource( 12 ) ] diff --git a/production/blueprints/mannequin/mannequin.tres b/production/blueprints/mannequin/mannequin.tres index b0b9da8..f982073 100644 --- a/production/blueprints/mannequin/mannequin.tres +++ b/production/blueprints/mannequin/mannequin.tres @@ -44,9 +44,13 @@ extends SummerDayBlueprint func _create_cell(table: SummerDayTable): var cell = SummerDayCell.new() var cylinder = SummerDayEditableTube.new() + cylinder.table = table cell.editable_list.append(cylinder) return cell -" + + +func get_allocation_size(): + return 2" [resource] script = SubResource( 1 ) diff --git a/production/blueprints/mannequin/mat.tres b/production/blueprints/mannequin/mat.tres index 282edea..fc2b89a 100644 --- a/production/blueprints/mannequin/mat.tres +++ b/production/blueprints/mannequin/mat.tres @@ -1,6 +1,4 @@ -[gd_resource type="ShaderMaterial" load_steps=3 format=2] - -[ext_resource path="res://Bullshit/THIS SHOULD FIX IThoefully.tres" type="Texture" id=1] +[gd_resource type="ShaderMaterial" load_steps=4 format=2] [sub_resource type="Shader" id=1] code = "shader_type spatial; @@ -22,7 +20,7 @@ void vertex() { vec4 row2; vec4 row3; - if (VERTEX.z >= 0.0) { + 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); @@ -38,10 +36,11 @@ void vertex() { 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); + vec3 transformed_xy = vec3(pre.xy / pre.w, 1.0) * transpose(canvas_transform); + vec4 post = vec4(transformed_xy.x, transformed_xy.y, pre.z, 1.0); POSITION = post; - VERTEX = (post / post.w).xyz; + VERTEX = post.xyz; + COLOR = vec4(post.w, post.w - 1.0, post.w * 0.2, 1.0); // vec3 tran = vec3(VERTEX.xy, 1.0) * transpose(canvas_transform); // vec4 pos_t = vec4(tran.x, tran.y, VERTEX.z, 1.0); @@ -50,10 +49,26 @@ void vertex() { } void fragment() { - ALBEDO = vec3(0.33, 0.81, 0.95); + //ALBEDO = vec3(0.33, 0.81, 0.95); + ALBEDO = texture(table, UV).rgb; }" +[sub_resource type="Image" id=9] +data = { +"data": PoolByteArray( 146, 121, 211, 61, 105, 86, 230, 188, 0, 0, 0, 0, 252, 152, 127, 63, 240, 63, 201, 188, 72, 62, 73, 62, 0, 0, 0, 0, 29, 23, 26, 63, 192, 134, 71, 189, 169, 77, 108, 187, 0, 0, 0, 0, 0, 0, 128, 63, 192, 134, 71, 189, 169, 77, 108, 187, 0, 0, 0, 0, 0, 0, 128, 63, 225, 221, 100, 62, 58, 251, 45, 189, 0, 0, 0, 0, 220, 162, 139, 62, 30, 240, 195, 188, 186, 74, 183, 62, 0, 0, 0, 0, 248, 30, 185, 62, 11, 245, 66, 60, 50, 221, 41, 189, 0, 0, 0, 0, 0, 0, 128, 191, 11, 245, 66, 188, 50, 221, 41, 61, 0, 0, 0, 0, 0, 0, 128, 63 ), +"format": "RGBAFloat", +"height": 1, +"mipmaps": false, +"width": 8 +} + +[sub_resource type="ImageTexture" id=8] +flags = 0 +flags = 0 +image = SubResource( 9 ) +size = Vector2( 8, 1 ) + [resource] shader = SubResource( 1 ) -shader_param/canvas_transform = Basis( 0.999546, 0, -0.0981899, 0, -1.22596, -0.0477029, 0, 0, 1 ) -shader_param/table = ExtResource( 1 ) +shader_param/canvas_transform = Basis( 0.715913, 0, -0.474076, 0, -1.32223, 0.449119, 0, 0, 1 ) +shader_param/table = SubResource( 8 ) diff --git a/project.godot b/project.godot index e9cbebb..8f2935b 100644 --- a/project.godot +++ b/project.godot @@ -119,6 +119,11 @@ _global_script_classes=[ { "language": "GDScript", "path": "res://addons/summer_day/tools/canvas/pen.gd" }, { +"base": "Resource", +"class": "SummerDayQuad", +"language": "GDScript", +"path": "res://addons/summer_day/data/blueprint/quad.gd" +}, { "base": "SummerDayTool", "class": "SummerDayRotationCanvasTool", "language": "GDScript", @@ -207,6 +212,7 @@ _global_script_class_icons={ "SummerDayMathHelper": "", "SummerDayMatrix4": "", "SummerDayPenCanvasTool": "", +"SummerDayQuad": "", "SummerDayRotationCanvasTool": "", "SummerDayScene": "", "SummerDaySceneFrame": "",