@@ -131,7 +131,7 @@ void GLTFSample::OnCreate()
131131 ImGUI_Init ((void *)m_windowHwnd);
132132 m_UIState.Initialize ();
133133
134- OnResize ();
134+ OnResize (true );
135135 OnUpdateDisplay ();
136136
137137 // Init Camera, looking at the origin
@@ -196,15 +196,15 @@ bool GLTFSample::OnEvent(MSG msg)
196196// OnResize
197197//
198198// --------------------------------------------------------------------------------------
199- void GLTFSample::OnResize ()
199+ void GLTFSample::OnResize (bool resizeRender )
200200{
201201 // Destroy resources (if we are not minimized)
202- if (m_Width && m_Height && m_pRenderer)
202+ if (resizeRender && m_Width && m_Height && m_pRenderer)
203203 {
204204 m_pRenderer->OnDestroyWindowSizeDependentResources ();
205205 m_pRenderer->OnCreateWindowSizeDependentResources (&m_swapChain, m_Width, m_Height);
206206 }
207-
207+
208208 m_camera.SetFov (AMD_PI_OVER_4, m_Width, m_Height, 0 .1f , 1000 .0f );
209209}
210210
@@ -283,7 +283,7 @@ void GLTFSample::LoadScene(int sceneIndex)
283283
284284 // Allocate shadow information (if any)
285285 m_pRenderer->AllocateShadowMaps (m_pGltfLoader);
286-
286+
287287 // set default camera
288288 json camera = scene[" camera" ];
289289 m_activeCamera = scene.value (" activeCamera" , m_activeCamera);
@@ -322,14 +322,16 @@ void GLTFSample::OnUpdate()
322322 io.MouseDelta .y = 0 ;
323323 io.MouseWheel = 0 ;
324324 }
325-
325+
326326 // Update Camera
327327 UpdateCamera (m_camera, io);
328328 if (m_UIState.bUseTAA )
329329 {
330330 static uint32_t Seed;
331331 m_camera.SetProjectionJitter (m_Width, m_Height, Seed);
332332 }
333+ else
334+ m_camera.SetProjectionJitter (0 .f , 0 .f );
333335
334336 // Keyboard & Mouse
335337 HandleInput (io);
@@ -347,7 +349,7 @@ void GLTFSample::OnUpdate()
347349void GLTFSample::HandleInput (const ImGuiIO& io)
348350{
349351 auto fnIsKeyTriggered = [&io](char key) { return io.KeysDown [key] && io.KeysDownDuration [key] == 0 .0f ; };
350-
352+
351353 // Handle Keyboard/Mouse input here
352354
353355 /* MAGNIFIER CONTROLS */
@@ -375,6 +377,10 @@ void GLTFSample::UpdateCamera(Camera& cam, const ImGuiIO& io)
375377 // Choose camera movement depending on setting
376378 if (m_activeCamera == 0 )
377379 {
380+ // If nothing has changed, don't calculate an update (we are getting micro changes in view causing bugs)
381+ if (!io.MouseWheel && (!io.MouseDown [0 ] || (!io.MouseDelta .x && !io.MouseDelta .y ) ))
382+ return ;
383+
378384 // Orbiting
379385 distance -= (float )io.MouseWheel / 3 .0f ;
380386 distance = std::max<float >(distance, 0 .1f );
@@ -452,7 +458,7 @@ int WINAPI WinMain(HINSTANCE hInstance,
452458 LPSTR lpCmdLine,
453459 int nCmdShow)
454460{
455- LPCSTR Name = " SampleDX12 v1.4" ;
461+ LPCSTR Name = " SampleDX12 v1.4.1 " ;
456462
457463 // create new DX sample
458464 return RunFramework (hInstance, lpCmdLine, nCmdShow, new GLTFSample (Name));
0 commit comments