This page has been translated automatically.
Setting Up Materials
Setting Up Properties
Landscape Tool
Extending Editor Functionality
World Nodes
Sound Objects
Pathfinding Objects
Usage Examples
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine Tools
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
Content Optimization
Material Nodes Library
Art Samples


本文介绍的功能在 Community SDK 版本中不可用。
您应该升级到 Sim SDK版本才能使用它。

The Image Generator (IG) renders scenes of the virtual world, providing an immersive view of the simulation, it can be thought of as a viewport into the virtual world of simulation. A simulator may have one or more IG channels rendering an "out-the-window" view and might have several additional views representing various sensors: electro-optical (EO), infrared (IR), and night vision (NV); and sometimes radar. The way these views are displayed may vary from a simple desktop monitor to a multiple projector dome display.Image Generator(IG)渲染了虚拟世界的场景,提供了逼真的模拟视图,可以将其视为仿真虚拟世界的视口。模拟器可能具有一个或多个IG通道,呈现“窗外”视图,并且可能具有代表各种传感器的几个其他视图:电光(EO),红外(IR)和夜视(NV);有时是雷达。这些视图的显示方式可能从简单的台式机显示器到多台投影机的球型显示器不等。

The IG uses the terrain database and a set of entities (aircrafts, vehicles, etc.) to render a scene, along with sky, weather and visual effects, from the specified perspective, and sends a video signal to the appropriate display within the user interface.IG使用 地形数据库 和一组 实体 (飞机,车辆等)来渲染从指定的角度来看场景,天空,天气和视觉效果,并将视频信号发送到用户界面内的相应显示器。

The IG receives updates and events from all the other hosts from the network, be it a vehicle/aircraft simulation host, instructor operator station (IOS), physical simulation host, etc. The IG also responds to requests from other hosts to check for intersections with the terrain to determine if the vehicle/aircraft bumps into anything or has a line-of-sight to another entity(ies).IG从网络中的所有其他主机接收更新和事件,这些主机可能是车辆/飞机模拟主机,教练操作员站(IOS),物理模拟主机等。IG还响应其他主机的请求以检查路口 根据地形确定车辆/飞机是否撞上任何物体或是否与另一个实体有视线。

The simulator and the IG can be integrated into a single application, where the simulator uses API calls to control the IG. Or, the simulator can be connected to the IG via a network connection and communicate by sending/receiving messages specified by an interface control document such as CIGI (Common Image Generator Interface). Or, they can be connected using the distributed simulation network and pass messages using communication protocols such as DIS or HLA.模拟器和IG可以集成到单个应用程序中,其中模拟器使用 API调用来控制IG。或者,模拟器可以通过网络连接连接到IG,并通过发送/接收由接口控制文档(例如 CIGI (通用图像生成器接口))指定的消息进行通信。或者,可以使用分布式仿真网络进行连接,并使用 DIS HLA 等通信协议传递消息。

Communication Protocols

HLA is a standard for interoperability among simulations. Rather than a networking protocol (wire standard) like DIS, HLA defines an architecture with a set of Application Programmer’s Interface (API) Standards. Simulation applications (known as federates) communicate by making calls to the HLA APIs. A piece of software known as the Runtime Infrastructure (RTI) implements the HLA API, and is responsible for transporting data from one federate to another.HLA是模拟之间互操作性的标准。 HLA定义了一种具有一组应用程序接口(API)标准的体系结构,而不是像DIS这样的网络协议(有线标准)。仿真应用程序(称为联邦)通过调用HLA API进行通信。一种称为运行时基础结构(RTI)的软件实现了HLA API,并负责将数据从一个联合体传输到另一个联合体。

An Entity is a static or dynamic simulation object that can be created, manipulated, and destroyed by the host. The virtual world is filled with entities, they represent certain objects of the real world (e.g. aircrafts, vehicles, ships, etc.)Entity是可以由主机创建,操纵和销毁的静态或动态仿真对象。虚拟世界充满了实体,它们代表现实世界的某些对象(例如飞机,车辆,轮船等)

