Skip to content

Commit 45789a8

Browse files
Merge pull request #18 from SpectrumPro/dev
V0.3.0 Update
2 parents 379e2f3 + 1a7c62e commit 45789a8

File tree

702 files changed

+294752
-1110
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

702 files changed

+294752
-1110
lines changed

.github/Capure.PNG

84.9 KB
Loading

.github/workflows/godot-export.yml

Lines changed: 0 additions & 41 deletions
This file was deleted.

3D.tscn

Lines changed: 606 additions & 0 deletions
Large diffs are not rendered by default.

Add_fixture.tscn

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
[gd_scene load_steps=2 format=3 uid="uid://c3lrdtiw05qft"]
2+
3+
[ext_resource type="Theme" uid="uid://cyua45ur0ijqo" path="res://Main.theme" id="1_460tm"]
4+
5+
[node name="PanelContainer" type="PanelContainer"]
6+
anchors_preset = 15
7+
anchor_right = 1.0
8+
anchor_bottom = 1.0
9+
grow_horizontal = 2
10+
grow_vertical = 2
11+
size_flags_horizontal = 3
12+
size_flags_vertical = 3
13+
theme = ExtResource("1_460tm")
14+
15+
[node name="MarginContainer" type="MarginContainer" parent="."]
16+
layout_mode = 2
17+
theme_override_constants/margin_left = 10
18+
theme_override_constants/margin_top = 10
19+
theme_override_constants/margin_right = 10
20+
theme_override_constants/margin_bottom = 10
21+
22+
[node name="HSplitContainer" type="HSplitContainer" parent="MarginContainer"]
23+
layout_mode = 2
24+
split_offset = 100
25+
26+
[node name="Fixture Tree" type="Tree" parent="MarginContainer/HSplitContainer"]
27+
layout_mode = 2
28+
size_flags_horizontal = 3
29+
30+
[node name="PanelContainer" type="PanelContainer" parent="MarginContainer/HSplitContainer"]
31+
layout_mode = 2
32+
size_flags_horizontal = 3
33+
34+
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/HSplitContainer/PanelContainer"]
35+
layout_mode = 2
36+
37+
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/HSplitContainer/PanelContainer/VBoxContainer"]
38+
layout_mode = 2
39+
40+
[node name="Label" type="Label" parent="MarginContainer/HSplitContainer/PanelContainer/VBoxContainer/HBoxContainer"]
41+
layout_mode = 2
42+
text = "Channel"
43+
44+
[node name="SpinBox" type="SpinBox" parent="MarginContainer/HSplitContainer/PanelContainer/VBoxContainer/HBoxContainer"]
45+
layout_mode = 2
46+
size_flags_horizontal = 10
47+
48+
[node name="HBoxContainer3" type="HBoxContainer" parent="MarginContainer/HSplitContainer/PanelContainer/VBoxContainer"]
49+
layout_mode = 2
50+
51+
[node name="Label" type="Label" parent="MarginContainer/HSplitContainer/PanelContainer/VBoxContainer/HBoxContainer3"]
52+
layout_mode = 2
53+
text = "Universe"
54+
55+
[node name="Fixture Universe Option" type="OptionButton" parent="MarginContainer/HSplitContainer/PanelContainer/VBoxContainer/HBoxContainer3"]
56+
custom_minimum_size = Vector2(200, 0)
57+
layout_mode = 2
58+
size_flags_horizontal = 10
59+
item_count = 2
60+
popup/item_0/text = "Universe 1"
61+
popup/item_0/id = 0
62+
popup/item_1/text = "Universe 2"
63+
popup/item_1/id = 1
64+
65+
[node name="HSeparator" type="HSeparator" parent="MarginContainer/HSplitContainer/PanelContainer/VBoxContainer"]
66+
layout_mode = 2
67+
68+
[node name="HBoxContainer4" type="HBoxContainer" parent="MarginContainer/HSplitContainer/PanelContainer/VBoxContainer"]
69+
layout_mode = 2
70+
71+
[node name="Label" type="Label" parent="MarginContainer/HSplitContainer/PanelContainer/VBoxContainer/HBoxContainer4"]
72+
layout_mode = 2
73+
text = "Mode
74+
"
75+
76+
[node name="Modes" type="OptionButton" parent="MarginContainer/HSplitContainer/PanelContainer/VBoxContainer/HBoxContainer4"]
77+
custom_minimum_size = Vector2(200, 0)
78+
layout_mode = 2
79+
size_flags_horizontal = 10
80+
item_count = 1
81+
selected = 0
82+
fit_to_longest_item = false
83+
popup/item_0/text = " "
84+
popup/item_0/id = 0
85+
86+
[node name="Channel List" type="ItemList" parent="MarginContainer/HSplitContainer/PanelContainer/VBoxContainer"]
87+
custom_minimum_size = Vector2(0, 200)
88+
layout_mode = 2
89+
allow_search = false
90+
91+
[node name="HBoxContainer5" type="HBoxContainer" parent="MarginContainer/HSplitContainer/PanelContainer/VBoxContainer"]
92+
layout_mode = 2
93+
size_flags_vertical = 10
94+
95+
[node name="Label" type="Label" parent="MarginContainer/HSplitContainer/PanelContainer/VBoxContainer/HBoxContainer5"]
96+
layout_mode = 2
97+
text = "Quantity"
98+
99+
[node name="SpinBox" type="SpinBox" parent="MarginContainer/HSplitContainer/PanelContainer/VBoxContainer/HBoxContainer5"]
100+
layout_mode = 2
101+
size_flags_horizontal = 10
102+
103+
[node name="HBoxContainer6" type="HBoxContainer" parent="MarginContainer/HSplitContainer/PanelContainer/VBoxContainer"]
104+
layout_mode = 2
105+
size_flags_vertical = 8
106+
107+
[node name="Label" type="Label" parent="MarginContainer/HSplitContainer/PanelContainer/VBoxContainer/HBoxContainer6"]
108+
layout_mode = 2
109+
text = "Offset"
110+
111+
[node name="SpinBox" type="SpinBox" parent="MarginContainer/HSplitContainer/PanelContainer/VBoxContainer/HBoxContainer6"]
112+
layout_mode = 2
113+
size_flags_horizontal = 10
114+
115+
[node name="HBoxContainer2" type="HBoxContainer" parent="MarginContainer/HSplitContainer/PanelContainer/VBoxContainer"]
116+
layout_mode = 2
117+
size_flags_vertical = 8
118+
119+
[node name="Add Fixture Button" type="Button" parent="MarginContainer/HSplitContainer/PanelContainer/VBoxContainer/HBoxContainer2"]
120+
layout_mode = 2
121+
size_flags_horizontal = 3
122+
text = "Add Fixture"

