Foundation
Loading...
Searching...
No Matches
Classes | Functions | Variables
EditorScene.cpp File Reference
#include <algorithm>
#include <cctype>
#include <limits>
#include <numbers>
#include "PathUtil.hpp"
#include "EditorState.hpp"
#include <Fonts/PlexSansIcon.h>
#include <Renderer/Mesh.hpp>
#include "Renderer/GPUScene.hpp"
#include "Renderer/LightBVH.hpp"
#include "Renderer/Postprocess.hpp"
#include <Math/Decompose.hpp>
#include <Math/Quantize.hpp>
#include <imgui.h>
#include <tracy/Tracy.hpp>
#include <cmath>

Classes

struct  SceneLoadStats
 
struct  PendingSceneLoad
 

Functions

static bool PathsReferToSameFile (StringView a, StringView b)
 
static void ReleaseScenePayloadFileForRewrite (StringView payloadPath)
 
void CommitSceneToGPU (bool resetAccumulation)
 
static FTexture LoadViewLUT (StringView path, Allocator *alloc=GLOBAL_ALLOC)
 
static bool HasDDSExtension (StringView path)
 
static FTexture LoadMatcapTexture (StringView path, Allocator *alloc=GLOBAL_ALLOC)
 
static void LoadSelectedViewLUTs (FTexture &sdr, FTexture &hdr, int &sdrIndex, int &hdrIndex, String const &sdrExternalPath, String const &hdrExternalPath, Allocator *alloc=GLOBAL_ALLOC)
 
static void LoadSelectedViewLUTs (FTexture &sdr, FTexture &hdr)
 
static void UploadEditorViewLUTs (GPUScene *gpu, FTexture const &sdr, FTexture const &hdr)
 
String ResolveMatcapPath (int &index, String const &externalPath)
 
static void LoadSelectedMatcap (FTexture &matcap, int &matcapIndex, String const &externalPath, Allocator *alloc=GLOBAL_ALLOC)
 
static void LoadSelectedMatcap (FTexture &matcap)
 
static void UploadEditorMatcap (GPUScene *gpu, FTexture const &matcap)
 
static double MillisecondsSince (std::chrono::steady_clock::time_point start)
 
bool ApplyViewLUTSelection ()
 
bool ApplyMatcapSelection ()
 
FTexture ReadbackRenderTexture (RHITexture *source, Allocator *alloc)
 
static Vector< float > CombineRenderTextures (Span< const FTexture > textures, uint32_t &outWidth, uint32_t &outHeight, Allocator *alloc=GLOBAL_ALLOC)
 
void DoRenderReadback (RendererOutputs const &outputs)
 
void UpdateSceneLights ()
 
void DeleteSelectedInstance ()
 
static void ApplySceneCamera (FImportedScene const &scene, FArcballCamera &cameraState, CameraApertureState &apertureState, RendererUBO &globals)
 
static size_t GPUSceneBudgetBytes (GPUSceneDesc const &desc)
 
static GPUSceneCreateGPUScene (FImportedScene const &scene, size_t &outBudgetBytes)
 
static void DestroyGPUScene (GPUScene *&gpu)
 
static String PrepareScenePayloadFile (StringView path)
 
static void ApplySceneGlobals (FImportedScene const &scene)
 
static void InitializeSceneLoad (FImportedScene &scene, SceneLoadStats &stats, GPUScene *&newGPUScene)
 
static void BeginSceneUpload (FImportedScene &scene, GPUScene *gpu, FSceneGPUResources &resources)
 
static void PrepareSceneGlobals (FImportedScene &scene, GPUScene *gpu, AllocatorStack &sceneAlloc)
 
static void InstallLoadedScene (String const &scenePayloadPath, GPUScene *&newGPUScene)
 
static void DestroyPendingSceneLoad ()
 
static void FinishPendingSceneLoad ()
 
bool PollSceneLoad ()
 
void RequestLoadScene (StringView path, StringView envMapPath)
 
void CheckDeferredSceneLoad ()
 
void LoadScene (StringView path)
 
void LoadEnvMap (StringView path)
 
void HandleFile (const char *filePath)
 

Variables

static constexpr const char * kTempScenePath = "Cache/Last.fscn"
 
static String sDeferredScenePath
 
static String sDeferredEnvMapPath
 
static constexpr size_t kDefaultSceneLoadScratchBudget = 64ull * (1ull << 20)
 
static PendingSceneLoadsPendingSceneLoad = nullptr
 

Function Documentation

◆ ApplyMatcapSelection()

bool ApplyMatcapSelection ( )

◆ ApplySceneCamera()

static void ApplySceneCamera ( FImportedScene const &  scene,
FArcballCamera cameraState,
CameraApertureState apertureState,
RendererUBO globals 
)
static

◆ ApplySceneGlobals()

static void ApplySceneGlobals ( FImportedScene const &  scene)
static

◆ ApplyViewLUTSelection()

bool ApplyViewLUTSelection ( )

◆ BeginSceneUpload()

static void BeginSceneUpload ( FImportedScene scene,
GPUScene gpu,
FSceneGPUResources resources 
)
static

