This page has been translated automatically.
Видеоуроки
Интерфейс
Основы
Продвинутый уровень
Подсказки и советы
Основы
Программирование на C#
Рендеринг
Профессиональный уровень (SIM)
Принципы работы
Свойства (properties)
Компонентная Система
Рендер
Физика
Редактор UnigineEditor
Обзор интерфейса
Работа с ассетами
Контроль версий
Настройки и предпочтения
Работа с проектами
Настройка параметров ноды
Setting Up Materials
Настройка свойств
Освещение
Sandworm
Использование инструментов редактора для конкретных задач
Расширение функционала редактора
Встроенные объекты
Ноды (Nodes)
Объекты (Objects)
Эффекты
Декали
Источники света
Geodetics
World-ноды
Звуковые объекты
Объекты поиска пути
Player-ноды
Программирование
Основы
Настройка среды разработки
Примеры использования
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Плагины
Форматы файлов
Материалы и шейдеры
Rebuilding the Engine Tools
Интерфейс пользователя (GUI)
VR Development
Двойная точность координат
API
Animations-Related Classes
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
Работа с контентом
Оптимизация контента
Материалы
Визуальный редактор материалов
Сэмплы материалов
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Учебные материалы
Внимание! Эта версия документация УСТАРЕЛА, поскольку относится к более ранней версии SDK! Пожалуйста, переключитесь на самую актуальную документацию для последней версии SDK.
Внимание! Эта версия документации описывает устаревшую версию SDK, которая больше не поддерживается! Пожалуйста, обновитесь до последней версии SDK.

Unigine::VR Class

Header: #include <UnigineVR.h>

The base class for managing virtual reality in UNIGINE.The base class for managing virtual reality in UNIGINE.

VR InitializationVR Initialization#

By default, VR is not initialized. To run the engine with VR, you need to specify the -vr_app command-line option on the application start-up.By default, VR is not initialized. To run the engine with VR, you need to specify the -vr_app command-line option on the application start-up.

Примечание
You cannot launch the deprecated VR plugins (OpenVR, Varjo, Oculus) when the built-in VR is initialized, as it overrides the plugin's functionality. If you try to add a VR plugin after VR initialization, you will get an error message.You cannot launch the deprecated VR plugins (OpenVR, Varjo, Oculus) when the built-in VR is initialized, as it overrides the plugin's functionality. If you try to add a VR plugin after VR initialization, you will get an error message.

Supported Graphics APIsSupported Graphics APIs#

The following graphics APIs are supported out of the box:The following graphics APIs are supported out of the box:

  • DirectX 11DirectX 11
  • DirectX 12DirectX 12
  • VulkanVulkan
Примечание
For OpenGL API support, use the corresponding VR plugins (deprecated).For OpenGL API support, use the corresponding VR plugins (deprecated).

VR Class

Enums

API#

ИмяОписание
API_NULL = 0VR API is not initialized.VR API is not initialized.
API_VARJO = 1Varjo API.Varjo API.
API_OPENVR = 2OpenVR API.OpenVR API.

VIEWPORT_TYPE#

ИмяОписание
VIEWPORT_TYPE_CONTEXT = 0Context (low-res) viewport.Context (low-res) viewport.
VIEWPORT_TYPE_FOCUS = 1Focus (high-res) viewport.Focus (high-res) viewport.
VIEWPORT_TYPE_NUM = 2Number of viewport types.Number of viewport types.

EYE_TYPE#

ИмяОписание
EYE_TYPE_LEFT = 0Left eye.Left eye.
EYE_TYPE_RIGHT = 1Right eye.Right eye.
EYE_TYPE_NUM = 2Number of eye types.Number of eye types.

MIRROR_MODE#

ИмяОписание
MIRROR_MODE_BEGIN = 0The first element to be used for iteration.The first element to be used for iteration.
MIRROR_MODE_BLACK_SCREEN = 0No image (black screen).No image (black screen).
MIRROR_MODE_MONO_LEFT = 1Mono image for the left eye.Mono image for the left eye.
MIRROR_MODE_MONO_RIGHT = 2Mono image for the right eye.Mono image for the right eye.
MIRROR_MODE_STEREO = 3Stereo image (left and right eyes).Stereo image (left and right eyes).
MIRROR_MODE_END = 3The last element to be used for iteration.The last element to be used for iteration.

WINDOW_MODE#

ИмяОписание
WINDOW_MODE_BEGIN = 0The first element to be used for iteration.The first element to be used for iteration.
WINDOW_MODE_DISABLED = 0Showing the mirrored image is disabled.Showing the mirrored image is disabled.
WINDOW_MODE_MAIN = 1The main window shows the mirrored image.The main window shows the mirrored image.
WINDOW_MODE_END = 1The last element to be used for iteration.The last element to be used for iteration.

TRACKING_SPACE#

