|
|
@ -18,24 +18,18 @@ var _has_received_frame: bool = false |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _ready() -> void: |
|
|
func _ready() -> void: |
|
|
# Get or create the material — duplicate to ensure each instance has its own |
|
|
|
|
|
_material = material_override as StandardMaterial3D |
|
|
|
|
|
if _material != null: |
|
|
|
|
|
_material = _material.duplicate() as StandardMaterial3D |
|
|
|
|
|
material_override = _material |
|
|
|
|
|
else: |
|
|
|
|
|
|
|
|
# Always create a fresh material — instanced scenes share sub_resources, |
|
|
|
|
|
# so we must not reuse the scene's material or all quads show the same texture |
|
|
_material = StandardMaterial3D.new() |
|
|
_material = StandardMaterial3D.new() |
|
|
material_override = _material |
|
|
|
|
|
|
|
|
|
|
|
# Configure material for unlit display (no scene lighting affects the webcam feed) |
|
|
|
|
|
_material.shading_mode = BaseMaterial3D.SHADING_MODE_UNSHADED |
|
|
_material.shading_mode = BaseMaterial3D.SHADING_MODE_UNSHADED |
|
|
_material.albedo_color = default_color |
|
|
_material.albedo_color = default_color |
|
|
_material.transparency = BaseMaterial3D.TRANSPARENCY_ALPHA |
|
|
_material.transparency = BaseMaterial3D.TRANSPARENCY_ALPHA |
|
|
|
|
|
material_override = _material |
|
|
|
|
|
|
|
|
# Create initial texture (will be replaced on first frame) |
|
|
# Create initial texture (will be replaced on first frame) |
|
|
_texture = ImageTexture.new() |
|
|
_texture = ImageTexture.new() |
|
|
|
|
|
|
|
|
print("[WebcamDisplay] Ready, waiting for frames...") |
|
|
|
|
|
|
|
|
print("[WebcamDisplay] %s ready, waiting for frames..." % name) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _process(delta: float) -> void: |
|
|
func _process(delta: float) -> void: |
|
|
|