mirror of
https://github.com/CrispyPin/ovr-utils.git
synced 2024-11-21 23:20:25 +01:00
add godot vr project
This commit is contained in:
parent
6249845625
commit
e7fb97cf4d
44 changed files with 18018 additions and 3 deletions
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -1,9 +1,8 @@
|
|||
|
||||
# Godot-specific ignores
|
||||
.import/
|
||||
export.cfg
|
||||
export_presets.cfg
|
||||
|
||||
# Mono-specific ignores
|
||||
.mono/
|
||||
data_*/
|
||||
|
||||
builds/
|
6
ovr-utils/.gitattributes
vendored
Normal file
6
ovr-utils/.gitattributes
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
*.gd eol=lf
|
||||
*.tscn eol=lf
|
||||
*.cfg eol=lf
|
||||
*.godot eol=lf
|
||||
*.tres eol=lf
|
||||
*.import eol=lf
|
10
ovr-utils/.gitignore
vendored
Normal file
10
ovr-utils/.gitignore
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
*.o
|
||||
*.os
|
||||
.import/
|
||||
*.dblite
|
||||
*.exp
|
||||
*.lib
|
||||
*.obj
|
||||
*.TMP
|
||||
logs
|
||||
Thumbs.db
|
9
ovr-utils/CONTRIBUTORS.md
Normal file
9
ovr-utils/CONTRIBUTORS.md
Normal file
|
@ -0,0 +1,9 @@
|
|||
Contributors
|
||||
============
|
||||
|
||||
This plugin has mostly been developed by [Bastiaan Olij](https://github.com/BastiaanOlij).
|
||||
Special thanks to [Benedikt](https://github.com/beniwtv) for doing all the work on overlay support.
|
||||
|
||||
Other people who have helped out by submitting fixes, enhancements, etc are:
|
||||
- [RMKD](https://github.com/RMKD)
|
||||
- [Bruvzg](https://github.com/bruvzg)
|
21
ovr-utils/LICENSE
Normal file
21
ovr-utils/LICENSE
Normal file
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2018-2020 Bastiaan Olij
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
16
ovr-utils/Overlay.tscn
Normal file
16
ovr-utils/Overlay.tscn
Normal file
|
@ -0,0 +1,16 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://icon.png" type="Texture" id=1]
|
||||
|
||||
[node name="Overlay" type="Control"]
|
||||
margin_right = 561.0
|
||||
margin_bottom = 391.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
texture = ExtResource( 1 )
|
||||
expand = true
|
40
ovr-utils/README.md
Normal file
40
ovr-utils/README.md
Normal file
|
@ -0,0 +1,40 @@
|
|||
# Godot OpenVR GDNative module
|
||||
This module is provided as is, all files are contained within the addons/godot-openvr-asset folder
|
||||
|
||||
This module requires **Godot 3.1 or newer** to run, **Godot 3.2** is highly recommended.
|
||||
|
||||
The scenes subfolder contains a number of godot scenes that help you set up your project.
|
||||
For basic functionality start with adding ovr_first_person.tcn to your project.
|
||||
Also make sure that vsync is turned off in your project settings.
|
||||
|
||||
Source code for this module can be found here:
|
||||
https://github.com/GodotVR/godot_openvr
|
||||
|
||||
Also note that we have a support asset containing a number of useful scenes to get you going building VR applications in Godot:
|
||||
https://github.com/GodotVR/godot-vr-common
|
||||
|
||||
Documentation on using this asset can be found here:
|
||||
https://github.com/GodotVR/godot-openvr-asset/wiki
|
||||
|
||||
HDR support
|
||||
-----------
|
||||
HDR support was added to OpenVR but requires the keep_3d_linear flag added to Godot 3.2. This will ensure rendering inside of the headset is correct. The preview on screen will look darker. You can solve this by using a separate viewport.
|
||||
|
||||
When using Godot 3.1 you need to either use the GLES2 renderer or turn HDR off on the viewport used to render to the HMD.
|
||||
|
||||
Licensing
|
||||
---------
|
||||
The Godot OpenVR module and the godot scenes in this add on are all supplied under an MIT License.
|
||||
|
||||
The dynamic libraries supplier by Valve fall under Valve's own license.
|
||||
For more information about this license please visit https://github.com/ValveSoftware/openvr
|
||||
|
||||
About this repository
|
||||
---------------------
|
||||
This repository was created by and is maintained by Bastiaan Olij a.k.a. Mux213
|
||||
|
||||
You can follow me on twitter for regular updates here:
|
||||
https://twitter.com/mux213
|
||||
|
||||
Videos about my work with Godot including tutorials on working with VR in Godot can by found on my youtube page:
|
||||
https://www.youtube.com/BastiaanOlij
|
25
ovr-utils/addons/godot-openvr/CHANGES.md
Normal file
25
ovr-utils/addons/godot-openvr/CHANGES.md
Normal file
|
@ -0,0 +1,25 @@
|
|||
Changes to the Godot OpenVR asset
|
||||
=================================
|
||||
|
||||
Note, version numbers listed here are the version number assigned to the asset. Each time a new version is uploaded to the asset store we will increase the version number.
|
||||
More frequent updates may be available on the source repository.
|
||||
|
||||
1.0.5 - 1 March 2019
|
||||
--------------------
|
||||
- Now using OpenVR 1.9.16
|
||||
- Added support for overlays
|
||||
|
||||
1.0.4 - 27 March 2019
|
||||
---------------------
|
||||
- Build for Godot 3.1
|
||||
- Now using OpenVR 1.2.10
|
||||
- Added Mac binaries (untested)
|
||||
|
||||
1.0.3 - 23 June 2018
|
||||
--------------------
|
||||
- Now using OpenVR 1.0.15
|
||||
- Fixed crash issue related to new reloadable property in GDNative
|
||||
|
||||
1.0.2 - 4 May 2018
|
||||
------------------
|
||||
Changes were not tracked
|
21
ovr-utils/addons/godot-openvr/LICENSE
Normal file
21
ovr-utils/addons/godot-openvr/LICENSE
Normal file
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2018-2020 Bastiaan Olij
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
8
ovr-utils/addons/godot-openvr/OpenVRConfig.gdns
Normal file
8
ovr-utils/addons/godot-openvr/OpenVRConfig.gdns
Normal file
|
@ -0,0 +1,8 @@
|
|||
[gd_resource type="NativeScript" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/godot-openvr/godot_openvr.gdnlib" type="GDNativeLibrary" id=1]
|
||||
|
||||
[resource]
|
||||
resource_name = "OpenVRConfig"
|
||||
class_name = "OpenVRConfig"
|
||||
library = ExtResource( 1 )
|
8
ovr-utils/addons/godot-openvr/OpenVROverlay.gdns
Normal file
8
ovr-utils/addons/godot-openvr/OpenVROverlay.gdns
Normal file
|
@ -0,0 +1,8 @@
|
|||
[gd_resource type="NativeScript" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/godot-openvr/godot_openvr.gdnlib" type="GDNativeLibrary" id=1]
|
||||
|
||||
[resource]
|
||||
resource_name = "OpenVROverlay"
|
||||
class_name = "OpenVROverlay"
|
||||
library = ExtResource( 1 )
|
11
ovr-utils/addons/godot-openvr/OpenVRRenderModel.gdns
Normal file
11
ovr-utils/addons/godot-openvr/OpenVRRenderModel.gdns
Normal file
|
@ -0,0 +1,11 @@
|
|||
[gd_resource type="NativeScript" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/godot-openvr/godot_openvr.gdnlib" type="GDNativeLibrary" id=1]
|
||||
|
||||
[resource]
|
||||
|
||||
resource_name = "OpenVRRenderModel"
|
||||
class_name = "OpenVRRenderModel"
|
||||
library = ExtResource( 1 )
|
||||
_sections_unfolded = [ "Resource" ]
|
||||
|
27
ovr-utils/addons/godot-openvr/bin/LICENSE
Normal file
27
ovr-utils/addons/godot-openvr/bin/LICENSE
Normal file
|
@ -0,0 +1,27 @@
|
|||
Copyright (c) 2015, Valve Corporation
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
2
ovr-utils/addons/godot-openvr/bin/osx/.gitignore
vendored
Normal file
2
ovr-utils/addons/godot-openvr/bin/osx/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
!*.*
|
||||
.DS_Store
|
|
@ -0,0 +1 @@
|
|||
Versions/Current/Headers
|
|
@ -0,0 +1 @@
|
|||
Versions/Current/OpenVR
|
|
@ -0,0 +1 @@
|
|||
Versions/Current/Resources
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
Binary file not shown.
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.valvesoftware.OpenVR.framework</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>OpenVR</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
</dict>
|
||||
</plist>
|
|
@ -0,0 +1 @@
|
|||
A
|
2
ovr-utils/addons/godot-openvr/bin/osx/README.md
Normal file
2
ovr-utils/addons/godot-openvr/bin/osx/README.md
Normal file
|
@ -0,0 +1,2 @@
|
|||
OSX support is currently untested as we have no contributor who is using Mac OSX for VR development.
|
||||
If you are able and willing to help out please contact us!
|
BIN
ovr-utils/addons/godot-openvr/bin/osx/libgodot_openvr.dylib
Normal file
BIN
ovr-utils/addons/godot-openvr/bin/osx/libgodot_openvr.dylib
Normal file
Binary file not shown.
BIN
ovr-utils/addons/godot-openvr/bin/win64/libgodot_openvr.dll
Normal file
BIN
ovr-utils/addons/godot-openvr/bin/win64/libgodot_openvr.dll
Normal file
Binary file not shown.
BIN
ovr-utils/addons/godot-openvr/bin/win64/openvr_api.dll
Normal file
BIN
ovr-utils/addons/godot-openvr/bin/win64/openvr_api.dll
Normal file
Binary file not shown.
BIN
ovr-utils/addons/godot-openvr/bin/x11/libgodot_openvr.so
Normal file
BIN
ovr-utils/addons/godot-openvr/bin/x11/libgodot_openvr.so
Normal file
Binary file not shown.
BIN
ovr-utils/addons/godot-openvr/bin/x11/libopenvr_api.so
Normal file
BIN
ovr-utils/addons/godot-openvr/bin/x11/libopenvr_api.so
Normal file
Binary file not shown.
20
ovr-utils/addons/godot-openvr/godot_openvr.gdnlib
Normal file
20
ovr-utils/addons/godot-openvr/godot_openvr.gdnlib
Normal file
|
@ -0,0 +1,20 @@
|
|||
[general]
|
||||
|
||||
singleton=true
|
||||
load_once=true
|
||||
symbol_prefix="godot_openvr_"
|
||||
reloadable=false
|
||||
|
||||
[entry]
|
||||
|
||||
X11.64="res://addons/godot-openvr/bin/x11/libgodot_openvr.so"
|
||||
Windows.32="res://addons/godot-openvr/bin/win32/libgodot_openvr.dll"
|
||||
Windows.64="res://addons/godot-openvr/bin/win64/libgodot_openvr.dll"
|
||||
OSX.64="res://addons/godot-openvr/bin/osx/libgodot_openvr.dylib"
|
||||
|
||||
[dependencies]
|
||||
|
||||
X11.64=[ "res://addons/godot-openvr/bin/x11/libopenvr_api.so" ]
|
||||
Windows.32=[ "res://addons/godot-openvr/bin/win32/openvr_api.dll" ]
|
||||
Windows.64=[ "res://addons/godot-openvr/bin/win64/openvr_api.dll" ]
|
||||
OSX.64=[ "res://addons/godot-openvr/bin/osx/OpenVR.framework" ]
|
BIN
ovr-utils/addons/godot-openvr/icon.png
Normal file
BIN
ovr-utils/addons/godot-openvr/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.4 KiB |
34
ovr-utils/addons/godot-openvr/icon.png.import
Normal file
34
ovr-utils/addons/godot-openvr/icon.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/icon.png-a89ecb8be28ea6c50eeae0c3cb0cd271.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/godot-openvr/icon.png"
|
||||
dest_files=[ "res://.import/icon.png-a89ecb8be28ea6c50eeae0c3cb0cd271.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
112
ovr-utils/addons/godot-openvr/scenes/framecounter_in_3d.tscn
Normal file
112
ovr-utils/addons/godot-openvr/scenes/framecounter_in_3d.tscn
Normal file
|
@ -0,0 +1,112 @@
|
|||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[sub_resource type="PlaneMesh" id=1]
|
||||
|
||||
size = Vector2( 0.3, 0.15 )
|
||||
subdivide_width = 10
|
||||
subdivide_depth = 10
|
||||
|
||||
[sub_resource type="Shader" id=2]
|
||||
|
||||
code = "shader_type spatial;
|
||||
render_mode unshaded;
|
||||
|
||||
uniform sampler2D viewport_texture : hint_albedo;
|
||||
|
||||
void vertex() {
|
||||
VERTEX.y = 1.0 - cos(VERTEX.x + 0.3) * 0.5 - cos(VERTEX.z + 0.15) * 0.5;
|
||||
}
|
||||
|
||||
void fragment() {
|
||||
vec4 col = texture(viewport_texture, vec2(1.0-UV.x, UV.y));
|
||||
ALBEDO = col.rgb;
|
||||
ALPHA = col.a;
|
||||
}"
|
||||
|
||||
[sub_resource type="ShaderMaterial" id=3]
|
||||
|
||||
render_priority = 0
|
||||
shader = SubResource( 2 )
|
||||
_sections_unfolded = [ "Resource", "shader_param" ]
|
||||
|
||||
[sub_resource type="GDScript" id=4]
|
||||
|
||||
script/source = "extends MeshInstance
|
||||
|
||||
func _ready():
|
||||
get_surface_material(0).set_shader_param(\"viewport_texture\", $Viewport.get_texture())
|
||||
|
||||
func _process(delta):
|
||||
$Viewport/World/Label.text = str(Engine.get_frames_per_second()) + \" FPS\""
|
||||
|
||||
[node name="FPS" type="MeshInstance" index="0"]
|
||||
|
||||
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0 )
|
||||
layers = 1
|
||||
material_override = null
|
||||
cast_shadow = 1
|
||||
extra_cull_margin = 0.0
|
||||
use_in_baked_light = false
|
||||
lod_min_distance = 0.0
|
||||
lod_min_hysteresis = 0.0
|
||||
lod_max_distance = 0.0
|
||||
lod_max_hysteresis = 0.0
|
||||
mesh = SubResource( 1 )
|
||||
skeleton = NodePath("..")
|
||||
material/0 = SubResource( 3 )
|
||||
script = SubResource( 4 )
|
||||
_sections_unfolded = [ "Transform", "material" ]
|
||||
|
||||
[node name="Viewport" type="Viewport" parent="." index="0"]
|
||||
|
||||
arvr = false
|
||||
size = Vector2( 200, 100 )
|
||||
own_world = false
|
||||
world = null
|
||||
transparent_bg = true
|
||||
msaa = 0
|
||||
hdr = false
|
||||
disable_3d = false
|
||||
usage = 0
|
||||
debug_draw = 0
|
||||
render_target_v_flip = false
|
||||
render_target_clear_mode = 0
|
||||
render_target_update_mode = 3
|
||||
audio_listener_enable_2d = false
|
||||
audio_listener_enable_3d = false
|
||||
physics_object_picking = false
|
||||
gui_disable_input = false
|
||||
gui_snap_controls_to_pixels = true
|
||||
shadow_atlas_size = 0
|
||||
shadow_atlas_quad_0 = 2
|
||||
shadow_atlas_quad_1 = 2
|
||||
shadow_atlas_quad_2 = 3
|
||||
shadow_atlas_quad_3 = 4
|
||||
_sections_unfolded = [ "Render Target", "Rendering" ]
|
||||
|
||||
[node name="World" type="Node2D" parent="Viewport" index="0"]
|
||||
|
||||
_sections_unfolded = [ "Transform", "Z" ]
|
||||
|
||||
[node name="Label" type="Label" parent="Viewport/World" index="0"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_right = 200.0
|
||||
margin_bottom = 100.0
|
||||
rect_scale = Vector2( 3, 3 )
|
||||
rect_pivot_offset = Vector2( 0, 0 )
|
||||
mouse_filter = 2
|
||||
size_flags_horizontal = 1
|
||||
size_flags_vertical = 4
|
||||
custom_colors/font_color = Color( 1, 1, 1, 1 )
|
||||
custom_colors/font_color_shadow = Color( 0, 0, 0, 1 )
|
||||
text = "FPS"
|
||||
percent_visible = 1.0
|
||||
lines_skipped = 0
|
||||
max_lines_visible = -1
|
||||
_sections_unfolded = [ "Anchor", "Grow Direction", "Margin", "Material", "Rect", "Visibility", "custom_colors" ]
|
||||
|
||||
|
64
ovr-utils/addons/godot-openvr/scenes/ovr_controller.gd
Normal file
64
ovr-utils/addons/godot-openvr/scenes/ovr_controller.gd
Normal file
|
@ -0,0 +1,64 @@
|
|||
extends ARVRController
|
||||
|
||||
signal controller_activated(controller)
|
||||
|
||||
export var show_controller_mesh = true setget set_show_controller_mesh, get_show_controller_mesh
|
||||
|
||||
func set_show_controller_mesh(p_show):
|
||||
show_controller_mesh = p_show
|
||||
if $Controller_mesh:
|
||||
$Controller_mesh.visible = p_show
|
||||
|
||||
func get_show_controller_mesh():
|
||||
return show_controller_mesh
|
||||
|
||||
var ovr_render_model
|
||||
var components = Array()
|
||||
var ws = 0
|
||||
|
||||
func _ready():
|
||||
# instance our render model object
|
||||
ovr_render_model = preload("res://addons/godot-openvr/OpenVRRenderModel.gdns").new()
|
||||
|
||||
# set our starting vaule
|
||||
$Controller_mesh.visible = show_controller_mesh
|
||||
|
||||
# hide to begin with
|
||||
visible = false
|
||||
|
||||
func apply_world_scale():
|
||||
var new_ws = ARVRServer.world_scale
|
||||
if (ws != new_ws):
|
||||
ws = new_ws
|
||||
$Controller_mesh.scale = Vector3(ws, ws, ws)
|
||||
|
||||
func load_controller_mesh(controller_name):
|
||||
if ovr_render_model.load_model(controller_name.substr(0, controller_name.length()-2)):
|
||||
return ovr_render_model
|
||||
|
||||
if ovr_render_model.load_model("generic_controller"):
|
||||
return ovr_render_model
|
||||
|
||||
return Mesh.new()
|
||||
|
||||
func _process(delta):
|
||||
if !get_is_active():
|
||||
visible = false
|
||||
return
|
||||
|
||||
# always set our world scale, user may end up changing this
|
||||
apply_world_scale()
|
||||
|
||||
if visible:
|
||||
return
|
||||
|
||||
# became active? lets handle it...
|
||||
var controller_name = get_controller_name()
|
||||
print("Controller " + controller_name + " became active")
|
||||
|
||||
# attempt to load a mesh for this
|
||||
$Controller_mesh.mesh = load_controller_mesh(controller_name)
|
||||
|
||||
# make it visible
|
||||
visible = true
|
||||
emit_signal("controller_activated", self)
|
8
ovr-utils/addons/godot-openvr/scenes/ovr_controller.tscn
Normal file
8
ovr-utils/addons/godot-openvr/scenes/ovr_controller.tscn
Normal file
|
@ -0,0 +1,8 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/godot-openvr/scenes/ovr_controller.gd" type="Script" id=1]
|
||||
|
||||
[node name="OVRController" type="ARVRController"]
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="Controller_mesh" type="MeshInstance" parent="."]
|
55
ovr-utils/addons/godot-openvr/scenes/ovr_first_person.tscn
Normal file
55
ovr-utils/addons/godot-openvr/scenes/ovr_first_person.tscn
Normal file
|
@ -0,0 +1,55 @@
|
|||
[gd_scene load_steps=6 format=2]
|
||||
|
||||
[ext_resource path="res://addons/vr-common/misc/VR_Common_Shader_Cache.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://addons/godot-openvr/scenes/ovr_controller.tscn" type="PackedScene" id=2]
|
||||
|
||||
[sub_resource type="PlaneMesh" id=1]
|
||||
size = Vector2( 0.001, 0.001 )
|
||||
|
||||
[sub_resource type="SpatialMaterial" id=2]
|
||||
|
||||
[sub_resource type="GDScript" id=3]
|
||||
script/source = "extends Spatial
|
||||
|
||||
func _physics_process(delta):
|
||||
# we keep this in line with our camera but we remove the tilt
|
||||
var new_transform = get_node(\"../ARVRCamera\").transform
|
||||
|
||||
var new_basis = Basis()
|
||||
new_basis.z = Vector3(new_transform.basis.z.x, 0.0, new_transform.basis.z.z).normalized()
|
||||
if new_basis.z.length() > 0.5:
|
||||
new_basis.y - Vector3(0.0, 1.0, 0.0)
|
||||
new_basis.x = new_basis.y.cross(new_basis.z)
|
||||
new_transform.basis = new_basis
|
||||
|
||||
transform = new_transform
|
||||
else:
|
||||
# we're looking straight up or down, ignore this
|
||||
pass"
|
||||
|
||||
[node name="OVRFirstPerson" type="ARVROrigin"]
|
||||
|
||||
[node name="ARVRCamera" type="ARVRCamera" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.85, 0 )
|
||||
fov = 65.0
|
||||
near = 0.01
|
||||
far = 1000.01
|
||||
|
||||
[node name="shader_cache" parent="ARVRCamera" instance=ExtResource( 1 )]
|
||||
|
||||
[node name="Controller" type="MeshInstance" parent="ARVRCamera/shader_cache"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -2 )
|
||||
mesh = SubResource( 1 )
|
||||
material/0 = SubResource( 2 )
|
||||
|
||||
[node name="HUD_Anchor" type="Spatial" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.85, 0 )
|
||||
script = SubResource( 3 )
|
||||
|
||||
[node name="Left_Hand" parent="." instance=ExtResource( 2 )]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.5, 1.25, 0 )
|
||||
|
||||
[node name="Right_Hand" parent="." instance=ExtResource( 2 )]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.5, 1.25, 0 )
|
||||
controller_id = 2
|
||||
|
7
ovr-utils/default_env.tres
Normal file
7
ovr-utils/default_env.tres
Normal file
|
@ -0,0 +1,7 @@
|
|||
[gd_resource type="Environment" load_steps=2 format=2]
|
||||
|
||||
[sub_resource type="ProceduralSky" id=1]
|
||||
|
||||
[resource]
|
||||
background_mode = 2
|
||||
background_sky = SubResource( 1 )
|
BIN
ovr-utils/icon.png
Normal file
BIN
ovr-utils/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.2 KiB |
34
ovr-utils/icon.png.import
Normal file
34
ovr-utils/icon.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://icon.png"
|
||||
dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
21
ovr-utils/main.gd
Normal file
21
ovr-utils/main.gd
Normal file
|
@ -0,0 +1,21 @@
|
|||
extends Spatial
|
||||
|
||||
var size : Vector2
|
||||
|
||||
func _init() -> void:
|
||||
#pass
|
||||
#func _ready() -> void:
|
||||
var OpenVRConfig = preload("res://addons/godot-openvr/OpenVRConfig.gdns").new()
|
||||
OpenVRConfig.set_application_type(2) # Set to OVERLAY MODE = 2, NORMAL MODE = 1
|
||||
OpenVRConfig.set_tracking_universe(1) # Set to SEATED MODE = 0, STANDING MODE = 1, RAW MODE = 2
|
||||
|
||||
# Find the OpenVR interface and initialise it
|
||||
var arvr_interface : ARVRInterface = ARVRServer.find_interface("OpenVR")
|
||||
|
||||
if arvr_interface and arvr_interface.initialize():
|
||||
size = arvr_interface.get_render_targetsize()
|
||||
|
||||
func _ready() -> void:
|
||||
$Viewport.size = size
|
||||
#$VRViewport.size = size
|
||||
|
17
ovr-utils/main.tscn
Normal file
17
ovr-utils/main.tscn
Normal file
|
@ -0,0 +1,17 @@
|
|||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://main.gd" type="Script" id=1]
|
||||
[ext_resource path="res://addons/godot-openvr/OpenVROverlay.gdns" type="Script" id=3]
|
||||
[ext_resource path="res://Overlay.tscn" type="PackedScene" id=4]
|
||||
|
||||
[node name="Spatial" type="Spatial"]
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="Viewport" type="Viewport" parent="."]
|
||||
arvr = true
|
||||
size = Vector2( 100, 100 )
|
||||
transparent_bg = true
|
||||
render_target_update_mode = 3
|
||||
script = ExtResource( 3 )
|
||||
|
||||
[node name="Overlay" parent="Viewport" instance=ExtResource( 4 )]
|
27
ovr-utils/project.godot
Normal file
27
ovr-utils/project.godot
Normal file
|
@ -0,0 +1,27 @@
|
|||
; Engine configuration file.
|
||||
; It's best edited using the editor UI and not directly,
|
||||
; since the parameters that go here are not all obvious.
|
||||
;
|
||||
; Format:
|
||||
; [section] ; section goes between []
|
||||
; param=value ; assign values to parameters
|
||||
|
||||
config_version=4
|
||||
|
||||
[application]
|
||||
|
||||
config/name="ovr-utils"
|
||||
run/main_scene="res://main.tscn"
|
||||
config/icon="res://icon.png"
|
||||
|
||||
[gdnative]
|
||||
|
||||
singletons=[ "res://addons/godot-openvr/godot_openvr.gdnlib" ]
|
||||
|
||||
[physics]
|
||||
|
||||
common/enable_pause_aware_picking=true
|
||||
|
||||
[rendering]
|
||||
|
||||
environment/default_environment="res://default_env.tres"
|
Loading…
Reference in a new issue