◆ CheckDeferredSceneLoad()

void CheckDeferredSceneLoad ( )

◆ CombineRenderTextures()

static Vector< float > CombineRenderTextures ( Span< const FTexture textures,
uint32_t &  outWidth,
uint32_t &  outHeight,
Allocator alloc = GLOBAL_ALLOC 
)
static

◆ CommitSceneToGPU()

void CommitSceneToGPU ( bool  resetAccumulation)

◆ CreateGPUScene()

static GPUScene * CreateGPUScene ( FImportedScene const &  scene,
size_t &  outBudgetBytes 
)
static

◆ DeleteSelectedInstance()

void DeleteSelectedInstance ( )

◆ DestroyGPUScene()

static void DestroyGPUScene ( GPUScene *&  gpu)
static

◆ DestroyPendingSceneLoad()

static void DestroyPendingSceneLoad ( )
static

◆ DoRenderReadback()

void DoRenderReadback ( RendererOutputs const &  outputs)

◆ FinishPendingSceneLoad()

static void FinishPendingSceneLoad ( )
static

◆ GPUSceneBudgetBytes()

static size_t GPUSceneBudgetBytes ( GPUSceneDesc const &  desc)
static

◆ HandleFile()

void HandleFile ( const char *  filePath)

◆ HasDDSExtension()

static bool HasDDSExtension ( StringView  path)
static

◆ InitializeSceneLoad()

static void InitializeSceneLoad ( FImportedScene scene,
SceneLoadStats stats,
GPUScene *&  newGPUScene 
)
static

◆ InstallLoadedScene()

static void InstallLoadedScene ( String const &  scenePayloadPath,
GPUScene *&  newGPUScene 
)
static

◆ LoadEnvMap()

void LoadEnvMap ( StringView  path)

◆ LoadMatcapTexture()

static FTexture LoadMatcapTexture ( StringView  path,
Allocator alloc = GLOBAL_ALLOC 
)
static

◆ LoadScene()

void LoadScene ( StringView  path)

◆ LoadSelectedMatcap() [1/2]

static void LoadSelectedMatcap ( FTexture matcap)
static

◆ LoadSelectedMatcap() [2/2]

static void LoadSelectedMatcap ( FTexture matcap,
int &  matcapIndex,
String const &  externalPath,
Allocator alloc = GLOBAL_ALLOC 
)
static

◆ LoadSelectedViewLUTs() [1/2]

static void LoadSelectedViewLUTs ( FTexture sdr,
FTexture hdr 
)
static

◆ LoadSelectedViewLUTs() [2/2]

static void LoadSelectedViewLUTs ( FTexture sdr,
FTexture hdr,
int &  sdrIndex,
int &  hdrIndex,
String const &  sdrExternalPath,
String const &  hdrExternalPath,
Allocator alloc = GLOBAL_ALLOC 
)
static

◆ LoadViewLUT()

static FTexture LoadViewLUT ( StringView  path,
Allocator alloc = GLOBAL_ALLOC 
)
static

◆ MillisecondsSince()

static double MillisecondsSince ( std::chrono::steady_clock::time_point  start)
static

◆ PathsReferToSameFile()

static bool PathsReferToSameFile ( StringView  a,
StringView  b 
)
static

◆ PollSceneLoad()

bool PollSceneLoad ( )

◆ PrepareSceneGlobals()

static void PrepareSceneGlobals ( FImportedScene scene,
GPUScene gpu,
AllocatorStack sceneAlloc 
)
static

◆ PrepareScenePayloadFile()

static String PrepareScenePayloadFile ( StringView  path)
static

◆ ReadbackRenderTexture()

FTexture ReadbackRenderTexture ( RHITexture source,
Allocator alloc 
)

◆ ReleaseScenePayloadFileForRewrite()

static void ReleaseScenePayloadFileForRewrite ( StringView  payloadPath)
static

◆ RequestLoadScene()

void RequestLoadScene ( StringView  path,
StringView  envMapPath 
)

◆ ResolveMatcapPath()

String ResolveMatcapPath ( int &  index,
String const &  externalPath 
)

◆ UpdateSceneLights()

void UpdateSceneLights ( )

◆ UploadEditorMatcap()

static void UploadEditorMatcap ( GPUScene gpu,
FTexture const &  matcap 
)
static

◆ UploadEditorViewLUTs()

static void UploadEditorViewLUTs ( GPUScene gpu,
FTexture const &  sdr,
FTexture const &  hdr 
)
static

Variable Documentation

◆ kDefaultSceneLoadScratchBudget

constexpr size_t kDefaultSceneLoadScratchBudget = 64ull * (1ull << 20)
staticconstexpr

◆ kTempScenePath

constexpr const char* kTempScenePath = "Cache/Last.fscn"
staticconstexpr

◆ sDeferredEnvMapPath

String sDeferredEnvMapPath
static

◆ sDeferredScenePath

String sDeferredScenePath
static

◆ sPendingSceneLoad

PendingSceneLoad* sPendingSceneLoad = nullptr
static