mirror of
https://github.com/CLfamilaris/VRDOM.git
synced 2024-11-11 22:47:09 +01:00
Foot tracker support and Spout2 for capture!
This commit is contained in:
parent
0eb387a62f
commit
5b19c0699c
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,7 +2,6 @@
|
||||
.godot/
|
||||
*.dblite
|
||||
|
||||
*.dll
|
||||
*.lib
|
||||
*.exp
|
||||
*.obj
|
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"godotTools.editorPath.godot4": "c:\\Users\\LLatt\\Downloads\\Godot_v4.2.1-stable_mono_win64\\Godot_v4.2.1-stable_mono_win64.exe"
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
<Project Sdk="Godot.NET.Sdk/4.1.1">
|
||||
<Project Sdk="Godot.NET.Sdk/4.2.1">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<EnableDynamicLoading>true</EnableDynamicLoading>
|
||||
|
9
VRDOM.csproj.old
Normal file
9
VRDOM.csproj.old
Normal file
@ -0,0 +1,9 @@
|
||||
<Project Sdk="Godot.NET.Sdk/4.1.1">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<EnableDynamicLoading>true</EnableDynamicLoading>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ScreenCapture.NET" Version="1.3.1" />
|
||||
</ItemGroup>
|
||||
</Project>
|
65
addons/spout_gd/README.md
Normal file
65
addons/spout_gd/README.md
Normal file
@ -0,0 +1,65 @@
|
||||
# Spout GD
|
||||
|
||||
[Godot](https://github.com/godotengine/godot) 4.2.1 bindings for [Spout](https://github.com/leadedge/Spout2).
|
||||
|
||||
The Godot 3 engine module is located on the `godot-3` branch.
|
||||
|
||||
Precompiled builds of the plugin can be found in the [releases](../../releases/tag/latest) section of github.
|
||||
|
||||
## Status
|
||||
|
||||
The sender/receiver apis have been implemented. Please open an issue if something doesn't seem to work.
|
||||
|
||||
## Building
|
||||
|
||||
Prerequisites:
|
||||
|
||||
* Windows (Spout only works on Windows)
|
||||
* git
|
||||
* bash
|
||||
* scons
|
||||
* a C++ compiler capable of [compiling Godot](https://docs.godotengine.org/en/stable/contributing/development/compiling/compiling_for_windows.html)
|
||||
* cmake
|
||||
|
||||
Clone the repository: `git clone --recurse-submodules https://github.com/you-win/spout-gd.git`
|
||||
|
||||
Run `build.sh` in a bash-compatible terminal. This will:
|
||||
|
||||
* Compile Spout2
|
||||
* Compile the gdextension bindings
|
||||
* Compile spout-gd
|
||||
|
||||
Once compilation is finished, the following files should be moved to your project's `addons/spout-gd` folder (create it manually if it does not exist):
|
||||
|
||||
* `spout_gd.gdextension`
|
||||
* `Spout2/Binaries/x64/SpoutLibrary.dll`
|
||||
* `out/pick_the_correct_file_here.dll`
|
||||
|
||||
## Basic usage
|
||||
|
||||
```gdscript
|
||||
var spout: Spout
|
||||
var my_image: Image = load_from_somewhere_idk() # Provide your own image somehow
|
||||
func _ready():
|
||||
spout = Spout.new()
|
||||
|
||||
spout.send_image(my_image, image.get_width(), image.get_height())
|
||||
```
|
||||
|
||||
## SpoutTexture - Simple Receiving
|
||||
|
||||
Provided as a convenience is a Texture resource for receiving streams from a Spout sender. You can use this any place you can use any other kind of Texture, including places like UI elements and Materials on 3D objects.
|
||||
|
||||
The sender is polled per render cycle.
|
||||
|
||||
<img src="https://github.com/erodozer/spout-gd/assets/316728/989389ab-23ed-4ae0-8ccc-ca9ba51f6346" width=400>
|
||||
|
||||
<img src="https://github.com/erodozer/spout-gd/assets/316728/dab4ed75-e046-4197-be50-5d634216b7c2" width=600>
|
||||
|
||||
## SpoutViewport - Simple Sending
|
||||
|
||||
By wrapping the scene you wish to render in a SpoutViewport, you can easily send render target contents over Spout. Simply use it the same way as you would a SubViewport, and assign a sender name for it to assume.
|
||||
|
||||
The SpoutViewport is designed to only send during application run time, not within the editor. This helps prevent creating multiple senders with the same name during testing, allowing for more stable capture.
|
||||
|
||||
<img src="https://github.com/erodozer/spout-gd/assets/316728/08a021a6-eaab-408e-9961-51adac31e958" width=800>
|
BIN
addons/spout_gd/SpoutLibrary.dll
Normal file
BIN
addons/spout_gd/SpoutLibrary.dll
Normal file
Binary file not shown.
15
addons/spout_gd/spout_gd.gdextension
Normal file
15
addons/spout_gd/spout_gd.gdextension
Normal file
@ -0,0 +1,15 @@
|
||||
[configuration]
|
||||
entry_symbol = "spout_gd_library_init"
|
||||
compatibility_minimum = 4.2
|
||||
|
||||
[libraries]
|
||||
windows.debug.x86_64 = "res://addons/spout_gd/spout_gd.windows.template_debug.dll"
|
||||
windows.release.x86_64 = "res://addons/spout_gd/spout_gd.windows.template_release.dll"
|
||||
|
||||
[dependencies]
|
||||
windows.debug.x86_64 = {
|
||||
"SpoutLibrary.dll": ""
|
||||
}
|
||||
windows.release.x86_64 = {
|
||||
"SpoutLibrary.dll": ""
|
||||
}
|
BIN
addons/spout_gd/spout_gd.windows.template_debug.dll
Normal file
BIN
addons/spout_gd/spout_gd.windows.template_debug.dll
Normal file
Binary file not shown.
BIN
addons/spout_gd/spout_gd.windows.template_release.dll
Normal file
BIN
addons/spout_gd/spout_gd.windows.template_release.dll
Normal file
Binary file not shown.
BIN
addons/spout_gd/~spout_gd.windows.template_debug.dll
Normal file
BIN
addons/spout_gd/~spout_gd.windows.template_debug.dll
Normal file
Binary file not shown.
@ -12,7 +12,7 @@ config_version=5
|
||||
|
||||
config/name="VRDOM"
|
||||
run/main_scene="res://Main.tscn"
|
||||
config/features=PackedStringArray("4.1", "C#", "Forward Plus")
|
||||
config/features=PackedStringArray("4.2", "C#", "Forward Plus")
|
||||
config/icon="res://icon.svg"
|
||||
|
||||
[audio]
|
||||
|
@ -1,66 +0,0 @@
|
||||
using System.Threading;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Godot;
|
||||
using ScreenCapture.NET;
|
||||
|
||||
public partial class DisplayCapture : CsgMesh3D
|
||||
{
|
||||
private IScreenCapture _screenCapture;
|
||||
private CaptureZone _capZone;
|
||||
private ImageTexture _texture;
|
||||
private Image _image;
|
||||
private Thread _capThread;
|
||||
private CancellationTokenSource cancel = new CancellationTokenSource();
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
// Create a screen-capture service
|
||||
IScreenCaptureService screenCaptureService = new DX11ScreenCaptureService();
|
||||
|
||||
// Get all available graphics cards
|
||||
IEnumerable<GraphicsCard> graphicsCards = screenCaptureService.GetGraphicsCards();
|
||||
|
||||
// Get the displays from the graphics card(s) you are interested in
|
||||
IEnumerable<Display> displays = screenCaptureService.GetDisplays(graphicsCards.First());
|
||||
|
||||
// Create a screen-capture for all screens you want to capture
|
||||
_screenCapture = screenCaptureService.GetScreenCapture(displays.First());
|
||||
|
||||
// Register the regions you want to capture on the screen
|
||||
// Capture the whole screen
|
||||
_capZone = _screenCapture.RegisterCaptureZone(0, 0, _screenCapture.Display.Width, _screenCapture.Display.Height);
|
||||
|
||||
_image = Image.Create(_capZone.Width, _capZone.Height, false, Image.Format.Rgba8);
|
||||
_image.Fill(Color.Color8(0, 0, 0, 255));
|
||||
_texture = ImageTexture.CreateFromImage(_image);
|
||||
|
||||
_capThread = new(new ThreadStart(RefreshCaptureThread));
|
||||
_capThread.Start();
|
||||
}
|
||||
|
||||
void RefreshCaptureThread()
|
||||
{
|
||||
while (!cancel.IsCancellationRequested)
|
||||
{
|
||||
_screenCapture.CaptureScreen();
|
||||
lock (_capZone.Buffer)
|
||||
{
|
||||
_image.SetData(_capZone.Width, _capZone.Height, false, Image.Format.Rgba8, _capZone.Buffer);
|
||||
_texture.CallDeferred(ImageTexture.MethodName.Update, _image);
|
||||
Thread.Sleep(16);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void _ExitTree()
|
||||
{
|
||||
cancel.Cancel();
|
||||
_screenCapture.Dispose();
|
||||
}
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
(Material as ShaderMaterial).SetShaderParameter("texture_albedo", _texture);
|
||||
}
|
||||
}
|
@ -1,10 +1,10 @@
|
||||
[gd_resource type="OpenXRActionMap" load_steps=9 format=3 uid="uid://dj5lrsrjr7l7s"]
|
||||
[gd_resource type="OpenXRActionMap" load_steps=11 format=3 uid="uid://dj5lrsrjr7l7s"]
|
||||
|
||||
[sub_resource type="OpenXRAction" id="OpenXRAction_tgww6"]
|
||||
resource_name = "default_pose"
|
||||
localized_name = "Default pose"
|
||||
action_type = 3
|
||||
toplevel_paths = PackedStringArray("/user/hand/left", "/user/hand/right", "/user/vive_tracker_htcx/role/left_foot", "/user/vive_tracker_htcx/role/right_foot", "/user/vive_tracker_htcx/role/left_shoulder", "/user/vive_tracker_htcx/role/right_shoulder", "/user/vive_tracker_htcx/role/left_elbow", "/user/vive_tracker_htcx/role/right_elbow", "/user/vive_tracker_htcx/role/left_knee", "/user/vive_tracker_htcx/role/right_knee", "/user/vive_tracker_htcx/role/waist", "/user/vive_tracker_htcx/role/chest", "/user/vive_tracker_htcx/role/camera", "/user/vive_tracker_htcx/role/keyboard")
|
||||
toplevel_paths = PackedStringArray("/user/hand/left", "/user/hand/right", "/user/vive_tracker_htcx/role/left_foot", "/user/vive_tracker_htcx/role/right_foot")
|
||||
|
||||
[sub_resource type="OpenXRAction" id="OpenXRAction_8s7vw"]
|
||||
resource_name = "haptic"
|
||||
@ -39,6 +39,14 @@ paths = PackedStringArray("/user/hand/left/input/thumbstick/click")
|
||||
interaction_profile_path = "/interaction_profiles/oculus/touch_controller"
|
||||
bindings = [SubResource("OpenXRIPBinding_7fsr8"), SubResource("OpenXRIPBinding_mpmsu"), SubResource("OpenXRIPBinding_idjss")]
|
||||
|
||||
[sub_resource type="OpenXRIPBinding" id="OpenXRIPBinding_iraq1"]
|
||||
action = SubResource("OpenXRAction_tgww6")
|
||||
paths = PackedStringArray("/user/vive_tracker_htcx/role/left_foot/input/grip/pose", "/user/vive_tracker_htcx/role/right_foot/input/grip/pose")
|
||||
|
||||
[sub_resource type="OpenXRInteractionProfile" id="OpenXRInteractionProfile_jg0wb"]
|
||||
interaction_profile_path = "/interaction_profiles/htc/vive_tracker_htcx"
|
||||
bindings = [SubResource("OpenXRIPBinding_iraq1")]
|
||||
|
||||
[resource]
|
||||
action_sets = [SubResource("OpenXRActionSet_5gwpn")]
|
||||
interaction_profiles = [SubResource("OpenXRInteractionProfile_pkpee")]
|
||||
interaction_profiles = [SubResource("OpenXRInteractionProfile_pkpee"), SubResource("OpenXRInteractionProfile_jg0wb")]
|
||||
|
Loading…
Reference in New Issue
Block a user