ИмяОписание
TRACKING_SPACE_BEGIN = 0The first element to be used for iteration.The first element to be used for iteration.
TRACKING_SPACE_UNKNOWN = 0Poses are provided in the coordinate system defined by the tracker driver.Poses are provided in the coordinate system defined by the tracker driver.
TRACKING_SPACE_SEATED = 1Poses are provided relative to the seated zero pose.Poses are provided relative to the seated zero pose.
TRACKING_SPACE_STANDING = 2Poses are provided relative to the safe bounds specified by the user.Poses are provided relative to the safe bounds specified by the user.
TRACKING_SPACE_END = 2The last element to be used for iteration.The last element to be used for iteration.

Члены класса

void setRenderEnabled ( bool enabled ) #

Console: vr_render_enabled
Устанавливает value indicating if rendering into the head-mounted display is enabled.value indicating if rendering into the head-mounted display is enabled. Этот параметр находится в следующем файле конфигурации: *.boot.

Аргументы

  • bool enabled - Set true to enable rendering into the HMD; false - to disable it. Значение по умолчанию false.

bool isRenderEnabled() const#

Console: vr_render_enabled
Возвращает value indicating if rendering into the head-mounted display is enabled.value indicating if rendering into the head-mounted display is enabled. Этот параметр находится в следующем файле конфигурации: *.boot.

Возвращаемое значение

true if rendering into the HMD is enabled; otherwise false. Значение по умолчанию false.

void setPeripheralRenderingModeEnabled ( bool enabled ) #

Console: vr_peripheral_rendering_mode_enabled
Устанавливает value indicating if the peripheral rendering mode is enabled. In this mode, the HMD has two context (peripheral) and two focus displays. You can disable two additional viewports to improve peformance.
Примечание
This feature is available for the Varjo devices only.This feature is available for the Varjo devices only.
This feature is available for the Varjo devices only.
value indicating if the peripheral rendering mode is enabled. In this mode, the HMD has two context (peripheral) and two focus displays. You can disable two additional viewports to improve peformance.
Примечание
This feature is available for the Varjo devices only.This feature is available for the Varjo devices only.
Этот параметр находится в следующем файле конфигурации: *.boot.

Аргументы

  • bool enabled - Set true to enable the peripheral rendering mode; false - to disable it. Значение по умолчанию false.

bool isPeripheralRenderingModeEnabled() const#

Console: vr_peripheral_rendering_mode_enabled
Возвращает value indicating if the peripheral rendering mode is enabled. In this mode, the HMD has two context (peripheral) and two focus displays. You can disable two additional viewports to improve peformance.
Примечание
This feature is available for the Varjo devices only.This feature is available for the Varjo devices only.
This feature is available for the Varjo devices only.
value indicating if the peripheral rendering mode is enabled. In this mode, the HMD has two context (peripheral) and two focus displays. You can disable two additional viewports to improve peformance.
Примечание
This feature is available for the Varjo devices only.This feature is available for the Varjo devices only.
Этот параметр находится в следующем файле конфигурации: *.boot.

Возвращаемое значение

true if the peripheral rendering mode is enabled; otherwise false. Значение по умолчанию false.

void setMirrorMode ( VR::MIRROR_MODE mode ) #

Console: vr_mirror_mode
Устанавливает mirror mode that defines how the mirrored image (i.e. VR image) will be displayed in the target window.mirror mode that defines how the mirrored image (i.e. VR image) will be displayed in the target window. Этот параметр находится в следующем файле конфигурации: *.boot.

Аргументы

  • VR::MIRROR_MODE mode - Одно из следующих значений:
    • 0 - black screen (no image is displayed).
    • 1 - image rendered for the left eye.
    • 2 - image rendered for the right eye.
    • 3 - stereo image (both the left and right eyes). (по умолчанию)

VR::MIRROR_MODE getMirrorMode() const#

Console: vr_mirror_mode
Возвращает mirror mode that defines how the mirrored image (i.e. VR image) will be displayed in the target window.mirror mode that defines how the mirrored image (i.e. VR image) will be displayed in the target window. Этот параметр находится в следующем файле конфигурации: *.boot.

Возвращаемое значение

Одно из следующих значений:
  • 0 - black screen (no image is displayed).
  • 1 - image rendered for the left eye.
  • 2 - image rendered for the right eye.
  • 3 - stereo image (both the left and right eyes). (по умолчанию)

void setWindowMode ( VR::WINDOW_MODE mode ) #

Console: vr_window_mode
Устанавливает window mode that defines which window will display the mirrored image (i.e. VR image).window mode that defines which window will display the mirrored image (i.e. VR image). Этот параметр находится в следующем файле конфигурации: *.boot.

Аргументы

  • VR::WINDOW_MODE mode - Одно из следующих значений:
    • 0 - mirroring is disabled.
    • 1 - main window displays the mirrored image. (по умолчанию)

VR::WINDOW_MODE getWindowMode() const#

Console: vr_window_mode
Возвращает window mode that defines which window will display the mirrored image (i.e. VR image).window mode that defines which window will display the mirrored image (i.e. VR image). Этот параметр находится в следующем файле конфигурации: *.boot.