Assets/3D/Camera3D.gd

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
class_name FreeLookCamera extends Camera3D
2+
3+
# Modifier keys' speed multiplier
4+
const SHIFT_MULTIPLIER = 2.5
5+
const ALT_MULTIPLIER = 1.0 / SHIFT_MULTIPLIER
6+
7+
8+
@export_range(0.0, 1.0) var sensitivity: float = 0.25
9+
10+
# Mouse state
11+
var _mouse_position = Vector2(0.0, 0.0)
12+
var _total_pitch = 0.0
13+
14+
# Movement state
15+
var _direction = Vector3(0.0, 0.0, 0.0)
16+
var _velocity = Vector3(0.0, 0.0, 0.0)
17+
var _acceleration = 30
18+
var _deceleration = -10
19+
var _vel_multiplier = 4
20+
21+
# Keyboard state
22+
var _w = false
23+
var _s = false
24+
var _a = false
25+
var _d = false
26+
var _q = false
27+
var _e = false
28+
var _shift = false
29+
var _alt = false
30+
31+
func _input(event):
32+
# Receives mouse motion
33+
if event is InputEventMouseMotion:
34+
_mouse_position = event.relative
35+
36+
# Receives mouse button input
37+
if event is InputEventMouseButton:
38+
match event.button_index:
39+
MOUSE_BUTTON_RIGHT: # Only allows rotation if right click down
40+
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED if event.pressed else Input.MOUSE_MODE_VISIBLE)
41+
MOUSE_BUTTON_WHEEL_UP: # Increases max velocity
42+
_vel_multiplier = clamp(_vel_multiplier * 1.1, 0.2, 20)
43+
MOUSE_BUTTON_WHEEL_DOWN: # Decereases max velocity
44+
_vel_multiplier = clamp(_vel_multiplier / 1.1, 0.2, 20)
45+
46+
# Receives key input
47+
if event is InputEventKey:
48+
match event.keycode:
49+
KEY_W:
50+
_w = event.pressed
51+
KEY_S:
52+
_s = event.pressed
53+
KEY_A:
54+
_a = event.pressed
55+
KEY_D:
56+
_d = event.pressed
57+
KEY_Q:
58+
_q = event.pressed
59+
KEY_E:
60+
_e = event.pressed
61+
KEY_SHIFT:
62+
_shift = event.pressed
63+
KEY_ALT:
64+
_alt = event.pressed
65+
66+
# Updates mouselook and movement every frame
67+
func _process(delta):
68+
_update_mouselook()
69+
_update_movement(delta)
70+
71+
# Updates camera movement
72+
func _update_movement(delta):
73+
# Computes desired direction from key states
74+
_direction = Vector3(
75+
(_d as float) - (_a as float),
76+
(_e as float) - (_q as float),
77+
(_s as float) - (_w as float)
78+
)
79+
80+
# Computes the change in velocity due to desired direction and "drag"
81+
# The "drag" is a constant acceleration on the camera to bring it's velocity to 0
82+
var offset = _direction.normalized() * _acceleration * _vel_multiplier * delta \
83+
+ _velocity.normalized() * _deceleration * _vel_multiplier * delta
84+
85+
# Compute modifiers' speed multiplier
86+
var speed_multi = 1
87+
if _shift: speed_multi *= SHIFT_MULTIPLIER
88+
if _alt: speed_multi *= ALT_MULTIPLIER
89+
90+
# Checks if we should bother translating the camera
91+
if _direction == Vector3.ZERO and offset.length_squared() > _velocity.length_squared():
92+
# Sets the velocity to 0 to prevent jittering due to imperfect deceleration
93+
_velocity = Vector3.ZERO
94+
else:
95+
# Clamps speed to stay within maximum value (_vel_multiplier)
96+
_velocity.x = clamp(_velocity.x + offset.x, -_vel_multiplier, _vel_multiplier)
97+
_velocity.y = clamp(_velocity.y + offset.y, -_vel_multiplier, _vel_multiplier)
98+
_velocity.z = clamp(_velocity.z + offset.z, -_vel_multiplier, _vel_multiplier)
99+
100+
translate(_velocity * delta * speed_multi)
101+
102+
# Updates mouse look
103+
func _update_mouselook():
104+
# Only rotates mouse if the mouse is captured
105+
if Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED:
106+
_mouse_position *= sensitivity
107+
var yaw = _mouse_position.x
108+
var pitch = _mouse_position.y
109+
_mouse_position = Vector2(0, 0)
110+
111+
# Prevents looking up/down too far
112+
pitch = clamp(pitch, -90 - _total_pitch, 90 - _total_pitch)
113+
_total_pitch += pitch
114+
115+
rotate_y(deg_to_rad(-yaw))
116+
rotate_object_local(Vector3(1,0,0), deg_to_rad(-pitch))