A Terrain Database (or simply Database) is a virtual model of the landscape where the simulation takes place. Its character, quality, and content defines what can be done in the simulation environment. The resolution and level of detail of the terrain database content define the fidelity of interactions possible within the environment. UNIGINE supports double-precision coordinates enabling you to extend geographic coverage of the terrain, that defines the size of the area where the simulation can take place, up to the whole Earth's surface.Terrain Database(或简称为Database)是进行模拟的景观的虚拟模型。它的特性,质量和内容定义了在仿真环境中可以完成的工作。地形数据库内容的分辨率和详细程度定义了环境中可能发生的交互作用的保真度。 UNIGINE支持双精度坐标,使您能够扩展地形的地理覆盖范围,该范围定义了可以进行模拟的区域的大小,直至整个地球表面。

There’s more in a scene than the terrain database and the entities moving around – sky, atmosphere, and water. Drawing these ethereal parts of the environment is the IG’s responsibility too. Since their appearance varies dramatically depending on the weather and the time of day, several models are implemented to simulate the environment:除了地形数据库实体天空,大气之外,场景中还有更多的场景。 IG还负责吸引环境中的这些空灵部分。由于它们的外观会根据天气和一天中的时间变化很大,因此实现了一些模型来模拟环境:

  • An ephemeris model determines the position of the sun and moon, which both cast light into the scene, depending on given coordinates and date/time.星历表模型确定太阳和月亮的位置,它们都根据给定的坐标和日期/时间将光线投射到场景中。
  • A weather model, either in the IG or supplied by an external weather simulation, provides the cloud coverage, and a global wind concept with direction and strength, affecting vegetation animation and the environment.IG中的或由外部天气模拟提供的天气模型,可提供云层覆盖以及具有方向和强度的全球风概念,从而影响植被的动画和环境。

UNIGINE's IG is designed to be simple, easy to use and extensible via its plug-in based architecture. The main framework plugin, that manipulates systems, entities, articulated parts, component templates and so on, is the IG Plugin, it operates in terms of the UNIGINE Engine (Nodes, NodeReferences, etc.) and is not bound to any specific communication protocol. The IG plugin has a set of additional plugins, called connectors, that are used to link IG terminology with that of each specific protocol (e.g. CIGI, HLA, DIS). Basically, the architecture looks as follows:UNIGINE的IG通过其基于插件的体系结构设计为简单,易用且可扩展 IG插件是操纵系统,实体,铰接的零件,组件模板等的主要框架插件,它以UNIGINE引擎(节点,NodeReferences等)的形式运行,并且不受任何特定的通信协议的约束。 IG插件还有一组额外的插件,称为 connectors ,用于将IG术语与每个特定协议(例如CIGI,HLA,DIS)的链接。基本上,体系结构如下所示:


Within the IG, all entities, lights, databases, etc. are referred to via IDs. Simple articulation of entities' parts is performed based on XML definition and does not require a modeler to prepare any animations.在IG中,所有实体,灯光,数据库等均通过ID进行引用。根据 XML定义对实体的零件进行简单的表达,不需要建模者准备任何动画。

UNIGINE IG is currently implemented as IG Template.UNIGINE IG当前被实现为 IG模板

Currently supported CIGI packets当前支持的CIGI数据包