Возвращаемое значение

Одно из следующих значений:
  • 0 - mirroring is disabled.
  • 1 - main window displays the mirrored image. (по умолчанию)

void setTrackingSpace ( VR::TRACKING_SPACE space ) #

Console: vr_tracking_space
Устанавливает zero pose of the tracking origin.zero pose of the tracking origin. Этот параметр находится в следующем файле конфигурации: *.boot.

Аргументы

  • VR::TRACKING_SPACE space - Одно из следующих значений:
    • 0 - seated.
    • 1 - standing. (по умолчанию)
    • 2 - raw (uncalibrated).

VR::TRACKING_SPACE getTrackingSpace() const#

Console: vr_tracking_space
Возвращает zero pose of the tracking origin.zero pose of the tracking origin. Этот параметр находится в следующем файле конфигурации: *.boot.

Возвращаемое значение

Одно из следующих значений:
  • 0 - seated.
  • 1 - standing. (по умолчанию)
  • 2 - raw (uncalibrated).

void setMotionPrediction ( bool prediction ) #

Console: vr_motion_prediction
Устанавливает value indicating if motion prediction in the Varjo headsets is enabled. When enabled, the engine submits the velocity value from the GBuffer to the Varjo Composer.value indicating if motion prediction in the Varjo headsets is enabled. When enabled, the engine submits the velocity value from the GBuffer to the Varjo Composer. Этот параметр находится в следующем файле конфигурации: *.boot.

Аргументы

  • bool prediction - Set true to enable motion prediction; false - to disable it. Значение по умолчанию false.

bool isMotionPrediction() const#

Console: vr_motion_prediction
Возвращает value indicating if motion prediction in the Varjo headsets is enabled. When enabled, the engine submits the velocity value from the GBuffer to the Varjo Composer.value indicating if motion prediction in the Varjo headsets is enabled. When enabled, the engine submits the velocity value from the GBuffer to the Varjo Composer. Этот параметр находится в следующем файле конфигурации: *.boot.

Возвращаемое значение

true if motion prediction is enabled; otherwise false. Значение по умолчанию false.

void setMotionPredictionVelocityPrecision ( ) #

Console: vr_motion_prediction_velocity_precision
Устанавливает factor of velocity scale before packing a floating point value into a 2x8 bit unsigned integer (uint).
Примечание
This feature is available for the Varjo devices only.This feature is available for the Varjo devices only.
This feature is available for the Varjo devices only.
factor of velocity scale before packing a floating point value into a 2x8 bit unsigned integer (uint).
Примечание
This feature is available for the Varjo devices only.This feature is available for the Varjo devices only.
Этот параметр находится в следующем файле конфигурации: *.boot.

Аргументы

  • precision -
    Диапазон значений: [eps, inf]. Значение по умолчанию : 32.0f.

getMotionPredictionVelocityPrecision() const#

Console: vr_motion_prediction_velocity_precision
Возвращает factor of velocity scale before packing a floating point value into a 2x8 bit unsigned integer (uint).
Примечание
This feature is available for the Varjo devices only.This feature is available for the Varjo devices only.
This feature is available for the Varjo devices only.
factor of velocity scale before packing a floating point value into a 2x8 bit unsigned integer (uint).
Примечание
This feature is available for the Varjo devices only.This feature is available for the Varjo devices only.
Этот параметр находится в следующем файле конфигурации: *.boot.

Возвращаемое значение


Диапазон значений: [eps, inf]. Значение по умолчанию : 32.0f.

void setMotionPredictionVelocityTimeDelta ( ) #

Console: vr_motion_prediction_velocity_time_delta
Устанавливает factor for optimizing between fast and slow-moving objects. A smaller number works better for fast-moving objects, and vice versa.
Примечание
This feature is available for the Varjo devices only.This feature is available for the Varjo devices only.
This feature is available for the Varjo devices only.
factor for optimizing between fast and slow-moving objects. A smaller number works better for fast-moving objects, and vice versa.
Примечание
This feature is available for the Varjo devices only.This feature is available for the Varjo devices only.
Этот параметр находится в следующем файле конфигурации: *.boot.

Аргументы

  • delta -
    Диапазон значений: [eps, inf]. Значение по умолчанию : 1.0f / 60.0f.

getMotionPredictionVelocityTimeDelta() const#

Console: vr_motion_prediction_velocity_time_delta
Возвращает factor for optimizing between fast and slow-moving objects. A smaller number works better for fast-moving objects, and vice versa.
Примечание
This feature is available for the Varjo devices only.This feature is available for the Varjo devices only.
This feature is available for the Varjo devices only.
factor for optimizing between fast and slow-moving objects. A smaller number works better for fast-moving objects, and vice versa.
Примечание
This feature is available for the Varjo devices only.This feature is available for the Varjo devices only.
Этот параметр находится в следующем файле конфигурации: *.boot.

Возвращаемое значение


Диапазон значений: [eps, inf]. Значение по умолчанию : 1.0f / 60.0f.

