VTK  9.4.20250227
Rendering/OpenXR/vtkOpenXRSceneComponent.h

vtkOpenXRSceneComponent represent a component in the XR scene.

vtkOpenXRSceneComponent represent a component in the XR scene.This class is instanciated by vtkOpenXRSceneObserver when a new component has been detected by the OpenXR runtime.

This class is designed as a variant, where the component data varies depending on its type.

void OnNewComponent(vtkObject* observer, unsigned long event, void* calldata)
{
auto* component = static_cast<vtkOpenXRSceneComponent*>(calldata);
if(component->GetType() == vtkOpenXRSceneComponent::Marker)
{
someActor->SetUserMatrix(component->GetMarkerPose());
}
}
abstract base class for most VTK objects
Definition vtkObject.h:162
// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
// SPDX-License-Identifier: BSD-3-Clause
#ifndef vtkOpenXRSceneComponent_h
#define vtkOpenXRSceneComponent_h
#include "vtkObject.h"
#include "vtkRenderingOpenXRModule.h" // For export macro
#include "vtkSmartPointer.h" // For vtkSmartPointer
#include <array> // For std::array
#include <cstdint> // For int types
#include <memory> // For std::unique_ptr
VTK_ABI_NAMESPACE_BEGIN
class VTKRENDERINGOPENXR_EXPORT vtkOpenXRSceneComponent : public vtkObject
{
struct vtkInternals;
public:
enum ComponentTypes
{
Unknown, // May be used in case the runtime supports more than we know of
Marker // Only QrCode at this time
};
vtkGetMacro(LastModifiedTime, int64_t);
vtkGetMacro(Type, ComponentTypes);
vtkMatrix4x4* GetMarkerPose() const;
const std::string& GetMarkerText() const;
double GetMarkerWidth() const;
double GetMarkerHeight() const;
void Initialize(ComponentTypes type);
void UpdateMarkerRepresentation(
int64_t lastModifiedTime, vtkMatrix4x4* matrix, double width, double height, std::string text);
protected:
private:
void operator=(const vtkOpenXRSceneComponent&) = delete;
int64_t LastModifiedTime{ 0 };
ComponentTypes Type{ Unknown };
std::unique_ptr<vtkInternals> Impl{};
};
VTK_ABI_NAMESPACE_END
#endif
represent and manipulate 4x4 transformation matrices
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.