update external headers

This commit is contained in:
Nick Fisher
2022-02-06 13:28:28 +08:00
parent 6d5a63d398
commit bd3d0d080b
150 changed files with 27445 additions and 14805 deletions

View File

@@ -54,18 +54,6 @@ public:
Type type; //!< property type
};
struct PropertyArray {
Property const* array;
size_t size;
};
/**
* Queries the list of all available properties.
*
* @return A pair containing a pointer to a Property array and the size of this array.
*/
PropertyArray getProperties() const noexcept;
/**
* Queries whether a property exists
* @param name The name of the property to query
@@ -123,6 +111,24 @@ public:
bool getProperty(const char* name, math::float4* v) const noexcept;
/** @}*/
struct DataSource {
void const* data;
size_t count;
};
DataSource getDataSource(const char* name) const noexcept;
struct FrameHistory {
using duration_ms = float;
duration_ms target{};
duration_ms targetWithHeadroom{};
duration_ms frameTime{};
duration_ms frameTimeDenoised{};
float scale = 1.0f;
float pid_e = 0.0f;
float pid_i = 0.0f;
float pid_d = 0.0f;
};
};

View File

@@ -35,9 +35,11 @@ class ColorGrading;
class DebugRegistry;
class Fence;
class IndexBuffer;
class SkinningBuffer;
class IndirectLight;
class Material;
class MaterialInstance;
class MorphTargetBuffer;
class Renderer;
class RenderTarget;
class Scene;
@@ -419,6 +421,8 @@ public:
bool destroy(const VertexBuffer* p); //!< Destroys an VertexBuffer object.
bool destroy(const Fence* p); //!< Destroys a Fence object.
bool destroy(const IndexBuffer* p); //!< Destroys an IndexBuffer object.
bool destroy(const SkinningBuffer* p); //!< Destroys a SkinningBuffer object.
bool destroy(const MorphTargetBuffer* p); //!< Destroys a MorphTargetBuffer object.
bool destroy(const IndirectLight* p); //!< Destroys an IndirectLight object.
/**

View File

@@ -273,6 +273,7 @@ public:
* Constant bias in depth-resolution units by which shadows are moved away from the
* light. The default value of 0.5 is used to round depth values up.
* Generally this value shouldn't be changed or at least be small and positive.
* This is ignored when the View's ShadowType is set to VSM.
*/
float polygonOffsetConstant = 0.5f;
@@ -281,6 +282,7 @@ public:
* away from the light. The default value of 2.0 works well with SHADOW_SAMPLING_PCF_LOW.
* Generally this value is between 0.5 and the size in texel of the PCF filter.
* Setting this value correctly is essential for LISPSM shadow-maps.
* This is ignored when the View's ShadowType is set to VSM.
*/
float polygonOffsetSlope = 2.0f;
@@ -332,6 +334,12 @@ public:
*/
float blurWidth = 0.0f;
} vsm;
/**
* Light bulb radius used for soft shadows. Currently this is only used when DPCF or PCSS is
* enabled. (2cm by default).
*/
float shadowBulbRadius = 0.02f;
};
struct ShadowCascades {
@@ -558,10 +566,11 @@ public:
* and are defined by the angle from the center axis to where the falloff begins (i.e.
* cones are defined by their half-angle).
*
* @param inner inner cone angle in *radians* between 0 and @f$ \pi/2 @f$
*
* @param outer outer cone angle in *radians* between \p inner and @f$ \pi/2 @f$
* Both inner and outer are silently clamped to a minimum value of 0.5 degrees
* (~0.00873 radians) to avoid floating-point precision issues during rendering.
*
* @param inner inner cone angle in *radians* between 0.00873 and \p outer
* @param outer outer cone angle in *radians* between 0.00873 inner and @f$ \pi/2 @f$
* @return This Builder, for chaining calls.
*
* @note
@@ -812,8 +821,8 @@ public:
* Dynamically updates a spot light's cone as angles
*
* @param i Instance of the component obtained from getInstance().
* @param inner inner cone angle in *radians* between 0 and pi/2
* @param outer outer cone angle in *radians* between inner and pi/2
* @param inner inner cone angle in *radians* between 0.00873 and outer
* @param outer outer cone angle in *radians* between 0.00873 and pi/2
*
* @see Builder.spotLightCone()
*/

View File

@@ -193,9 +193,12 @@ public:
//! Returns the refraction mode used by this material.
RefractionMode getRefractionMode() const noexcept;
// Return the refraction type used by this material.
//! Return the refraction type used by this material.
RefractionType getRefractionType() const noexcept;
//! Returns the reflection mode used by this material.
ReflectionMode getReflectionMode() const noexcept;
/**
* Returns the number of parameters declared by this material.
* The returned value can be 0.

View File

@@ -62,6 +62,7 @@ enum UTILS_PUBLIC ChunkType : uint64_t {
MaterialDomain = charTo64bitNum("MAT_DOMN"),
MaterialRefraction = charTo64bitNum("MAT_REFM"),
MaterialRefractionType = charTo64bitNum("MAT_REFT"),
MaterialReflectionMode = charTo64bitNum("MAT_REFL"),
MaterialRequiredAttributes = charTo64bitNum("MAT_REQA"),
MaterialDepthWriteSet = charTo64bitNum("MAT_DEWS"),

View File

@@ -27,7 +27,7 @@
namespace filament {
// update this when a new version of filament wouldn't work with older materials
static constexpr size_t MATERIAL_VERSION = 12;
static constexpr size_t MATERIAL_VERSION = 17;
/**
* Supported shading models
@@ -136,20 +136,10 @@ enum VertexAttribute : uint8_t {
CUSTOM6 = 14,
CUSTOM7 = 15,
// Aliases for vertex morphing.
MORPH_POSITION_0 = CUSTOM0,
MORPH_POSITION_1 = CUSTOM1,
MORPH_POSITION_2 = CUSTOM2,
MORPH_POSITION_3 = CUSTOM3,
MORPH_TANGENTS_0 = CUSTOM4,
MORPH_TANGENTS_1 = CUSTOM5,
MORPH_TANGENTS_2 = CUSTOM6,
MORPH_TANGENTS_3 = CUSTOM7,
// this is limited by driver::MAX_VERTEX_ATTRIBUTE_COUNT
};
static constexpr size_t MAX_MORPH_TARGETS = 4;
static constexpr size_t MAX_MORPH_TARGETS = 128; // this is limited by filament::CONFIG_MAX_MORPH_TARGET_COUNT
static constexpr size_t MAX_CUSTOM_ATTRIBUTES = 8;
/**
@@ -186,6 +176,14 @@ enum class RefractionType : uint8_t {
THIN = 1, //!< refraction through thin objects (e.g. window)
};
/**
* Reflection mode
*/
enum class ReflectionMode : uint8_t {
DEFAULT = 0, //! reflections sample from the scene's IBL only
SCREEN_SPACE = 1, //! reflections sample from screen space, and fallback to the scene's IBL
};
// can't really use std::underlying_type<AttributeIndex>::type because the driver takes a uint32_t
using AttributeBitset = utils::bitset32;

View File

@@ -0,0 +1,119 @@
/*
* Copyright (C) 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef TNT_FILAMENT_MORPHTARGETBUFFER_H
#define TNT_FILAMENT_MORPHTARGETBUFFER_H
#include <filament/FilamentAPI.h>
#include <filament/Engine.h>
#include <math/mathfwd.h>
namespace filament {
/**
* MorphTargetBuffer is used to hold morphing data (positions and tangents).
*/
class UTILS_PUBLIC MorphTargetBuffer : public FilamentAPI {
struct BuilderDetails;
public:
class Builder : public BuilderBase<BuilderDetails> {
friend struct BuilderDetails;
public:
Builder() noexcept;
Builder(Builder const& rhs) noexcept;
Builder(Builder&& rhs) noexcept;
~Builder() noexcept;
Builder& operator=(Builder const& rhs) noexcept;
Builder& operator=(Builder&& rhs) noexcept;
/**
* Size of the morph targets in vertex counts.
* @param vertexCount Number of vertex counts the morph targets can hold.
* @return A reference to this Builder for chaining calls.
*/
Builder& vertexCount(size_t vertexCount) noexcept;
/**
* Size of the morph targets in targets.
* @param count Number of targets the morph targets can hold.
* @return A reference to this Builder for chaining calls.
*/
Builder& count(size_t count) noexcept;
/**
* Creates the MorphTargetBuffer object and returns a pointer to it.
*
* @param engine Reference to the filament::Engine to associate this MorphTargetBuffer with.
*
* @return pointer to the newly created object or nullptr if exceptions are disabled and
* an error occurred.
*
* @exception utils::PostConditionPanic if a runtime error occurred, such as running out of
* memory or other resources.
* @exception utils::PreConditionPanic if a parameter to a builder function was invalid.
*/
MorphTargetBuffer* build(Engine& engine);
private:
friend class FMorphTargetBuffer;
};
/**
* Updates the position of morph target at the index.
* @param engine Reference to the filament::Engine associated with this MorphTargetBuffer.
* @param targetIndex the index of morph target to be updated.
* @param weights pointer to at least count positions
* @param count number of position elements in positions
*/
void setPositionsAt(Engine& engine, size_t targetIndex, math::float3 const* positions, size_t count);
/**
* Updates the position of morph target at the index.
* @param engine Reference to the filament::Engine associated with this MorphTargetBuffer.
* @param targetIndex the index of morph target to be updated.
* @param weights pointer to at least count positions
* @param count number of position elements in positions
*/
void setPositionsAt(Engine& engine, size_t targetIndex, math::float4 const* positions, size_t count);
/**
* Updates the position of morph target at the index.
* @param engine Reference to the filament::Engine associated with this MorphTargetBuffer.
* @param targetIndex the index of morph target to be updated.
* @param tangents pointer to at least count tangents
* @param count number of tangent elements in tangents
*/
void setTangentsAt(Engine& engine, size_t targetIndex, math::short4 const* tangents, size_t count);
/**
* Returns the vertex count of this MorphTargetBuffer.
* @return The number of vertices the MorphTargetBuffer holds.
*/
size_t getVertexCount() const noexcept;
/**
* Returns the target count of this MorphTargetBuffer.
* @return The number of targets the MorphTargetBuffer holds.
*/
size_t getCount() const noexcept;
};
} // namespace filament
#endif //TNT_FILAMENT_MORPHTARGETBUFFER_H

