This page has been translated automatically.
视频教程
界面
要领
高级
实用建议
基础
专业(SIM)
UnigineEditor
界面概述
资源工作流程
Version Control
设置和首选项
项目开发
调整节点参数
Setting Up Materials
设置属性
照明
Sandworm
使用编辑器工具执行特定任务
如何擴展編輯器功能
嵌入式节点类型
Nodes
Objects
Effects
Decals
光源
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
编程
基本原理
搭建开发环境
使用范例
C++
C#
UnigineScript
统一的Unigine着色器语言 UUSL (Unified UNIGINE Shader Language)
File Formats
材质和着色器
Rebuilding the Engine Tools
GUI
双精度坐标
应用程序接口
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
VR-Related Classes
创建内容
内容优化
材质
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials

VRPN 客户端插件

Virtual Reality Peripheral Network (VRPN) is a device-independent system for accessing virtual reality peripherals in VR applications. The VRPN system consists of programming interfaces for both the client application and the hardware drivers and a server application that communicates with the hardware devices. The DTrack application often goes as a server application.Virtual Reality Peripheral Network (VRPN) 是一个独立于设备的系统,用于访问 VR 应用程序中的虚拟现实外围设备。 VRPN 系统由客户端应用程序和硬件驱动程序的编程接口以及与硬件设备通信的服务器应用程序组成。 DTrack 应用程序通常用作服务器应用程序。

The Virtual Reality Peripheral Network (VRPN) plugin represents the client application which is connected to the server and used for receiving input data from different input devices (joysticks, 3D motion and orientation tracking sensors and so on) via the Network.Virtual Reality Peripheral Network (VRPN) 插件代表客户端应用程序,它连接到服务器并用于通过网络从不同的输入设备(操纵杆、3D 运动和方向跟踪传感器等)接收输入数据。

For example, by using the VRPN Client plugin, you can implement an application that processes input data from ART controls.例如,通过使用 VRPN Client 插件,您可以实现处理来自 ART 控件的输入数据的应用程序。

See Also
也可以看看#

  • VrpnAnalogDevice classVrpnAnalogDevice
  • VrpnButtonDevice classVrpnButtonDevice
  • VrpnTackerDevice classVrpnTackerDevice
  • Samples on the plugin usage:插件使用示例:

    • <UnigineSDK>/data/samples/plugins/vrpn_client_00 that demonstrates receiving data from the FlyStick device and two sensors, tracking this device and a head. The data is presented as a text.<UnigineSDK>/data/samples/plugins/vrpn_client_00 演示从 FlyStick 设备和两个传感器接收数据,跟踪该设备和头部。数据以文本形式呈现。
    • <UnigineSDK>/data/samples/plugins/vrpn_client_01 that demonstrates receiving data from the virtual FlyStick device and two sensors, tracking this device and a head, inside the UNIGINE scene.<UnigineSDK>/data/samples/plugins/vrpn_client_01 演示了从虚拟 FlyStick 设备和两个传感器接收数据,在 UNIGINE 场景中跟踪该设备和头部。
    注意
    The samples are available if you add the VRPN Client plugin to your project via UNIGINE SDK Browser.如果您通过 UNIGINE SDK 浏览器将 VRPN Client 插件添加到您的项目,则这些示例可用。

Launching VRPN Client Plugin
启动 VRPN 客户端插件#

注意
Before launching the plugin, you should run a server application (it is usually DTrack) that receives input data from an input device. The VRPN Client plugin will connect to this server and receive data from it.在启动插件之前,您应该运行一个从输入设备接收输入数据的服务器应用程序(通常是 DTrack)。 VRPN Client 插件将连接到该服务器并从中接收数据。

To use the VRPN Client plugin, you should specify the extern_plugin command line option on the application start-up:要使用 VRPN Client 插件,您应该在应用程序启动时指定 extern_plugin 命令行选项:

命令行
main_x64 -extern_plugin "UnigineVrpnClient"

Implementing Application Using VRPN Client Plugin
使用 VRPN 客户端插件实现应用程序#

When the VRPN Client plugin is loaded, the following classes are added to UnigineScript:加载 VRPN Client 插件后,以下类将添加到 UnigineScript:

  • VrpnAnalogDevice that receives data about input devices sticks.VrpnAnalogDevice 接收有关输入设备棒的数据。
  • VrpnButtonDevice that receives data about input devices buttons states.VrpnButtonDevice 接收有关输入设备按钮状态的数据。
  • VrpnTrackerDevice that receives about position, orientation, velocity and acceleration of tracked objects from 3D tracking sensors.VrpnTrackerDevice 从 3D 跟踪传感器接收有关被跟踪对象的位置、方向、速度和加速度。
注意
Each class can be instanced more than once.每个类可以被多次实例化。

When implementing an application using the plugin, instances of the classes listed above should be created on engine initialization.使用插件实现应用程序时,应在引擎初始化时创建上面列出的类的实例。

注意
The server address and the device name should be passed to constructors of the UnigineScript classes (VrpnAnalogDevice, VrpnButtonDevice, VrpnTrackerDevice) as follows: device_name@server_address.服务器地址和设备名称应传递给 UnigineScript 类 (VrpnAnalogDevice, VrpnButtonDevice, VrpnTrackerDevice) 的构造函数,如下所示:device_name@server_address

For example, if the VRPN server is set on the PC via the DTrack application, the following should be passed: DTrack@localhost. If the server is set on another PC, instead of the localhost, you should specify the PC's IP address. You should also call the update() method for each initialized device on engine update.For example, if the VRPN server is set on the PC via the DTrack application, the following should be passed: DTrack@localhost. If the server is set on another PC, instead of the localhost, you should specify the PC's IP address. You should also call the update() method for each initialized device on engine update.For example, if the VRPN server is set on the PC via the DTrack application, the following should be passed: DTrack@localhost. If the server is set on another PC, instead of the localhost, you should specify the PC's IP address. You should also call the Update() method for each initialized device on engine update.例如,如果通过 DTrack 应用程序在 PC 上设置 VRPN 服务器,则应传递以下内容:DTrack@localhost。如果服务器设置在另一台 PC 上,而不是 localhost,您应该指定 PC 的 IP 地址。您还应该在引擎更新时为每个初始化的设备调用 update() 方法。

源代码 (UnigineScript)
#ifdef HAS_VRPN_CLIENT

VrpnTrackerDevice tracker;
VrpnButtonDevice button;
VrpnAnalogDevice analog;

int init() {
	
	tracker = new VrpnTrackerDevice("DTrack@localhost");
	button = new VrpnButtonDevice("DTrack@localhost");
	analog = new VrpnAnalogDevice("DTrack@localhost");
	
	return 1;
}

int shutdown() {

	delete tracker;
	delete button;
	delete analog;
	
	return 1;
}

int update() {
	
	tracker.update();
	button.update();
	analog.update();
	
	return 1;
}

#else

int init() {
	log.warning("No VRPN Client plugin detected\n");
	return 1;
}

int shutdown() {
	return 1;
}

#endif
最新更新: 2024-12-13
Build: ()