update headers to Filament v1.25.0
This commit is contained in:
@@ -40,7 +40,7 @@ namespace viewer {
|
||||
*
|
||||
* When executing a test, clients should call tick() after each frame is rendered, which gives
|
||||
* automation an opportunity to push settings to Filament, increment the current test index (if
|
||||
* enough time has elapsed), and request an asychronous screenshot.
|
||||
* enough time has elapsed), and request an asynchronous screenshot.
|
||||
*
|
||||
* The time to sleep between tests is configurable and can be set to zero. Automation also waits a
|
||||
* specified minimum number of frames between tests.
|
||||
|
||||
@@ -72,6 +72,7 @@ using MultiSampleAntiAliasingOptions = filament::View::MultiSampleAntiAliasingOp
|
||||
using TemporalAntiAliasingOptions = filament::View::TemporalAntiAliasingOptions;
|
||||
using VignetteOptions = filament::View::VignetteOptions;
|
||||
using VsmShadowOptions = filament::View::VsmShadowOptions;
|
||||
using GuardBandOptions = filament::View::GuardBandOptions;
|
||||
using LightManager = filament::LightManager;
|
||||
|
||||
// These functions push all editable property values to their respective Filament objects.
|
||||
@@ -171,6 +172,7 @@ struct ViewSettings {
|
||||
TemporalAntiAliasingOptions taa;
|
||||
VignetteOptions vignette;
|
||||
VsmShadowOptions vsmShadowOptions;
|
||||
GuardBandOptions guardBand;
|
||||
|
||||
// Custom View Options
|
||||
ColorGradingSettings colorGrading;
|
||||
@@ -194,7 +196,7 @@ struct LightSettings {
|
||||
LightManager::ShadowOptions shadowOptions;
|
||||
SoftShadowOptions softShadowOptions;
|
||||
float sunlightIntensity = 100000.0f;
|
||||
math::float3 sunlightDirection = {0.6, -1.0, -0.8};;
|
||||
math::float3 sunlightDirection = {0.6, -1.0, -0.8};
|
||||
math::float3 sunlightColor = filament::Color::toLinear<filament::ACCURATE>({ 0.98, 0.92, 0.89});
|
||||
float iblIntensity = 30000.0f;
|
||||
float iblRotation = 0.0f;
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef VIEWER_SIMPLEVIEWER_H
|
||||
#define VIEWER_SIMPLEVIEWER_H
|
||||
#ifndef VIEWER_VIEWERGUI_H
|
||||
#define VIEWER_VIEWERGUI_H
|
||||
|
||||
#include <filament/Box.h>
|
||||
#include <filament/DebugRegistry.h>
|
||||
@@ -26,6 +26,7 @@
|
||||
|
||||
#include <gltfio/Animator.h>
|
||||
#include <gltfio/FilamentAsset.h>
|
||||
#include <gltfio/NodeManager.h>
|
||||
|
||||
#include <viewer/Settings.h>
|
||||
|
||||
@@ -35,6 +36,7 @@
|
||||
#include <math/mat4.h>
|
||||
#include <math/vec3.h>
|
||||
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
|
||||
namespace filagui {
|
||||
@@ -45,15 +47,15 @@ namespace filament {
|
||||
namespace viewer {
|
||||
|
||||
/**
|
||||
* \class SimpleViewer SimpleViewer.h viewer/SimpleViewer.h
|
||||
* \brief Manages the state for a simple glTF viewer with imgui controls and a tree view.
|
||||
* \class ViewerGui ViewerGui.h viewer/ViewerGui.h
|
||||
* \brief Builds ImGui widgets for a simple glTF viewer and manages the associated state.
|
||||
*
|
||||
* This is a utility that can be used across multiple platforms, including web.
|
||||
*
|
||||
* \note If you don't need ImGui controls, there is no need to use this class, just use AssetLoader
|
||||
* instead.
|
||||
*/
|
||||
class UTILS_PUBLIC SimpleViewer {
|
||||
class UTILS_PUBLIC ViewerGui {
|
||||
public:
|
||||
using Animator = gltfio::Animator;
|
||||
using FilamentAsset = gltfio::FilamentAsset;
|
||||
@@ -62,29 +64,39 @@ public:
|
||||
static constexpr int DEFAULT_SIDEBAR_WIDTH = 350;
|
||||
|
||||
/**
|
||||
* Constructs a SimpleViewer that has a fixed association with the given Filament objects.
|
||||
* Constructs a ViewerGui that has a fixed association with the given Filament objects.
|
||||
*
|
||||
* Upon construction, the simple viewer may create some additional Filament objects (such as
|
||||
* light sources) that it owns.
|
||||
*/
|
||||
SimpleViewer(filament::Engine* engine, filament::Scene* scene, filament::View* view,
|
||||
ViewerGui(filament::Engine* engine, filament::Scene* scene, filament::View* view,
|
||||
int sidebarWidth = DEFAULT_SIDEBAR_WIDTH);
|
||||
|
||||
/**
|
||||
* Destroys the SimpleViewer and any Filament entities that it owns.
|
||||
* Destroys the ViewerGui and any Filament entities that it owns.
|
||||
*/
|
||||
~SimpleViewer();
|
||||
~ViewerGui();
|
||||
|
||||
/**
|
||||
* Adds the asset's ready-to-render entities into the scene.
|
||||
* Sets the viewer's current asset.
|
||||
*
|
||||
* The viewer does not claim ownership over the asset or its entities. Clients should use
|
||||
* AssetLoader and ResourceLoader to load an asset before passing it in.
|
||||
*
|
||||
* This method does not add renderables to the scene; see populateScene().
|
||||
*
|
||||
* @param asset The asset to view.
|
||||
* @param instanceToAnimate Optional instance from which to get the animator.
|
||||
*/
|
||||
void populateScene(FilamentAsset* asset, FilamentInstance* instanceToAnimate = nullptr);
|
||||
void setAsset(FilamentAsset* asset, FilamentInstance* instanceToAnimate = nullptr);
|
||||
|
||||
/**
|
||||
* Adds the asset's ready-to-render entities into the scene.
|
||||
*
|
||||
* This is used for asychronous loading. It can be called once per frame to gradually add
|
||||
* entities into the scene as their textures are loaded.
|
||||
*/
|
||||
void populateScene();
|
||||
|
||||
/**
|
||||
* Removes the current asset from the viewer.
|
||||
@@ -126,7 +138,7 @@ public:
|
||||
void renderUserInterface(float timeStepInSeconds, filament::View* guiView, float pixelRatio);
|
||||
|
||||
/**
|
||||
* Event-passing methods, useful only when SimpleViewer manages its own instance of ImGuiHelper.
|
||||
* Event-passing methods, useful only when ViewerGui manages its own instance of ImGuiHelper.
|
||||
* The key codes used in these methods are just normal ASCII/ANSI codes.
|
||||
* @{
|
||||
*/
|
||||
@@ -218,8 +230,14 @@ public:
|
||||
int getCurrentCamera() const { return mCurrentCamera; }
|
||||
|
||||
private:
|
||||
using SceneMask = gltfio::NodeManager::SceneMask;
|
||||
|
||||
void updateIndirectLight();
|
||||
|
||||
bool isRemoteMode() const { return mAsset == nullptr; }
|
||||
|
||||
void sceneSelectionUI();
|
||||
|
||||
// Immutable properties set from the constructor.
|
||||
filament::Engine* const mEngine;
|
||||
filament::Scene* const mScene;
|
||||
@@ -238,7 +256,6 @@ private:
|
||||
// Properties that can be changed from the UI.
|
||||
int mCurrentAnimation = 1; // It is a 1-based index and 0 means not playing animation
|
||||
int mCurrentVariant = 0;
|
||||
bool mResetAnimation = true;
|
||||
bool mEnableWireframe = false;
|
||||
int mVsmMsaaSamplesLog2 = 1;
|
||||
Settings mSettings;
|
||||
@@ -246,10 +263,19 @@ private:
|
||||
uint32_t mFlags;
|
||||
utils::Entity mCurrentMorphingEntity;
|
||||
std::vector<float> mMorphWeights;
|
||||
SceneMask mVisibleScenes;
|
||||
bool mShowingRestPose = false;
|
||||
|
||||
// 0 is the default "free camera". Additional cameras come from the gltf file (1-based index).
|
||||
int mCurrentCamera = 0;
|
||||
|
||||
// Cross fade animation parameters.
|
||||
float mCrossFadeDuration = 0.5f; // number of seconds to transition between animations
|
||||
int mPreviousAnimation = 0; // one-based index of the previous animation
|
||||
double mCurrentStartTime = 0.0f; // start time of most recent cross-fade (seconds)
|
||||
double mPreviousStartTime = 0.0f; // start time of previous cross-fade (seconds)
|
||||
bool mResetAnimation = true; // set when building ImGui widgets, honored in applyAnimation
|
||||
|
||||
// Color grading UI state.
|
||||
float mToneMapPlot[1024];
|
||||
float mRangePlot[1024 * 3];
|
||||
@@ -262,4 +288,4 @@ filament::math::mat4f fitIntoUnitCube(const filament::Aabb& bounds, float zoffse
|
||||
} // namespace viewer
|
||||
} // namespace filament
|
||||
|
||||
#endif // VIEWER_SIMPLEVIEWER_H
|
||||
#endif // VIEWER_VIEWERGUI_H
|
||||
Reference in New Issue
Block a user