Skip to content

Commit cfec7c0

Browse files
committed
glTFSample v1.4.1
1 parent 929c172 commit cfec7c0

File tree

13 files changed

+41
-54
lines changed

13 files changed

+41
-54
lines changed

.gitlab-ci.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
variables:
22
SampleName: GLTFSample
33
CMakeConfig: -G "Visual Studio 16 2019" -A x64
4-
CaudronMediaUrl: http://isvgit.amd.com/raguaviv/cauldron-media/-/archive/master/cauldron-media-master.zip
54
GIT_SUBMODULE_STRATEGY: normal
65

76
stages:
@@ -42,7 +41,6 @@ package_sample:
4241
- build_vk
4342
script:
4443
- copy %VULKAN_SDK%\Bin\glslc.exe bin
45-
- move NOTICES.txt %SampleName%
4644
- echo cd .\bin\ > %SampleName%_VK.bat
4745
- echo start %SampleName%_VK.exe >> %SampleName%_VK.bat
4846
- echo cd .\bin\ > %SampleName%_DX12.bat
@@ -51,7 +49,7 @@ package_sample:
5149
name: "%SampleName%-%CI_COMMIT_TAG%-%CI_COMMIT_REF_NAME%-%CI_COMMIT_SHORT_SHA%"
5250
paths:
5351
- "bin/"
54-
- "NOTICES.txt"
52+
- "license.txt"
5553
- "media/cauldron-media/"
5654
- "%SampleName%_VK.bat"
5755
- "%SampleName%_DX12.bat"

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
url = ../Cauldron.git
44
[submodule "media/Cauldron-Media"]
55
path = media/Cauldron-Media
6-
url = ../../GPUOpen-LibrariesAndSDKs/Cauldron-Media
6+
url = ../Cauldron-Media.git

NOTICES.txt

Lines changed: 0 additions & 24 deletions
This file was deleted.

libs/cauldron

Submodule cauldron updated 58 files

license.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2019 Advanced Micro Devices, Inc. All rights reserved.
1+
Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved.
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

src/DX12/GLTFSample.cpp

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -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()
347349
void 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));

src/DX12/GLTFSample.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class GLTFSample : public FrameworkWindows
3434
void OnDestroy() override;
3535
void OnRender() override;
3636
bool OnEvent(MSG msg) override;
37-
void OnResize() override;
37+
void OnResize(bool resizeRender) override;
3838
void OnUpdateDisplay() override;
3939

4040
void BuildUI();