Type Supported Not Supported
ig_control Byte Swap, Database Number Timestamp, Extrapolation/Interpolation Enable, IG Mode
entity_control PARTIAL Alpha, Extrapolation/Interpolation Enable
entity_clamped_control FULL
articulated_control FULL
articulated_short_control FULL
rate_control FULL
celestial_control FULL
atmosphere_control Visibility Range, Wind speed and direction Global Humidity, Global Air Temperature, Global Barometric Pressure
environment_control NOT SUPPORTED Merge Weather Properties, Merge Aerosol Concentrations, Merge Maritime Surface Conditions, Merge Terrestrial Surface Conditions
weather_control Layer ID (1-5), Weather Enable, Random Lightning Enable, Cloud Type (not regional clouds), Scope(0-1), Visibility Range, Coverage(for cloud), Base Elevation, Thickness, Horizontal Wind Speed, Vertical Wind Speed, Wind Direction, Aerosol Concentration (for precipitation) Entity ID, Severity, Air Temperature, Scud Frequency, Barometric Pressure
maritime_control FULL
wave_control NOT SUPPORTED
terrestrial_control NOT SUPPORTED
view_control FULL
sensor_control NOT SUPPORTED
tracker_control NOT SUPPORTED
earth_model_def NOT SUPPORTED
trajectory_def NOT SUPPORTED
view_def FULL
segment_def FULL
volume_def FULL
hat_hot_request FULL, with Extended Response and Update Period parameter
los_segment_request PARTIAL, with Extended Response and Update Period parameter Alpha Threshold, Color
los_vector_request PARTIAL, with Extended Response and Update Period parameter Alpha Threshold
position_request FULL, with Update Period parameter
environment_request NOT SUPPORTED
symbol_surface_def PARTIAL
symbol_text_def PARTIAL
symbol_circle_def PARTIAL
symbol_line_def PARTIAL
symbol_clone NOT SUPPORTED
symbol_control PARTIAL
symbol_short_control PARTIAL

Interpolation and Extrapolation插值和外推#

Unigine IG uses Interpolated Snapshots (IS) to tackle with the problem of lost packets between the IG and hosts. It works by taking two old, but known positions and interpolating the object between them. It is accomplished by having a buffer of received positions and rotations, along with the time they represent. We usually take our current local time minus some predefined amount — interpolation period (40 ms by default), then go into our buffer, find the two indices that are just before and just after this time and interpolate.Unigine IG使用内插快照(IS)解决IG与主机之间的数据包丢失的问题。它通过采取两个旧的但已知的位置并在它们之间插入对象来工作。通过缓冲接收到的位置和旋转以及它们代表的时间来实现。通常,我们将当前本地时间减去一些预定义的时间-插值周期(默认为 40 ms),然后进入缓冲区,找到之前和之后的两个索引在这段时间之后进行插值。

If we don't have a received position and rotation for the time we're looking for, the extrapolation (guessing) is used. It also has a limited time — extrapolation period (200 ms by default). If the extrapolation period is over but there are still no packets received, all objects will freeze.如果我们在寻找的时间内没有收到位置和旋转信息,则使用外推(猜测)。它也有时间限制-外推期(默认为 200 ms)。如果推断期已结束,但仍未收到任何数据包,则所有对象将冻结。

In most cases, this method provides a very accurate representation of the world to each slave, as in general only already known positions of remote objects are rendered and in rare cases the system will try to extrapolate (guess) where an object is. This, however, comes at a cost, as we always render 40 ms (interpolation period) behind current time, so that new packets have time to arrive with data.在大多数情况下,此方法为每个从属设备提供了非常准确的世界表示,因为通常只渲染远程对象的已知位置,在极少数情况下,系统会尝试推断(猜测)对象所在的位置。但是,这是有代价的,因为我们总是在当前时间之后渲染 40 毫秒(插值周期),以便新数据包有时间到达数据。

See Also也可以看看#

  • The IG plugin API section for more details on managing IG via code (C++). IG插件API 部分提供了有关通过代码(C ++)管理IG的更多详细信息。
  • The Setting Up Properties article for more details on adjusting properties for new entities.设置属性文章,为调整新实体的属性提供了更多详细信息。
  • The IG Configuration article for more details on setting up your IG. IG配置文章,提供有关设置IG的更多详细信息。
  • The Environment Settings article for more details on configuring sky and weather parameters.环境设置文章提供了有关配置天空和天气参数的更多详细信息。

Using the IG Template使用IG模板#