void setFoveatedRenderingEnabled ( bool enabled ) #

Console: vr_foveated_rendering_enabled
Устанавливает value indicating if foveated rendering is enabled. Foveated rendering makes use of the eye tracking functionality in the Varjo headsets to improve performance by reducing the image quality in peripheral areas where the user is not looking. Foveation allows applications to render fewer pixels and achieve a better VR experience.
Примечание
This feature is available for the Varjo devices only.This feature is available for the Varjo devices only.
This feature is available for the Varjo devices only.
value indicating if foveated rendering is enabled. Foveated rendering makes use of the eye tracking functionality in the Varjo headsets to improve performance by reducing the image quality in peripheral areas where the user is not looking. Foveation allows applications to render fewer pixels and achieve a better VR experience.
Примечание
This feature is available for the Varjo devices only.This feature is available for the Varjo devices only.
Этот параметр находится в следующем файле конфигурации: *.boot.

Аргументы

  • bool enabled - Set true to enable foveated rendering; false - to disable it. Значение по умолчанию true.

bool isFoveatedRenderingEnabled() const#

Console: vr_foveated_rendering_enabled
Возвращает value indicating if foveated rendering is enabled. Foveated rendering makes use of the eye tracking functionality in the Varjo headsets to improve performance by reducing the image quality in peripheral areas where the user is not looking. Foveation allows applications to render fewer pixels and achieve a better VR experience.
Примечание
This feature is available for the Varjo devices only.This feature is available for the Varjo devices only.
This feature is available for the Varjo devices only.
value indicating if foveated rendering is enabled. Foveated rendering makes use of the eye tracking functionality in the Varjo headsets to improve performance by reducing the image quality in peripheral areas where the user is not looking. Foveation allows applications to render fewer pixels and achieve a better VR experience.
Примечание
This feature is available for the Varjo devices only.This feature is available for the Varjo devices only.
Этот параметр находится в следующем файле конфигурации: *.boot.

Возвращаемое значение

true if foveated rendering is enabled; otherwise false. Значение по умолчанию true.

const char * getApiName() const#

Возвращает name of the VR API.name of the VR API.

Возвращаемое значение

name of the VR API.

VR::API getApiType() const#

Возвращает type of the VR API.type of the VR API.

Возвращаемое значение

type of the VR API.

getHMDRefreshRate() const#

Возвращает refresh rate of the head-mounted display.refresh rate of the head-mounted display.

Возвращаемое значение

refresh rate of the HMD.

Math::Vec3 getHandtrackingOffset() const#

Возвращает hand tracking offset (for the Ultraleap device only).hand tracking offset (for the Ultraleap device only).

Возвращаемое значение

hand tracking offset.

bool isPeripheralRenderingModeUsed() const#

Возвращает value indicating if the peripheral rendering is used.value indicating if the peripheral rendering is used.

Возвращаемое значение

true if the peripheral rendering is used; otherwise false.

bool isHMDConnected() const#

Возвращает value indicating if the head-mounted display is connected.value indicating if the head-mounted display is connected.

Возвращаемое значение

true if the HMD is connected; otherwise false.

bool isUsingFoveatedRendering() const#

Возвращает value indicating if the foveated rendering is used.value indicating if the foveated rendering is used.

Возвращаемое значение

true if the foveated rendering is used; otherwise false.

Ptr<Viewport> getViewport() const#

Возвращает viewport. It can be useful when implementing extra VR logic.viewport. It can be useful when implementing extra VR logic.

Возвращаемое значение

viewport.

bool isSteamVRRendersControllers() const#

Возвращает value indicating if the SteamVR controllers are rendered. When you access the SteamVR menu during the application runtime, the SteamVR controllers start to be rendered along with the application controllers. You can use this function to check the state of the SteamVR controllers and disable the application controllers to avoid performance drops caused by the simultaneous rendering of both controllers.value indicating if the SteamVR controllers are rendered. When you access the SteamVR menu during the application runtime, the SteamVR controllers start to be rendered along with the application controllers. You can use this function to check the state of the SteamVR controllers and disable the application controllers to avoid performance drops caused by the simultaneous rendering of both controllers.

Возвращаемое значение

true if the SteamVR controllers are rendered; otherwise false.

Event<bool> getEventRenderModelsVisibility() const#

Event triggered when the render models visibility is changed. You can subscribe to events via connect()  and unsubscribe via disconnect(). You can also use EventConnection  and EventConnections  classes for convenience (see examples below).
Примечание
For more details see the Event Handling article.For more details see the Event Handling article.
For more details see the Event Handling article.
Event triggered when the render models visibility is changed. You can subscribe to events via connect()  and unsubscribe via disconnect(). You can also use EventConnection  and EventConnections  classes for convenience (see examples below).
Примечание
For more details see the Event Handling article.For more details see the Event Handling article.
The event handler signature is as follows: myhandler(visible)

Usage Example

