Blender
V3.3
|
#include <cassert>
#include <Eigen/Core>
#include <Eigen/Geometry>
#include "GHOST_Types.h"
#include "GHOST_XrException.h"
#include "GHOST_Xr_intern.h"
#include "GHOST_XrControllerModel.h"
#include "tiny_gltf.h"
Go to the source code of this file.
Classes | |
struct | GHOST_XrControllerModelNode |
struct | GHOST_XrPrimitive |
Macros | |
#define | TINYGLTF_IMPLEMENTATION |
#define | TINYGLTF_NO_STB_IMAGE |
#define | TINYGLTF_NO_STB_IMAGE_WRITE |
#define | STBIWDEF static inline |
Functions | |
glTF Utilities | |
Adapted from Microsoft OpenXR-Mixed Reality Samples (MIT License): https://github.com/microsoft/OpenXR-MixedReality | |
static void | validate_accessor (const tinygltf::Accessor &accessor, const tinygltf::BufferView &buffer_view, const tinygltf::Buffer &buffer, size_t byte_stride, size_t element_size) |
template<float(GHOST_XrControllerModelVertex::*) field> | |
static void | read_vertices (const tinygltf::Accessor &accessor, const tinygltf::BufferView &buffer_view, const tinygltf::Buffer &buffer, GHOST_XrPrimitive &primitive) |
static void | load_attribute_accessor (const tinygltf::Model &gltf_model, const std::string &attribute_name, int accessor_id, GHOST_XrPrimitive &primitive) |
template<typename TSrcIndex > | |
static void | read_indices (const tinygltf::Accessor &accessor, const tinygltf::BufferView &buffer_view, const tinygltf::Buffer &buffer, GHOST_XrPrimitive &primitive) |
static void | load_index_accessor (const tinygltf::Model &gltf_model, const tinygltf::Accessor &accessor, GHOST_XrPrimitive &primitive) |
static GHOST_XrPrimitive | read_primitive (const tinygltf::Model &gltf_model, const tinygltf::Primitive &gltf_primitive) |
static void | calc_node_transforms (const tinygltf::Node &gltf_node, const float parent_transform[4][4], float r_local_transform[4][4], float r_world_transform[4][4]) |
static void | load_node (const tinygltf::Model &gltf_model, int gltf_node_id, int32_t parent_idx, const float parent_transform[4][4], const std::string &parent_name, const std::vector< XrControllerModelNodePropertiesMSFT > &node_properties, std::vector< GHOST_XrControllerModelVertex > &vertices, std::vector< uint32_t > &indices, std::vector< GHOST_XrControllerModelComponent > &components, std::vector< GHOST_XrControllerModelNode > &nodes, std::vector< int32_t > &node_state_indices) |
OpenXR Extension Functions | |
#define | INIT_EXTENSION_FUNCTION(name) |
static PFN_xrGetControllerModelKeyMSFT | g_xrGetControllerModelKeyMSFT = nullptr |
static PFN_xrLoadControllerModelMSFT | g_xrLoadControllerModelMSFT = nullptr |
static PFN_xrGetControllerModelPropertiesMSFT | g_xrGetControllerModelPropertiesMSFT = nullptr |
static PFN_xrGetControllerModelStateMSFT | g_xrGetControllerModelStateMSFT = nullptr |
static XrInstance | g_instance = XR_NULL_HANDLE |
static void | init_controller_model_extension_functions (XrInstance instance) |
#define INIT_EXTENSION_FUNCTION | ( | name | ) |
Definition at line 375 of file GHOST_XrControllerModel.cpp.
#define STBIWDEF static inline |
Definition at line 21 of file GHOST_XrControllerModel.cpp.
#define TINYGLTF_IMPLEMENTATION |
Definition at line 18 of file GHOST_XrControllerModel.cpp.
#define TINYGLTF_NO_STB_IMAGE |
Definition at line 19 of file GHOST_XrControllerModel.cpp.
#define TINYGLTF_NO_STB_IMAGE_WRITE |
Definition at line 20 of file GHOST_XrControllerModel.cpp.
|
static |
Calculate node local and world transforms.
Definition at line 224 of file GHOST_XrControllerModel.cpp.
References float().
Referenced by load_node().
|
static |
Definition at line 380 of file GHOST_XrControllerModel.cpp.
References g_instance, g_xrGetControllerModelKeyMSFT, g_xrGetControllerModelPropertiesMSFT, g_xrGetControllerModelStateMSFT, g_xrLoadControllerModelMSFT, INIT_EXTENSION_FUNCTION, and instance.
Referenced by GHOST_XrControllerModel::GHOST_XrControllerModel().
|
static |
Definition at line 97 of file GHOST_XrControllerModel.cpp.
References buffer.
Referenced by read_primitive().
|
static |
Reads index data from a glTF primitive into a GHOST_XrPrimitive.
Definition at line 168 of file GHOST_XrControllerModel.cpp.
References buffer.
Referenced by read_primitive().
|
static |
Definition at line 283 of file GHOST_XrControllerModel.cpp.
References calc_node_transforms(), component(), count, indices, GHOST_XrPrimitive::indices, node, offset, read_primitive(), and GHOST_XrPrimitive::vertices.
|
static |
Reads index data from a glTF primitive into a GHOST_XrPrimitive. glTF indices may be 8bit, 16bit or 32bit integers. This will coalesce indices from the source type(s) into a 32bit integer.
Definition at line 131 of file GHOST_XrControllerModel.cpp.
References buffer, GHOST_XrPrimitive::indices, and validate_accessor().
|
static |
Definition at line 197 of file GHOST_XrControllerModel.cpp.
References load_attribute_accessor(), and load_index_accessor().
Referenced by load_node().
|
static |
Definition at line 65 of file GHOST_XrControllerModel.cpp.
References buffer, float(), stride, validate_accessor(), and GHOST_XrPrimitive::vertices.
|
static |
Validate that an accessor does not go out of bounds of the buffer view that it references and that the buffer view does not exceed the bounds of the buffer that it references
Definition at line 46 of file GHOST_XrControllerModel.cpp.
References buffer.
Referenced by read_indices(), and read_vertices().
|
static |
Definition at line 373 of file GHOST_XrControllerModel.cpp.
Referenced by init_controller_model_extension_functions().
|
static |
Definition at line 369 of file GHOST_XrControllerModel.cpp.
Referenced by init_controller_model_extension_functions(), and GHOST_XrControllerModel::load().
|
static |
Definition at line 371 of file GHOST_XrControllerModel.cpp.
Referenced by init_controller_model_extension_functions().
|
static |
Definition at line 372 of file GHOST_XrControllerModel.cpp.
Referenced by init_controller_model_extension_functions(), and GHOST_XrControllerModel::updateComponents().
|
static |
Definition at line 370 of file GHOST_XrControllerModel.cpp.
Referenced by init_controller_model_extension_functions().