View File

@@ -284,6 +284,28 @@ struct AmbientOcclusionOptions {
} ssct;
};
/**
* Options for Temporal Multi-Sample Anti-aliasing (MSAA)
* @see setMultiSampleAntiAliasingOptions()
*/
struct MultiSampleAntiAliasingOptions {
bool enabled = false; //!< enables or disables msaa
/**
* sampleCount number of samples to use for multi-sampled anti-aliasing.\n
* 0: treated as 1
* 1: no anti-aliasing
* n: sample count. Effective sample could be different depending on the
* GPU capabilities.
*/
uint8_t sampleCount = 4;
/**
* custom resolve improves quality for HDR scenes, but may impact performance.
*/
bool customResolve = false;
};
/**
* Options for Temporal Anti-aliasing (TAA)
* @see setTemporalAntiAliasingOptions()
@@ -294,6 +316,18 @@ struct TemporalAntiAliasingOptions {
bool enabled = false; //!< enables or disables temporal anti-aliasing
};
/**
* Options for Screen-space Reflections.
* @see setScreenSpaceReflectionsOptions()
*/
struct ScreenSpaceReflectionsOptions {
float thickness = 0.5f; //!< ray thickness, in world units
float bias = 0.01f; //!< bias, in world units, to prevent self-intersections
float maxDistance = 3.0f; //!< maximum distance, in world units, to raycast
float stride = 1.0f; //!< stride, in texels, for samples along the ray.
bool enabled = false;
};
/**
* List of available post-processing anti-aliasing techniques.
* @see setAntiAliasing, getAntiAliasing, setSampleCount
@@ -317,7 +351,9 @@ enum class Dithering : uint8_t {
*/
enum class ShadowType : uint8_t {
PCF, //!< percentage-closer filtered shadows (default)
VSM //!< variance shadows
VSM, //!< variance shadows
DPCF, //!< PCF with contact hardening simulation
PCSS //!< PCF with soft shadows and contact hardening
};
/**
@@ -339,13 +375,6 @@ struct VsmShadowOptions {
*/
bool mipmapping = false;
/**
* EVSM exponent.
* The maximum value permissible is 5.54 for a shadow map in fp16, or 42.0 for a
* shadow map in fp32. Currently the shadow map bit depth is always fp16.
*/
float exponent = 5.54f;
/**
* VSM minimum variance scale, must be positive.
*/
@@ -357,6 +386,27 @@ struct VsmShadowOptions {
float lightBleedReduction = 0.15f;
};
/**
* View-level options for DPCF and PCSS Shadowing.
* @see setSoftShadowOptions()
* @warning This API is still experimental and subject to change.
*/
struct SoftShadowOptions {
/**
* Globally scales the penumbra of all DPCF and PCSS shadows
* Acceptable values are greater than 0
*/
float penumbraScale = 1.0f;
/**
* Globally scales the computed penumbra ratio of all DPCF and PCSS shadows.
* This effectively controls the strength of contact hardening effect and is useful for
* artistic purposes. Higher values make the shadows become softer faster.
* Acceptable values are equal to or greater than 1.
*/
float penumbraRatioScale = 1.0f;
};
} // namespace filament
#endif //TNT_FILAMENT_OPTIONS_H

