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
1113struct 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