Foundation
Loading...
Searching...
No Matches
Classes | Enumerations | Functions | Variables
EditorUI.cpp File Reference
#include <cmath>
#include <cfloat>
#include <cstring>
#include <algorithm>
#include <Math/Decompose.hpp>
#include <imgui_internal.h>
#include <ImGuizmo.h>
#include <Renderer/Postprocess.hpp>
#include <Fonts/PlexSansIcon.h>
#include "PathUtil.hpp"
#include "EditorState.hpp"
#include <Renderer/Mesh.hpp>

Classes

struct  TexturePreviewEntry
 
struct  TexturePreviewImage
 
struct  TexturePreviewModalState
 
struct  MaterialTexturePickerModalState
 

Enumerations

enum class  TexturePreviewSource { None , GPUSceneTexture , RendererTextureView }
 

Functions

static void DrawLightGizmos ()
 
static void DrawInstanceGizmos ()
 
static void DrawViewportSelectionContextMenu ()
 
static float const * GizmoSnapForOperation (ImGuizmo::OPERATION op)
 
template<typename T >
static size_t DrawMemoryStatsTable (const char *tableId, Vector< T > &stats)
 
static float BytesToMiB (size_t bytes)
 
static void AppendMemoryFlag (char *buffer, size_t bufferSize, const char *flag)
 
static const char * MemoryTypeFlagsText (RHIDeviceMemoryTypeStat const &stat, char(&buffer)[128])
 
static void DrawRHIDeviceHeapStatsTable (RHIDeviceMemoryStats const &stats)
 
static void DrawRHIDeviceMemoryTypeStatsTable (RHIDeviceMemoryStats const &stats)
 
static void DrawAperturePreview (uint32_t blades, float rotation, float ratio)
 
static FInstanceSelectedSceneInstance ()
 
static int SelectedInstanceIndex ()
 
static bool IsInstanceIndexValid (int index)
 
static void SelectInstance (uint32_t index, GSInstance const &inst)
 
static mat4 InstanceTransformMatrix (FTransform const &transform)
 
static bool GetInstanceWorldBounds (int index, FSerializedBounds &outBounds)
 
static void FrameInstance (int index)
 
static void MoveInstanceToView (int index)
 
static void AlignInstanceWithView (int index)
 
static bool IsLightIndexValid (int index)
 
static bool IsLightTransformable (int index)
 
static void MoveLightToView (int index)
 
static void AlignLightWithView (int index)
 
static void AlignViewToLight (int index)
 
static void DeleteLight (int index)
 
static const char * InstanceTypeName (uint32_t type)
 
static const char * LightTypeName (FLightType type)
 
static int GetSelectedMaterialIndex ()
 
static bool IsMaterialIndexValid (int materialIndex)
 
static uint64_t & TexturePreviewFrame ()
 
static Vector< TexturePreviewEntry > & TexturePreviewCache ()
 
static TexturePreviewModalStateTexturePreviewModal ()
 
static void ResetTexturePreviewModal ()
 
static void ResetMaterialTexturePickerModal ()
 
void ClearMaterialTexturePreviewCache ()
 
static TexturePreviewImage GetTexturePreviewImage (uint32_t textureIndex, ImGui_ImplFoundation_ImageSampler sampler)
 
static TexturePreviewImage GetTexturePreviewImage (Renderer *renderer, ResourceHandle viewHandle, RHITextureView *view, ImGui_ImplFoundation_ImageSampler sampler)
 
static void PruneTexturePreviewCache (uint64_t frame)
 
static bool IsTexturePreviewFormatSupported (RHIResourceFormat format)
 
static TexturePreviewImage ResolveTexturePreviewModalImage (TexturePreviewModalState const &state)
 
static void OpenTexturePreviewModal (const char *title, GPUScene *gpuScene, uint32_t textureIndex, ImGui_ImplFoundation_ImageSampler sampler, TexturePreviewImage const &preview)
 
static void OpenTexturePreviewModal (const char *label, uint32_t textureIndex, ImGui_ImplFoundation_ImageSampler sampler, TexturePreviewImage const &preview)
 
static void OpenTexturePreviewModal (const char *title, Renderer *renderer, ResourceHandle viewHandle, ImGui_ImplFoundation_ImageSampler sampler, TexturePreviewImage const &preview)
 
static void DrawTexturePreviewModal ()
 
static void DrawTexturePreview (const char *label, uint32_t textureIndex, ImGui_ImplFoundation_ImageSampler sampler=ImGuiImplFoundationImageSamplerLinear)
 
