-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for OpenXR local floor extension #87235
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
modules/openxr/extensions/openxr_local_floor_extension.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/**************************************************************************/ | ||
/* openxr_local_floor_extension.cpp */ | ||
/**************************************************************************/ | ||
/* This file is part of: */ | ||
/* GODOT ENGINE */ | ||
/* https://godotengine.org */ | ||
/**************************************************************************/ | ||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ | ||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ | ||
/* */ | ||
/* 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. */ | ||
/**************************************************************************/ | ||
|
||
#include "openxr_local_floor_extension.h" | ||
|
||
#include "core/string/print_string.h" | ||
|
||
OpenXRLocalFloorExtension *OpenXRLocalFloorExtension::singleton = nullptr; | ||
|
||
OpenXRLocalFloorExtension *OpenXRLocalFloorExtension::get_singleton() { | ||
return singleton; | ||
} | ||
|
||
OpenXRLocalFloorExtension::OpenXRLocalFloorExtension() { | ||
singleton = this; | ||
} | ||
|
||
OpenXRLocalFloorExtension::~OpenXRLocalFloorExtension() { | ||
singleton = nullptr; | ||
} | ||
|
||
HashMap<String, bool *> OpenXRLocalFloorExtension::get_requested_extensions() { | ||
HashMap<String, bool *> request_extensions; | ||
|
||
request_extensions[XR_EXT_LOCAL_FLOOR_EXTENSION_NAME] = &available; | ||
|
||
return request_extensions; | ||
} | ||
|
||
bool OpenXRLocalFloorExtension::is_available() { | ||
return available; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/**************************************************************************/ | ||
/* openxr_local_floor_extension.h */ | ||
/**************************************************************************/ | ||
/* This file is part of: */ | ||
/* GODOT ENGINE */ | ||
/* https://godotengine.org */ | ||
/**************************************************************************/ | ||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ | ||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ | ||
/* */ | ||
/* 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. */ | ||
/**************************************************************************/ | ||
|
||
#ifndef OPENXR_LOCAL_FLOOR_EXTENSION_H | ||
#define OPENXR_LOCAL_FLOOR_EXTENSION_H | ||
|
||
#include "openxr_extension_wrapper.h" | ||
|
||
class OpenXRLocalFloorExtension : public OpenXRExtensionWrapper { | ||
public: | ||
static OpenXRLocalFloorExtension *get_singleton(); | ||
|
||
OpenXRLocalFloorExtension(); | ||
virtual ~OpenXRLocalFloorExtension() override; | ||
|
||
virtual HashMap<String, bool *> get_requested_extensions() override; | ||
|
||
bool is_available(); | ||
|
||
private: | ||
static OpenXRLocalFloorExtension *singleton; | ||
|
||
bool available = false; | ||
}; | ||
|
||
#endif // OPENXR_LOCAL_FLOOR_EXTENSION_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest doing this the other way around.
XR_PLAY_AREA_ROOMSCALE
is the mode where the center of the playspace is locked in place as this is the default room scale behavior most headsets adhere to.The new mode could then be called
XR_PLAY_AREA_ROOMSCALE_LOCAL
which then has a description such asSame as XR_PLAY_AREA_ROOMSCALE
but the center of the play space is calibrate to the position of the player at startup, and when the player does a system recenter. It is important to note that the player can walk away from this center`.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, you're saying that
XR_REFERENCE_SPACE_TYPE_STAGE
should map toXR_PLAY_AREA_ROOMSCALE
? We certainly could do that, the terminology can be whatever we want. :-)However, it feels weird that
XR_PLAY_AREA_STAGE
would not equalXR_REFERENCE_SPACE_TYPE_STAGE
, given that they both containSTAGE
(and the project setting for this also calls it "Stage"). And given the original description of this constant (I only changed the end bit aboutcenter_on_hmd()
), it certainly seems like this value was meant to be meant to be used forXR_REFERENCE_SPACE_TYPE_STAGE
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Owh,
XR_PLAY_AREA_STAGE
already exists... hmmm weird.. I see your point.. I think I really badly chose these names way back when :)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm tempted to rename them to
XR_PLAY_AREA_ROOMSCALE_LOCAL
andXR_PLAY_AREA_ROOMSCALE_STAGE
, just to set them apart as two roomscale variants..We'll get in trouble with the production team for a breaking rename but I don't think anyone will even have been aware that we had these options seeing it was never implemented.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If totally renaming them is a possibility, I think having just
XR_PLAY_AREA_LOCAL
andXR_PLAY_AREA_LOCAL_FLOOR
would be great. Those do seem to be sort of standard names - they also exist in WebXR.Do any low-level XR APIs even have a "space type" for "sitting" or "3dof"? Those are the other values on this enum, but they're not really mappable to anything in OpenXR or WebXR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the mobile VR interface exposes itself as 3DOF as it doesn't have positional tracking, so I'd keep that. I'm happy with having that and the 3 suggestions you make, and removing the rest.
We'll have to make a clear statement as to why we're making this breaking change and why we think we can get away with it (this feature having been unimplemented is a strong indicator that nobody is currently using it:P ).
(obviously if we need to keep the old ones and give them the same const value and mark them as deprecated, that could be a way to make any critics happy, but I rather see them removed).