Исходный код (C++)
// implement the RenderModelsVisibility event handler
void rendermodelsvisibility_event_handler(visible)
{
	Log::message("\Handling RenderModelsVisibility event\n");
}


//////////////////////////////////////////////////////////////////////////////
//  1. Multiple subscriptions can be linked to an instance of the EventConnections 
//  class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnections class
EventConnections rendermodelsvisibility_event_connections;

// link to this instance when subscribing to an event (subscription to various events can be linked)
VR::getEventRenderModelsVisibility().connect(rendermodelsvisibility_event_connections, rendermodelsvisibility_event_handler);

// other subscriptions are also linked to this EventConnections instance 
// (e.g. you can subscribe using lambdas)
VR::getEventRenderModelsVisibility().connect(rendermodelsvisibility_event_connections, [](visible) { 
		Log::message("\Handling RenderModelsVisibility event (lambda).\n");
	}
);

// ...

// later all of these linked subscriptions can be removed with a single line
rendermodelsvisibility_event_connections.disconnectAll();

//////////////////////////////////////////////////////////////////////////////
//  2. You can subscribe and unsubscribe via an instance of the EventConnection 
//  class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnection class
EventConnection rendermodelsvisibility_event_connection;

// subscribe to the RenderModelsVisibility event with a handler function keeping the connection
VR::getEventRenderModelsVisibility().connect(rendermodelsvisibility_event_connection, rendermodelsvisibility_event_handler);

// ...

// you can temporarily disable a particular event connection to perform certain actions
rendermodelsvisibility_event_connection.setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
rendermodelsvisibility_event_connection.setEnabled(true);

// ...

// remove subscription to the RenderModelsVisibility event via the connection
rendermodelsvisibility_event_connection.disconnect();

//////////////////////////////////////////////////////////////////////////////
//  3. You can add EventConnection/EventConnections instance as a member of the
//  class that handles the event. In this case all linked subscriptions will be 
//  automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////

// Class handling the event
class SomeClass
{
public:
	// instance of the EventConnections class as a class member
	EventConnections e_connections;

	// A RenderModelsVisibility event handler implemented as a class member
	void event_handler(visible)
	{
		Log::message("\Handling RenderModelsVisibility event\n");
		// ...
	}
};

SomeClass *sc = new SomeClass();

// ...

// specify a class instance in case a handler method belongs to some class
VR::getEventRenderModelsVisibility().connect(sc->e_connections, sc, &SomeClass::event_handler);

// ...

// handler class instance is deleted with all its subscriptions removed automatically
delete sc;

//////////////////////////////////////////////////////////////////////////////
//  4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////

// subscribe to the RenderModelsVisibility event with a handler function
VR::getEventRenderModelsVisibility().connect(rendermodelsvisibility_event_handler);


// remove subscription to the RenderModelsVisibility event later by the handler function
VR::getEventRenderModelsVisibility().disconnect(rendermodelsvisibility_event_handler);


//////////////////////////////////////////////////////////////////////////////
//   5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////

// define a connection ID to be used to unsubscribe later
EventConnectionId rendermodelsvisibility_handler_id;

// subscribe to the RenderModelsVisibility event with a lambda handler function and keeping connection ID
rendermodelsvisibility_handler_id = VR::getEventRenderModelsVisibility().connect([](visible) { 
		Log::message("\Handling RenderModelsVisibility event (lambda).\n");
	}
);

// remove the subscription later using the ID
VR::getEventRenderModelsVisibility().disconnect(rendermodelsvisibility_handler_id);


//////////////////////////////////////////////////////////////////////////////
//   6. Ignoring all RenderModelsVisibility events when necessary
//////////////////////////////////////////////////////////////////////////////

// you can temporarily disable the event to perform certain actions without triggering it
VR::getEventRenderModelsVisibility().setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
VR::getEventRenderModelsVisibility().setEnabled(true);

Возвращаемое значение

Event reference.

Event<> getEventAudioSettingsChanged() const#

Event triggered when the audio settings changed. You can subscribe to events via connect()  and unsubscribe via disconnect(). You can also use EventConnection  and EventConnections  classes for convenience (see examples below).
Примечание
For more details see the Event Handling article.For more details see the Event Handling article.
For more details see the Event Handling article.
Event triggered when the audio settings changed. You can subscribe to events via connect()  and unsubscribe via disconnect(). You can also use EventConnection  and EventConnections  classes for convenience (see examples below).
Примечание
For more details see the Event Handling article.For more details see the Event Handling article.
The event handler signature is as follows: myhandler()

Usage Example

Исходный код (C++)
// implement the AudioSettingsChanged event handler
void audiosettingschanged_event_handler()
{
	Log::message("\Handling AudioSettingsChanged event\n");
}


//////////////////////////////////////////////////////////////////////////////
//  1. Multiple subscriptions can be linked to an instance of the EventConnections 
//  class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnections class
EventConnections audiosettingschanged_event_connections;

// link to this instance when subscribing to an event (subscription to various events can be linked)
VR::getEventAudioSettingsChanged().connect(audiosettingschanged_event_connections, audiosettingschanged_event_handler);

