Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Commit

Permalink
Release 2.1.0 (#120)
Browse files Browse the repository at this point in the history
* Update gradle build config files in order to enable prefab publishing (see https://developer.android.com/studio/build/native-dependencies?agpversion=4.1)

* Deprecate `OvrDisplayRefreshRate` and replace with `OvrDisplay`:
  * Added api to set the color scale.
  * Added api to report the primary controller type.
  * Update documentation for the new apis

* Add hand pointer implementation to the plugin demo

* Update Android Studio to version 4.1.
  • Loading branch information
Fredia Huya-Kouadio authored Oct 13, 2020
1 parent 03a561f commit 5079324
Show file tree
Hide file tree
Showing 38 changed files with 1,683 additions and 783 deletions.
20 changes: 11 additions & 9 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ AllowAllParametersOfDeclarationOnNextLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: true
BinPackArguments: false
BinPackParameters: false
BreakBeforeTernaryOperators: false
BreakConstructorInitializers: AfterColon
ColumnLimit: 100
Expand All @@ -18,14 +20,6 @@ ContinuationIndentWidth: 8
Cpp11BracedListStyle: false
DisableFormat: false
FixNamespaceComments: true
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '".*"'
Priority: 1
- Regex: '^<.*\.h>'
Priority: 2
- Regex: '^<.*'
Priority: 3
IndentCaseLabels: true
IndentWidth: 4
KeepEmptyLinesAtTheStartOfBlocks: false
Expand All @@ -40,8 +34,16 @@ UseTab: Never
### C++ specific config ###
Language: Cpp
Standard: Auto
AccessModifierOffset: -4
AccessModifierOffset: -3
AllowShortFunctionsOnASingleLine: Inline
IncludeBlocks: Merge
IncludeCategories:
- Regex: '".*"'
Priority: 1
- Regex: '^<.*\.h>'
Priority: 2
- Regex: '^<.*'
Priority: 3
---
### Java specific config ###
Language: Java
Expand Down
489 changes: 486 additions & 3 deletions .editorconfig

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Clone the repository and **initialise the submodules** with `git submodule updat

#### Oculus Mobile SDK
- Download the [latest version](https://developer.oculus.com/downloads/package/oculus-mobile-sdk/)
(**Oculus Mobile SDK 17.0** (1.34.0) or higher) of the Oculus Mobile SDK and extract it into the
(**Oculus Mobile SDK 19.0** (1.36.0) or higher) of the Oculus Mobile SDK and extract it into the
`plugin/libs/ovr_sdk_mobile` directory (create the directory if it doesn't exist).
- If you change the default install location, update the `OVR_ROOT_DIR` cmake variable in the the
`plugin/CMakeLists.txt` build file to point to the Oculus Mobile SDK install location.
Expand All @@ -69,7 +69,8 @@ Clone the repository and **initialise the submodules** with `git submodule updat
- Navigate to the `plugin/libs/godot-cpp` directory and follow [these steps](https://github.com/GodotNativeTools/godot-cpp/tree/master#compiling-the-cpp-bindings-library) to generate the cpp bindings.

#### Android SDK & NDK
- Download and setup [Android Studio version **4.0** or higher](https://developer.android.com/studio).
- Download and setup
[Android Studio version **4.1** or higher](https://developer.android.com/studio).
- After setup, ensure you have the latest versions by checking the [SDK Manager](https://developer.android.com/studio/intro/update.html#sdk-manager) for updates.
- Set the environment variable `ANDROID_HOME` to the Android SDK location.
- Follow the instructions [here](https://developer.android.com/studio/projects/install-ndk#specific-version) and install version **21.0.6113669** of the NDK.
Expand Down
25 changes: 11 additions & 14 deletions build.gradle.kts → build.gradle
Original file line number Diff line number Diff line change
@@ -1,43 +1,40 @@
apply(from = "config.gradle.kts")
apply from: 'config.gradle'

buildscript {
apply(from = "config.gradle.kts")

val kotlinVersion: String by extra
val gradlePluginVersion: String by extra
apply from: 'config.gradle'

repositories {
google()
jcenter()

}
dependencies {
classpath("com.android.tools.build:gradle:$gradlePluginVersion")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
classpath "com.android.tools.build:gradle:$versions.gradlePluginVersion"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$versions.kotlinVersion"
}
}

allprojects {
repositories {
google()
jcenter()

}
}

val outputDir = "build/outputs"
def outputDir = "build/outputs"

task clean(type: Delete) {
dependsOn(":OVRMobile:clean")

tasks.register<Delete>("clean") {
delete(rootProject.buildDir)

// Delete the contents of the outputs directory.
// Delete the contents of the outputs directory
delete(outputDir)
}

/**
* Generate the plugin binaries.
*/
tasks.register<Copy>("generatePluginBinary") {
task generatePluginBinary(type: Copy) {
dependsOn(":OVRMobile:assembleDebug")
dependsOn(":OVRMobile:assembleRelease")
from("plugin/build/outputs/aar")
Expand All @@ -48,7 +45,7 @@ tasks.register<Copy>("generatePluginBinary") {
* Generate the plugin native shared libraries.
* This is mostly to be used by maintainers to update the https://github.com/GodotVR/godot-oculus-mobile-asset repo.
*/
tasks.register<Copy>("generateSharedLibs") {
task generateSharedLibs(type: Copy) {
dependsOn(":OVRMobile:externalNativeBuildDebug")
dependsOn(":OVRMobile:externalNativeBuildRelease")

Expand Down
8 changes: 8 additions & 0 deletions config.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ext.versions = [
gradlePluginVersion: '4.1.0',
compileSdk : 30,
minSdk : 18,
targetSdk : 30,
buildTools : '30.0.1',
kotlinVersion : '1.4.10',
]
7 changes: 0 additions & 7 deletions config.gradle.kts

This file was deleted.

18 changes: 13 additions & 5 deletions demo/addons/godot_ovrmobile/example_scenes/arvr_origin.gd
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var ovr_init_config = null;

# the other APIs are available during runtime
var ovr_performance = null;
var ovr_display_refresh_rate = null;
var ovr_display = null;
var ovr_vr_api_proxy = null;

# some of the Oculus VrAPI constants are defined in this file. Have a look into it to learn more
Expand Down Expand Up @@ -51,14 +51,22 @@ func _initialize_ovr_mobile_arvr_interface():
Engine.iterations_per_second = 72 # Quest

# load the .gdns classes.
ovr_display_refresh_rate = load("res://addons/godot_ovrmobile/OvrDisplayRefreshRate.gdns");
ovr_display = load("res://addons/godot_ovrmobile/OvrDisplay.gdns");
ovr_performance = load("res://addons/godot_ovrmobile/OvrPerformance.gdns");
ovr_vr_api_proxy = load("res://addons/godot_ovrmobile/OvrVrApiProxy.gdns");

# and now instance the .gdns classes for use if load was successfull
if (ovr_display_refresh_rate): ovr_display_refresh_rate = ovr_display_refresh_rate.new()
if (ovr_performance): ovr_performance = ovr_performance.new()
if (ovr_vr_api_proxy): ovr_vr_api_proxy = ovr_vr_api_proxy.new()
if (ovr_display):
ovr_display = ovr_display.new()
# Get the list of supported display refresh rates.
print("Display refresh rates: " + str(ovr_display.get_supported_display_refresh_rates()))
# Get the device color space
print("Device color space: " + str(ovr_display.get_color_space()))

if (ovr_performance):
ovr_performance = ovr_performance.new()
if (ovr_vr_api_proxy):
ovr_vr_api_proxy = ovr_vr_api_proxy.new()

# Connect to the plugin signals
_connect_to_signals()
Expand Down
9 changes: 8 additions & 1 deletion demo/addons/godot_ovrmobile/example_scenes/arvr_origin.tscn
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
[gd_scene load_steps=7 format=2]
[gd_scene load_steps=8 format=2]

[ext_resource path="res://addons/godot_ovrmobile/example_scenes/touch_controller.dae" type="PackedScene" id=1]
[ext_resource path="res://addons/godot_ovrmobile/example_scenes/left_hand_model.glb" type="PackedScene" id=2]
[ext_resource path="res://addons/godot_ovrmobile/example_scenes/right_hand_model.glb" type="PackedScene" id=3]
[ext_resource path="res://addons/godot_ovrmobile/example_scenes/arvr_origin.gd" type="Script" id=4]
[ext_resource path="res://addons/godot_ovrmobile/example_scenes/oculus_touch_controller.gd" type="Script" id=5]
[ext_resource path="res://addons/godot_ovrmobile/example_scenes/oculus_hand_tracker.gd" type="Script" id=6]
[ext_resource path="res://addons/godot_ovrmobile/example_scenes/hand_pointer.tscn" type="PackedScene" id=7]

[node name="ARVROrigin" type="ARVROrigin"]
script = ExtResource( 4 )
Expand Down Expand Up @@ -34,12 +35,18 @@ script = ExtResource( 6 )

[node name="HandModel" parent="LeftHand" instance=ExtResource( 2 )]

[node name="HandPointer" parent="LeftHand/HandModel" instance=ExtResource( 7 )]
visible = false

[node name="RightHand" type="ARVRController" parent="."]
transform = Transform( 1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.346606, 1.72656, -0.4 )
controller_id = 2
script = ExtResource( 6 )

[node name="HandModel" parent="RightHand" instance=ExtResource( 3 )]

[node name="HandPointer" parent="RightHand/HandModel" instance=ExtResource( 7 )]
visible = false
[connection signal="button_pressed" from="LeftTouchController" to="LeftTouchController" method="_on_LeftTouchController_button_pressed"]
[connection signal="button_pressed" from="RightTouchController" to="RightTouchController" method="_on_RightTouchController_button_pressed"]
[connection signal="button_release" from="RightTouchController" to="RightTouchController" method="_on_RightTouchController_button_release"]
Expand Down
28 changes: 28 additions & 0 deletions demo/addons/godot_ovrmobile/example_scenes/hand_pointer.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[gd_scene load_steps=5 format=2]

[ext_resource path="res://addons/godot_ovrmobile/example_scenes/ray_cast_with_reticle.gd" type="Script" id=1]
[ext_resource path="res://addons/godot_ovrmobile/example_scenes/ray_reticle.tscn" type="PackedScene" id=2]

[sub_resource type="SpatialMaterial" id=1]

[sub_resource type="CylinderMesh" id=2]
material = SubResource( 1 )
top_radius = 0.001
bottom_radius = 0.01
height = 0.05

[node name="HandPointer" type="Spatial"]

[node name="RayCast" type="RayCast" parent="." groups=[
"gast_ray_caster",
]]
enabled = true
cast_to = Vector3( 0, 0, -4 )
script = ExtResource( 1 )

[node name="RayReticle" parent="RayCast" instance=ExtResource( 2 )]

[node name="PointerModel" type="MeshInstance" parent="."]
transform = Transform( 1, 0, 0, 0, -1.62921e-07, 1, 0, -1, -1.62921e-07, 0, 0, -0.03 )
mesh = SubResource( 2 )
material/0 = null
11 changes: 11 additions & 0 deletions demo/addons/godot_ovrmobile/example_scenes/oculus_hand_tracker.gd
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Quat(-0.081241, -0.013242, 0.560496, 0.824056), Quat(0.00276, 0.037404, 0.637818
var _t = 0.0

onready var hand_model : Spatial = $HandModel
onready var hand_pointer : Spatial = $HandModel/HandPointer

func _ready():
_initialize_hands()
Expand All @@ -53,6 +54,7 @@ func _ready():

func _process(delta_t):
_update_hand_model(hand_model, hand_skel);
_update_hand_pointer(hand_pointer)

# If we are on desktop or don't have hand tracking we set a debug pose on the left hand
if (controller_id == LEFT_TRACKER_ID && !ovr_hand_tracking):
Expand Down Expand Up @@ -111,6 +113,15 @@ func _update_hand_model(model : Spatial, skel: Skeleton):
return false;


func _update_hand_pointer(model: Spatial):
if (ovr_hand_tracking): # check if the hand tracking API was loaded
if (ovr_hand_tracking.is_pointer_pose_valid(controller_id)):
model.visible = true
model.global_transform = ovr_hand_tracking.get_pointer_pose(controller_id)
else:
model.visible = false


func _on_LeftHand_pinch_pressed(button):
if (button == FINGER_PINCH.INDEX_PINCH): print("Left Index Pinching");
if (button == FINGER_PINCH.MIDDLE_PINCH):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
extends RayCast

onready var ray_reticle = $RayReticle

func _physics_process(delta):
ray_reticle.visible = is_colliding()
if (ray_reticle.visible):
ray_reticle.translation = to_local(get_collision_point())

13 changes: 13 additions & 0 deletions demo/addons/godot_ovrmobile/example_scenes/ray_reticle.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[gd_scene load_steps=3 format=2]

[sub_resource type="SpatialMaterial" id=1]
albedo_color = Color( 1, 1, 1, 0.75 )

[sub_resource type="SphereMesh" id=2]
material = SubResource( 1 )
radius = 0.02
height = 0.04

[node name="RayReticle" type="MeshInstance"]
mesh = SubResource( 2 )
material/0 = null
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Jun 03 16:52:10 PDT 2020
#Wed Sep 23 18:33:41 PDT 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
2 changes: 1 addition & 1 deletion plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

project(godot_ovrmobile)
project(godot_ovrmobile VERSION 2.0.0)

###############################################################################
## PROJECT SETUP
Expand Down
27 changes: 18 additions & 9 deletions plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ apply plugin: "com.android.library"
apply plugin: "kotlin-android"

android {
compileSdkVersion compileSdk
buildToolsVersion = buildTools
buildToolsVersion = versions.buildTools
compileSdkVersion versions.compileSdk
ndkVersion "21.1.6352462"

defaultConfig {
minSdkVersion minSdk
targetSdkVersion targetSdk
versionCode 2
versionName '2.0.0'
minSdkVersion versions.minSdk
targetSdkVersion versions.targetSdk
versionCode 3
versionName '2.1.0'
setProperty("archivesBaseName", "gdovrmobile.${versionName}")

externalNativeBuild {
Expand All @@ -23,8 +24,6 @@ android {
}
}

ndkVersion "21.0.6113669"

externalNativeBuild {
cmake {
path "CMakeLists.txt"
Expand All @@ -35,10 +34,20 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

buildFeatures {
prefabPublishing true
}

prefab {
godot_ovrmobile {
headers "src/main/cpp"
}
}
}

dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:$versions.kotlinVersion")
if (rootProject.findProject(":godot:lib") != null) {
compileOnly(project(":godot:lib"))
} else {
Expand Down
2 changes: 1 addition & 1 deletion plugin/gdovrmobile.gdap
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

name="OVRMobile"
binary_type="local"
binary="gdovrmobile.2.0.0-release.aar"
binary="gdovrmobile.2.1.0-release.aar"
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
[ext_resource path="res://addons/godot_ovrmobile/godot_ovrmobile.gdnlib" type="GDNativeLibrary" id=1]

[resource]
resource_name = "OvrDisplayRefreshRate"
class_name = "OvrDisplayRefreshRate"
resource_name = "OvrDisplay"
class_name = "OvrDisplay"
library = ExtResource( 1 )
Loading

0 comments on commit 5079324

Please sign in to comment.