Assets/3D/Light.tscn

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[gd_scene load_steps=3 format=3 uid="uid://csex1cusgig"]
2+
3+
[ext_resource type="PackedScene" uid="uid://bnwurf5jfs7qx" path="res://Assets/3D/light.glb" id="1_inr13"]
4+
5+
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_1q57w"]
6+
albedo_color = Color(0.286275, 0.286275, 0.286275, 1)
7+
metallic = 1.0
8+
9+
[node name="light" instance=ExtResource("1_inr13")]
10+
11+
[node name="Cylinder" parent="." index="0"]
12+
surface_material_override/0 = SubResource("StandardMaterial3D_1q57w")

Assets/3D/Metal.tres

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[gd_resource type="StandardMaterial3D" format=3 uid="uid://jwlx0lbgr8ab"]
2+
3+
[resource]
4+
albedo_color = Color(0.415686, 0.415686, 0.415686, 1)
5+
metallic = 1.0

Assets/3D/Room Lights.gd

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
extends Node3D
2+
3+
4+
# Called when the node enters the scene tree for the first time.
5+
func _ready():
6+
for n in self.get_children():
7+
n.light_energy = 0.01
8+
# n.light_energy = 1
9+
10+
11+
# Called every frame. 'delta' is the elapsed time since the previous frame.
12+
func _process(delta):
13+
pass

Assets/3D/light.glb

247 KB
Binary file not shown.

Assets/3D/light.glb.import

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[remap]
2+
3+
importer="scene"
4+
importer_version=1
5+
type="PackedScene"
6+
uid="uid://bnwurf5jfs7qx"
7+
path="res://.godot/imported/light.glb-97e41cbd03027fad717944b5c4394651.scn"
8+
9+
[deps]
10+
11+
source_file="res://Assets/3D/light.glb"
12+
dest_files=["res://.godot/imported/light.glb-97e41cbd03027fad717944b5c4394651.scn"]
13+
14+
[params]
15+
16+
nodes/root_type=""
17+
nodes/root_name=""
18+
nodes/apply_root_scale=true
19+
nodes/root_scale=1.0
20+
meshes/ensure_tangents=true
21+
meshes/generate_lods=true
22+
meshes/create_shadow_meshes=true
23+
meshes/light_baking=1
24+
meshes/lightmap_texel_size=0.2
25+
meshes/force_disable_compression=false
26+
skins/use_named_skins=true
27+
animation/import=true
28+
animation/fps=30
29+
animation/trimming=false
30+
animation/remove_immutable_tracks=true
31+
import_script/path=""
32+
_subresources={}
33+
gltf/naming_version=1
34+
gltf/embedded_image_handling=1

0 commit comments

Comments
 (0)