View File

@@ -37,6 +37,12 @@ class Texture;
* An offscreen render target that can be associated with a View and contains
* weak references to a set of attached Texture objects.
*
* RenderTarget is intended to be used with the View's post-processing disabled for the most part.
* especially when a DEPTH attachment is also used (see Builder::texture()).
*
* Custom RenderTarget are ultimately intended to render into textures that might be used during
* the main render pass.
*
* Clients are responsible for the lifetime of all associated Texture attachments.
*
* @see View
@@ -87,6 +93,14 @@ public:
*
* All RenderTargets must have a non-null COLOR attachment.
*
* When using a DEPTH attachment, it is important to always disable post-processing
* in the View. Failing to do so will cause the DEPTH attachment to be ignored in most
* cases.
*
* When the intention is to keep the content of the DEPTH attachment after rendering,
* Usage::SAMPLEABLE must be set on the DEPTH attachment, otherwise the content of the
* DEPTH buffer may be discarded.
*
* @param attachment The attachment point of the texture.
* @param texture The associated texture object.
* @return A reference to this Builder for chaining calls.

View File

@@ -41,9 +41,11 @@ class Engine;
class IndexBuffer;
class Material;
class MaterialInstance;
class MorphTargetBuffer;
class Renderer;
class SkinningBuffer;
class VertexBuffer;
class Texture;
class FEngine;
class FRenderPrimitive;
@@ -105,8 +107,8 @@ public:
* Clients can specify bones either using this quat-vec3 pair, or by using 4x4 matrices.
*/
struct Bone {
math::quatf unitQuaternion = { 1, 0, 0, 0 };
math::float3 translation = { 0, 0, 0 };
math::quatf unitQuaternion = { 1.f, 0.f, 0.f, 0.f };
math::float3 translation = { 0.f, 0.f, 0.f };
float reserved = 0;
};
@@ -300,9 +302,6 @@ public:
/**
* Controls if the renderable has vertex morphing targets, false by default.
*
* This is required to enable GPU morphing for up to 4 attributes. The attached VertexBuffer
* must provide data in the appropriate VertexAttribute slots (\c MORPH_POSITION_0 etc).
*
* See also RenderableManager::setMorphWeights(), which can be called on a per-frame basis
* to advance the animation.
*/
@@ -456,12 +455,16 @@ public:
/**
* Updates the vertex morphing weights on a renderable, all zeroes by default.
*
* This is specified using a 4-tuple, one float per morph target. If the renderable has fewer
* than 4 morph targets, then clients should fill the unused components with zeroes.
*
* The renderable must be built with morphing enabled, see Builder::morphing().
*/
void setMorphWeights(Instance instance, math::float4 const& weights) noexcept;
void setMorphWeights(Instance instance, float const* weights, size_t count) noexcept;
/**
* Associates a MorphTargetBuffer to the given primitive.
*/
void setMorphTargetBufferAt(Instance instance,
size_t primitiveIndex, MorphTargetBuffer* morphTargetBuffer) noexcept;
/**
* Gets the bounding box used for frustum culling.

View File

@@ -99,7 +99,7 @@ public:
* headRoomRatio: additional headroom for the GPU as a ratio of the targetFrameTime.
* Useful for taking into account constant costs like post-processing or
* GPU drivers on different platforms.
* history: History size. higher values, tend to filter more (clamped to 30)
* history: History size. higher values, tend to filter more (clamped to 31)
* scaleRate: rate at which the gpu load is adjusted to reach the target frame rate
* This value can be computed as 1 / N, where N is the number of frames
* needed to reach 64% of the target scale factor.
@@ -110,10 +110,10 @@ public:
*
*/
struct FrameRateOptions {
float headRoomRatio = 0.0f; //!< additional headroom for the GPU
float scaleRate = 0.125f; //!< rate at which the system reacts to load changes
uint8_t history = 3; //!< history size
uint8_t interval = 1; //!< desired frame interval in unit of 1.0 / DisplayInfo::refreshRate
float headRoomRatio = 0.0f; //!< additional headroom for the GPU
float scaleRate = 1.0f / 8.0f; //!< rate at which the system reacts to load changes
uint8_t history = 15; //!< history size
uint8_t interval = 1; //!< desired frame interval in unit of 1.0 / DisplayInfo::refreshRate
};
/**
@@ -252,7 +252,7 @@ public:
*
* render() generates commands for each of the following stages:
*
* 1. Shadow map pass, if needed (currently only a single shadow map is supported).
* 1. Shadow map passes, if needed.
* 2. Depth pre-pass.
* 3. Color pass.
* 4. Post-processing pass.
@@ -341,7 +341,7 @@ public:
*
* Framebuffer as seen on User buffer (PixelBufferDescriptor&)
* screen
*
*
* +--------------------+
* | | .stride .alignment
* | | ----------------------->-->
@@ -359,7 +359,8 @@ public:
* O------------+-------+
*
*
* Typically readPixels() will be called after render() and before endFrame().
* readPixels() must be called within a frame, meaning after beginFrame() and before endFrame().
* Typically, readPixels() will be called after render().
*
* After issuing this method, the callback associated with `buffer` will be invoked on the
* main thread, indicating that the read-back has completed. Typically, this will happen

View File

@@ -22,6 +22,7 @@
#include <backend/DriverEnums.h>
#include <backend/PixelBufferDescriptor.h>
#include <backend/CallbackHandler.h>
#include <utils/compiler.h>
@@ -199,6 +200,18 @@ public:
*/
void setAcquiredImage(void* image, Callback callback, void* userdata) noexcept;
/**
* @see setAcquiredImage(void*, Callback, void*)
*
* @param image Pointer to AHardwareBuffer, casted to void* since this is a public header.
* @param handler Handler to dispatch the AcquiredImage or nullptr for the default handler.
* @param callback This is triggered by Filament when it wishes to release the image.
* It callback tales two arguments: the AHardwareBuffer and the userdata.
* @param userdata Optional closure data. Filament will pass this into the callback when it
* releases the image.
*/
void setAcquiredImage(void* image, backend::CallbackHandler* handler, Callback callback, void* userdata) noexcept;
/**
* Updates the size of the incoming stream. Whether this value is used is
* stream dependent. On Android, it must be set when using

View File

@@ -74,7 +74,7 @@ struct UTILS_PUBLIC LinearToneMapper final : public ToneMapper {
LinearToneMapper() noexcept;
~LinearToneMapper() noexcept final;
math::float3 operator()(math::float3 c) const noexcept;
math::float3 operator()(math::float3 c) const noexcept override;
};
/**
@@ -86,7 +86,7 @@ struct UTILS_PUBLIC ACESToneMapper final : public ToneMapper {
ACESToneMapper() noexcept;
~ACESToneMapper() noexcept final;
math::float3 operator()(math::float3 c) const noexcept;
math::float3 operator()(math::float3 c) const noexcept override;
};
/**
@@ -99,7 +99,7 @@ struct UTILS_PUBLIC ACESLegacyToneMapper final : public ToneMapper {
ACESLegacyToneMapper() noexcept;
~ACESLegacyToneMapper() noexcept final;
math::float3 operator()(math::float3 c) const noexcept;
math::float3 operator()(math::float3 c) const noexcept override;
};
/**
@@ -112,7 +112,7 @@ struct UTILS_PUBLIC FilmicToneMapper final : public ToneMapper {
FilmicToneMapper() noexcept;
~FilmicToneMapper() noexcept final;
math::float3 operator()(math::float3 x) const noexcept;
math::float3 operator()(math::float3 x) const noexcept override;
};
/**
@@ -123,8 +123,6 @@ struct UTILS_PUBLIC FilmicToneMapper final : public ToneMapper {
*
* The tone mapping curve is defined by 5 parameters:
* - contrast: controls the contrast of the curve
* - shoulder: controls the shoulder of the curve, i.e. how quickly scene
* referred values map to output white
* - midGrayIn: sets the input middle gray
* - midGrayOut: sets the output middle gray
* - hdrMax: defines the maximum input value that will be mapped to
@@ -138,18 +136,15 @@ struct UTILS_PUBLIC GenericToneMapper final : public ToneMapper {
*
* @param contrast: controls the contrast of the curve, must be > 0.0, values
* in the range 0.5..2.0 are recommended.
* @param shoulder: controls the shoulder of the curve, i.e. how quickly scene
* referred values map to output white, between 0.0 and 1.0.
* @param midGrayIn: sets the input middle gray, between 0.0 and 1.0.
* @param midGrayOut: sets the output middle gray, between 0.0 and 1.0.
* @param hdrMax: defines the maximum input value that will be mapped to
* output white. Must be >= 1.0.
*/
GenericToneMapper(
float contrast = 1.585f,
float shoulder = 0.5f,
explicit GenericToneMapper(
float contrast = 1.55f,
float midGrayIn = 0.18f,
float midGrayOut = 0.268f,
float midGrayOut = 0.215f,
float hdrMax = 10.0f
) noexcept;
~GenericToneMapper() noexcept final;
@@ -157,9 +152,9 @@ struct UTILS_PUBLIC GenericToneMapper final : public ToneMapper {
GenericToneMapper(GenericToneMapper const&) = delete;
GenericToneMapper& operator=(GenericToneMapper const&) = delete;
GenericToneMapper(GenericToneMapper&& rhs) noexcept;
GenericToneMapper& operator=(GenericToneMapper& rhs) noexcept;
GenericToneMapper& operator=(GenericToneMapper&& rhs) noexcept;
math::float3 operator()(math::float3 x) const noexcept;
math::float3 operator()(math::float3 x) const noexcept override;
/** Returns the contrast of the curve as a strictly positive value. */
float getContrast() const noexcept;
@@ -179,9 +174,6 @@ struct UTILS_PUBLIC GenericToneMapper final : public ToneMapper {
/** Sets the contrast of the curve, must be > 0.0, values in the range 0.5..2.0 are recommended. */
void setContrast(float contrast) noexcept;
/** Sets how quickly scene referred values map to output white, between 0.0 and 1.0. */
void setShoulder(float shoulder) noexcept;
/** Sets the input middle gray, between 0.0 and 1.0. */
void setMidGrayIn(float midGrayIn) noexcept;
@@ -225,9 +217,9 @@ private:
*/
struct UTILS_PUBLIC DisplayRangeToneMapper final : public ToneMapper {
DisplayRangeToneMapper() noexcept;
~DisplayRangeToneMapper() noexcept;
~DisplayRangeToneMapper() noexcept override;
math::float3 operator()(math::float3 c) const noexcept;
math::float3 operator()(math::float3 c) const noexcept override;
};
} // namespace filament

View File

@@ -32,6 +32,10 @@
namespace filament {
namespace backend {
class CallbackHandler;
} // namespace backend
class Camera;
class ColorGrading;
class MaterialInstance;
@@ -76,7 +80,10 @@ public:
using RenderQuality = RenderQuality;
using AmbientOcclusionOptions = AmbientOcclusionOptions;
using TemporalAntiAliasingOptions = TemporalAntiAliasingOptions;
using MultiSampleAntiAliasingOptions = MultiSampleAntiAliasingOptions;
using VsmShadowOptions = VsmShadowOptions;
using SoftShadowOptions = SoftShadowOptions;
using ScreenSpaceReflectionsOptions = ScreenSpaceReflectionsOptions;
/**
* Sets the View's name. Only useful for debugging.
@@ -275,7 +282,9 @@ public:
* cost. See setAntialiasing.
*
* @see setAntialiasing
* @deprecated use setMultiSampleAntiAliasingOptions instead
*/
UTILS_DEPRECATED
void setSampleCount(uint8_t count = 1) noexcept;
/**
@@ -283,7 +292,9 @@ public:
* A value of 0 or 1 means MSAA is disabled.
*
* @return value set by setSampleCount().
* @deprecated use getMultiSampleAntiAliasingOptions instead
*/
UTILS_DEPRECATED
uint8_t getSampleCount() const noexcept;
/**
@@ -320,6 +331,34 @@ public:
*/
TemporalAntiAliasingOptions const& getTemporalAntiAliasingOptions() const noexcept;
/**
* Enables or disable screen-space reflections. Disabled by default.
*
* @param options screen-space reflections options
*/
void setScreenSpaceReflectionsOptions(ScreenSpaceReflectionsOptions options) noexcept;
/**
* Returns screen-space reflections options.
*
* @return screen-space reflections options
*/
ScreenSpaceReflectionsOptions const& getScreenSpaceReflectionsOptions() const noexcept;
/**
* Enables or disable multi-sample anti-aliasing (MSAA). Disabled by default.
*
* @param options multi-sample anti-aliasing options
*/
void setMultiSampleAntiAliasingOptions(MultiSampleAntiAliasingOptions options) noexcept;
/**
* Returns multi-sample anti-aliasing options.
*
* @return multi-sample anti-aliasing options
*/
MultiSampleAntiAliasingOptions const& getMultiSampleAntiAliasingOptions() const noexcept;
/**
* Sets this View's color grading transforms.
*
@@ -514,19 +553,44 @@ public:
*/
VsmShadowOptions getVsmShadowOptions() const noexcept;
/**
* Sets soft shadowing options that apply across the entire View.
*
* Additional light-specific soft shadow parameters can be set with LightManager::setShadowOptions.
*
* Only applicable when shadow type is set to ShadowType::DPCF or ShadowType::PCSS.
*
* @param options Options for shadowing.
*
* @see setShadowType
*
* @warning This API is still experimental and subject to change.
*/
void setSoftShadowOptions(SoftShadowOptions const& options) noexcept;
/**
* Returns the soft shadowing options associated with this View.
*
* @return value set by setSoftShadowOptions().
*/
SoftShadowOptions getSoftShadowOptions() const noexcept;
/**
* Enables or disables post processing. Enabled by default.
*
* Post-processing includes:
* - Depth-of-field
* - Bloom
* - Tone-mapping & gamma encoding
* - Vignetting
* - Temporal Anti-aliasing (TAA)
* - Color grading & gamma encoding
* - Dithering
* - MSAA
* - FXAA
* - Dynamic scaling
*
* Disabling post-processing forgoes color correctness as well as anti-aliasing and
* should only be used experimentally (e.g., for UI overlays).
* Disabling post-processing forgoes color correctness as well as some anti-aliasing techniques
* and should only be used for debugging, UI overlays or when using custom render targets
* (see RenderTarget).
*
* @param enabled true enables post processing, false disables it.
*
@@ -611,9 +675,10 @@ public:
* @param x Horizontal coordinate to query in the viewport with origin on the left.
* @param y Vertical coordinate to query on the viewport with origin at the bottom.
* @param data A pointer to an instance of T
* @param handler Handler to dispatch the callback or nullptr for the default handler.
*/
template<typename T, void(T::*method)(PickingQueryResult const&)>
void pick(uint32_t x, uint32_t y, T* instance) noexcept {
void pick(uint32_t x, uint32_t y, T* instance, backend::CallbackHandler* handler = nullptr) noexcept {
PickingQuery& query = pick(x, y, [](PickingQueryResult const& result, PickingQuery* pq) {
void* user = pq->storage;
(*static_cast<T**>(user)->*method)(result);
@@ -630,9 +695,10 @@ public:
* @param x Horizontal coordinate to query in the viewport with origin on the left.
* @param y Vertical coordinate to query on the viewport with origin at the bottom.
* @param data An instance of T
* @param handler Handler to dispatch the callback or nullptr for the default handler.
*/
template<typename T, void(T::*method)(PickingQueryResult const&)>
void pick(uint32_t x, uint32_t y, T instance) noexcept {
void pick(uint32_t x, uint32_t y, T instance, backend::CallbackHandler* handler = nullptr) noexcept {
static_assert(sizeof(instance) <= sizeof(PickingQuery::storage), "user data too large");
PickingQuery& query = pick(x, y, [](PickingQueryResult const& result, PickingQuery* pq) {
void* user = pq->storage;
@@ -650,11 +716,12 @@ public:
* @param x Horizontal coordinate to query in the viewport with origin on the left.
* @param y Vertical coordinate to query on the viewport with origin at the bottom.
* @param functor A functor, typically a lambda function.
* @param handler Handler to dispatch the callback or nullptr for the default handler.
*/
template<typename T>
void pick(uint32_t x, uint32_t y, T functor) noexcept {
void pick(uint32_t x, uint32_t y, T functor, backend::CallbackHandler* handler = nullptr) noexcept {
static_assert(sizeof(functor) <= sizeof(PickingQuery::storage), "functor too large");
PickingQuery& query = pick(x, y,
PickingQuery& query = pick(x, y, handler,
(PickingQueryResultCallback)[](PickingQueryResult const& result, PickingQuery* pq) {
void* user = pq->storage;
T& that = *static_cast<T*>(user);
@@ -674,11 +741,12 @@ public:
* @param x Horizontal coordinate to query in the viewport with origin on the left.
* @param y Vertical coordinate to query on the viewport with origin at the bottom.
* @param callback User callback, called when the picking query result is available.
* @param handler Handler to dispatch the callback or nullptr for the default handler.
* @return A reference to a PickingQuery structure, which can be used to store up to
* 8*sizeof(void*) bytes of user data. This user data is later accessible
* in the PickingQueryResultCallback callback 3rd parameter.
*/
PickingQuery& pick(uint32_t x, uint32_t y,
PickingQuery& pick(uint32_t x, uint32_t y, backend::CallbackHandler* handler,
PickingQueryResultCallback callback) noexcept;