src/DX12/Renderer.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ void Renderer::OnRender(const UIState* pState, const Camera& Cam, SwapChain* pSw
443443
pPerFrame->wireframeOptions.setY(pState->WireframeColor[1]);
444444
pPerFrame->wireframeOptions.setZ(pState->WireframeColor[2]);
445445
pPerFrame->wireframeOptions.setW(pState->WireframeMode == UIState::WireframeMode::WIREFRAME_MODE_SOLID_COLOR ? 1.0f : 0.0f);
446-
446+
pPerFrame->lodBias = 0.0f;
447447
m_pGLTFTexturesAndBuffers->SetPerFrameConstants();
448448
m_pGLTFTexturesAndBuffers->SetSkinningMatricesForSkeletons();
449449
}
@@ -475,8 +475,9 @@ void Renderer::OnRender(const UIState* pState, const Camera& Cam, SwapChain* pSw
475475
SetViewportAndScissor(pCmdLst1, 0, 0, ShadowMap->ShadowResolution, ShadowMap->ShadowResolution);
476476
pCmdLst1->OMSetRenderTargets(0, NULL, false, &m_ShadowMapPoolDSV.GetCPU(ShadowMap->ShadowIndex));
477477

478-
GltfDepthPass::per_frame* cbDepthPerFrame = m_GLTFDepth->SetPerFrameConstants();
479-
cbDepthPerFrame->mViewProj = pPerFrame->lights[ShadowMap->LightIndex].mLightViewProj;
478+
per_frame* cbDepthPerFrame = m_GLTFDepth->SetPerFrameConstants();
479+
cbDepthPerFrame->mCameraCurrViewProj = pPerFrame->lights[ShadowMap->LightIndex].mLightViewProj;
480+
cbDepthPerFrame->lodBias = 0.0f;
480481

481482
m_GLTFDepth->Draw(pCmdLst1);
482483

src/DX12/UI.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,15 +234,15 @@ void GLTFSample::BuildUI()
234234
{
235235
if (m_fullscreenMode != PRESENTATIONMODE_WINDOWED)
236236
{
237-
UpdateDisplay(m_displayModesAvailable[m_currentDisplayModeNamesIndex], m_disableLocalDimming);
237+
UpdateDisplay(m_disableLocalDimming);
238238
m_previousDisplayModeNamesIndex = m_currentDisplayModeNamesIndex;
239239
}
240240
else if (CheckIfWindowModeHdrOn() &&
241241
(m_displayModesAvailable[m_currentDisplayModeNamesIndex] == DISPLAYMODE_SDR ||
242242
m_displayModesAvailable[m_currentDisplayModeNamesIndex] == DISPLAYMODE_HDR10_2084 ||
243243
m_displayModesAvailable[m_currentDisplayModeNamesIndex] == DISPLAYMODE_HDR10_SCRGB))
244244
{
245-
UpdateDisplay(m_displayModesAvailable[m_currentDisplayModeNamesIndex], m_disableLocalDimming);
245+
UpdateDisplay(m_disableLocalDimming);
246246
m_previousDisplayModeNamesIndex = m_currentDisplayModeNamesIndex;
247247
}
248248
else
@@ -266,7 +266,7 @@ void GLTFSample::BuildUI()
266266
{
267267
static bool selectedDisableLocaldimmingSetting = false;
268268
if (ImGui::Checkbox("Disable Local Dimming", &selectedDisableLocaldimmingSetting))
269-
UpdateDisplay(m_displayModesAvailable[m_currentDisplayModeNamesIndex], selectedDisableLocaldimmingSetting);
269+
UpdateDisplay(selectedDisableLocaldimmingSetting);
270270
}
271271
}
272272

src/VK/GLTFSample.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ void GLTFSample::OnCreate()
125125
ImGUI_Init((void *)m_windowHwnd);
126126
m_UIState.Initialize();
127127

128-
OnResize();
128+
OnResize(true);
129129
OnUpdateDisplay();
130130

131131
// Init Camera, looking at the origin
@@ -190,10 +190,10 @@ bool GLTFSample::OnEvent(MSG msg)
190190
// OnResize
191191
//
192192
//--------------------------------------------------------------------------------------
193-
void GLTFSample::OnResize()
193+
void GLTFSample::OnResize(bool resizeRender)
194194
{
195195
// destroy resources (if we are not minimized)
196-
if (m_Width && m_Height && m_pRenderer)
196+
if (resizeRender && m_Width && m_Height && m_pRenderer)
197197
{
198198
m_pRenderer->OnDestroyWindowSizeDependentResources();
199199
m_pRenderer->OnCreateWindowSizeDependentResources(&m_swapChain, m_Width, m_Height);
@@ -326,6 +326,8 @@ void GLTFSample::OnUpdate()
326326
static uint32_t Seed;
327327
m_camera.SetProjectionJitter(m_Width, m_Height, Seed);
328328
}
329+
else
330+
m_camera.SetProjectionJitter(0.f, 0.f);
329331

330332
// Keyboard & Mouse
331333
HandleInput(io);
@@ -381,6 +383,10 @@ void GLTFSample::UpdateCamera(Camera& cam, const ImGuiIO& io)
381383
// Choose camera movement depending on setting
382384
if (m_activeCamera == 0)
383385
{
386+
// If nothing has changed, don't calculate an update (we are getting micro changes in view causing bugs)
387+
if (!io.MouseWheel && (!io.MouseDown[0] || (!io.MouseDelta.x && !io.MouseDelta.y)))
388+
return;
389+
384390
// Orbiting
385391
distance -= (float)io.MouseWheel / 3.0f;
386392
distance = std::max<float>(distance, 0.1f);
@@ -459,8 +465,8 @@ int WINAPI WinMain(HINSTANCE hInstance,
459465
LPSTR lpCmdLine,
460466
int nCmdShow)
461467
{
462-
LPCSTR Name = "SampleVK v1.4";
468+
LPCSTR Name = "SampleVK v1.4.1";
463469

464470
// create new Vulkan sample
465471
return RunFramework(hInstance, lpCmdLine, nCmdShow, new GLTFSample(Name));
466-
}
472+
}

0 commit comments

Comments
 (0)