// other subscriptions are also linked to this EventConnections instance 
// (e.g. you can subscribe using lambdas)
VR::getEventAudioSettingsChanged().connect(audiosettingschanged_event_connections, []() { 
		Log::message("\Handling AudioSettingsChanged event (lambda).\n");
	}
);

// ...

// later all of these linked subscriptions can be removed with a single line
audiosettingschanged_event_connections.disconnectAll();

//////////////////////////////////////////////////////////////////////////////
//  2. You can subscribe and unsubscribe via an instance of the EventConnection 
//  class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnection class
EventConnection audiosettingschanged_event_connection;

// subscribe to the AudioSettingsChanged event with a handler function keeping the connection
VR::getEventAudioSettingsChanged().connect(audiosettingschanged_event_connection, audiosettingschanged_event_handler);

// ...

// you can temporarily disable a particular event connection to perform certain actions
audiosettingschanged_event_connection.setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
audiosettingschanged_event_connection.setEnabled(true);

// ...

// remove subscription to the AudioSettingsChanged event via the connection
audiosettingschanged_event_connection.disconnect();

//////////////////////////////////////////////////////////////////////////////
//  3. You can add EventConnection/EventConnections instance as a member of the
//  class that handles the event. In this case all linked subscriptions will be 
//  automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////

// Class handling the event
class SomeClass
{
public:
	// instance of the EventConnections class as a class member
	EventConnections e_connections;

	// A AudioSettingsChanged event handler implemented as a class member
	void event_handler()
	{
		Log::message("\Handling AudioSettingsChanged event\n");
		// ...
	}
};

SomeClass *sc = new SomeClass();

// ...

// specify a class instance in case a handler method belongs to some class
VR::getEventAudioSettingsChanged().connect(sc->e_connections, sc, &SomeClass::event_handler);

// ...

// handler class instance is deleted with all its subscriptions removed automatically
delete sc;

//////////////////////////////////////////////////////////////////////////////
//  4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////

// subscribe to the AudioSettingsChanged event with a handler function
VR::getEventAudioSettingsChanged().connect(audiosettingschanged_event_handler);


// remove subscription to the AudioSettingsChanged event later by the handler function
VR::getEventAudioSettingsChanged().disconnect(audiosettingschanged_event_handler);


//////////////////////////////////////////////////////////////////////////////
//   5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////

// define a connection ID to be used to unsubscribe later
EventConnectionId audiosettingschanged_handler_id;

// subscribe to the AudioSettingsChanged event with a lambda handler function and keeping connection ID
audiosettingschanged_handler_id = VR::getEventAudioSettingsChanged().connect([]() { 
		Log::message("\Handling AudioSettingsChanged event (lambda).\n");
	}
);

// remove the subscription later using the ID
VR::getEventAudioSettingsChanged().disconnect(audiosettingschanged_handler_id);


//////////////////////////////////////////////////////////////////////////////
//   6. Ignoring all AudioSettingsChanged events when necessary
//////////////////////////////////////////////////////////////////////////////

// you can temporarily disable the event to perform certain actions without triggering it
VR::getEventAudioSettingsChanged().setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
VR::getEventAudioSettingsChanged().setEnabled(true);

Возвращаемое значение

Event reference.

Event<int> getEventDeviceRenderModelChanged() const#

Event triggered when the render model of the VR device is changed. You can subscribe to events via connect()  and unsubscribe via disconnect(). You can also use EventConnection  and EventConnections  classes for convenience (see examples below).
Примечание
For more details see the Event Handling article.For more details see the Event Handling article.
For more details see the Event Handling article.
Event triggered when the render model of the VR device is changed. You can subscribe to events via connect()  and unsubscribe via disconnect(). You can also use EventConnection  and EventConnections  classes for convenience (see examples below).
Примечание
For more details see the Event Handling article.For more details see the Event Handling article.
The event handler signature is as follows: myhandler(vr_device_number)

Usage Example

Исходный код (C++)
// implement the DeviceRenderModelChanged event handler
void devicerendermodelchanged_event_handler(vr_device_number)
{
	Log::message("\Handling DeviceRenderModelChanged event\n");
}


//////////////////////////////////////////////////////////////////////////////
//  1. Multiple subscriptions can be linked to an instance of the EventConnections 
//  class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnections class
EventConnections devicerendermodelchanged_event_connections;

// link to this instance when subscribing to an event (subscription to various events can be linked)
VR::getEventDeviceRenderModelChanged().connect(devicerendermodelchanged_event_connections, devicerendermodelchanged_event_handler);

// other subscriptions are also linked to this EventConnections instance 
// (e.g. you can subscribe using lambdas)
VR::getEventDeviceRenderModelChanged().connect(devicerendermodelchanged_event_connections, [](vr_device_number) { 
		Log::message("\Handling DeviceRenderModelChanged event (lambda).\n");
	}
);

// ...

