| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- /**************************************************************************/
- /* openxr_render_model_manager.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. */
- /**************************************************************************/
- #pragma once
- #include "modules/modules_enabled.gen.h"
- #ifdef MODULE_GLTF_ENABLED
- #include "openxr_render_model.h"
- #include "scene/3d/node_3d.h"
- #include "scene/resources/packed_scene.h"
- #include "servers/xr/xr_positional_tracker.h"
- #include <openxr/openxr.h>
- class OpenXRRenderModelManager : public Node3D {
- GDCLASS(OpenXRRenderModelManager, Node3D);
- public:
- enum RenderModelTracker {
- RENDER_MODEL_TRACKER_ANY,
- RENDER_MODEL_TRACKER_NONE_SET,
- RENDER_MODEL_TRACKER_LEFT_HAND,
- RENDER_MODEL_TRACKER_RIGHT_HAND,
- };
- virtual PackedStringArray get_configuration_warnings() const override;
- void set_tracker(RenderModelTracker p_tracker);
- RenderModelTracker get_tracker() const;
- void set_make_local_to_pose(const String &p_action);
- String get_make_local_to_pose() const;
- private:
- HashMap<RID, Node3D *> render_models;
- Node3D *container = nullptr;
- bool is_dirty = false;
- RenderModelTracker tracker = RENDER_MODEL_TRACKER_ANY;
- String make_local_to_pose;
- // cached values
- Ref<XRPositionalTracker> positional_tracker;
- XrPath xr_path = XR_NULL_PATH;
- bool _has_filters();
- void _on_render_model_added(RID p_render_model);
- void _on_render_model_removed(RID p_render_model);
- void _on_render_model_top_level_path_changed(RID p_path);
- void _update_models();
- protected:
- static void _bind_methods();
- void _notification(int p_what);
- };
- VARIANT_ENUM_CAST(OpenXRRenderModelManager::RenderModelTracker);
- #endif // MODULE_GLTF_ENABLED
|