-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
171 additions
and
123 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
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
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
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
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 |
---|---|---|
@@ -1,18 +1,8 @@ | ||
[gd_resource type="StandardMaterial3D" load_steps=4 format=3 uid="uid://b6aokpwbpsi2l"] | ||
[gd_resource type="StandardMaterial3D" load_steps=2 format=3 uid="uid://b6aokpwbpsi2l"] | ||
|
||
[ext_resource type="Texture2D" uid="uid://dplxjdemisp4h" path="res://src/models/icosahedron/test/UV_face_index.png" id="1_w4ekc"] | ||
[ext_resource type="Shader" path="res://src/models/icosahedron/shaders/cutplane_effect_v3.gdshader" id="2_x1gid"] | ||
|
||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_2ft62"] | ||
render_priority = 0 | ||
shader = ExtResource("2_x1gid") | ||
shader_parameter/cutplane = Vector4(0.358, 0, 0.934, 0.794) | ||
shader_parameter/color = Color(0, 1, 0, 1) | ||
shader_parameter/enable = true | ||
shader_parameter/outline_thickness = 0.0 | ||
|
||
[resource] | ||
resource_name = "Material.002" | ||
next_pass = SubResource("ShaderMaterial_2ft62") | ||
albedo_texture = ExtResource("1_w4ekc") | ||
roughness = 0.5 |
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 |
---|---|---|
@@ -1,40 +1,39 @@ | ||
@tool | ||
extends Node3D | ||
|
||
const IcosahedronScene = preload('res://src/models/icosahedron/Icosahedron.tscn') | ||
var G: Globals = Globals.new() | ||
@onready var icosahedron: Icosahedron = $Icosahedron | ||
|
||
@export var a := false: | ||
set(val): | ||
var new_figure = IcosahedronScene.instantiate() | ||
new_figure.shader_type = 1 | ||
self.add_child(new_figure) | ||
new_figure.owner = get_tree().edited_scene_root | ||
print_debug(new_figure.shader_type) | ||
|
||
@export var b := false: | ||
set(val): | ||
for i in self.get_children(): | ||
remove_child(i) | ||
|
||
@export var c := 0: | ||
set(val): | ||
c = val | ||
var a : Icosahedron = get_child(0) | ||
print_debug(a) | ||
a.shader_type = val | ||
|
||
var controlledNode | ||
# TODO get from defaults | ||
var ROTATION_SPEED := 12 | ||
@export var show_face_numbers: bool = false | ||
# Called when the node enters the scene tree for the first time. | ||
func _ready() -> void: | ||
#if not get_tree().edited_scene_root.get_node_or_null('./globals'): | ||
#var globals = Globals.new() | ||
#globals.set_name('globals') | ||
#get_tree().edited_scene_root.call_deferred('add_child', globals) | ||
#G = get_tree().edited_scene_root.get_node('./globals') | ||
pass # Replace with function body. | ||
var new_figure = IcosahedronScene.instantiate().with_type(1).with_face_numbers(show_face_numbers) | ||
add_child(new_figure) | ||
controlledNode = new_figure.mesh_icosahedron | ||
|
||
|
||
# Called every frame. 'delta' is the elapsed time since the previous frame. | ||
func _process(delta: float) -> void: | ||
if not controlledNode: | ||
return | ||
if Input.is_action_just_pressed('ui_accept'): | ||
controlledNode.transform.basis = Basis(Quaternion()).orthonormalized() | ||
handle_free_spin_input(delta) | ||
pass | ||
|
||
func handle_free_spin_input(delta: float): | ||
var _rotation: Quaternion | ||
var rs := ROTATION_SPEED / 10. * delta | ||
var is_inverted = false | ||
|
||
if Input.is_action_pressed("ui_up"): | ||
_rotation = _rotation * Quaternion(0, 0, -rs, 1, ) | ||
if Input.is_action_pressed("ui_down"): | ||
_rotation = _rotation * Quaternion(0, 0, rs, 1, ) | ||
if Op.xor(is_inverted, Input.is_action_pressed("ui_right")): | ||
_rotation = _rotation * Quaternion(0, rs, 0, 1, ) | ||
if Op.xor(is_inverted, Input.is_action_pressed("ui_left")): | ||
_rotation = _rotation * Quaternion(0, -rs, 0, 1, ) | ||
if controlledNode and _rotation: | ||
var t = _rotation.normalized() * controlledNode.quaternion | ||
controlledNode.transform.basis = Basis(t).orthonormalized() |
Oops, something went wrong.