The basic workflow is as follows:基本工作流程如下:

  1. Open the SDK Browser, go the the Projects tab, and create a new project using the IG Template.

    Create a Project

    打开SDK浏览器,转到项目标签,然后使用 IG 模板创建新项目

    Create a Project

  2. Open the world in UnigineEditor by clicking Open Editor.

    Open the UnigineEditor


    Open the UnigineEditor

  3. Use the Landscape Tool to generate a terrain.

    Generate a Terrain

    The process of terrain generation is shown in the Georeferenced Terrain Generation video tutorial.The process of terrain generation is shown in the Georeferenced Terrain Generation video tutorial.
    The process of terrain generation is shown in the Georeferenced Terrain Generation video tutorial.

    Generate a Terrain

    The process of terrain generation is shown in the Georeferenced Terrain Generation video tutorial.地理参考地形生成视频教程中显示了地形生成的过程。
  4. Add models (as node references) to represent entities used in your simulation (aircrafts, vehicles, etc.). Assign properties (lights, landing gears, wheels, controllers, effects, etc.) to the corresponding nodes and adjust their parameters as required.

    Add Models and Adjust Properties

    添加模型(作为节点引用)以表示模拟中使用的实体(飞机,车辆等)。 分配属性(灯光,起落架,车轮,控制器,效果等)到相应的节点,并根据需要调整其参数。

    Add Models and Adjust Properties

  5. Save your world and close Unigine Editor.保存您的世界并关闭Unigine编辑器。
  6. Open the configuration file (ig_config.xml) and add definitions for all your entities, specify necessary system settings and connector parameters.

    Add Models and Adjust Properties


    Add Models and Adjust Properties

  7. Launch your IG application by clicking Run.

    Run the Application

    By default your application will launch with IG, CIGIConnector plugins. If you want to change this, please modify the startup options after clicking an ellipsis under the Run button for your project on the Projects tab of the SDK Browser.By default your application will launch with IG, CIGIConnector plugins. If you want to change this, please modify the startup options after clicking an ellipsis under the Run button for your project on the Projects tab of the SDK Browser.
    By default your application will launch with IG, CIGIConnector plugins. If you want to change this, please modify the startup options after clicking an ellipsis under the Run button for your project on the Projects tab of the SDK Browser.

    Run the Application

    By default your application will launch with IG, CIGIConnector plugins. If you want to change this, please modify the startup options after clicking an ellipsis under the Run button for your project on the Projects tab of the SDK Browser.默认情况下,您的应用程序将使用 IG,CIGIConnector 插件启动。如果要更改此设置,请在项目的 Project 标签上单击项目的 Run 按钮下的省略号后,修改启动选项。 SDK浏览器。
  8. Launch your host application or a CIGI Host Emulator to communicate with your IG.


IG Synchronization SystemIG同步系统#

The IG has its own synchronization system with the Syncker plugin initialized automatically. To use a Multi-IG configuration, you should specify additional startup command-line arguments. There are common arguments used for both Master and Slave, and specific ones. The list of all available arguments for IG network configuration is given in the Syncker-Specific Options article.IG拥有自己的同步系统,其中 Syncker插件已自动初始化。要使用 Multi-IG 配置,您应该指定其他启动命令行参数。主站和从站都有通用的参数,也有特定的参数。 IG网络配置的所有可用参数的列表在 Syncker特定选项文章中给出。

IG launching order does not matter (you can run the Master and then Slaves, or vice versa). What is important is that you should specify the proper number of IGs for the Master via the -sync_count argument. Please note, that it is the total number of IG hosts, not the number of Slaves (e.g.: if you have 1 Master and 2 Slaves, you should specify: -sync_count 3).IG的启动顺序无关紧要(您可以先运行主设备,然后运行从设备,反之亦然)。重要的是您应该通过 -sync_count 参数为主设备指定正确的IG数量。请注意,这是IG主机的总数,而不是从站的数量(例如:如果您具有 1 主站和 2 从站,则应指定: -sync_count 3 )。

IG uses the only port (the one used by Syncker): UDP 8890IG使用唯一的端口(Syncker使用的端口): UDP 8890

This means that two messages reporting successful connections must appear in the Console.这意味着控制台中必须出现两条报告连接成功的消息。

For a Slave it looks as follows:对于从设备,其外观如下:

IG::Manager::on_ig_connected(): Connection to "IG Master" (ip:port) has been established //< - message from IG
Syncker::Slave::connect_to_master(): connection to "ip" accepted in 0.00 seconds //<- message from Syncker

For the Master it looks as follows:对于母版,其外观如下:

IG::Manager::on_ig_connected(): Connection to "IG Slave" (ip:port) has been established <- from IG
Syncker::Master::check_new_connections(): connection from "ip" "slave" accepted in 0.00 seconds <- from Syncker
IG::Manager::on_ig_connected(): all connections established. Session started <- from IG

The last message means that the Master has established all necessary connections and is ready to work.最后一条消息表示主机已建立所有必要的连接并准备工作。

If the IG is launched with a connector, the latter starts using IG API immediately, without waiting for all connections. Therefore, the Master switches to blocking mode (the window is not refreshed) with the following message printed to the Console:如果使用连接器启动IG,则连接器将立即开始使用IG API,而无需等待所有连接。因此,主服务器切换到阻止模式(不刷新窗口),并向控制台打印以下消息:

IG::Manager::wait_for_all_connections(): waiting for all connections within a minute…

Thus, you have one minute to connect all IGs. If no hosts are connected the IG during this period the Master will shut down reporting to the Console that connections were not established.因此,您有1分钟的时间连接所有IG。如果在此期间没有主机连接到IG,则主机将关闭向控制台的报告,报告未建立连接。

So, the minimum number of arguments required to launch IG on two computers looks as follows:因此,在两台计算机上启动IG所需的最少参数数目如下所示:


-extern_plugin "IG,CIGIConnector" -sync_master 1 -sync_count 2

-extern_plugin "IG,CIGIConnector" -sync_master 1 -sync_count 2


-extern_plugin "IG" -sync_master 0

-extern_plugin "IG" -sync_master 0

Please note, that there are no IP addresses explicitly specified the IG will try to define addresses automatically.请注意,没有明确指定IP地址,IG会尝试自动定义地址。

IG Master and IG Slaves must be in the same isolated subsystem. In case of several IG Masters in the network you should specify their IP addresses explicitly, as automatic detection is not available.IG主站和IG从站必须位于同一隔离子系统中。如果网络中有多个IG Master,则应明确指定其IP地址,因为自动检测不可用。

Here is a typical number of arguments when launching IG hosts:这是启动IG主机时的典型参数数量:


-extern_plugin "IG,CIGIConnector" -sync_master 1 -sync_count 3 -sync_view left

Slave 1:

-extern_plugin "IG" -sync_master 0 -sync_view center

Slave 2:

-extern_plugin "IG" -sync_master 0 -sync_view right

Extending Template's Functionality扩展模板的功能#

UNIGINE's IG provides the following opportunities for customization:UNIGINE的IG提供以下定制机会:

  • IG can be built into a Qt/WinForm/WPF application and have a custom interface (e.g., switching between cameras in the simplest case).IG可以内置到Qt / WinForm / WPF应用程序中,并具有自定义界面(例如,在最简单的情况下在摄像机之间切换)。
  • A host can have several IGs connected, and each running IG can be programmed to have its own logic, if necessary.主机可以连接多个IG,并且如有必要,可以将每个运行的IG编程为具有自己的逻辑。
  • Secondary static objects (such as a billboard on a building or a ship following a certain route) can be animated, and their position, rotation, or other specific parameters can be requested via CIGI/HLA.可以对辅助静态对象(例如,沿着特定路线的建筑物或船舶上的广告牌)进行动画处理,并可以通过CIGI / HLA请求其位置,旋转或其他特定参数。
  • New visual effects can be created to create a more realistic picture.可以创建新的视觉效果以创建更逼真的图像。
  • Users can add their own custom components and process them by modifying the ig_config.xml file.用户可以添加自己的自定义组件,并通过修改 ig_config.xml 文件进行处理。
  • You can extend IG functionality to support other protocols (e.g. ALSP, TENA, CTIA, etc. ), for this purpose you'll have to write your own connectors.您可以扩展IG功能以支持其他协议(例如ALSP,TENA,CTIA等),为此,您必须编写自己的连接器