// later all of these linked subscriptions can be removed with a single line
devicerendermodelchanged_event_connections.disconnectAll();

//////////////////////////////////////////////////////////////////////////////
//  2. You can subscribe and unsubscribe via an instance of the EventConnection 
//  class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////

// create an instance of the EventConnection class
EventConnection devicerendermodelchanged_event_connection;

// subscribe to the DeviceRenderModelChanged event with a handler function keeping the connection
VR::getEventDeviceRenderModelChanged().connect(devicerendermodelchanged_event_connection, devicerendermodelchanged_event_handler);

// ...

// you can temporarily disable a particular event connection to perform certain actions
devicerendermodelchanged_event_connection.setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
devicerendermodelchanged_event_connection.setEnabled(true);

// ...

// remove subscription to the DeviceRenderModelChanged event via the connection
devicerendermodelchanged_event_connection.disconnect();

//////////////////////////////////////////////////////////////////////////////
//  3. You can add EventConnection/EventConnections instance as a member of the
//  class that handles the event. In this case all linked subscriptions will be 
//  automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////

// Class handling the event
class SomeClass
{
public:
	// instance of the EventConnections class as a class member
	EventConnections e_connections;

	// A DeviceRenderModelChanged event handler implemented as a class member
	void event_handler(vr_device_number)
	{
		Log::message("\Handling DeviceRenderModelChanged event\n");
		// ...
	}
};

SomeClass *sc = new SomeClass();

// ...

// specify a class instance in case a handler method belongs to some class
VR::getEventDeviceRenderModelChanged().connect(sc->e_connections, sc, &SomeClass::event_handler);

// ...

// handler class instance is deleted with all its subscriptions removed automatically
delete sc;

//////////////////////////////////////////////////////////////////////////////
//  4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////

// subscribe to the DeviceRenderModelChanged event with a handler function
VR::getEventDeviceRenderModelChanged().connect(devicerendermodelchanged_event_handler);


// remove subscription to the DeviceRenderModelChanged event later by the handler function
VR::getEventDeviceRenderModelChanged().disconnect(devicerendermodelchanged_event_handler);


//////////////////////////////////////////////////////////////////////////////
//   5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////

// define a connection ID to be used to unsubscribe later
EventConnectionId devicerendermodelchanged_handler_id;

// subscribe to the DeviceRenderModelChanged event with a lambda handler function and keeping connection ID
devicerendermodelchanged_handler_id = VR::getEventDeviceRenderModelChanged().connect([](vr_device_number) { 
		Log::message("\Handling DeviceRenderModelChanged event (lambda).\n");
	}
);

// remove the subscription later using the ID
VR::getEventDeviceRenderModelChanged().disconnect(devicerendermodelchanged_handler_id);


//////////////////////////////////////////////////////////////////////////////
//   6. Ignoring all DeviceRenderModelChanged events when necessary
//////////////////////////////////////////////////////////////////////////////

// you can temporarily disable the event to perform certain actions without triggering it
VR::getEventDeviceRenderModelChanged().setEnabled(false);

// ... actions to be performed

// and enable it back when necessary
VR::getEventDeviceRenderModelChanged().setEnabled(true);

Возвращаемое значение

Event reference.

Math::ivec2 getHMDResolution ( VR::VIEWPORT_TYPE viewport_type = Enum.VR.VIEWPORT_TYPE.CONTEXT ) const#

Returns the current resolution of the head-mounted display. For HMDs having context (peripheral) and focus displays, you should specify the viewport type.Returns the current resolution of the head-mounted display. For HMDs having context (peripheral) and focus displays, you should specify the viewport type.

Аргументы

  • VR::VIEWPORT_TYPE viewport_type - Type of the viewport (for HMDs having context (peripheral) and focus displays).Type of the viewport (for HMDs having context (peripheral) and focus displays).

Возвращаемое значение

HMD resolution.HMD resolution.

bool hasFeatureMixedReality ( ) const#

Returns a value indicating if the mixed reality mode is available. Mixed reality enables you to combine real-world view from front-facing cameras mounted on the headset with the VR image rendered. This feature is available for the Varjo devices only.
Примечание
If VR is not initialized, the function will return false.If VR is not initialized, the function will return false.
If VR is not initialized, the function will return false.
Returns a value indicating if the mixed reality mode is available. Mixed reality enables you to combine real-world view from front-facing cameras mounted on the headset with the VR image rendered. This feature is available for the Varjo devices only.
Примечание
If VR is not initialized, the function will return false.If VR is not initialized, the function will return false.

Возвращаемое значение

true if the feature is available; otherwise, false.true if the feature is available; otherwise, false.

bool hasFeatureEyeTracking ( ) const#

Returns a value indicating if eye tracking is available. This feature is available for the Varjo devices only.
Примечание
If VR is not initialized, the function will return false.If VR is not initialized, the function will return false.
If VR is not initialized, the function will return false.
Returns a value indicating if eye tracking is available. This feature is available for the Varjo devices only.
Примечание
If VR is not initialized, the function will return false.If VR is not initialized, the function will return false.