static bool IsSceneEnvironmentTextureIndex (size_t textureIndex)
 
static uint32_t SceneTextureIndexFromId (FUUID id)
 
static bool IsPickableSceneTexture2D (FSerializedTexture const &texture)
 
static char const * ResolveSceneName (FUUID nameId)
 
static char const * NameOr (FUUID nameId, char const *fallback)
 
static void ImGuiPushUUID (FUUID const &id)
 
static void FormatIndexLabelWithName (char *buf, size_t bufSize, char const *suffix, int index, FUUID nameId)
 
static void DrawUUIDRow (FUUID id)
 
static void SetUUIDTooltip (FUUID id)
 
static uint32_t SceneTextureToGpuIndex (uint32_t sceneTextureIndex)
 
static MaterialTexturePickerModalStateMaterialTexturePickerModal ()
 
static void OpenMaterialTexturePickerModal (const char *label, FUUID materialId, FUUID FMaterial::*slot, ImGui_ImplFoundation_ImageSampler sampler)
 
static void MaterialTexturePickerTileStyleBegin (bool selected)
 
static void MaterialTexturePickerTileStyleEnd (bool selected)
 
static void MaterialTexturePickerTileSelectionOutline (bool selected)
 
static void DrawMaterialTexturePickerNoneTile (ImVec2 size, bool selected)
 
static void DrawMaterialTexturePickerGrid (uint32_t &pendingSelection, ImGui_ImplFoundation_ImageSampler sampler)
 
static bool DrawMaterialTexturePickerModal ()
 
static bool IsMaterialTexturePickerOpen ()
 
static char const * MaterialTexturePropLabel (char *buf, size_t bufSize, char const *name, FUUID textureId)
 
static void DrawMaterialTextureSlot (const char *label, FMaterial &material, FUUID FMaterial::*slot, ImGui_ImplFoundation_ImageSampler sampler=ImGuiImplFoundationImageSamplerLinear)
 
static bool DrawHairColorPresets (float4 &baseColor)
 
static bool DrawPrincipledMaterialPresets (FMaterial &material)
 
static void DrawRenderGraphTexturePreviews (Renderer *renderer, Allocator *scratch)
 
void EditorDockSpaceAndMenuBar ()
 
void FHierarchyPanel ()
 
void FLightingPanel ()
 
static void FAnimationPanel ()
 
void FRunningImGui ()
 
void FRendering (RendererOutputs const &outputs)
 

Variables

static constexpr const char * kExternalViewLUTLabel = "<external>"
 
static constexpr const char * kExternalMatcapLabel = "<external>"
 
static constexpr const char * kTexturePreviewModalName = "Texture Preview"
 
static constexpr const char * kMaterialTexturePickerModalName = "Select Texture"
 

Enumeration Type Documentation

◆ TexturePreviewSource

enum class TexturePreviewSource
strong
Enumerator
None 
GPUSceneTexture 
RendererTextureView 

Function Documentation

◆ AlignInstanceWithView()

static void AlignInstanceWithView ( int  index)
static

◆ AlignLightWithView()

static void AlignLightWithView ( int  index)
static

◆ AlignViewToLight()

static void AlignViewToLight ( int  index)
static

◆ AppendMemoryFlag()

static void AppendMemoryFlag ( char *  buffer,
size_t  bufferSize,
const char *  flag 
)
static

◆ BytesToMiB()

static float BytesToMiB ( size_t  bytes)
static

◆ ClearMaterialTexturePreviewCache()

void ClearMaterialTexturePreviewCache ( )

◆ DeleteLight()

static void DeleteLight ( int  index)
static

◆ DrawAperturePreview()

static void DrawAperturePreview ( uint32_t  blades,
float  rotation,
float  ratio 
)
static

◆ DrawHairColorPresets()

static bool DrawHairColorPresets ( float4 baseColor)
static

◆ DrawInstanceGizmos()

static void DrawInstanceGizmos ( )
static

◆ DrawLightGizmos()

static void DrawLightGizmos ( )
static

◆ DrawMaterialTexturePickerGrid()

static void DrawMaterialTexturePickerGrid ( uint32_t &  pendingSelection,
ImGui_ImplFoundation_ImageSampler  sampler 
)
static

◆ DrawMaterialTexturePickerModal()

static bool DrawMaterialTexturePickerModal ( )
static

◆ DrawMaterialTexturePickerNoneTile()

