Nebula
Loading...
Searching...
No Matches
assetpreview.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
27//------------------------------------------------------------------------------
28#if WITH_NEBULA_EDITOR
29#include "core/refcounted.h"
30#include "coregraphics/mesh.h"
33#include "graphics/view.h"
34#include "math/bbox.h"
35#include "neweditor/viewtools/editorcamera.h"
37#include "imgui.h"
38#include <functional>
39
40namespace GraphicsFeature
41{
42
43class AssetPreview : public Core::RefCounted
44{
46public:
48 static const Graphics::StageMask Stage = 1 << 3;
49
51 virtual ~AssetPreview();
52
54 static AssetPreview* Get();
56 static AssetPreview* Peek();
58 static void Destroy();
59
62 using Overlay = std::function<void(ImDrawList* drawList, const Math::mat4& viewProjection, const ImVec2& min, const ImVec2& max)>;
63
65 void Draw(const ImVec2& size, const Overlay& overlay = nullptr);
67 void Hide();
69 void Frame(const Math::bbox& box);
71 CoreGraphics::MeshId GetMaterialKnob();
73 Graphics::ViewId GetView() const;
75 int GetShading() const;
76
77private:
79 bool Setup();
81 void Discard();
84 void DrawViewMenu(const ImVec2& min);
85
86 static Ptr<AssetPreview> instance;
87
92 Ids::Id32 textureId;
93 bool hasTextureId;
94 Resources::ResourceId knob;
95 Editor::EditorCamera orbit;
96 bool enabled;
97 float fieldOfView;
98 bool orthographic;
99 int shading;
100};
101
102} // namespace GraphicsFeature
103#endif // WITH_NEBULA_EDITOR
104//------------------------------------------------------------------------------
The common base class of Nebula.
Definition refcounted.h:45
The 3D preview the asset documents draw what they edit in: a material on a knob, a model,...
Nebula's bounding box class.
Definition bbox.h:24
Nebula's smart pointer class which manages the life time of RefCounted objects.
Definition ptr.h:38
ImGUI debug interface for inspecting frame scripts.
Definition shaderserverbase.h:53
Definition graphicsfeatureunit.cc:66
uint16_t StageMask
Definition view.h:23
uint32_t Id32
Definition id.h:138
#define __DeclareClass(type)
Definition mesh.h:29
texture type
Definition texture.h:25
The graphics entity is only an Id, to which we can attach GraphicsContexts.
Definition graphicsentity.h:16
Definition view.h:34
A 4x4 single point precision float matrix.
Definition mat4.h:55