Reframe cockpit around industrial reference
This commit is contained in:
1 parent
c2b3ac42a3
commit
dffe790926
9 files changed
+146
-95
No files matched your search
@@ -6,8 +6,10 @@ const CockpitMeshFactory = preload("res://game/presentation/cockpit/cockpit_mesh
|
||||
const DiveAlertLevel = preload("res://game/domain/dive/dive_alert_level.gd")
|
||||
|
||||
var _materials: CockpitMaterialPalette
|
||||
var _oxygen_needle: Node3D
|
||||
var _battery_needle: Node3D
|
||||
var _pressure_needle: Node3D
|
||||
var _hull_needle: Node3D
|
||||
var _depth_needle: Node3D
|
||||
var _indicator_materials: Array[StandardMaterial3D] = []
|
||||
var _active_indicator_count := 0
|
||||
|
||||
@@ -15,29 +17,49 @@ var _active_indicator_count := 0
|
||||
func _init(materials: CockpitMaterialPalette) -> void:
|
||||
_materials = materials
|
||||
name = "AnalogGauges"
|
||||
_build_binnacle()
|
||||
_build_instrument_cluster()
|
||||
_build_indicator_bank()
|
||||
_oxygen_needle = _add_gauge(
|
||||
"OxygenGauge",
|
||||
Vector3(-0.50, 0.12, 0.145),
|
||||
"%",
|
||||
0.72
|
||||
)
|
||||
_battery_needle = _add_gauge(
|
||||
"BatteryGauge",
|
||||
Vector3(-0.095, 0.315, 0.145),
|
||||
"%"
|
||||
Vector3(-0.22, 0.12, 0.145),
|
||||
"%",
|
||||
0.72
|
||||
)
|
||||
_pressure_needle = _add_gauge(
|
||||
"PressureGauge",
|
||||
Vector3(0.095, 0.315, 0.145),
|
||||
"BAR"
|
||||
_hull_needle = _add_gauge(
|
||||
"HullGauge",
|
||||
Vector3(0.05, 0.12, 0.145),
|
||||
"%",
|
||||
0.56
|
||||
)
|
||||
_add_binnacle_label("CHARGE BAT.", Vector3(-0.095, 0.235, 0.160))
|
||||
_add_binnacle_label("PRESSION COQUE", Vector3(0.095, 0.235, 0.160))
|
||||
_depth_needle = _add_gauge(
|
||||
"DepthGauge",
|
||||
Vector3(0.40, 0.12, 0.145),
|
||||
"%",
|
||||
0.90
|
||||
)
|
||||
_add_cluster_label("OXYGÈNE", Vector3(-0.50, 0.025, 0.170))
|
||||
_add_cluster_label("BATTERIE", Vector3(-0.22, 0.025, 0.170))
|
||||
_add_cluster_label("COQUE", Vector3(0.05, 0.045, 0.170))
|
||||
_add_cluster_label("PROFONDEUR", Vector3(0.40, 0.005, 0.170))
|
||||
|
||||
|
||||
func present(
|
||||
oxygen_ratio: float,
|
||||
battery_ratio: float,
|
||||
pressure_ratio: float,
|
||||
hull_ratio: float,
|
||||
depth_ratio: float,
|
||||
alert_level: DiveAlertLevel.Value
|
||||
) -> void:
|
||||
_set_needle_ratio(_oxygen_needle, oxygen_ratio)
|
||||
_set_needle_ratio(_battery_needle, battery_ratio)
|
||||
_set_needle_ratio(_pressure_needle, pressure_ratio)
|
||||
_set_needle_ratio(_hull_needle, hull_ratio)
|
||||
_set_needle_ratio(_depth_needle, depth_ratio)
|
||||
_update_indicator_bank(alert_level)
|
||||
|
||||
|
||||
@@ -49,23 +71,27 @@ func indicator_count() -> int:
|
||||
return _indicator_materials.size()
|
||||
|
||||
|
||||
func gauge_count() -> int:
|
||||
return 4
|
||||
|
||||
|
||||
func active_indicator_count() -> int:
|
||||
return _active_indicator_count
|
||||
|
||||
|
||||
func _build_binnacle() -> void:
|
||||
func _build_instrument_cluster() -> void:
|
||||
CockpitMeshFactory.add_box(
|
||||
"BinnacleHousing",
|
||||
"InstrumentClusterHousing",
|
||||
self,
|
||||
Vector3(0.0, 0.290, 0.095),
|
||||
Vector3(0.40, 0.180, 0.105),
|
||||
Vector3(-0.04, 0.105, 0.095),
|
||||
Vector3(1.26, 0.255, 0.105),
|
||||
_materials.overhead_steel
|
||||
)
|
||||
CockpitMeshFactory.add_box(
|
||||
"BinnacleFoot",
|
||||
"InstrumentClusterFoot",
|
||||
self,
|
||||
Vector3(0.0, 0.205, 0.075),
|
||||
Vector3(0.47, 0.040, 0.14),
|
||||
Vector3(-0.04, -0.025, 0.075),
|
||||
Vector3(1.32, 0.040, 0.14),
|
||||
_materials.dark_steel
|
||||
)
|
||||
|
||||
@@ -81,11 +107,11 @@ func _build_indicator_bank() -> void:
|
||||
]
|
||||
var captions: Array[String] = ["SYS", "ATTN", "ALRM"]
|
||||
for indicator_index in colors.size():
|
||||
var x := -0.055 + indicator_index * 0.055
|
||||
var y := 0.165 - indicator_index * 0.050
|
||||
CockpitMeshFactory.add_cylinder(
|
||||
"%sBezel" % captions[indicator_index],
|
||||
root,
|
||||
Vector3(x, 0.198, 0.156),
|
||||
Vector3(0.205, y, 0.156),
|
||||
0.016,
|
||||
0.012,
|
||||
_materials.brass,
|
||||
@@ -96,7 +122,7 @@ func _build_indicator_bank() -> void:
|
||||
CockpitMeshFactory.add_cylinder(
|
||||
"%sLens" % captions[indicator_index],
|
||||
root,
|
||||
Vector3(x, 0.198, 0.165),
|
||||
Vector3(0.205, y, 0.165),
|
||||
0.009,
|
||||
0.008,
|
||||
material,
|
||||
@@ -108,7 +134,7 @@ func _build_indicator_bank() -> void:
|
||||
label.font_size = 8
|
||||
label.pixel_size = 0.00042
|
||||
label.modulate = Color(0.70, 0.67, 0.56)
|
||||
label.position = Vector3(x, 0.177, 0.168)
|
||||
label.position = Vector3(0.235, y, 0.168)
|
||||
root.add_child(label)
|
||||
|
||||
|
||||
@@ -136,7 +162,7 @@ func _update_indicator_bank(alert_level: DiveAlertLevel.Value) -> void:
|
||||
_active_indicator_count = 1
|
||||
|
||||
|
||||
func _add_binnacle_label(caption: String, position: Vector3) -> void:
|
||||
func _add_cluster_label(caption: String, position: Vector3) -> void:
|
||||
var label := Label3D.new()
|
||||
label.name = "%sLabel" % caption.to_pascal_case().replace(" ", "")
|
||||
label.text = caption
|
||||
@@ -147,18 +173,23 @@ func _add_binnacle_label(caption: String, position: Vector3) -> void:
|
||||
add_child(label)
|
||||
|
||||
|
||||
func _add_gauge(gauge_name: String, position: Vector3, caption: String) -> Node3D:
|
||||
func _add_gauge(
|
||||
gauge_name: String,
|
||||
position: Vector3,
|
||||
caption: String,
|
||||
gauge_scale: float
|
||||
) -> Node3D:
|
||||
var gauge := Node3D.new()
|
||||
gauge.name = gauge_name
|
||||
gauge.position = position
|
||||
gauge.scale = Vector3(0.62, 0.62, 0.62)
|
||||
gauge.scale = Vector3(gauge_scale, gauge_scale, gauge_scale)
|
||||
add_child(gauge)
|
||||
CockpitMeshFactory.add_box(
|
||||
"MountingPlate",
|
||||
gauge,
|
||||
Vector3(0.0, 0.0, -0.025),
|
||||
Vector3(0.225, 0.225, 0.055),
|
||||
_materials.dark_steel
|
||||
_materials.overhead_steel
|
||||
)
|
||||
for screw_position: Vector2 in [
|
||||
Vector2(-0.086, -0.086),
|
||||
@@ -182,7 +213,7 @@ func _add_gauge(gauge_name: String, position: Vector3, caption: String) -> Node3
|
||||
bezel_mesh.height = 0.035
|
||||
bezel_mesh.radial_segments = 32
|
||||
bezel.mesh = bezel_mesh
|
||||
bezel.material_override = _materials.brass
|
||||
bezel.material_override = _materials.brushed_steel
|
||||
bezel.rotation_degrees.x = 90.0
|
||||
gauge.add_child(bezel)
|
||||
var face := MeshInstance3D.new()
|
||||
|
||||
Reference in new issue
Block a user