/**************************************************************************/1/* openxr_structure.h */2/**************************************************************************/3/* This file is part of: */4/* GODOT ENGINE */5/* https://godotengine.org */6/**************************************************************************/7/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */8/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */9/* */10/* Permission is hereby granted, free of charge, to any person obtaining */11/* a copy of this software and associated documentation files (the */12/* "Software"), to deal in the Software without restriction, including */13/* without limitation the rights to use, copy, modify, merge, publish, */14/* distribute, sublicense, and/or sell copies of the Software, and to */15/* permit persons to whom the Software is furnished to do so, subject to */16/* the following conditions: */17/* */18/* The above copyright notice and this permission notice shall be */19/* included in all copies or substantial portions of the Software. */20/* */21/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */22/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */23/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */24/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */25/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */26/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */27/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */28/**************************************************************************/2930#pragma once3132#include "core/object/gdvirtual.gen.inc"33#include "core/object/ref_counted.h"34#include "openxr_util.h"35#include "util.h"3637// Base class for XrStructureType based headers38class OpenXRStructureBase : public RefCounted {39GDCLASS(OpenXRStructureBase, RefCounted);4041public:42/*43* get_header should return a pointer to a proper XrStructureType structure.44* The pointer should remain valid as long as this object is not destructed.45*46* This function should be implemented based on the following template:47* void *get_header(void *p_next = nullptr) {48* my_xr_struct.type = XR_TYPE_XYZ;49* if (get_next().is_valid()) {50* my_xr_struct.next = get_next()->get_header(p_next);51* } else {52* my_xr_struct.next = p_next53* }54*55* // add further setup of the struct here56*57* return &my_xr_struct;58* }59*/60virtual void *get_header(void *p_next = nullptr);61virtual XrStructureType get_structure_type();6263void set_next(const Ref<OpenXRStructureBase> p_next);64Ref<OpenXRStructureBase> get_next() const;6566GDVIRTUAL1R(uint64_t, _get_header, uint64_t);6768protected:69static void _bind_methods();7071private:72Ref<OpenXRStructureBase> next;7374uint64_t _get_structure_type();75};767778