Skip to content

Commit 64e7b26

Browse files
author
devsh
committed
remake example 61, not thoroughly tested, some TODOs remain for @AnastaZIuk
1 parent 7ec6846 commit 64e7b26

File tree

3 files changed

+721
-662
lines changed

3 files changed

+721
-662
lines changed

09_GeometryCreator/main.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,6 @@ class GeometryCreatorApp final : public MonoWindowApplication, public BuiltinRes
1616
: IApplicationFramework(_localInputCWD, _localOutputCWD, _sharedInputCWD, _sharedOutputCWD),
1717
device_base_t({1280,720}, EF_D16_UNORM, _localInputCWD, _localOutputCWD, _sharedInputCWD, _sharedOutputCWD) {}
1818

19-
SPhysicalDeviceFeatures getRequiredDeviceFeatures() const override
20-
{
21-
auto retval = device_base_t::getRequiredDeviceFeatures();
22-
retval.geometryShader = true;
23-
return retval;
24-
}
25-
2619
inline bool onAppInitialized(smart_refctd_ptr<ISystem>&& system) override
2720
{
2821
if (!asset_base_t::onAppInitialized(smart_refctd_ptr(system)))
@@ -100,7 +93,6 @@ class GeometryCreatorApp final : public MonoWindowApplication, public BuiltinRes
10093
camera.endInputProcessing(nextPresentationTimestamp);
10194
}
10295

103-
auto* queue = getGraphicsQueue();
10496

10597
asset::SViewport viewport;
10698
{
@@ -155,6 +147,7 @@ class GeometryCreatorApp final : public MonoWindowApplication, public BuiltinRes
155147
m_renderer->render(cb,viewParams);
156148

157149
cb->endRenderPass();
150+
cb->endDebugMarker();
158151
cb->end();
159152

160153
IQueue::SSubmitInfo::SSemaphoreInfo retval =
@@ -183,7 +176,7 @@ class GeometryCreatorApp final : public MonoWindowApplication, public BuiltinRes
183176
}
184177
};
185178

186-
if (queue->submit(infos) != IQueue::RESULT::SUCCESS)
179+
if (getGraphicsQueue()->submit(infos) != IQueue::RESULT::SUCCESS)
187180
{
188181
retval.semaphore = nullptr; // so that we don't wait on semaphore that will never signal
189182
m_realFrameIx--;

61_UI/include/transform.hpp

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
1-
#ifndef __NBL_THIS_EXAMPLE_TRANSFORM_H_INCLUDED__
2-
#define __NBL_THIS_EXAMPLE_TRANSFORM_H_INCLUDED__
1+
#ifndef _NBL_THIS_EXAMPLE_TRANSFORM_H_INCLUDED_
2+
#define _NBL_THIS_EXAMPLE_TRANSFORM_H_INCLUDED_
3+
34

45
#include "nbl/ui/ICursorControl.h"
6+
57
#include "nbl/ext/ImGui/ImGui.h"
8+
69
#include "imgui/imgui_internal.h"
710
#include "imguizmo/ImGuizmo.h"
811

9-
static constexpr inline auto OfflineSceneTextureIx = 1u;
1012

1113
struct TransformRequestParams
1214
{
13-
bool useWindow = true, editTransformDecomposition = false, enableViewManipulate = false;
1415
float camDistance = 8.f;
16+
uint8_t sceneTexDescIx = ~0;
17+
bool useWindow = true, editTransformDecomposition = false, enableViewManipulate = false;
1518
};
1619

17-
void EditTransform(float* cameraView, const float* cameraProjection, float* matrix, const TransformRequestParams& params)
20+
nbl::hlsl::uint16_t2 EditTransform(float* cameraView, const float* cameraProjection, float* matrix, const TransformRequestParams& params)
1821
{
1922
static ImGuizmo::OPERATION mCurrentGizmoOperation(ImGuizmo::TRANSLATE);
2023
static ImGuizmo::MODE mCurrentGizmoMode(ImGuizmo::LOCAL);
@@ -99,11 +102,12 @@ void EditTransform(float* cameraView, const float* cameraProjection, float* matr
99102
rendered is aligned to our texture scene using
100103
imgui "cursor" screen positions
101104
*/
102-
105+
// TODO: this shouldn't be handled here I think
103106
SImResourceInfo info;
104-
info.textureID = OfflineSceneTextureIx;
107+
info.textureID = params.sceneTexDescIx;
105108
info.samplerIx = (uint16_t)nbl::ext::imgui::UI::DefaultSamplerIx::USER;
106109

110+
nbl::hlsl::uint16_t2 retval;
107111
if (params.useWindow)
108112
{
109113
ImGui::SetNextWindowSize(ImVec2(800, 400), ImGuiCond_Appearing);
@@ -118,6 +122,7 @@ void EditTransform(float* cameraView, const float* cameraProjection, float* matr
118122

119123
ImGui::Image(info, contentRegionSize);
120124
ImGuizmo::SetRect(cursorPos.x, cursorPos.y, contentRegionSize.x, contentRegionSize.y);
125+
retval = {contentRegionSize.x,contentRegionSize.y};
121126

122127
viewManipulateRight = cursorPos.x + contentRegionSize.x;
123128
viewManipulateTop = cursorPos.y;
@@ -137,6 +142,7 @@ void EditTransform(float* cameraView, const float* cameraProjection, float* matr
137142

138143
ImGui::Image(info, contentRegionSize);
139144
ImGuizmo::SetRect(cursorPos.x, cursorPos.y, contentRegionSize.x, contentRegionSize.y);
145+
retval = {contentRegionSize.x,contentRegionSize.y};
140146

141147
viewManipulateRight = cursorPos.x + contentRegionSize.x;
142148
viewManipulateTop = cursorPos.y;
@@ -149,6 +155,8 @@ void EditTransform(float* cameraView, const float* cameraProjection, float* matr
149155

150156
ImGui::End();
151157
ImGui::PopStyleColor();
158+
159+
return retval;
152160
}
153161

154162
#endif // __NBL_THIS_EXAMPLE_TRANSFORM_H_INCLUDED__

0 commit comments

Comments
 (0)