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)
Plugins
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

Unigine::Plugins::SpiderVision::ColorCorrectionData Class

Header: #include <plugins/Unigine/SpiderVision/UnigineSpiderVision.h>

The instance of this class stores the viewport color correction data. Color correction may be required to compensate for the difference in color rendition of different projectors.

You can also adjust the brightness of the image to make the parts of the image that are farther away from the viewer lighter and vice versa, so that the brightness of the resulting image is uniform.

The color correction data are stored in the configuration file.

This object is accessible via the corresponding method of the ViewportData class.

ColorCorrectionData Class

Members

void setEnabled ( bool enabled ) #

Sets a new value indicating if the color correction is applied.

Arguments

  • bool enabled - Set true to enable color correction; false - to disable it.

bool isEnabled() const#

Returns the current value indicating if the color correction is applied.

Return value

true if color correction is enabled; otherwise false.

void setColorScale ( const Math::vec4& scale ) #

Sets a new color multiplier for the rendered image.

Arguments

  • const Math::vec4& scale - The color multiplier

Math::vec4 getColorScale() const#

Returns the current color multiplier for the rendered image.

Return value

Current color multiplier

void setColorBias ( const Math::vec4& bias ) #

Sets a new color bias for the rendered image.

Arguments

  • const Math::vec4& bias - The per-channel color bias.

Math::vec4 getColorBias() const#

Returns the current color bias for the rendered image.

Return value

Current per-channel color bias.

void setCornerBrightness ( const Math::vec4& brightness ) #

Sets a new brightness correction values for the corners of the rendered image.

Arguments

  • const Math::vec4& brightness - The four-component vector containing brightness values, in the [0.0f, 1.0f] range, for the corners of the rendered image (upper left, upper right, lower left, lower right).

Math::vec4 getCornerBrightness() const#

Returns the current brightness correction values for the corners of the rendered image.

Return value

Current four-component vector containing brightness values, in the [0.0f, 1.0f] range, for the corners of the rendered image (upper left, upper right, lower left, lower right).

static Event<> getEventChanged() const#

event triggered on changing color correction data. You can subscribe to events via connect()   and unsubscribe via disconnect(). You can also use EventConnection and EventConnections classes for convenience (see examples below).
Notice
For more details see the Event Handling article.
The event handler signature is as follows: myhandler()

Usage Example

Source code (C++)
// implement the Changed event handler
void changed_event_handler()
{
	Log::message("\Handling Changed 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 changed_event_connections;

// link to this instance when subscribing to an event (subscription to various events can be linked)
ColorCorrectionData::getEventChanged().connect(changed_event_connections, changed_event_handler);

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

// ...

// later all of these linked subscriptions can be removed with a single line
changed_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 changed_event_connection;

// subscribe to the Changed event with a handler function keeping the connection
ColorCorrectionData::getEventChanged().connect(changed_event_connection, changed_event_handler);

// ...

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

// ... actions to be performed

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

// ...

// remove subscription to the Changed event via the connection
changed_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 Changed event handler implemented as a class member
	void event_handler()
	{
		Log::message("\Handling Changed event\n");
		// ...
	}
};

SomeClass *sc = new SomeClass();

// ...

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

// ...

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


//////////////////////////////////////////////////////////////////////////////
//   4. Subscribe to an event saving a particular connection ID
//   and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// instance of the EventConnections class to manage event connections
EventConnections e_connections;

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

// subscribe to the Changed event with a lambda handler function and keeping connection ID
changed_handler_id = ColorCorrectionData::getEventChanged().connect(e_connections, []() { 
		Log::message("\Handling Changed event (lambda).\n");
	}
);

// remove the subscription later using the ID
ColorCorrectionData::getEventChanged().disconnect(changed_handler_id);


//////////////////////////////////////////////////////////////////////////////
//   5. Ignoring all Changed events when necessary
//////////////////////////////////////////////////////////////////////////////

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

// ... actions to be performed

// and enable it back when necessary
ColorCorrectionData::getEventChanged().setEnabled(true);

Return value

Event reference.

void saveXml ( const Ptr<Xml> & xml ) #

Saves the color correction data to the given instance of the Xml class.

Arguments

  • const Ptr<Xml> & xml - Xml class instance into which the data will be saved.

bool restoreXml ( const Ptr<Xml> & xml ) #

Loads the color correction data from the specified instance of the Xml class.

Arguments

  • const Ptr<Xml> & xml - Xml class instance the data from which is to be loaded.

Return value

true if the data has been loaded successfully, otherwise false.

void save ( const Ptr<Stream> & stream ) #

Saves the color correction data to the specified stream.

Arguments

  • const Ptr<Stream> & stream - Stream to which the data is to be written.

void restore ( const Ptr<Stream> & stream ) #

Loads the color correction data from the specified stream.

Arguments

  • const Ptr<Stream> & stream - Stream the data from which is to be loaded.
Last update: 2024-08-16
Build: ()