static void DrawMaterialTexturePickerNoneTile ( ImVec2  size,
bool  selected 
)
static

◆ DrawMaterialTextureSlot()

static void DrawMaterialTextureSlot ( const char *  label,
FMaterial material,
FUUID FMaterial::*  slot,
ImGui_ImplFoundation_ImageSampler  sampler = ImGuiImplFoundationImageSamplerLinear 
)
static

◆ DrawMemoryStatsTable()

template<typename T >
static size_t DrawMemoryStatsTable ( const char *  tableId,
Vector< T > &  stats 
)
static

◆ DrawPrincipledMaterialPresets()

static bool DrawPrincipledMaterialPresets ( FMaterial material)
static

◆ DrawRenderGraphTexturePreviews()

static void DrawRenderGraphTexturePreviews ( Renderer renderer,
Allocator scratch 
)
static

◆ DrawRHIDeviceHeapStatsTable()

static void DrawRHIDeviceHeapStatsTable ( RHIDeviceMemoryStats const &  stats)
static

◆ DrawRHIDeviceMemoryTypeStatsTable()

static void DrawRHIDeviceMemoryTypeStatsTable ( RHIDeviceMemoryStats const &  stats)
static

◆ DrawTexturePreview()

static void DrawTexturePreview ( const char *  label,
uint32_t  textureIndex,
ImGui_ImplFoundation_ImageSampler  sampler = ImGuiImplFoundationImageSamplerLinear 
)
static

◆ DrawTexturePreviewModal()

static void DrawTexturePreviewModal ( )
static

◆ DrawUUIDRow()

static void DrawUUIDRow ( FUUID  id)
static

◆ DrawViewportSelectionContextMenu()

static void DrawViewportSelectionContextMenu ( )
static

◆ EditorDockSpaceAndMenuBar()

void EditorDockSpaceAndMenuBar ( )

◆ FAnimationPanel()

static void FAnimationPanel ( )
static

◆ FHierarchyPanel()

void FHierarchyPanel ( )

◆ FLightingPanel()

void FLightingPanel ( )

◆ FormatIndexLabelWithName()

static void FormatIndexLabelWithName ( char *  buf,
size_t  bufSize,
char const *  suffix,
int  index,
FUUID  nameId 
)
static

◆ FrameInstance()

static void FrameInstance ( int  index)
static

◆ FRendering()

void FRendering ( RendererOutputs const &  outputs)

◆ FRunningImGui()

void FRunningImGui ( )

◆ GetInstanceWorldBounds()

static bool GetInstanceWorldBounds ( int  index,
FSerializedBounds outBounds 
)
static

◆ GetSelectedMaterialIndex()

static int GetSelectedMaterialIndex ( )
static

◆ GetTexturePreviewImage() [1/2]

static TexturePreviewImage GetTexturePreviewImage ( Renderer renderer,
ResourceHandle  viewHandle,
RHITextureView view,
ImGui_ImplFoundation_ImageSampler  sampler 
)
static

◆ GetTexturePreviewImage() [2/2]

static TexturePreviewImage GetTexturePreviewImage ( uint32_t  textureIndex,
ImGui_ImplFoundation_ImageSampler  sampler 
)
static

◆ GizmoSnapForOperation()

static float const * GizmoSnapForOperation ( ImGuizmo::OPERATION  op)
static

◆ ImGuiPushUUID()

static void ImGuiPushUUID ( FUUID const &  id)
static

◆ InstanceTransformMatrix()

static mat4 InstanceTransformMatrix ( FTransform const &  transform)
static

◆ InstanceTypeName()

static const char * InstanceTypeName ( uint32_t  type)
static

◆ IsInstanceIndexValid()

static bool IsInstanceIndexValid ( int  index)
static

◆ IsLightIndexValid()

static bool IsLightIndexValid ( int  index)
static

◆ IsLightTransformable()

static bool IsLightTransformable ( int  index)
static

◆ IsMaterialIndexValid()

static bool IsMaterialIndexValid ( int  materialIndex)
static

◆ IsMaterialTexturePickerOpen()

static bool IsMaterialTexturePickerOpen ( )
static

◆ IsPickableSceneTexture2D()

static bool IsPickableSceneTexture2D ( FSerializedTexture const &  texture)
static

◆ IsSceneEnvironmentTextureIndex()

static bool IsSceneEnvironmentTextureIndex ( size_t  textureIndex)
static

◆ IsTexturePreviewFormatSupported()

static bool IsTexturePreviewFormatSupported ( RHIResourceFormat  format)
static

