update headers to Filament v1.25.0
This commit is contained in:
@@ -260,7 +260,7 @@ public:
|
||||
* range can be adjusted with this method.
|
||||
*
|
||||
* @param intensity Scale factor applied to the environment and irradiance such that
|
||||
* the result is in lux, or <i>lumen/m^2(default = 30000)
|
||||
* the result is in lux, or <i>lumen/m^2</i> (default = 30000)
|
||||
*/
|
||||
void setIntensity(float intensity) noexcept;
|
||||
|
||||
|
||||
@@ -72,6 +72,7 @@ enum UTILS_PUBLIC ChunkType : uint64_t {
|
||||
MaterialColorWrite = charTo64bitNum("MAT_CWRIT"),
|
||||
MaterialDepthWrite = charTo64bitNum("MAT_DWRIT"),
|
||||
MaterialDepthTest = charTo64bitNum("MAT_DTEST"),
|
||||
MaterialInstanced = charTo64bitNum("MAT_INSTA"),
|
||||
MaterialCullingMode = charTo64bitNum("MAT_CUMO"),
|
||||
|
||||
MaterialHasCustomDepthShader =charTo64bitNum("MAT_CSDP"),
|
||||
|
||||
@@ -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 = 21;
|
||||
static constexpr size_t MATERIAL_VERSION = 25;
|
||||
|
||||
/**
|
||||
* Supported shading models
|
||||
|
||||
@@ -78,43 +78,49 @@ public:
|
||||
};
|
||||
|
||||
/**
|
||||
* Updates the position of morph target at the index.
|
||||
* Updates positions for the given morph target.
|
||||
*
|
||||
* This is equivalent to the float4 method, but uses 1.0 for the 4th component.
|
||||
*
|
||||
* Both positions and tangents must be provided.
|
||||
*
|
||||
* @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
|
||||
* @param positions pointer to at least "count" positions
|
||||
* @param count number of float3 vectors in positions
|
||||
* @param offset offset into the target buffer, expressed as a number of float4 vectors
|
||||
* @see setTangentsAt
|
||||
*/
|
||||
void setPositionsAt(Engine& engine, size_t targetIndex,
|
||||
math::float3 const* positions, size_t count, size_t offset = 0);
|
||||
|
||||
/**
|
||||
* Updates the position of morph target at the index.
|
||||
* Updates positions for the given morph target.
|
||||
*
|
||||
* Both positions and tangents must be provided.
|
||||
*
|
||||
* @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
|
||||
* @see setPositionsAt
|
||||
* @param positions pointer to at least "count" positions
|
||||
* @param count number of float4 vectors in positions
|
||||
* @param offset offset into the target buffer, expressed as a number of float4 vectors
|
||||
* @see setTangentsAt
|
||||
*/
|
||||
void setPositionsAt(Engine& engine, size_t targetIndex,
|
||||
math::float4 const* positions, size_t count, size_t offset = 0);
|
||||
|
||||
/**
|
||||
* Updates the position of morph target at the index.
|
||||
* Updates tangents for the given morph target.
|
||||
*
|
||||
* Both positions and tangents must be provided.
|
||||
* These quaternions must be represented as signed shorts, where real numbers in the [-1,+1]
|
||||
* range multiplied by 32767.
|
||||
*
|
||||
* @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
|
||||
* @see setTangentsAt
|
||||
* @param tangents pointer to at least "count" tangents
|
||||
* @param count number of short4 quaternions in tangents
|
||||
* @param offset offset into the target buffer, expressed as a number of short4 vectors
|
||||
* @see setPositionsAt
|
||||
*/
|
||||
void setTangentsAt(Engine& engine, size_t targetIndex,
|
||||
math::short4 const* tangents, size_t count, size_t offset = 0);
|
||||
|
||||
@@ -25,6 +25,9 @@ namespace filament {
|
||||
|
||||
class Texture;
|
||||
|
||||
/**
|
||||
* Generic quality level.
|
||||
*/
|
||||
enum class QualityLevel : uint8_t {
|
||||
LOW,
|
||||
MEDIUM,
|
||||
@@ -69,8 +72,8 @@ enum class BlendMode : uint8_t {
|
||||
*
|
||||
*/
|
||||
struct DynamicResolutionOptions {
|
||||
math::float2 minScale = math::float2(0.5f); //!< minimum scale factors in x and y
|
||||
math::float2 maxScale = math::float2(1.0f); //!< maximum scale factors in x and y
|
||||
math::float2 minScale = {0.5f, 0.5f}; //!< minimum scale factors in x and y %codegen_java_float%
|
||||
math::float2 maxScale = {1.0f, 1.0f}; //!< maximum scale factors in x and y %codegen_java_float%
|
||||
float sharpness = 0.9f; //!< sharpness when QualityLevel::MEDIUM or higher is used [0 (disabled), 1 (sharpest)]
|
||||
bool enabled = false; //!< enable or disable dynamic resolution
|
||||
bool homogeneousScaling = false; //!< set to true to force homogeneous scaling
|
||||
@@ -125,8 +128,8 @@ struct BloomOptions {
|
||||
ADD, //!< Bloom is modulated by the strength parameter and added to the scene
|
||||
INTERPOLATE //!< Bloom is interpolated with the scene using the strength parameter
|
||||
};
|
||||
Texture* dirt = nullptr; //!< user provided dirt texture
|
||||
float dirtStrength = 0.2f; //!< strength of the dirt texture
|
||||
Texture* dirt = nullptr; //!< user provided dirt texture %codegen_skip_json% %codegen_skip_javascript%
|
||||
float dirtStrength = 0.2f; //!< strength of the dirt texture %codegen_skip_json% %codegen_skip_javascript%
|
||||
float strength = 0.10f; //!< bloom's strength between 0.0 and 1.0
|
||||
uint32_t resolution = 360; //!< resolution of vertical axis (2^levels to 2048)
|
||||
float anamorphism = 1.0f; //!< bloom x/y aspect-ratio (1/32 to 32)
|
||||
@@ -151,16 +154,16 @@ struct BloomOptions {
|
||||
* Options to control fog in the scene
|
||||
*/
|
||||
struct FogOptions {
|
||||
float distance = 0.0f; //!< distance in world units from the camera where the fog starts ( >= 0.0 )
|
||||
float maximumOpacity = 1.0f; //!< fog's maximum opacity between 0 and 1
|
||||
float height = 0.0f; //!< fog's floor in world units
|
||||
float heightFalloff = 1.0f; //!< how fast fog dissipates with altitude
|
||||
LinearColor color{0.5f}; //!< fog's color (linear), see fogColorFromIbl
|
||||
float density = 0.1f; //!< fog's density at altitude given by 'height'
|
||||
float inScatteringStart = 0.0f; //!< distance in world units from the camera where in-scattering starts
|
||||
float inScatteringSize = -1.0f; //!< size of in-scattering (>0 to activate). Good values are >> 1 (e.g. ~10 - 100).
|
||||
bool fogColorFromIbl = false; //!< Fog color will be modulated by the IBL color in the view direction.
|
||||
bool enabled = false; //!< enable or disable fog
|
||||
float distance = 0.0f; //!< distance in world units from the camera where the fog starts ( >= 0.0 )
|
||||
float maximumOpacity = 1.0f; //!< fog's maximum opacity between 0 and 1
|
||||
float height = 0.0f; //!< fog's floor in world units
|
||||
float heightFalloff = 1.0f; //!< how fast fog dissipates with altitude
|
||||
LinearColor color = {0.5f, 0.5f, 0.5f};//!< fog's color (linear), see fogColorFromIbl
|
||||
float density = 0.1f; //!< fog's density at altitude given by 'height'
|
||||
float inScatteringStart = 0.0f; //!< distance in world units from the camera where in-scattering starts
|
||||
float inScatteringSize = -1.0f; //!< size of in-scattering (>0 to activate). Good values are >> 1 (e.g. ~10 - 100).
|
||||
bool fogColorFromIbl = false; //!< Fog color will be modulated by the IBL color in the view direction.
|
||||
bool enabled = false; //!< enable or disable fog
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -174,8 +177,9 @@ struct FogOptions {
|
||||
*/
|
||||
struct DepthOfFieldOptions {
|
||||
enum class Filter : uint8_t {
|
||||
NONE = 0,
|
||||
MEDIAN = 2
|
||||
NONE,
|
||||
UNUSED,
|
||||
MEDIAN
|
||||
};
|
||||
float cocScale = 1.0f; //!< circle of confusion scale factor (amount of blur)
|
||||
float maxApertureDiameter = 0.01f; //!< maximum aperture diameter in meters (zero to disable rotation)
|
||||
@@ -227,7 +231,7 @@ struct VignetteOptions {
|
||||
float midPoint = 0.5f; //!< high values restrict the vignette closer to the corners, between 0 and 1
|
||||
float roundness = 0.5f; //!< controls the shape of the vignette, from a rounded rectangle (0.0), to an oval (0.5), to a circle (1.0)
|
||||
float feather = 0.5f; //!< softening amount of the vignette effect, between 0 and 1
|
||||
LinearColorA color{0.0f, 0.0f, 0.0f, 1.0f}; //!< color of the vignette effect, alpha is currently ignored
|
||||
LinearColorA color = {0.0f, 0.0f, 0.0f, 1.0f}; //!< color of the vignette effect, alpha is currently ignored
|
||||
bool enabled = false; //!< enables or disables the vignette effect
|
||||
};
|
||||
|
||||
@@ -271,17 +275,18 @@ struct AmbientOcclusionOptions {
|
||||
* Ambient shadows from dominant light
|
||||
*/
|
||||
struct Ssct {
|
||||
float lightConeRad = 1.0f; //!< full cone angle in radian, between 0 and pi/2
|
||||
float shadowDistance = 0.3f; //!< how far shadows can be cast
|
||||
float contactDistanceMax = 1.0f; //!< max distance for contact
|
||||
float intensity = 0.8f; //!< intensity
|
||||
math::float3 lightDirection{ 0, -1, 0 }; //!< light direction
|
||||
float depthBias = 0.01f; //!< depth bias in world units (mitigate self shadowing)
|
||||
float depthSlopeBias = 0.01f; //!< depth slope bias (mitigate self shadowing)
|
||||
uint8_t sampleCount = 4; //!< tracing sample count, between 1 and 255
|
||||
uint8_t rayCount = 1; //!< # of rays to trace, between 1 and 255
|
||||
bool enabled = false; //!< enables or disables SSCT
|
||||
} ssct;
|
||||
float lightConeRad = 1.0f; //!< full cone angle in radian, between 0 and pi/2
|
||||
float shadowDistance = 0.3f; //!< how far shadows can be cast
|
||||
float contactDistanceMax = 1.0f; //!< max distance for contact
|
||||
float intensity = 0.8f; //!< intensity
|
||||
math::float3 lightDirection = { 0, -1, 0 }; //!< light direction
|
||||
float depthBias = 0.01f; //!< depth bias in world units (mitigate self shadowing)
|
||||
float depthSlopeBias = 0.01f; //!< depth slope bias (mitigate self shadowing)
|
||||
uint8_t sampleCount = 4; //!< tracing sample count, between 1 and 255
|
||||
uint8_t rayCount = 1; //!< # of rays to trace, between 1 and 255
|
||||
bool enabled = false; //!< enables or disables SSCT
|
||||
};
|
||||
Ssct ssct; // %codegen_skip_javascript% %codegen_java_flatten%
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -328,21 +333,31 @@ struct ScreenSpaceReflectionsOptions {
|
||||
bool enabled = false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Options for the screen-space guard band.
|
||||
* A guard band can be enabled to avoid some artifacts towards the edge of the screen when
|
||||
* using screen-space effects such as SSAO. Enabling the guard band reduces performance slightly.
|
||||
* Currently the guard band can only be enabled or disabled.
|
||||
*/
|
||||
struct GuardBandOptions {
|
||||
bool enabled = false;
|
||||
};
|
||||
|
||||
/**
|
||||
* List of available post-processing anti-aliasing techniques.
|
||||
* @see setAntiAliasing, getAntiAliasing, setSampleCount
|
||||
*/
|
||||
enum class AntiAliasing : uint8_t {
|
||||
NONE = 0, //!< no anti aliasing performed as part of post-processing
|
||||
FXAA = 1 //!< FXAA is a low-quality but very efficient type of anti-aliasing. (default).
|
||||
NONE, //!< no anti aliasing performed as part of post-processing
|
||||
FXAA //!< FXAA is a low-quality but very efficient type of anti-aliasing. (default).
|
||||
};
|
||||
|
||||
/**
|
||||
* List of available post-processing dithering techniques.
|
||||
*/
|
||||
enum class Dithering : uint8_t {
|
||||
NONE = 0, //!< No dithering
|
||||
TEMPORAL = 1 //!< Temporal dithering (default)
|
||||
NONE, //!< No dithering
|
||||
TEMPORAL //!< Temporal dithering (default)
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -205,10 +205,12 @@ public:
|
||||
* avoid using a separate View for the HUD. Note that priority is completely orthogonal to
|
||||
* Builder::layerMask, which merely controls visibility.
|
||||
*
|
||||
* \see Builder::blendOrder()
|
||||
* @param priority clamped to the range [0..7], defaults to 4; 7 is lowest priority
|
||||
* (rendered last).
|
||||
*
|
||||
* The priority is 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()
|
||||
*/
|
||||
Builder& priority(uint8_t priority) noexcept;
|
||||
|
||||
@@ -337,23 +339,44 @@ public:
|
||||
*/
|
||||
Builder& morphing(uint8_t level, size_t primitiveIndex,
|
||||
MorphTargetBuffer* morphTargetBuffer, size_t offset, size_t count) noexcept;
|
||||
|
||||
inline Builder& morphing(uint8_t level, size_t primitiveIndex,
|
||||
MorphTargetBuffer* morphTargetBuffer) noexcept;
|
||||
|
||||
/**
|
||||
* Sets an ordering index for blended primitives that all live at the same Z value.
|
||||
* Sets the drawing order for blended primitives. The drawing order is either global or
|
||||
* local (default) to this Renderable. In either case, the Renderable priority takes
|
||||
* precedence.
|
||||
*
|
||||
* @param primitiveIndex the primitive of interest
|
||||
* @param order draw order number (0 by default). Only the lowest 15 bits are used.
|
||||
*
|
||||
* @return Builder reference for chaining calls.
|
||||
*
|
||||
* @see globalBlendOrderEnabled
|
||||
*/
|
||||
Builder& blendOrder(size_t primitiveIndex, uint16_t order) noexcept;
|
||||
|
||||
/**
|
||||
* Sets whether the blend order is global or local to this Renderable (by default).
|
||||
*
|
||||
* @param primitiveIndex the primitive of interest
|
||||
* @param enabled true for global, false for local blend ordering.
|
||||
*
|
||||
* @return Builder reference for chaining calls.
|
||||
*
|
||||
* @see blendOrder
|
||||
*/
|
||||
Builder& globalBlendOrderEnabled(size_t primitiveIndex, bool enabled) noexcept;
|
||||
|
||||
|
||||
/**
|
||||
* Specifies the number of draw instance of this renderable. The default is 1 instance and
|
||||
* the maximum number of instances allowed is 65535. 0 is invalid.
|
||||
* All instances are culled using the same bounding box, so care must be taken to make
|
||||
* sure all instances render inside the specified bounding box.
|
||||
* The material can use getInstanceIndex() in the vertex shader to get the instance index and
|
||||
* The material must set its `instanced` parameter to `true` in order to use
|
||||
* getInstanceIndex() in the vertex or fragment shader to get the instance index and
|
||||
* possibly adjust the position or transform.
|
||||
*
|
||||
* @param instanceCount the number of instances silently clamped between 1 and 65535.
|
||||
@@ -394,6 +417,7 @@ public:
|
||||
MaterialInstance const* materialInstance = nullptr;
|
||||
PrimitiveType type = PrimitiveType::TRIANGLES;
|
||||
uint16_t blendOrder = 0;
|
||||
bool globalBlendOrderEnabled = false;
|
||||
struct {
|
||||
MorphTargetBuffer* buffer = nullptr;
|
||||
size_t offset = 0;
|
||||
@@ -497,7 +521,15 @@ public:
|
||||
void setBones(Instance instance, math::mat4f const* transforms, size_t boneCount = 1, size_t offset = 0); //!< \overload
|
||||
|
||||
/**
|
||||
* Associates a SkinningBuffer to a renderable instance
|
||||
* Associates a region of a SkinningBuffer to a renderable instance
|
||||
*
|
||||
* Note: due to hardware limitations offset + 256 must be smaller or equal to
|
||||
* skinningBuffer->getBoneCount()
|
||||
*
|
||||
* @param instance Instance of the component obtained from getInstance().
|
||||
* @param skinningBuffer skinning buffer to associate to the instance
|
||||
* @param count Size of the region in bones, must be smaller or equal to 256.
|
||||
* @param offset Start offset of the region in bones
|
||||
*/
|
||||
void setSkinningBuffer(Instance instance, SkinningBuffer* skinningBuffer,
|
||||
size_t count, size_t offset);
|
||||
@@ -511,7 +543,7 @@ public:
|
||||
* @param instance Instance of the component obtained from getInstance().
|
||||
* @param weights Pointer to morph target weights to be update.
|
||||
* @param count Number of morph target weights.
|
||||
* @param offset Index of the first first morph target weight to set at instance.
|
||||
* @param offset Index of the first morph target weight to set at instance.
|
||||
*/
|
||||
void setMorphWeights(Instance instance,
|
||||
float const* weights, size_t count, size_t offset = 0);
|
||||
@@ -578,24 +610,28 @@ public:
|
||||
size_t offset, size_t count) noexcept;
|
||||
|
||||
/**
|
||||
* Changes the active range of indices or topology for the given primitive.
|
||||
*
|
||||
* \see Builder::geometry()
|
||||
*/
|
||||
void setGeometryAt(Instance instance, size_t primitiveIndex,
|
||||
PrimitiveType type, size_t offset, size_t count) noexcept;
|
||||
|
||||
/**
|
||||
* Changes the ordering index for blended primitives that all live at the same Z value.
|
||||
*
|
||||
* \see Builder::blendOrder()
|
||||
* Changes the drawing order for blended primitives. The drawing order is either global or
|
||||
* local (default) to this Renderable. In either case, the Renderable priority takes precedence.
|
||||
*
|
||||
* @param instance the renderable of interest
|
||||
* @param primitiveIndex the primitive of interest
|
||||
* @param order draw order number (0 by default). Only the lowest 15 bits are used.
|
||||
*
|
||||
* @see Builder::blendOrder(), setGlobalBlendOrderEnabledAt()
|
||||
*/
|
||||
void setBlendOrderAt(Instance instance, size_t primitiveIndex, uint16_t order) noexcept;
|
||||
|
||||
/**
|
||||
* Changes whether the blend order is global or local to this Renderable (by default).
|
||||
*
|
||||
* @param instance the renderable of interest
|
||||
* @param primitiveIndex the primitive of interest
|
||||
* @param enabled true for global, false for local blend ordering.
|
||||
*
|
||||
* @see Builder::globalBlendOrderEnabled(), setBlendOrderAt()
|
||||
*/
|
||||
void setGlobalBlendOrderEnabledAt(Instance instance, size_t primitiveIndex, bool enabled) noexcept;
|
||||
|
||||
/**
|
||||
* Retrieves the set of enabled attribute slots in the given primitive's VertexBuffer.
|
||||
*/
|
||||
|
||||
@@ -80,11 +80,8 @@ public:
|
||||
// refresh-rate of the display in Hz. set to 0 for offscreen or turn off frame-pacing.
|
||||
float refreshRate = 60.0f;
|
||||
|
||||
// how far in advance a buffer must be queued for presentation at a given time in ns
|
||||
uint64_t presentationDeadlineNanos = 0;
|
||||
|
||||
// offset by which vsyncSteadyClockTimeNano provided in beginFrame() is offset in ns
|
||||
uint64_t vsyncOffsetNanos = 0;
|
||||
[[deprecated]] uint64_t presentationDeadlineNanos = 0;
|
||||
[[deprecated]] uint64_t vsyncOffsetNanos = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -243,6 +240,20 @@ public:
|
||||
bool beginFrame(SwapChain* swapChain,
|
||||
uint64_t vsyncSteadyClockTimeNano = 0u);
|
||||
|
||||
/**
|
||||
* Set the time at which the frame must be presented to the display.
|
||||
*
|
||||
* This must be called between beginFrame() and endFrame().
|
||||
*
|
||||
* @param monotonic_clock_ns the time in nanoseconds corresponding to the system monotonic up-time clock.
|
||||
* the presentation time is typically set in the middle of the period
|
||||
* of interest. The presentation time cannot be too far in the
|
||||
* future because it is limited by how many buffers are available in
|
||||
* the display sub-system. Typically it is set to 1 or 2 vsync periods
|
||||
* away.
|
||||
*/
|
||||
void setPresentationTime(int64_t monotonic_clock_ns);
|
||||
|
||||
/**
|
||||
* Render a View into this renderer's window.
|
||||
*
|
||||
@@ -444,6 +455,10 @@ public:
|
||||
*
|
||||
* It is also possible to use a Fence to wait for the read-back.
|
||||
*
|
||||
* OpenGL only: if issuing a readPixels on a RenderTarget backed by a Texture that had data
|
||||
* uploaded to it via setImage, the data returned from readPixels will be y-flipped with respect
|
||||
* to the setImage call.
|
||||
*
|
||||
* @remark
|
||||
* readPixels() is intended for debugging and testing. It will impact performance significantly.
|
||||
*
|
||||
|
||||
@@ -33,6 +33,7 @@ namespace filament {
|
||||
/**
|
||||
* SkinningBuffer is used to hold skinning data (bones). It is a simple wraper around
|
||||
* a structured UBO.
|
||||
* @see RenderableManager::setSkinningBuffer
|
||||
*/
|
||||
class UTILS_PUBLIC SkinningBuffer : public FilamentAPI {
|
||||
struct BuilderDetails;
|
||||
@@ -93,6 +94,7 @@ public:
|
||||
* @param transforms pointer to at least count Bone
|
||||
* @param count number of Bone elements in transforms
|
||||
* @param offset offset in elements (not bytes) in the SkinningBuffer (not in transforms)
|
||||
* @see RenderableManager::setSkinningBuffer
|
||||
*/
|
||||
void setBones(Engine& engine, RenderableManager::Bone const* transforms,
|
||||
size_t count, size_t offset = 0);
|
||||
@@ -103,6 +105,7 @@ public:
|
||||
* @param transforms pointer to at least count mat4f
|
||||
* @param count number of mat4f elements in transforms
|
||||
* @param offset offset in elements (not bytes) in the SkinningBuffer (not in transforms)
|
||||
* @see RenderableManager::setSkinningBuffer
|
||||
*/
|
||||
void setBones(Engine& engine, math::mat4f const* transforms,
|
||||
size_t count, size_t offset = 0);
|
||||
|
||||
@@ -124,7 +124,7 @@ public:
|
||||
*
|
||||
* Ignored if an environment is set.
|
||||
*
|
||||
* @param color
|
||||
* @param color the constant color
|
||||
*
|
||||
* @return This Builder, for chaining calls.
|
||||
*/
|
||||
|
||||
@@ -35,10 +35,9 @@ class Engine;
|
||||
/**
|
||||
* Stream is used to attach a video stream to a Filament `Texture`.
|
||||
*
|
||||
* Note that the `Stream` class is fairly Android centric. It supports three different
|
||||
* Note that the `Stream` class is fairly Android centric. It supports two different
|
||||
* configurations:
|
||||
*
|
||||
* - TEXTURE_ID...takes an OpenGL texture ID and incurs a copy
|
||||
* - ACQUIRED.....connects to an Android AHardwareBuffer
|
||||
* - NATIVE.......connects to an Android SurfaceTexture
|
||||
*
|
||||
@@ -67,10 +66,6 @@ class Engine;
|
||||
* - Filament invokes low-level graphics commands on the \em{driver thread}.
|
||||
* - The thread that calls `beginFrame` is called the \em{main thread}.
|
||||
*
|
||||
* The TEXTURE_ID configuration achieves synchronization automatically. In this mode, Filament
|
||||
* performs a copy on the main thread during `beginFrame` by blitting the external image into
|
||||
* an internal round-robin queue of images. This copy has a run-time cost.
|
||||
*
|
||||
* For ACQUIRED streams, there is no need to perform the copy because Filament explictly acquires
|
||||
* the stream, then releases it later via a callback function. This configuration is especially
|
||||
* useful when the Vulkan backend is enabled.
|
||||
@@ -97,7 +92,7 @@ public:
|
||||
* By default, Stream objects are ACQUIRED and must have external images pushed to them via
|
||||
* <pre>Stream::setAcquiredImage</pre>.
|
||||
*
|
||||
* To create a NATIVE or TEXTURE_ID stream, call one of the <pre>stream</pre> methods
|
||||
* To create a NATIVE stream, call one of the <pre>stream</pre> methods
|
||||
* on the builder.
|
||||
*/
|
||||
class Builder : public BuilderBase<BuilderDetails> {
|
||||
@@ -122,23 +117,6 @@ public:
|
||||
*/
|
||||
Builder& stream(void* stream) noexcept;
|
||||
|
||||
/**
|
||||
* Creates a TEXTURE_ID stream. This will sample data from the supplied
|
||||
* external texture and copy it into an internal private texture.
|
||||
*
|
||||
* @param externalTextureId An opaque texture id (typically a GLuint created with glGenTextures)
|
||||
* In a context shared with filament. In that case this texture's
|
||||
* target must be GL_TEXTURE_EXTERNAL_OES and the wrap mode must
|
||||
* be CLAMP_TO_EDGE.
|
||||
*
|
||||
* @return This Builder, for chaining calls.
|
||||
*
|
||||
* @see Texture::setExternalStream()
|
||||
* @deprecated this method existed only for ARCore which doesn't need this anymore, use Texture::import() instead.
|
||||
*/
|
||||
UTILS_DEPRECATED
|
||||
Builder& stream(intptr_t externalTextureId) noexcept;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param width initial width of the incoming stream. Whether this value is used is
|
||||
@@ -173,7 +151,7 @@ public:
|
||||
};
|
||||
|
||||
/**
|
||||
* Indicates whether this stream is a NATIVE stream, TEXTURE_ID stream, or ACQUIRED stream.
|
||||
* Indicates whether this stream is a NATIVE stream or ACQUIRED stream.
|
||||
*/
|
||||
StreamType getStreamType() const noexcept;
|
||||
|
||||
@@ -190,7 +168,7 @@ public:
|
||||
* also where the callback is invoked. This method can only be used for streams that were
|
||||
* constructed without calling the `stream` method on the builder.
|
||||
*
|
||||
* @see Stream for more information about NATIVE, TEXTURE_ID, and ACQUIRED configurations.
|
||||
* @see Stream for more information about NATIVE and ACQUIRED configurations.
|
||||
*
|
||||
* @param image Pointer to AHardwareBuffer, casted to void* since this is a public header.
|
||||
* @param callback This is triggered by Filament when it wishes to release the image.
|
||||
@@ -222,63 +200,6 @@ public:
|
||||
*/
|
||||
void setDimensions(uint32_t width, uint32_t height) noexcept;
|
||||
|
||||
/**
|
||||
* Read-back the content of the last frame of a Stream since the last call to
|
||||
* Renderer.beginFrame().
|
||||
*
|
||||
* The Stream must be of type externalTextureId. This function is a no-op otherwise.
|
||||
*
|
||||
* @param xoffset Left offset of the sub-region to read back.
|
||||
* @param yoffset Bottom offset of the sub-region to read back.
|
||||
* @param width Width of the sub-region to read back.
|
||||
* @param height Height of the sub-region to read back.
|
||||
* @param buffer Client-side buffer where the read-back will be written.
|
||||
*
|
||||
* The following format are always supported:
|
||||
* - PixelBufferDescriptor::PixelDataFormat::RGBA
|
||||
* - PixelBufferDescriptor::PixelDataFormat::RGBA_INTEGER
|
||||
*
|
||||
* The following types are always supported:
|
||||
* - PixelBufferDescriptor::PixelDataType::UBYTE
|
||||
* - PixelBufferDescriptor::PixelDataType::UINT
|
||||
* - PixelBufferDescriptor::PixelDataType::INT
|
||||
* - PixelBufferDescriptor::PixelDataType::FLOAT
|
||||
*
|
||||
* Other combination of format/type may be supported. If a combination is
|
||||
* not supported, this operation may fail silently. Use a DEBUG build
|
||||
* to get some logs about the failure.
|
||||
*
|
||||
* Stream buffer User buffer (PixelBufferDescriptor&)
|
||||
* +--------------------+
|
||||
* | | .stride .alignment
|
||||
* | | ----------------------->-->
|
||||
* | | O----------------------+--+ low addresses
|
||||
* | | | | | |
|
||||
* | w | | | .top | |
|
||||
* | <---------> | | V | |
|
||||
* | +---------+ | | +---------+ | |
|
||||
* | | ^ | | ======> | | | | |
|
||||
* | x | h| | | |.left| | | |
|
||||
* +------>| v | | +---->| | | |
|
||||
* | +.........+ | | +.........+ | |
|
||||
* | ^ | | | |
|
||||
* | y | | +----------------------+--+ high addresses
|
||||
* O------------+-------+
|
||||
*
|
||||
* Typically readPixels() will be called after Renderer.beginFrame().
|
||||
*
|
||||
* 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
|
||||
* after multiple calls to beginFrame(), render(), endFrame().
|
||||
*
|
||||
* It is also possible to use a Fence to wait for the read-back.
|
||||
*
|
||||
* @remark
|
||||
* readPixels() is intended for debugging and testing. It will impact performance significantly.
|
||||
*/
|
||||
void readPixels(uint32_t xoffset, uint32_t yoffset, uint32_t width, uint32_t height,
|
||||
backend::PixelBufferDescriptor&& buffer) noexcept;
|
||||
|
||||
/**
|
||||
* Returns the presentation time of the currently displayed frame in nanosecond.
|
||||
*
|
||||
|
||||
@@ -134,12 +134,12 @@ struct UTILS_PUBLIC GenericToneMapper final : public ToneMapper {
|
||||
* constructor parameters approximate an ACES tone mapping curve
|
||||
* and the maximum input value is set to 10.0.
|
||||
*
|
||||
* @param contrast: controls the contrast of the curve, must be > 0.0, values
|
||||
* in the range 0.5..2.0 are recommended.
|
||||
* @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.
|
||||
* @param contrast controls the contrast of the curve, must be > 0.0, values
|
||||
* in the range 0.5..2.0 are recommended.
|
||||
* @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.
|
||||
*/
|
||||
explicit GenericToneMapper(
|
||||
float contrast = 1.55f,
|
||||
|
||||
@@ -84,6 +84,7 @@ public:
|
||||
using VsmShadowOptions = VsmShadowOptions;
|
||||
using SoftShadowOptions = SoftShadowOptions;
|
||||
using ScreenSpaceReflectionsOptions = ScreenSpaceReflectionsOptions;
|
||||
using GuardBandOptions = GuardBandOptions;
|
||||
|
||||
/**
|
||||
* Sets the View's name. Only useful for debugging.
|
||||
@@ -345,6 +346,20 @@ public:
|
||||
*/
|
||||
ScreenSpaceReflectionsOptions const& getScreenSpaceReflectionsOptions() const noexcept;
|
||||
|
||||
/**
|
||||
* Enables or disable screen-space guard band. Disabled by default.
|
||||
*
|
||||
* @param options guard band options
|
||||
*/
|
||||
void setGuardBandOptions(GuardBandOptions options) noexcept;
|
||||
|
||||
/**
|
||||
* Returns screen-space guard band options.
|
||||
*
|
||||
* @return guard band options
|
||||
*/
|
||||
GuardBandOptions const& getGuardBandOptions() const noexcept;
|
||||
|
||||
/**
|
||||
* Enables or disable multi-sample anti-aliasing (MSAA). Disabled by default.
|
||||
*
|
||||
|
||||
@@ -43,11 +43,6 @@ public:
|
||||
*/
|
||||
Viewport() noexcept : backend::Viewport{} {}
|
||||
|
||||
Viewport(const Viewport& viewport) noexcept = default;
|
||||
Viewport(Viewport&& viewport) noexcept = default;
|
||||
Viewport& operator=(const Viewport& viewport) noexcept = default;
|
||||
Viewport& operator=(Viewport&& viewport) noexcept = default;
|
||||
|
||||
/**
|
||||
* Creates a Viewport from its left-bottom coordinates, width and height in pixels
|
||||
*
|
||||
@@ -67,16 +62,7 @@ public:
|
||||
*/
|
||||
bool empty() const noexcept { return !width || !height; }
|
||||
|
||||
/**
|
||||
* Computes a new scaled Viewport
|
||||
* @param s scaling factor on the x and y axes.
|
||||
* @return A new scaled Viewport. The coordinates and dimensions of the new Viewport are
|
||||
* rounded to the nearest integer value.
|
||||
*/
|
||||
Viewport scale(math::float2 s) const noexcept;
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* Compares two Viewports for equality
|
||||
* @param lhs reference to the left hand side Viewport
|
||||
|
||||
Reference in New Issue
Block a user