Skip to content

Commit

Permalink
Add fb-composition-layer-sample project
Browse files Browse the repository at this point in the history
  • Loading branch information
devloglogan committed May 29, 2024
1 parent b3ccf3c commit e6413cb
Show file tree
Hide file tree
Showing 15 changed files with 2,174 additions and 0 deletions.
27 changes: 27 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ task clean(type: Delete) {
delete rootProject.buildDir

dependsOn 'cleanAddon'
dependsOn 'cleanBuildFromSamples'

dependsOn ':godotopenxrkhronos:clean'
dependsOn ':godotopenxrlynx:clean'
Expand All @@ -55,6 +56,8 @@ task buildPlugin {
dependsOn ":godotopenxrlynx:build"
dependsOn ":godotopenxrmeta:build"
dependsOn ":godotopenxrpico:build"

finalizedBy "copyBuildToSamples"
}

/**
Expand Down Expand Up @@ -125,4 +128,28 @@ task buildSconsArtifacts {

dependsOn 'buildGodotOpenXRVendorsDebugGDExtension'
dependsOn 'buildGodotOpenXRVendorsReleaseGDExtension'
}

task copyBuildToSamples {
def sourceDir = file 'demo/addons/godotopenxrvendors'
def samplesDir = file 'samples'
doLast{
samplesDir.eachDir { targetSubdir ->
copy {
from sourceDir
into "${targetSubdir}/addons/godotopenxrvendors"
}
}
}
}

task cleanBuildFromSamples {
def samplesDir = file 'samples'
doLast{
samplesDir.eachDir { targetSubdir ->
delete {
delete "${targetSubdir}/addons/godotopenxrvendors"
}
}
}
}
2 changes: 2 additions & 0 deletions samples/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Normalize EOL for all files that Git considers text files.
* text=auto eol=lf
4 changes: 4 additions & 0 deletions samples/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Godot 4+ specific ignores
*/.godot/
*/addons/godotopenxrvendors
*/android/
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Ignore copies of the binaries Godot makes at startup
.bin/windows/*/*/~*.dll
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[configuration]

entry_symbol = "plugin_library_init"
compatibility_minimum = "4.3"
android_aar_plugin = true

[libraries]

android.debug.arm64 = "res://addons/godotopenxrvendors/.bin/android/template_debug/arm64/libgodotopenxrvendors.so"
android.release.arm64 = "res://addons/godotopenxrvendors/.bin/android/template_release/arm64/libgodotopenxrvendors.so"
android.debug.x86_64 = "res://addons/godotopenxrvendors/.bin/android/template_debug/x86_64/libgodotopenxrvendors.so"
android.release.x86_64 = "res://addons/godotopenxrvendors/.bin/android/template_release/x86_64/libgodotopenxrvendors.so"
macos.debug = "res://addons/godotopenxrvendors/.bin/macos/template_debug/libgodotopenxrvendors.macos.framework"
macos.release = "res://addons/godotopenxrvendors/.bin/macos/template_release/libgodotopenxrvendors.macos.framework"
windows.debug.x86_64 = "res://addons/godotopenxrvendors/.bin/windows/template_debug/x86_64/libgodotopenxrvendors.dll"
windows.release.x86_64 = "res://addons/godotopenxrvendors/.bin/windows/template_release/x86_64/libgodotopenxrvendors.dll"
linux.debug.x86_64 = "res://addons/godotopenxrvendors/.bin/linux/template_debug/x86_64/libgodotopenxrvendors.so"
linux.release.x86_64 = "res://addons/godotopenxrvendors/.bin/linux/template_release/x86_64/libgodotopenxrvendors.so"
19 changes: 19 additions & 0 deletions samples/fb-composition-layers-sample/example_panel.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
extends Control

@export var display_string: String = ""

@onready var pointer_left: ColorRect = $PointerLeft
@onready var pointer_right: ColorRect = $PointerRight

var start_pos: Vector2

func _ready() -> void:
start_pos = $Label.position
$Label.text = display_string

func _process(delta: float) -> void:
$Label.position = Vector2(start_pos.x + (100.0 * sin(Time.get_ticks_msec() * 0.001 * 2)), start_pos.y)

func update_pointers(p_position_left: Vector2, p_position_right: Vector2) -> void:
pointer_left.position = size * p_position_left - (0.5 * pointer_left.size)
pointer_right.position = size * p_position_right - (0.5 * pointer_left.size)
44 changes: 44 additions & 0 deletions samples/fb-composition-layers-sample/example_panel.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
[gd_scene load_steps=3 format=3 uid="uid://v75csjjxgtpx"]

[ext_resource type="Script" path="res://example_panel.gd" id="1_tdwln"]

[sub_resource type="LabelSettings" id="LabelSettings_8sbod"]

[node name="ExamplePanel" type="Control"]
auto_translate_mode = 1
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_tdwln")

[node name="Label" type="Label" parent="."]
auto_translate_mode = 1
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -22.5
offset_top = -11.5
offset_right = 22.5
offset_bottom = 11.5
grow_horizontal = 2
grow_vertical = 2
text = "Hello!"
label_settings = SubResource("LabelSettings_8sbod")

[node name="PointerRight" type="ColorRect" parent="."]
layout_mode = 0
offset_right = 10.0
offset_bottom = 10.0
color = Color(1, 0, 1, 1)

[node name="PointerLeft" type="ColorRect" parent="."]
layout_mode = 0
offset_right = 10.0
offset_bottom = 10.0
color = Color(1, 1, 0, 1)
227 changes: 227 additions & 0 deletions samples/fb-composition-layers-sample/export_presets.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,227 @@
[preset.0]

name="Quest"
platform="Android"
runnable=true
advanced_options=true
dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="../builds/FbPassthroughSample.apk"
encryption_include_filters=""
encryption_exclude_filters=""
encrypt_pck=false
encrypt_directory=false
script_export_mode=2

[preset.0.options]

custom_template/debug=""
custom_template/release=""
gradle_build/use_gradle_build=true
gradle_build/gradle_build_directory=""
gradle_build/android_source_template=""
gradle_build/compress_native_libraries=false
gradle_build/export_format=0
gradle_build/min_sdk=""
gradle_build/target_sdk=""
architectures/armeabi-v7a=false
architectures/arm64-v8a=true
architectures/x86=false
architectures/x86_64=false
version/code=1
version/name=""
package/unique_name="com.godotopenxrvendors.fbcompositionlayersample"
package/name=""
package/signed=true
package/app_category=2
package/retain_data_on_uninstall=false
package/exclude_from_recents=false
package/show_in_android_tv=false
package/show_in_app_library=true
package/show_as_launcher_app=false
launcher_icons/main_192x192=""
launcher_icons/adaptive_foreground_432x432=""
launcher_icons/adaptive_background_432x432=""
graphics/opengl_debug=false
xr_features/xr_mode=1
screen/immersive_mode=true
screen/support_small=true
screen/support_normal=true
screen/support_large=true
screen/support_xlarge=true
user_data_backup/allow=false
command_line/extra_args=""
apk_expansion/enable=false
apk_expansion/SALT=""
apk_expansion/public_key=""
permissions/custom_permissions=PackedStringArray()
permissions/access_checkin_properties=false
permissions/access_coarse_location=false
permissions/access_fine_location=false
permissions/access_location_extra_commands=false
permissions/access_mock_location=false
permissions/access_network_state=false
permissions/access_surface_flinger=false
permissions/access_wifi_state=false
permissions/account_manager=false
permissions/add_voicemail=false
permissions/authenticate_accounts=false
permissions/battery_stats=false
permissions/bind_accessibility_service=false
permissions/bind_appwidget=false
permissions/bind_device_admin=false
permissions/bind_input_method=false
permissions/bind_nfc_service=false
permissions/bind_notification_listener_service=false
permissions/bind_print_service=false
permissions/bind_remoteviews=false
permissions/bind_text_service=false
permissions/bind_vpn_service=false
permissions/bind_wallpaper=false
permissions/bluetooth=false
permissions/bluetooth_admin=false
permissions/bluetooth_privileged=false
permissions/brick=false
permissions/broadcast_package_removed=false
permissions/broadcast_sms=false
permissions/broadcast_sticky=false
permissions/broadcast_wap_push=false
permissions/call_phone=false
permissions/call_privileged=false
permissions/camera=false
permissions/capture_audio_output=false
permissions/capture_secure_video_output=false
permissions/capture_video_output=false
permissions/change_component_enabled_state=false
permissions/change_configuration=false
permissions/change_network_state=false
permissions/change_wifi_multicast_state=false
permissions/change_wifi_state=false
permissions/clear_app_cache=false
permissions/clear_app_user_data=false
permissions/control_location_updates=false
permissions/delete_cache_files=false
permissions/delete_packages=false
permissions/device_power=false
permissions/diagnostic=false
permissions/disable_keyguard=false
permissions/dump=false
permissions/expand_status_bar=false
permissions/factory_test=false
permissions/flashlight=false
permissions/force_back=false
permissions/get_accounts=false
permissions/get_package_size=false
permissions/get_tasks=false
permissions/get_top_activity_info=false
permissions/global_search=false
permissions/hardware_test=false
permissions/inject_events=false
permissions/install_location_provider=false
permissions/install_packages=false
permissions/install_shortcut=false
permissions/internal_system_window=false
permissions/internet=false
permissions/kill_background_processes=false
permissions/location_hardware=false
permissions/manage_accounts=false
permissions/manage_app_tokens=false
permissions/manage_documents=false
permissions/manage_external_storage=false
permissions/master_clear=false
permissions/media_content_control=false
permissions/modify_audio_settings=false
permissions/modify_phone_state=false
permissions/mount_format_filesystems=false
permissions/mount_unmount_filesystems=false
permissions/nfc=false
permissions/persistent_activity=false
permissions/post_notifications=false
permissions/process_outgoing_calls=false
permissions/read_calendar=false
permissions/read_call_log=false
permissions/read_contacts=false
permissions/read_external_storage=false
permissions/read_frame_buffer=false
permissions/read_history_bookmarks=false
permissions/read_input_state=false
permissions/read_logs=false
permissions/read_phone_state=false
permissions/read_profile=false
permissions/read_sms=false
permissions/read_social_stream=false
permissions/read_sync_settings=false
permissions/read_sync_stats=false
permissions/read_user_dictionary=false
permissions/reboot=false
permissions/receive_boot_completed=false
permissions/receive_mms=false
permissions/receive_sms=false
permissions/receive_wap_push=false
permissions/record_audio=false
permissions/reorder_tasks=false
permissions/restart_packages=false
permissions/send_respond_via_message=false
permissions/send_sms=false
permissions/set_activity_watcher=false
permissions/set_alarm=false
permissions/set_always_finish=false
permissions/set_animation_scale=false
permissions/set_debug_app=false
permissions/set_orientation=false
permissions/set_pointer_speed=false
permissions/set_preferred_applications=false
permissions/set_process_limit=false
permissions/set_time=false
permissions/set_time_zone=false
permissions/set_wallpaper=false
permissions/set_wallpaper_hints=false
permissions/signal_persistent_processes=false
permissions/status_bar=false
permissions/subscribed_feeds_read=false
permissions/subscribed_feeds_write=false
permissions/system_alert_window=false
permissions/transmit_ir=false
permissions/uninstall_shortcut=false
permissions/update_device_stats=false
permissions/use_credentials=false
permissions/use_sip=false
permissions/vibrate=false
permissions/wake_lock=false
permissions/write_apn_settings=false
permissions/write_calendar=false
permissions/write_call_log=false
permissions/write_contacts=false
permissions/write_external_storage=false
permissions/write_gservices=false
permissions/write_history_bookmarks=false
permissions/write_profile=false
permissions/write_secure_settings=false
permissions/write_settings=false
permissions/write_sms=false
permissions/write_social_stream=false
permissions/write_sync_settings=false
permissions/write_user_dictionary=false
xr_features/enable_meta_plugin=true
meta_xr_features/eye_tracking=0
meta_xr_features/hand_tracking=2
meta_xr_features/hand_tracking_frequency=0
meta_xr_features/passthrough=2
meta_xr_features/use_anchor_api=false
meta_xr_features/quest_1_support=false
meta_xr_features/quest_2_support=true
meta_xr_features/quest_3_support=true
meta_xr_features/quest_pro_support=true
xr_features/enable_pico_plugin=false
xr_features/enable_lynx_plugin=false
xr_features/enable_khronos_plugin=false
meta_xr_features/face_tracking=0
meta_xr_features/body_tracking=0
meta_xr_features/render_model=2
meta_xr_features/use_scene_api=false
meta_xr_features/use_overlay_keyboard=false
meta_xr_features/use_experimental_features=false
meta_xr_features/boundary_mode=0
1 change: 1 addition & 0 deletions samples/fb-composition-layers-sample/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit e6413cb

Please sign in to comment.