headers from v1.31.5

This commit is contained in:
Nick Fisher
2023-03-03 20:54:32 +08:00
parent e36ec57b17
commit a9d2985329
35 changed files with 3225 additions and 1944 deletions

View File

@@ -20,8 +20,7 @@
#include <math/vec2.h>
#include <math/vec3.h>
namespace filament {
namespace color {
namespace filament::color {
using namespace math;
@@ -35,7 +34,7 @@ struct Primaries {
float2 b;
bool operator==(const Primaries& rhs) const noexcept {
return r == rhs.r && b == rhs.b && g == rhs.b;
return r == rhs.r && b == rhs.b && g == rhs.g;
}
};
@@ -197,8 +196,8 @@ private:
*/
class PartialColorSpace {
public:
constexpr ColorSpace operator-(const WhitePoint whitePoint) const {
return ColorSpace(mPrimaries, mTransferFunction, whitePoint);
constexpr ColorSpace operator-(const WhitePoint& whitePoint) const {
return { mPrimaries, mTransferFunction, whitePoint };
}
private:
@@ -222,14 +221,14 @@ private:
*/
class Gamut {
public:
constexpr Gamut(const Primaries primaries) : mPrimaries(primaries) {
constexpr explicit Gamut(const Primaries primaries) : mPrimaries(primaries) {
}
constexpr Gamut(float2 r, float2 g, float2 b) : Gamut(Primaries{r, g, b}) {
constexpr Gamut(float2 r, float2 g, float2 b) : Gamut(Primaries{ r, g, b }) {
}
constexpr PartialColorSpace operator-(const TransferFunction transferFunction) const {
return PartialColorSpace(mPrimaries, transferFunction);
constexpr PartialColorSpace operator-(const TransferFunction& transferFunction) const {
return { mPrimaries, transferFunction };
}
constexpr const Primaries& getPrimaries() const { return mPrimaries; }
@@ -239,18 +238,19 @@ private:
};
//! Rec.709 color gamut, used in the sRGB and DisplayP3 color spaces.
constexpr Gamut Rec709 = Gamut({0.640f, 0.330f}, {0.300f, 0.600f}, {0.150f, 0.060f});
constexpr Gamut Rec709 = {{ 0.640f, 0.330f },
{ 0.300f, 0.600f },
{ 0.150f, 0.060f }};
//! Linear transfer function.
constexpr TransferFunction Linear = TransferFunction(1.0, 0.0, 0.0, 0.0, 1.0);
constexpr TransferFunction Linear = { 1.0, 0.0, 0.0, 0.0, 1.0 };
//! sRGB transfer function.
constexpr TransferFunction sRGB =
TransferFunction(1.0 / 1.055, 0.055 / 1.055, 1.0 / 12.92, 0.04045, 2.4);
constexpr TransferFunction sRGB = { 1.0 / 1.055, 0.055 / 1.055, 1.0 / 12.92, 0.04045, 2.4 };
//! Standard CIE 1931 2° illuminant D65. This illuminant has a color temperature of 6504K.
constexpr WhitePoint D65 = WhitePoint({0.31271f, 0.32902f});
constexpr WhitePoint D65 = { 0.31271f, 0.32902f };
} // namespace color
} // namespace filament
} // namespace filament::color
#endif // TNT_FILAMENT_COLOR_SPACE_H

View File

@@ -206,20 +206,44 @@ public:
*
* In general Filament reserves the right to re-order renderables to allow for efficient
* rendering. However clients can control ordering at a coarse level using \em priority.
* The priority is applied separately for opaque and translucent objects, that is, opaque
* objects are always drawn before translucent objects regardless of the priority.
*
* For example, this could be used to draw a semitransparent HUD, if a client wishes to
* avoid using a separate View for the HUD. Note that priority is completely orthogonal to
* For example, this could be used to draw a semitransparent HUD on top of everything,
* without using a separate View. Note that priority is completely orthogonal to
* Builder::layerMask, which merely controls visibility.
*
* The Skybox always using the lowest priority, so it's drawn last, which may improve
* performance.
*
* @param priority clamped to the range [0..7], defaults to 4; 7 is lowest priority
* (rendered last).
*
* @return Builder reference for chaining calls.
*
* @see Builder::blendOrder(), RenderableManager::setBlendOrderAt()
* @see Builder::blendOrder()
* @see Builder::channel()
* @see RenderableManager::setPriority()
* @see RenderableManager::setBlendOrderAt()
*/
Builder& priority(uint8_t priority) noexcept;
/**
* Set the channel this renderable is associated to. There can be 4 channels.
* All renderables in a given channel are rendered together, regardless of anything else.
* They are sorted as usual withing a channel.
* Channels work similarly to priorities, except that they enforce the strongest ordering.
*
* @param channel clamped to the range [0..3], defaults to 0.
*
* @return Builder reference for chaining calls.
*
* @see Builder::blendOrder()
* @see Builder::priority()
* @see RenderableManager::setBlendOrderAt()
*/
Builder& channel(uint8_t channel) noexcept;
/**
* Controls frustum culling, true by default.
*
@@ -461,6 +485,13 @@ public:
*/
void setPriority(Instance instance, uint8_t priority) noexcept;
/**
* Changes the channel a renderable is associated to.
*
* \see Builder::channel().
*/
void setChannel(Instance instance, uint8_t channel) noexcept;
/**
* Changes whether or not frustum culling is on.
*

View File

@@ -25,6 +25,8 @@
namespace filament {
class Engine;
/**
* A swap chain represents an Operating System's *native* renderable surface.
*
@@ -148,7 +150,11 @@ public:
using FrameScheduledCallback = backend::FrameScheduledCallback;
using FrameCompletedCallback = backend::FrameCompletedCallback;
/**
* Requests a SwapChain with an alpha channel.
*/
static const uint64_t CONFIG_TRANSPARENT = backend::SWAP_CHAIN_CONFIG_TRANSPARENT;
/**
* This flag indicates that the swap chain may be used as a source surface
* for reading back render results. This config must be set when creating
@@ -178,6 +184,29 @@ public:
static const uint64_t CONFIG_APPLE_CVPIXELBUFFER =
backend::SWAP_CHAIN_CONFIG_APPLE_CVPIXELBUFFER;
/**
* Indicates that the SwapChain must automatically perform linear to sRGB encoding.
*
* This flag is ignored if isSRGBSwapChainSupported() is false.
*
* When using this flag, the output colorspace in ColorGrading should be set to
* Rec709-Linear-D65, or post-processing should be disabled.
*
* @see isSRGBSwapChainSupported()
* @see ColorGrading.outputColorSpace()
* @see View.setPostProcessingEnabled()
*/
static constexpr uint64_t CONFIG_SRGB_COLORSPACE = backend::SWAP_CHAIN_CONFIG_SRGB_COLORSPACE;
/**
* Return whether createSwapChain supports the SWAP_CHAIN_CONFIG_SRGB_COLORSPACE flag.
* The default implementation returns false.
*
* @param engine A pointer to the filament Engine
* @return true if SWAP_CHAIN_CONFIG_SRGB_COLORSPACE is supported, false otherwise.
*/
static bool isSRGBSwapChainSupported(Engine& engine) noexcept;
void* getNativeWindow() const noexcept;
/**