move Filament headers to own directory under iOS/macOS
This commit is contained in:
@@ -34,10 +34,13 @@ class Entity;
|
||||
namespace filament {
|
||||
|
||||
/**
|
||||
* Camera represents the eye through which the scene is viewed.
|
||||
* Camera represents the eye(s) through which the scene is viewed.
|
||||
*
|
||||
* A Camera has a position and orientation and controls the projection and exposure parameters.
|
||||
*
|
||||
* For stereoscopic rendering, a Camera maintains two separate "eyes": Eye 0 and Eye 1. These are
|
||||
* arbitrary and don't necessarily need to correspond to "left" and "right".
|
||||
*
|
||||
* Creation and destruction
|
||||
* ========================
|
||||
*
|
||||
@@ -140,6 +143,18 @@ namespace filament {
|
||||
* intensity and the Camera exposure interact to produce the final scene's brightness.
|
||||
*
|
||||
*
|
||||
* Stereoscopic rendering
|
||||
* ======================
|
||||
*
|
||||
* The Camera's transform (as set by setModelMatrix or via TransformManager) defines a "head" space,
|
||||
* which typically corresponds to the location of the viewer's head. Each eye's transform is set
|
||||
* relative to this head space by setEyeModelMatrix.
|
||||
*
|
||||
* Each eye also maintains its own projection matrix. These can be set with setCustomEyeProjection.
|
||||
* Care must be taken to correctly set the projectionForCulling matrix, as well as its corresponding
|
||||
* near and far values. The projectionForCulling matrix must define a frustum (in head space) that
|
||||
* bounds the frustums of both eyes. Alternatively, culling may be disabled with
|
||||
* View::setFrustumCullingEnabled.
|
||||
*
|
||||
* \see Frustum, View
|
||||
*/
|
||||
@@ -234,6 +249,24 @@ public:
|
||||
*/
|
||||
void setCustomProjection(math::mat4 const& projection, double near, double far) noexcept;
|
||||
|
||||
/** Sets a custom projection matrix for each eye.
|
||||
*
|
||||
* The projectionForCulling, near, and far parameters establish a "culling frustum" which must
|
||||
* encompass anything either eye can see.
|
||||
*
|
||||
* @param projection an array of projection matrices, only the first
|
||||
* CONFIG_STEREOSCOPIC_EYES (2) are read
|
||||
* @param count size of the projection matrix array to set, must be
|
||||
* >= CONFIG_STEREOSCOPIC_EYES (2)
|
||||
* @param projectionForCulling custom projection matrix for culling, must encompass both eyes
|
||||
* @param near distance in world units from the camera to the culling near plane. \p near > 0.
|
||||
* @param far distance in world units from the camera to the culling far plane. \p far > \p
|
||||
* near.
|
||||
* @see setCustomProjection
|
||||
*/
|
||||
void setCustomEyeProjection(math::mat4 const* projection, size_t count,
|
||||
math::mat4 const& projectionForCulling, double near, double far);
|
||||
|
||||
/** Sets the projection matrix.
|
||||
*
|
||||
* The projection matrices must be of one of the following form:
|
||||
@@ -309,11 +342,14 @@ public:
|
||||
* The projection matrix used for rendering always has its far plane set to infinity. This
|
||||
* is why it may differ from the matrix set through setProjection() or setLensProjection().
|
||||
*
|
||||
* @param eyeId the index of the eye to return the projection matrix for, must be <
|
||||
* CONFIG_STEREOSCOPIC_EYES (2)
|
||||
* @return The projection matrix used for rendering
|
||||
*
|
||||
* @see setProjection, setLensProjection, setCustomProjection, getCullingProjectionMatrix
|
||||
* @see setProjection, setLensProjection, setCustomProjection, getCullingProjectionMatrix,
|
||||
* setCustomEyeProjection
|
||||
*/
|
||||
math::mat4 getProjectionMatrix() const noexcept;
|
||||
math::mat4 getProjectionMatrix(uint8_t eyeId = 0) const;
|
||||
|
||||
|
||||
/** Returns the projection matrix used for culling (far plane is finite).
|
||||
@@ -350,6 +386,26 @@ public:
|
||||
void setModelMatrix(const math::mat4& model) noexcept;
|
||||
void setModelMatrix(const math::mat4f& model) noexcept; //!< @overload
|
||||
|
||||
/** Set the position of an eye relative to this Camera (head).
|
||||
*
|
||||
* By default, both eyes' model matrices are identity matrices.
|
||||
*
|
||||
* For example, to position Eye 0 3cm leftwards and Eye 1 3cm rightwards:
|
||||
* ~~~~~~~~~~~{.cpp}
|
||||
* const mat4 leftEye = mat4::translation(double3{-0.03, 0.0, 0.0});
|
||||
* const mat4 rightEye = mat4::translation(double3{ 0.03, 0.0, 0.0});
|
||||
* camera.setEyeModelMatrix(0, leftEye);
|
||||
* camera.setEyeModelMatrix(1, rightEye);
|
||||
* ~~~~~~~~~~~
|
||||
*
|
||||
* This method is not intended to be called every frame. Instead, to update the position of the
|
||||
* head, use Camera::setModelMatrix.
|
||||
*
|
||||
* @param eyeId the index of the eye to set, must be < CONFIG_STEREOSCOPIC_EYES (2)
|
||||
* @param model the model matrix for an individual eye
|
||||
*/
|
||||
void setEyeModelMatrix(uint8_t eyeId, math::mat4 const& model);
|
||||
|
||||
/** Sets the camera's model matrix
|
||||
*
|
||||
* @param eye The position of the camera in world space.
|
||||
@@ -448,7 +504,9 @@ public:
|
||||
//! returns this camera's sensitivity in ISO
|
||||
float getSensitivity() const noexcept;
|
||||
|
||||
//! returns the focal length in meters [m] for a 35mm camera
|
||||
/** Returns the focal length in meters [m] for a 35mm camera.
|
||||
* Eye 0's projection matrix is used to compute the focal length.
|
||||
*/
|
||||
double getFocalLength() const noexcept;
|
||||
|
||||
/**
|
||||
|
||||
@@ -513,6 +513,14 @@ public:
|
||||
*/
|
||||
size_t getMaxAutomaticInstances() const noexcept;
|
||||
|
||||
/**
|
||||
* Queries the device and platform for instanced stereo rendering support.
|
||||
*
|
||||
* @return true if stereo rendering is supported, false otherwise
|
||||
* @see View::setStereoscopicOptions
|
||||
*/
|
||||
bool isStereoSupported() const noexcept;
|
||||
|
||||
/**
|
||||
* @return EntityManager used by filament
|
||||
*/
|
||||
|
||||
@@ -28,11 +28,7 @@
|
||||
namespace filament {
|
||||
|
||||
/**
|
||||
* Fence is used to synchronize rendering operations together, with the CPU or with compute.
|
||||
*
|
||||
* \note
|
||||
* Currently Fence only provide client-side synchronization.
|
||||
*
|
||||
* Fence is used to synchronize the application main thread with filament's rendering thread.
|
||||
*/
|
||||
class UTILS_PUBLIC Fence : public FilamentAPI {
|
||||
public:
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <utils/EntityInstance.h>
|
||||
|
||||
#include <math/mathfwd.h>
|
||||
#include <math/quat.h>
|
||||
|
||||
namespace utils {
|
||||
class Entity;
|
||||
@@ -244,6 +245,7 @@ public:
|
||||
* shadows that are too far and wouldn't contribute to the scene much, improving
|
||||
* performance and quality. This value is always positive.
|
||||
* Use 0.0f to use the camera far distance.
|
||||
* This only affect directional lights.
|
||||
*/
|
||||
float shadowFar = 0.0f;
|
||||
|
||||
@@ -360,6 +362,13 @@ public:
|
||||
* enabled. (2cm by default).
|
||||
*/
|
||||
float shadowBulbRadius = 0.02f;
|
||||
|
||||
/**
|
||||
* Transforms the shadow direction. Must be a unit quaternion.
|
||||
* The default is identity.
|
||||
* Ignored if the light type isn't directional. For artistic use. Use with caution.
|
||||
*/
|
||||
math::quatf transform{ 1.0f };
|
||||
};
|
||||
|
||||
struct ShadowCascades {
|
||||
@@ -671,7 +680,7 @@ public:
|
||||
* @return true is this light is a type of directional light
|
||||
*/
|
||||
inline bool isDirectional(Instance i) const noexcept {
|
||||
Type type = getType(i);
|
||||
Type const type = getType(i);
|
||||
return type == Type::DIRECTIONAL || type == Type::SUN;
|
||||
}
|
||||
|
||||
@@ -692,7 +701,7 @@ public:
|
||||
* @return true is this light is a type of spot light
|
||||
*/
|
||||
inline bool isSpotLight(Instance i) const noexcept {
|
||||
Type type = getType(i);
|
||||
Type const type = getType(i);
|
||||
return type == Type::SPOT || type == Type::FOCUSED_SPOT;
|
||||
}
|
||||
|
||||
|
||||
@@ -180,6 +180,11 @@ public:
|
||||
* is guaranteed to be invalid (either because it's been destroyed by the user already, or,
|
||||
* because it's been cleaned-up by the Engine).
|
||||
*
|
||||
* UserVariantFilterMask::ALL should be used with caution. Only variants that an application
|
||||
* needs should be included in the variants argument. For example, the STE variant is only used
|
||||
* for stereoscopic rendering. If an application is not planning to render in stereo, this bit
|
||||
* should be turned off to avoid unnecessary material compilations.
|
||||
*
|
||||
* @param priority Which priority queue to use, LOW or HIGH.
|
||||
* @param variants Variants to include to the compile command.
|
||||
* @param handler Handler to dispatch the callback or nullptr for the default handler
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
namespace filament {
|
||||
|
||||
// update this when a new version of filament wouldn't work with older materials
|
||||
static constexpr size_t MATERIAL_VERSION = 41;
|
||||
static constexpr size_t MATERIAL_VERSION = 43;
|
||||
|
||||
/**
|
||||
* Supported shading models
|
||||
@@ -236,14 +236,15 @@ enum class Property : uint8_t {
|
||||
using UserVariantFilterMask = uint32_t;
|
||||
|
||||
enum class UserVariantFilterBit : UserVariantFilterMask {
|
||||
DIRECTIONAL_LIGHTING = 0x01,
|
||||
DYNAMIC_LIGHTING = 0x02,
|
||||
SHADOW_RECEIVER = 0x04,
|
||||
SKINNING = 0x08,
|
||||
FOG = 0x10,
|
||||
VSM = 0x20,
|
||||
SSR = 0x40,
|
||||
ALL = 0x7F,
|
||||
DIRECTIONAL_LIGHTING = 0x01, //!< Directional lighting
|
||||
DYNAMIC_LIGHTING = 0x02, //!< Dynamic lighting
|
||||
SHADOW_RECEIVER = 0x04, //!< Shadow receiver
|
||||
SKINNING = 0x08, //!< Skinning
|
||||
FOG = 0x10, //!< Fog
|
||||
VSM = 0x20, //!< Variance shadow maps
|
||||
SSR = 0x40, //!< Screen-space reflections
|
||||
STE = 0x80, //!< Instanced stereo rendering
|
||||
ALL = 0xFF,
|
||||
};
|
||||
|
||||
} // namespace filament
|
||||
|
||||
@@ -133,14 +133,25 @@ struct BloomOptions {
|
||||
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)
|
||||
uint32_t resolution = 384; //!< resolution of vertical axis (2^levels to 2048)
|
||||
float anamorphism = 1.0f; //!< bloom x/y aspect-ratio (1/32 to 32)
|
||||
uint8_t levels = 6; //!< number of blur levels (3 to 11)
|
||||
uint8_t levels = 6; //!< number of blur levels (1 to 11)
|
||||
BlendMode blendMode = BlendMode::ADD; //!< how the bloom effect is applied
|
||||
bool threshold = true; //!< whether to threshold the source
|
||||
bool enabled = false; //!< enable or disable bloom
|
||||
float highlight = 1000.0f; //!< limit highlights to this value before bloom [10, +inf]
|
||||
|
||||
/**
|
||||
* Bloom quality level.
|
||||
* LOW (default): use a more optimized down-sampling filter, however there can be artifacts
|
||||
* with dynamic resolution, this can be alleviated by using the homogenous mode.
|
||||
* MEDIUM: Good balance between quality and performance.
|
||||
* HIGH: In this mode the bloom resolution is automatically increased to avoid artifacts.
|
||||
* This mode can be significantly slower on mobile, especially at high resolution.
|
||||
* This mode greatly improves the anamorphic bloom.
|
||||
*/
|
||||
QualityLevel quality = QualityLevel::LOW;
|
||||
|
||||
bool lensFlare = false; //!< enable screen-space lens flare
|
||||
bool starburst = true; //!< enable starburst effect on lens flare
|
||||
float chromaticAberration = 0.005f; //!< amount of chromatic aberration
|
||||
@@ -541,6 +552,13 @@ struct SoftShadowOptions {
|
||||
float penumbraRatioScale = 1.0f;
|
||||
};
|
||||
|
||||
/**
|
||||
* Options for stereoscopic (multi-eye) rendering.
|
||||
*/
|
||||
struct StereoscopicOptions {
|
||||
bool enabled = false;
|
||||
};
|
||||
|
||||
} // namespace filament
|
||||
|
||||
#endif //TNT_FILAMENT_OPTIONS_H
|
||||
|
||||
@@ -18,10 +18,13 @@
|
||||
#define TNT_FILAMENT_SWAPCHAIN_H
|
||||
|
||||
#include <filament/FilamentAPI.h>
|
||||
|
||||
#include <backend/CallbackHandler.h>
|
||||
#include <backend/DriverEnums.h>
|
||||
#include <backend/PresentCallable.h>
|
||||
|
||||
#include <utils/compiler.h>
|
||||
#include <utils/Invocable.h>
|
||||
|
||||
namespace filament {
|
||||
|
||||
@@ -148,7 +151,7 @@ class Engine;
|
||||
class UTILS_PUBLIC SwapChain : public FilamentAPI {
|
||||
public:
|
||||
using FrameScheduledCallback = backend::FrameScheduledCallback;
|
||||
using FrameCompletedCallback = backend::FrameCompletedCallback;
|
||||
using FrameCompletedCallback = utils::Invocable<void(SwapChain*)>;
|
||||
|
||||
/**
|
||||
* Requests a SwapChain with an alpha channel.
|
||||
@@ -241,17 +244,23 @@ public:
|
||||
* contents have completed rendering on the GPU.
|
||||
*
|
||||
* Use SwapChain::setFrameCompletedCallback to set a callback on an individual SwapChain. Each
|
||||
* time a frame completes GPU rendering, the callback will be called with optional user data.
|
||||
* time a frame completes GPU rendering, the callback will be called.
|
||||
*
|
||||
* The FrameCompletedCallback is guaranteed to be called on the main Filament thread.
|
||||
* If handler is nullptr, the callback is guaranteed to be called on the main Filament thread.
|
||||
*
|
||||
* @param callback A callback, or nullptr to unset.
|
||||
* @param user An optional pointer to user data passed to the callback function.
|
||||
* Use \c setFrameCompletedCallback() (with default arguments) to unset the callback.
|
||||
*
|
||||
* @param handler Handler to dispatch the callback or nullptr for the default handler.
|
||||
* @param callback Callback called when each frame completes.
|
||||
*
|
||||
* @remark Only Filament's Metal backend supports frame callbacks. Other backends ignore the
|
||||
* callback (which will never be called) and proceed normally.
|
||||
*
|
||||
* @see CallbackHandler
|
||||
*/
|
||||
void setFrameCompletedCallback(FrameCompletedCallback callback, void* user = nullptr);
|
||||
void setFrameCompletedCallback(backend::CallbackHandler* handler = nullptr,
|
||||
FrameCompletedCallback&& callback = {}) noexcept;
|
||||
|
||||
};
|
||||
|
||||
} // namespace filament
|
||||
|
||||
@@ -52,6 +52,8 @@ public:
|
||||
*/
|
||||
TextureSampler() noexcept = default;
|
||||
|
||||
explicit TextureSampler(backend::SamplerParams params) noexcept : mSamplerParams(params) { }
|
||||
|
||||
TextureSampler(const TextureSampler& rhs) noexcept = default;
|
||||
TextureSampler& operator=(const TextureSampler& rhs) noexcept = default;
|
||||
|
||||
|
||||
@@ -85,6 +85,7 @@ public:
|
||||
using SoftShadowOptions = SoftShadowOptions;
|
||||
using ScreenSpaceReflectionsOptions = ScreenSpaceReflectionsOptions;
|
||||
using GuardBandOptions = GuardBandOptions;
|
||||
using StereoscopicOptions = StereoscopicOptions;
|
||||
|
||||
/**
|
||||
* Sets the View's name. Only useful for debugging.
|
||||
@@ -676,6 +677,32 @@ public:
|
||||
*/
|
||||
bool isStencilBufferEnabled() const noexcept;
|
||||
|
||||
/**
|
||||
* Sets the stereoscopic rendering options for this view.
|
||||
*
|
||||
* Currently, only one type of stereoscopic rendering is supported: side-by-side.
|
||||
* Side-by-side stereo rendering splits the viewport into two halves: a left and right half.
|
||||
* Eye 0 will render to the left half, while Eye 1 will render into the right half.
|
||||
*
|
||||
* Currently, the following features are not supported with stereoscopic rendering:
|
||||
* - post-processing
|
||||
* - shadowing
|
||||
* - punctual lights
|
||||
*
|
||||
* Stereo rendering depends on device and platform support. To check if stereo rendering is
|
||||
* supported, use Engine::isStereoSupported().
|
||||
*
|
||||
* @param options The stereoscopic options to use on this view
|
||||
*/
|
||||
void setStereoscopicOptions(StereoscopicOptions const& options);
|
||||
|
||||
/**
|
||||
* Returns the stereoscopic options associated with this View.
|
||||
*
|
||||
* @return value set by setStereoscopicOptions().
|
||||
*/
|
||||
StereoscopicOptions const& getStereoscopicOptions() const noexcept;
|
||||
|
||||
// for debugging...
|
||||
|
||||
//! debugging: allows to entirely disable frustum culling. (culling enabled by default).
|
||||
|
||||
Reference in New Issue
Block a user