|
@@ -2,13 +2,15 @@
|
|
|
//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
|
|
//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
|
|
|
using System;
|
|
using System;
|
|
|
using System.Runtime.CompilerServices;
|
|
using System.Runtime.CompilerServices;
|
|
|
|
|
+using System.Runtime.InteropServices;
|
|
|
|
|
|
|
|
namespace BansheeEngine
|
|
namespace BansheeEngine
|
|
|
{
|
|
{
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// Settings that control automatic exposure (eye adaptation) post-process.
|
|
/// Settings that control automatic exposure (eye adaptation) post-process.
|
|
|
/// </summary>
|
|
/// </summary>
|
|
|
- struct AutoExposureSettings // Note: Must match C++ struct AutoExposureSettings
|
|
|
|
|
|
|
+ [StructLayout(LayoutKind.Sequential), SerializeObject]
|
|
|
|
|
+ public struct AutoExposureSettings // Note: Must match C++ struct AutoExposureSettings
|
|
|
{
|
|
{
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// Determines minimum luminance value in the eye adaptation histogram. The histogram is used for calculating the
|
|
/// Determines minimum luminance value in the eye adaptation histogram. The histogram is used for calculating the
|
|
@@ -28,8 +30,8 @@ namespace BansheeEngine
|
|
|
/// Percentage below which to ignore values in the eye adaptation histogram. The histogram is used for calculating
|
|
/// Percentage below which to ignore values in the eye adaptation histogram. The histogram is used for calculating
|
|
|
/// the average brightness of the scene.Total luminance in the histogram will be summed up and multiplied by this
|
|
/// the average brightness of the scene.Total luminance in the histogram will be summed up and multiplied by this
|
|
|
/// value to calculate minimal luminance. Luminance values below the minimal luminance will be ignored and not used
|
|
/// value to calculate minimal luminance. Luminance values below the minimal luminance will be ignored and not used
|
|
|
- /// in scene brightness calculations.This allows you to remove outliers on the lower end of the histogram (e.g. a
|
|
|
|
|
- /// few very dark pixels in an otherwise bright image). In range [0.0f, 1.0f].
|
|
|
|
|
|
|
+ /// in scene brightness calculations.This allows you to remove outliers on the lower end of the histogram (for
|
|
|
|
|
+ /// example a few very dark pixels in an otherwise bright image). In range [0.0f, 1.0f].
|
|
|
/// </summary>
|
|
/// </summary>
|
|
|
public float HistogramPctLow;
|
|
public float HistogramPctLow;
|
|
|
|
|
|
|
@@ -37,22 +39,22 @@ namespace BansheeEngine
|
|
|
/// Percentage above which to ignore values in the eye adaptation histogram. The histogram is used for calculating
|
|
/// Percentage above which to ignore values in the eye adaptation histogram. The histogram is used for calculating
|
|
|
/// the average brightness of the scene.Total luminance in the histogram will be summed up and multiplied by this
|
|
/// the average brightness of the scene.Total luminance in the histogram will be summed up and multiplied by this
|
|
|
/// value to calculate maximum luminance. Luminance values above the maximum luminance will be ignored and not used
|
|
/// value to calculate maximum luminance. Luminance values above the maximum luminance will be ignored and not used
|
|
|
- /// in scene brightness calculations.This allows you to remove outliers on the high end of the histogram (e.g. a few
|
|
|
|
|
- /// very bright pixels). In range [0.0f, 1.0f].
|
|
|
|
|
|
|
+ /// in scene brightness calculations.This allows you to remove outliers on the high end of the histogram (for
|
|
|
|
|
+ /// example a few very bright pixels). In range [0.0f, 1.0f].
|
|
|
/// </summary>
|
|
/// </summary>
|
|
|
public float HistogramPctHigh;
|
|
public float HistogramPctHigh;
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// Clamps the minimum eye adaptation scale to this value. This allows you to limit eye adaptation so that exposure
|
|
/// Clamps the minimum eye adaptation scale to this value. This allows you to limit eye adaptation so that exposure
|
|
|
- /// is never too high (e.g. when in a very dark room you probably do not want the exposure to be so high that
|
|
|
|
|
|
|
+ /// is never too high (for example when in a very dark room you probably do not want the exposure to be so high that
|
|
|
/// everything is still visible). In range [0.0f, 10.0f].
|
|
/// everything is still visible). In range [0.0f, 10.0f].
|
|
|
/// </summary>
|
|
/// </summary>
|
|
|
public float MinEyeAdaptation;
|
|
public float MinEyeAdaptation;
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// Clamps the maximum eye adaptation scale to this value. This allows you to limit eye adaptation so that exposure
|
|
/// Clamps the maximum eye adaptation scale to this value. This allows you to limit eye adaptation so that exposure
|
|
|
- /// is never too low (e.g. when looking at a very bright light source you probably don't want the exposure to be so
|
|
|
|
|
- /// low that the rest of the scene is all white (overexposed). In range [0.0f, 10.0f].
|
|
|
|
|
|
|
+ /// is never too low (for example when looking at a very bright light source you probably don't want the exposure to
|
|
|
|
|
+ /// be so low that the rest of the scene is all white (overexposed). In range [0.0f, 10.0f].
|
|
|
/// </summary>
|
|
/// </summary>
|
|
|
public float MaxEyeAdaptation;
|
|
public float MaxEyeAdaptation;
|
|
|
|
|
|
|
@@ -72,7 +74,8 @@ namespace BansheeEngine
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// Settings that control tonemap post-process.
|
|
/// Settings that control tonemap post-process.
|
|
|
/// </summary>
|
|
/// </summary>
|
|
|
- struct TonemappingSettings // Note: Must match C++ struct TonemappingSettings
|
|
|
|
|
|
|
+ [StructLayout(LayoutKind.Sequential), SerializeObject]
|
|
|
|
|
+ public struct TonemappingSettings // Note: Must match C++ struct TonemappingSettings
|
|
|
{
|
|
{
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// Controls the shoulder (upper non-linear) section of the filmic curve used for tonemapping. Mostly affects bright
|
|
/// Controls the shoulder (upper non-linear) section of the filmic curve used for tonemapping. Mostly affects bright
|
|
@@ -117,7 +120,8 @@ namespace BansheeEngine
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// Settings that control white balance post-process.
|
|
/// Settings that control white balance post-process.
|
|
|
/// </summary>
|
|
/// </summary>
|
|
|
- struct WhiteBalanceSettings // Note: Must match C++ struct WhiteBalanceSettings
|
|
|
|
|
|
|
+ [StructLayout(LayoutKind.Sequential), SerializeObject]
|
|
|
|
|
+ public struct WhiteBalanceSettings // Note: Must match C++ struct WhiteBalanceSettings
|
|
|
{
|
|
{
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// Temperature used for white balancing, in Kelvins.
|
|
/// Temperature used for white balancing, in Kelvins.
|
|
@@ -139,7 +143,8 @@ namespace BansheeEngine
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// Settings that control color grading post-process.
|
|
/// Settings that control color grading post-process.
|
|
|
/// </summary>
|
|
/// </summary>
|
|
|
- struct ColorGradingSettings // Note: Must match C++ struct ColorGradingSettings
|
|
|
|
|
|
|
+ [StructLayout(LayoutKind.Sequential), SerializeObject]
|
|
|
|
|
+ public struct ColorGradingSettings // Note: Must match C++ struct ColorGradingSettings
|
|
|
{
|
|
{
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// Saturation to be applied during color grading. Larger values increase vibrancy of the image.
|
|
/// Saturation to be applied during color grading. Larger values increase vibrancy of the image.
|
|
@@ -169,13 +174,9 @@ namespace BansheeEngine
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// Settings that control the post-process operations.
|
|
/// Settings that control the post-process operations.
|
|
|
/// </summary>
|
|
/// </summary>
|
|
|
- class PostProcessSettings : ScriptObject
|
|
|
|
|
|
|
+ [StructLayout(LayoutKind.Sequential), SerializeObject]
|
|
|
|
|
+ public struct PostProcessSettings
|
|
|
{
|
|
{
|
|
|
- public PostProcessSettings()
|
|
|
|
|
- {
|
|
|
|
|
- Internal_CreateInstance(this);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// Determines should automatic exposure be applied to the HDR image. When turned on the average scene brightness
|
|
/// Determines should automatic exposure be applied to the HDR image. When turned on the average scene brightness
|
|
|
/// will be calculated and used to automatically expose the image to the optimal range. Use the parameters provided
|
|
/// will be calculated and used to automatically expose the image to the optimal range. Use the parameters provided
|
|
@@ -183,162 +184,69 @@ namespace BansheeEngine
|
|
|
/// <see cref="ExposureScale"/> to manually adjust the automatic exposure. When automatic exposure is turned off you
|
|
/// <see cref="ExposureScale"/> to manually adjust the automatic exposure. When automatic exposure is turned off you
|
|
|
/// can use <see cref="ExposureScale"/> to manually set the exposure.
|
|
/// can use <see cref="ExposureScale"/> to manually set the exposure.
|
|
|
/// </summary>
|
|
/// </summary>
|
|
|
- public bool EnableAutoExposure
|
|
|
|
|
- {
|
|
|
|
|
- get { return Internal_GetEnableAutoExposure(mCachedPtr); }
|
|
|
|
|
- set { Internal_SetEnableAutoExposure(mCachedPtr, value); }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ public bool EnableAutoExposure;
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// Parameters used for customizing automatic scene exposure. <see cref="EnableAutoExposure"/>
|
|
/// Parameters used for customizing automatic scene exposure. <see cref="EnableAutoExposure"/>
|
|
|
/// </summary>
|
|
/// </summary>
|
|
|
- public AutoExposureSettings AutoExposure
|
|
|
|
|
- {
|
|
|
|
|
- get
|
|
|
|
|
- {
|
|
|
|
|
- AutoExposureSettings output;
|
|
|
|
|
- Internal_GetAutoExposureSettings(mCachedPtr, out output);
|
|
|
|
|
-
|
|
|
|
|
- return output;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- set { Internal_SetAutoExposureSettings(mCachedPtr, ref value); }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ public AutoExposureSettings AutoExposure;
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// Determines should the image be tonemapped. Tonemapping converts an HDR image into LDR image by applying
|
|
/// Determines should the image be tonemapped. Tonemapping converts an HDR image into LDR image by applying
|
|
|
/// a filmic curve to the image, simulating the effect of film cameras.Filmic curve improves image quality by
|
|
/// a filmic curve to the image, simulating the effect of film cameras.Filmic curve improves image quality by
|
|
|
/// tapering off lows and highs, preventing under- and over-exposure.This is useful if an image contains both
|
|
/// tapering off lows and highs, preventing under- and over-exposure.This is useful if an image contains both
|
|
|
/// very dark and very bright areas, in which case the global exposure parameter would leave some areas either over-
|
|
/// very dark and very bright areas, in which case the global exposure parameter would leave some areas either over-
|
|
|
- /// or under-exposed.Use ::tonemapping to customize how tonemapping performed.
|
|
|
|
|
|
|
+ /// or under-exposed. Use <see cref="Tonemapping"/> to customize how tonemapping performed.
|
|
|
///
|
|
///
|
|
|
/// If this is disabled, then color grading and white balancing will not be enabled either.Only relevant for HDR
|
|
/// If this is disabled, then color grading and white balancing will not be enabled either.Only relevant for HDR
|
|
|
/// images.
|
|
/// images.
|
|
|
/// </summary>
|
|
/// </summary>
|
|
|
- public bool EnableTonemapping
|
|
|
|
|
- {
|
|
|
|
|
- get { return Internal_GetEnableTonemapping(mCachedPtr); }
|
|
|
|
|
- set { Internal_SetEnableTonemapping(mCachedPtr, value); }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ public bool EnableTonemapping;
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// Parameters used for customizing tonemapping. <see cref="EnableTonemapping"/>
|
|
/// Parameters used for customizing tonemapping. <see cref="EnableTonemapping"/>
|
|
|
/// </summary>
|
|
/// </summary>
|
|
|
- public TonemappingSettings Tonemapping
|
|
|
|
|
- {
|
|
|
|
|
- get
|
|
|
|
|
- {
|
|
|
|
|
- TonemappingSettings output;
|
|
|
|
|
- Internal_GetTonemappingSettings(mCachedPtr, out output);
|
|
|
|
|
-
|
|
|
|
|
- return output;
|
|
|
|
|
- }
|
|
|
|
|
- set { Internal_SetTonemappingSettings(mCachedPtr, ref value); }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ public TonemappingSettings Tonemapping;
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// Parameters used for customizing white balancing. White balancing converts a scene illuminated by a light of the
|
|
/// Parameters used for customizing white balancing. White balancing converts a scene illuminated by a light of the
|
|
|
/// specified temperature into a scene illuminated by a standard D65 illuminant (average midday light) in order to
|
|
/// specified temperature into a scene illuminated by a standard D65 illuminant (average midday light) in order to
|
|
|
/// simulate the effects of chromatic adaptation of the human visual system.
|
|
/// simulate the effects of chromatic adaptation of the human visual system.
|
|
|
/// </summary>
|
|
/// </summary>
|
|
|
- public WhiteBalanceSettings WhiteBalance
|
|
|
|
|
- {
|
|
|
|
|
- get
|
|
|
|
|
- {
|
|
|
|
|
- WhiteBalanceSettings output;
|
|
|
|
|
- Internal_GetWhiteBalanceSettings(mCachedPtr, out output);
|
|
|
|
|
-
|
|
|
|
|
- return output;
|
|
|
|
|
- }
|
|
|
|
|
- set { Internal_SetWhiteBalanceSettings(mCachedPtr, ref value); }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ public WhiteBalanceSettings WhiteBalance;
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// Parameters used for customizing color grading.
|
|
/// Parameters used for customizing color grading.
|
|
|
/// </summary>
|
|
/// </summary>
|
|
|
- public ColorGradingSettings ColorGrading
|
|
|
|
|
- {
|
|
|
|
|
- get
|
|
|
|
|
- {
|
|
|
|
|
- ColorGradingSettings output;
|
|
|
|
|
- Internal_GetColorGradingSettings(mCachedPtr, out output);
|
|
|
|
|
-
|
|
|
|
|
- return output;
|
|
|
|
|
- }
|
|
|
|
|
- set { Internal_SetColorGradingSettings(mCachedPtr, ref value); }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ public ColorGradingSettings ColorGrading;
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
- /// Log2 value to scale the eye adaptation by (e.g. 2^0 = 1). Smaller values yield darker image, while larger yield
|
|
|
|
|
- /// brighter image.Allows you to customize exposure manually, applied on top of eye adaptation exposure (if
|
|
|
|
|
|
|
+ /// Log2 value to scale the eye adaptation by (for example 2^0 = 1). Smaller values yield darker image, while larger
|
|
|
|
|
+ /// yield brighter image.Allows you to customize exposure manually, applied on top of eye adaptation exposure (if
|
|
|
/// enabled). In range [-8, 8].
|
|
/// enabled). In range [-8, 8].
|
|
|
/// </summary>
|
|
/// </summary>
|
|
|
- public float ExposureScale
|
|
|
|
|
- {
|
|
|
|
|
- get { return Internal_GetExposureScale(mCachedPtr); }
|
|
|
|
|
- set { Internal_SetExposureScale(mCachedPtr, value); }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ public float ExposureScale;
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// Gamma value to adjust the image for. Larger values result in a brighter image. When tonemapping is turned
|
|
/// Gamma value to adjust the image for. Larger values result in a brighter image. When tonemapping is turned
|
|
|
/// on the best gamma curve for the output device is chosen automatically and this value can by used to merely tweak
|
|
/// on the best gamma curve for the output device is chosen automatically and this value can by used to merely tweak
|
|
|
/// that curve. If tonemapping is turned off this is the exact value of the gamma curve that will be applied.
|
|
/// that curve. If tonemapping is turned off this is the exact value of the gamma curve that will be applied.
|
|
|
/// </summary>
|
|
/// </summary>
|
|
|
- public float Gamma
|
|
|
|
|
- {
|
|
|
|
|
- get { return Internal_GetGamma(mCachedPtr); }
|
|
|
|
|
- set { Internal_SetGamma(mCachedPtr, value); }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ public float Gamma;
|
|
|
|
|
|
|
|
- [MethodImpl(MethodImplOptions.InternalCall)]
|
|
|
|
|
- private static extern void Internal_CreateInstance(PostProcessSettings managedInstance);
|
|
|
|
|
-
|
|
|
|
|
- [MethodImpl(MethodImplOptions.InternalCall)]
|
|
|
|
|
- private static extern bool Internal_GetEnableAutoExposure(IntPtr thisPtr);
|
|
|
|
|
-
|
|
|
|
|
- [MethodImpl(MethodImplOptions.InternalCall)]
|
|
|
|
|
- private static extern void Internal_SetEnableAutoExposure(IntPtr thisPtr, bool value);
|
|
|
|
|
-
|
|
|
|
|
- [MethodImpl(MethodImplOptions.InternalCall)]
|
|
|
|
|
- private static extern void Internal_GetAutoExposureSettings(IntPtr thisPtr, out AutoExposureSettings value);
|
|
|
|
|
-
|
|
|
|
|
- [MethodImpl(MethodImplOptions.InternalCall)]
|
|
|
|
|
- private static extern void Internal_SetAutoExposureSettings(IntPtr thisPtr, ref AutoExposureSettings value);
|
|
|
|
|
-
|
|
|
|
|
- [MethodImpl(MethodImplOptions.InternalCall)]
|
|
|
|
|
- private static extern bool Internal_GetEnableTonemapping(IntPtr thisPtr);
|
|
|
|
|
-
|
|
|
|
|
- [MethodImpl(MethodImplOptions.InternalCall)]
|
|
|
|
|
- private static extern void Internal_SetEnableTonemapping(IntPtr thisPtr, bool value);
|
|
|
|
|
-
|
|
|
|
|
- [MethodImpl(MethodImplOptions.InternalCall)]
|
|
|
|
|
- private static extern void Internal_GetTonemappingSettings(IntPtr thisPtr, out TonemappingSettings value);
|
|
|
|
|
-
|
|
|
|
|
- [MethodImpl(MethodImplOptions.InternalCall)]
|
|
|
|
|
- private static extern void Internal_SetTonemappingSettings(IntPtr thisPtr, ref TonemappingSettings value);
|
|
|
|
|
-
|
|
|
|
|
- [MethodImpl(MethodImplOptions.InternalCall)]
|
|
|
|
|
- private static extern void Internal_GetWhiteBalanceSettings(IntPtr thisPtr, out WhiteBalanceSettings value);
|
|
|
|
|
-
|
|
|
|
|
- [MethodImpl(MethodImplOptions.InternalCall)]
|
|
|
|
|
- private static extern void Internal_SetWhiteBalanceSettings(IntPtr thisPtr, ref WhiteBalanceSettings value);
|
|
|
|
|
-
|
|
|
|
|
- [MethodImpl(MethodImplOptions.InternalCall)]
|
|
|
|
|
- private static extern void Internal_GetColorGradingSettings(IntPtr thisPtr, out ColorGradingSettings value);
|
|
|
|
|
-
|
|
|
|
|
- [MethodImpl(MethodImplOptions.InternalCall)]
|
|
|
|
|
- private static extern void Internal_SetColorGradingSettings(IntPtr thisPtr, ref ColorGradingSettings value);
|
|
|
|
|
-
|
|
|
|
|
- [MethodImpl(MethodImplOptions.InternalCall)]
|
|
|
|
|
- private static extern float Internal_GetExposureScale(IntPtr thisPtr);
|
|
|
|
|
-
|
|
|
|
|
- [MethodImpl(MethodImplOptions.InternalCall)]
|
|
|
|
|
- private static extern void Internal_SetExposureScale(IntPtr thisPtr, float value);
|
|
|
|
|
|
|
+ /// <summary>
|
|
|
|
|
+ /// Creates a new instance of post process settings with the optimal default values.
|
|
|
|
|
+ /// </summary>
|
|
|
|
|
+ /// <returns>New instance of post process settings.</returns>
|
|
|
|
|
+ public static PostProcessSettings CreateDefault()
|
|
|
|
|
+ {
|
|
|
|
|
+ PostProcessSettings output;
|
|
|
|
|
+ Internal_CreateDefault(out output);
|
|
|
|
|
|
|
|
- [MethodImpl(MethodImplOptions.InternalCall)]
|
|
|
|
|
- private static extern float Internal_GetGamma(IntPtr thisPtr);
|
|
|
|
|
|
|
+ return output;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
|
|
- private static extern void Internal_SetGamma(IntPtr thisPtr, float value);
|
|
|
|
|
|
|
+ private static extern void Internal_CreateDefault(out PostProcessSettings value);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|