upgrade Filament to v1.41

This commit is contained in:
Nick Fisher
2023-08-18 12:01:14 +08:00
parent e62bf64c04
commit d82bdff939
72 changed files with 2455 additions and 2514 deletions

View File

@@ -45,6 +45,7 @@ class Renderer;
class SkinningBuffer;
class VertexBuffer;
class Texture;
class InstanceBuffer;
class FEngine;
class FRenderPrimitive;
@@ -119,6 +120,12 @@ public:
public:
enum Result { Error = -1, Success = 0 };
/**
* Default render channel
* @see Builder::channel()
*/
static constexpr uint8_t DEFAULT_CHANNEL = 2u;
/**
* Creates a builder for renderable components.
*
@@ -231,10 +238,13 @@ public:
/**
* 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.
* They are sorted as usual within 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.
* Channels 0 and 1 may not have render primitives using a material with `refractionType`
* set to `screenspace`.
*
* @param channel clamped to the range [0..3], defaults to 2.
*
* @return Builder reference for chaining calls.
*
@@ -293,6 +303,14 @@ public:
*/
Builder& enableSkinningBuffers(bool enabled = true) noexcept;
/**
* Controls if this renderable is affected by the large-scale fog.
* @param enabled If true, enables large-scale fog on this object. Disables it otherwise.
* True by default.
* @return A reference to this Builder for chaining calls.
*/
Builder& fog(bool enabled = true) noexcept;
/**
* Enables GPU vertex skinning for up to 255 bones, 0 by default.
*
@@ -399,20 +417,47 @@ public:
*/
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.
* Specifies the number of draw instances of this renderable. The default is 1 instance and
* the maximum number of instances allowed is 32767. 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 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.
* @param instanceCount the number of instances silently clamped between 1 and 32767.
*/
Builder& instances(size_t instanceCount) noexcept;
/**
* Specifies the number of draw instances of this renderable and an \c InstanceBuffer
* containing their local transforms. The default is 1 instance and the maximum number of
* instances allowed when supplying transforms is given by
* \c Engine::getMaxAutomaticInstances (64 on most platforms). 0 is invalid. The
* \c InstanceBuffer must not be destroyed before this renderable.
*
* 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 must set its `instanced` parameter to `true` in order to use
* \c getInstanceIndex() in the vertex or fragment shader to get the instance index.
*
* Only the \c VERTEX_DOMAIN_OBJECT vertex domain is supported.
*
* The local transforms of each instance can be updated with
* \c InstanceBuffer::setLocalTransforms.
*
* \see InstanceBuffer
* \see instances(size_t, * math::mat4f const*)
* @param instanceCount the number of instances, silently clamped between 1 and
* the result of Engine::getMaxAutomaticInstances().
* @param instanceBuffer an InstanceBuffer containing at least instanceCount transforms
*/
Builder& instances(size_t instanceCount, InstanceBuffer* instanceBuffer) noexcept;
/**
* Adds the Renderable component to an entity.
*
@@ -499,6 +544,19 @@ public:
*/
void setCulling(Instance instance, bool enable) noexcept;
/**
* Changes whether or not the large-scale fog is applied to this renderable
* @see Builder::fog()
*/
void setFogEnabled(Instance instance, bool enable) noexcept;
/**
* Returns whether large-scale fog is enabled for this renderable.
* @return True if fog is enabled for this renderable.
* @see Builder::fog()
*/
bool getFogEnabled(Instance instance) const noexcept;
/**
* Enables or disables a light channel.
* Light channel 0 is enabled by default.