◆ LightTypeName()

static const char * LightTypeName ( FLightType  type)
static

◆ MaterialTexturePickerModal()

static MaterialTexturePickerModalState & MaterialTexturePickerModal ( )
static

◆ MaterialTexturePickerTileSelectionOutline()

static void MaterialTexturePickerTileSelectionOutline ( bool  selected)
static

◆ MaterialTexturePickerTileStyleBegin()

static void MaterialTexturePickerTileStyleBegin ( bool  selected)
static

◆ MaterialTexturePickerTileStyleEnd()

static void MaterialTexturePickerTileStyleEnd ( bool  selected)
static

◆ MaterialTexturePropLabel()

static char const * MaterialTexturePropLabel ( char *  buf,
size_t  bufSize,
char const *  name,
FUUID  textureId 
)
static

◆ MemoryTypeFlagsText()

static const char * MemoryTypeFlagsText ( RHIDeviceMemoryTypeStat const &  stat,
char(&)  buffer[128] 
)
static

◆ MoveInstanceToView()

static void MoveInstanceToView ( int  index)
static

◆ MoveLightToView()

static void MoveLightToView ( int  index)
static

◆ NameOr()

static char const * NameOr ( FUUID  nameId,
char const *  fallback 
)
static

◆ OpenMaterialTexturePickerModal()

static void OpenMaterialTexturePickerModal ( const char *  label,
FUUID  materialId,
FUUID FMaterial::*  slot,
ImGui_ImplFoundation_ImageSampler  sampler 
)
static

◆ OpenTexturePreviewModal() [1/3]

static void OpenTexturePreviewModal ( const char *  label,
uint32_t  textureIndex,
ImGui_ImplFoundation_ImageSampler  sampler,
TexturePreviewImage const &  preview 
)
static

◆ OpenTexturePreviewModal() [2/3]

static void OpenTexturePreviewModal ( const char *  title,
GPUScene gpuScene,
uint32_t  textureIndex,
ImGui_ImplFoundation_ImageSampler  sampler,
TexturePreviewImage const &  preview 
)
static

◆ OpenTexturePreviewModal() [3/3]

static void OpenTexturePreviewModal ( const char *  title,
Renderer renderer,
ResourceHandle  viewHandle,
ImGui_ImplFoundation_ImageSampler  sampler,
TexturePreviewImage const &  preview 
)
static

◆ PruneTexturePreviewCache()

static void PruneTexturePreviewCache ( uint64_t  frame)
static

◆ ResetMaterialTexturePickerModal()

static void ResetMaterialTexturePickerModal ( )
static

◆ ResetTexturePreviewModal()

static void ResetTexturePreviewModal ( )
static

◆ ResolveSceneName()

static char const * ResolveSceneName ( FUUID  nameId)
static

◆ ResolveTexturePreviewModalImage()

static TexturePreviewImage ResolveTexturePreviewModalImage ( TexturePreviewModalState const &  state)
static

◆ SceneTextureIndexFromId()

static uint32_t SceneTextureIndexFromId ( FUUID  id)
static

◆ SceneTextureToGpuIndex()

static uint32_t SceneTextureToGpuIndex ( uint32_t  sceneTextureIndex)
static

◆ SelectedInstanceIndex()

static int SelectedInstanceIndex ( )
static

◆ SelectedSceneInstance()

static FInstance & SelectedSceneInstance ( )
static

◆ SelectInstance()

static void SelectInstance ( uint32_t  index,
GSInstance const &  inst 
)
static

◆ SetUUIDTooltip()

static void SetUUIDTooltip ( FUUID  id)
static

◆ TexturePreviewCache()

static Vector< TexturePreviewEntry > & TexturePreviewCache ( )
static

◆ TexturePreviewFrame()

static uint64_t & TexturePreviewFrame ( )
static

◆ TexturePreviewModal()

static TexturePreviewModalState & TexturePreviewModal ( )
static

Variable Documentation

◆ kExternalMatcapLabel

constexpr const char* kExternalMatcapLabel = "<external>"
staticconstexpr

◆ kExternalViewLUTLabel

constexpr const char* kExternalViewLUTLabel = "<external>"
staticconstexpr

◆ kMaterialTexturePickerModalName

constexpr const char* kMaterialTexturePickerModalName = "Select Texture"
staticconstexpr

◆ kTexturePreviewModalName

constexpr const char* kTexturePreviewModalName = "Texture Preview"
staticconstexpr