Adding a Custom Connector添加自定义连接器#

A connector is actually a custom C++ Plugin used to communicate messages between the host and the IG. This plugin reads packages and calls the corresponding methods of the IG Plugin (listed in include/plugins/UnigineIG.h).连接器实际上是一个自定义的 C ++插件,用于在主机和IG之间传递消息。该插件读取包并调用 IG插件(在 include / plugins / UnigineIG.h 中列出)的相应方法。

Files listed below can be used as a template for your custom connector:下面列出的文件可用作您的自定义连接器的模板:

  • Plugin include file to be put to the include/plugins folder:插件包含文件放入include/plugins文件夹:

    CUSTOMConnectorInterface.h CUSTOMConnectorInterface.h

    源代码 (C++)
    namespace IG
    	namespace CUSTOM
    		class ConnectorInterface
    			virtual ~ConnectorInterface() {}
    			// client initialization
    			virtual int init(/*initialization parameters*/) = 0;
    			// client shutdown
    			virtual int shutdown() = 0;
    			// other methods
    			// ...
    			// callbacks
    			//virtual void setConnectCallback(Unigine::CallbackBase* func) = 0;
    			//virtual Unigine::CallbackBase* getConnectCallback() const = 0;
    			// ...
  • Plugin source files to be put to the source/custom_connector folder:要放入source/custom_connector文件夹的插件源文件:

    CUSTOMConnectorPlugin.cpp CUSTOMConnectorPlugin.cpp

    源代码 (C++)
    #include <UniginePlugin.h>
    #include "CUSTOMConnector.h"
    #include "CUSTOMConnectorInterpreter.h"
    using namespace Unigine;
    // CUSTOMConnectorPlugin
    class CUSTOMConnectorPlugin : public Plugin
    	virtual ~CUSTOMConnectorPlugin();
    	const char *get_name() override;
    	void *get_data() override;
    	int init() override;
    	int shutdown() override;
    	void update() override;
    	IG::CUSTOM::Connector *connector;
    	: connector(nullptr)
    	delete connector;
    const char *CUSTOMConnectorPlugin::get_name()
    	return "CUSTOMConnector";
    void *CUSTOMConnectorPlugin::get_data()
    	return static_cast<IG::CUSTOM::ConnectorInterface *>(connector);
    int CUSTOMConnectorPlugin::init()
    	connector = new IG::CUSTOM::Connector();
    	return 1;
    int CUSTOMConnectorPlugin::shutdown()
    	return 1;
    void CUSTOMConnectorPlugin::update()
    // Plugin export
    extern "C" UNIGINE_EXPORT void *CreatePlugin()
    	return new CUSTOMConnectorPlugin();
    extern "C" UNIGINE_EXPORT void ReleasePlugin(void *plugin)
    	delete static_cast<CUSTOMConnectorPlugin *>(plugin);

    CUSTOMConnector.h CUSTOMConnector.h

    源代码 (C++)
    #ifndef __CUSTOM_CONNECTOR_H__
    #define __CUSTOM_CONNECTOR_H__
    #include <plugins/CUSTOMConnectorInterface.h>
    #include <plugins/UnigineIG.h>
    #include <UnigineInterface.h>
    #include <UnigineLogic.h>
    namespace IG
    namespace CUSTOM
    	class CUSTOMWorldLogic;
    	class Connector : public ConnectorInterface
    		virtual ~Connector() {}
    		// singleton
    		static Connector *get() 
    			if (connector == nullptr)
    				Log::fatal("%s:: CUSTOM connector is NULL\n", __FUNCTION__);
    			return connector;
    		// automatic initialization on plugin load
    		void init();		
    		// update/shutdown client
    		void update();
    		void shutdown();
    		// methods to be called by the CUSTOMWorldLogic class at the corresponding stages of the execution sequence
    		void onWorldInit();
    		void onWorldShutdown();
    		static Connector *connector;
    		IG::Manager *ig_manager = nullptr;
    		CUSTOMWorldLogic *world_logic;
    	// WorldLogic class
    	class CUSTOMWorldLogic : public Unigine::WorldLogic
    		CUSTOMWorldLogic() {}
    		virtual ~CUSTOMWorldLogic() {}
    		virtual UNIGINE_INLINE int init() override { Connector::get()->onWorldInit(); return 1; }
    		virtual UNIGINE_INLINE int shutdown() override { Connector::get()->onWorldShutdown(); return 1; }
    #endif /* __CUSTOM_CONNECTOR_H__ */

    CUSTOMConnector.cpp CUSTOMConnector.cpp

    源代码 (C++)
    #include "CUSTOMConnector.h"
    #include <UnigineEngine.h>
    #include <UnigineNode.h>
    using namespace Unigine;
    using namespace Math;
    using namespace IG;
    using namespace CUSTOM;
    Connector::Connector() {
    	world_logic = new CUSTOMWorldLogic();
    void Connector::init()
    	const auto host = "";
    	const auto port = 3000;
    	int ig_plugin_index = Engine::get()->findPlugin("IG");
    	if (ig_plugin_index == -1)
    		Log::error("IG::CUSTOM::Connector::init(): IG plugin isn't loaded\n");
    	ig_manager = (IG::Manager*)Engine::get()->getPluginData(ig_plugin_index);
    	// IG setup
    void Connector::update()
    	// read & write packets
    void Connector::shutdown() 
    	// shutdown client
    	// clear static link
    	connector = nullptr;
    	// ...
    void Connector::onWorldInit() 
    	// actions to be performed when a new world is loaded
    void Connector::onWorldShutdown() 
    	// actions to be performed when current world is closed

    CUSTOMConnectorInterpreter.h CUSTOMConnectorInterpreter.h

    源代码 (C++)
    #include <UnigineBase.h>
    void CUSTOMConnectorInterpreterInit();
    void CUSTOMConnectorInterpreterShutdown();

    CUSTOMConnectorInterpreter.cpp CUSTOMConnectorInterpreter.cpp

    源代码 (C++)
    #include <UnigineEngine.h>
    #include <UnigineInterface.h>
    #include <plugins/CUSTOMConnectorInterface.h>
    #include "CUSTOMConnector.h"
    using namespace Unigine;
    using namespace IG;
    void CUSTOMConnectorInterpreterInit()
    	int id = Interpreter::addGroup("CUSTOMConnectorInterpreter");
    	// defines
    	Interpreter::addExternDefine("HAS_CUSTOM_CONNECTOR", id);
    	// enums
    	// Interpreter::addExternVariable("CUSTOM_VERSION_10", MakeExternConstant<int>(CUSTOM_VERSION_10), id);
    	// functions
    	Connector *connector = Connector::get();
    	Interpreter::addExternLibrary("engine.custom", id);
    	//Interpreter::addExternFunction("engine.custom.init", MakeExternObjectFunction(connector, &Connector::init), id);
    	//Interpreter::addExternFunction("engine.custom.shutdown", MakeExternObjectFunction(connector, &Connector::shutdown), id);
    void CUSTOMConnectorInterpreterShutdown()

    CUSTOMConnectorWrapper.cpp CUSTOMConnectorWrapper.cpp

    源代码 (C++)
    //push ignore deprecated warnings
    #ifdef __GNUC__
    #pragma GCC diagnostic push
    #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
    #elif defined(_MSC_VER)
    #pragma warning(push)
    #pragma warning(disable: 4996)
    #include <UnigineEngine.h>
    #include <plugins/CUSTOMConnectorInterface.h>
    using namespace Unigine;
    extern "C" 
    	//UNIGINE_EXPORT void CUSTOMConnector_method(CUSTOMConnector *self) { if (self) self->method(); }
    //pop ignore deprecated warnings
    #ifdef __GNUC__
    #pragma GCC diagnostic pop
    #elif defined(_MSC_VER)
    #pragma warning(pop)
最新更新: 2021-11-30
Build: ()