Возвращаемое значение

true if the feature is available; otherwise, false.true if the feature is available; otherwise, false.

bool hasFeatureTrackingSpaceRaw ( ) const#

Returns a value indicating if poses can be provided in the coordinate system defined by the tracker driver.
Примечание
If VR is not initialized, the function will return false.If VR is not initialized, the function will return false.
If VR is not initialized, the function will return false.
Returns a value indicating if poses can be provided in the coordinate system defined by the tracker driver.
Примечание
If VR is not initialized, the function will return false.If VR is not initialized, the function will return false.

Возвращаемое значение

true if the feature is available; otherwise, false.true if the feature is available; otherwise, false.

bool hasFeatureMotionPrediction ( ) const#

Returns a value indicating if motion prediction is available. This feature is available for the Varjo devices only. It allows the engine to submit the velocity from the GBuffer to the Varjo Composer.
Примечание
If VR is not initialized, the function will return false.If VR is not initialized, the function will return false.
If VR is not initialized, the function will return false.
Returns a value indicating if motion prediction is available. This feature is available for the Varjo devices only. It allows the engine to submit the velocity from the GBuffer to the Varjo Composer.
Примечание
If VR is not initialized, the function will return false.If VR is not initialized, the function will return false.

Возвращаемое значение

true if the feature is available; otherwise, false.true if the feature is available; otherwise, false.

bool hasFeatureFoveatedRendering ( ) const#

Returns a value indicating if foveated rendering is available. This feature is available for the Varjo devices only. Foveated rendering enhances performance by using the eye tracking functionality in Varjo headsets: it decreases the image quality in the peripheral areas where the user is not looking. Foveation allows applications to render fewer pixels and achieve a better VR experience.
Примечание
If VR is not initialized, the function will return false.If VR is not initialized, the function will return false.
If VR is not initialized, the function will return false.
Returns a value indicating if foveated rendering is available. This feature is available for the Varjo devices only. Foveated rendering enhances performance by using the eye tracking functionality in Varjo headsets: it decreases the image quality in the peripheral areas where the user is not looking. Foveation allows applications to render fewer pixels and achieve a better VR experience.
Примечание
If VR is not initialized, the function will return false.If VR is not initialized, the function will return false.

Возвращаемое значение

true if the feature is available; otherwise, false.true if the feature is available; otherwise, false.

bool hasFeatureReportProximitySensor ( ) const#

Returns a value indicating if proximity sensor reporting is available.
Примечание
If VR is not initialized, the function will return false.If VR is not initialized, the function will return false.
If VR is not initialized, the function will return false.
Returns a value indicating if proximity sensor reporting is available.
Примечание
If VR is not initialized, the function will return false.If VR is not initialized, the function will return false.

Возвращаемое значение

true if the feature is available; otherwise, false.true if the feature is available; otherwise, false.

bool hasFeatureSupportForTreadmill ( ) const#

Returns a value indicating if the user treadmill support is available.
Примечание
If VR is not initialized, the function will return false.If VR is not initialized, the function will return false.
If VR is not initialized, the function will return false.
Returns a value indicating if the user treadmill support is available.
Примечание
If VR is not initialized, the function will return false.If VR is not initialized, the function will return false.

Возвращаемое значение

true if the feature is available; otherwise, false.true if the feature is available; otherwise, false.

bool hasFeatureSupportForBaseStations ( ) const#

Returns a value indicating if the base stations support is available.
Примечание
If VR is not initialized, the function will return false.If VR is not initialized, the function will return false.
If VR is not initialized, the function will return false.
Returns a value indicating if the base stations support is available.
Примечание
If VR is not initialized, the function will return false.If VR is not initialized, the function will return false.

Возвращаемое значение

true if the feature is available; otherwise, false.true if the feature is available; otherwise, false.

bool hasFeatureSupportForTrackers ( ) const#

Returns a value indicating if support for trackers is available.
Примечание
If VR is not initialized, the function will return false.If VR is not initialized, the function will return false.
If VR is not initialized, the function will return false.
Returns a value indicating if support for trackers is available.
Примечание
If VR is not initialized, the function will return false.If VR is not initialized, the function will return false.

Возвращаемое значение

true if the feature is available; otherwise, false.true if the feature is available; otherwise, false.

bool hasFeatureSupportForRenderModelComponents ( ) const#

Returns a value indicating if support for render model components is available.
Примечание
If VR is not initialized, the function will return false.If VR is not initialized, the function will return false.
If VR is not initialized, the function will return false.
Returns a value indicating if support for render model components is available.
Примечание
If VR is not initialized, the function will return false.If VR is not initialized, the function will return false.

Возвращаемое значение

true if the feature is available; otherwise, false.true if the feature is available; otherwise, false.

void resetZeroPose ( ) const#

Sets the zero pose to the current tracker position.Sets the zero pose to the current tracker position.
Последнее обновление: 06.02.2024
Build: ()