Skip to content

Commit 8f5cc2f

Browse files
Moved UpdateUI() call to SampleBase::Update()
1 parent 07f21b8 commit 8f5cc2f

File tree

57 files changed

+136
-118
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+136
-118
lines changed

SampleBase/include/SampleBase.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,9 @@ class SampleBase
198198
m_pSwapChain = pNewSwapChain;
199199
}
200200

201+
protected:
202+
virtual void UpdateUI() {}
203+
201204
protected:
202205
// Returns projection matrix adjusted to the current screen orientation
203206
float4x4 GetAdjustedProjectionMatrix(float FOV, float NearPlane, float FarPlane) const;
@@ -234,6 +237,8 @@ inline void SampleBase::Update(double CurrTime, double ElapsedTime)
234237
m_NumFramesRendered = 0;
235238
m_LastFPSTime = CurrTime;
236239
}
240+
241+
UpdateUI();
237242
}
238243

239244
extern SampleBase* CreateSample();

Samples/Atmosphere/src/AtmosphereSample.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2024 Diligent Graphics LLC
2+
* Copyright 2019-2025 Diligent Graphics LLC
33
* Copyright 2015-2019 Egor Yusov
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -830,7 +830,6 @@ void AtmosphereSample::Update(double CurrTime, double ElapsedTime)
830830
}
831831

832832
SampleBase::Update(CurrTime, ElapsedTime);
833-
UpdateUI();
834833

835834
m_fElapsedTime = static_cast<float>(ElapsedTime);
836835

Samples/Atmosphere/src/AtmosphereSample.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2024 Diligent Graphics LLC
2+
* Copyright 2019-2025 Diligent Graphics LLC
33
* Copyright 2015-2019 Egor Yusov
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -52,8 +52,10 @@ class AtmosphereSample final : public SampleBase
5252

5353
virtual const Char* GetSampleName() const override final { return "Atmosphere Sample"; }
5454

55+
protected:
56+
virtual void UpdateUI() override final;
57+
5558
private:
56-
void UpdateUI();
5759
void CreateShadowMap();
5860
void RenderShadowMap(IDeviceContext* pContext,
5961
LightAttribs& LightAttribs,

Samples/GLTFViewer/src/GLTFViewer.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1434,7 +1434,6 @@ void GLTFViewer::Update(double CurrTime, double ElapsedTime)
14341434
}
14351435

14361436
SampleBase::Update(CurrTime, ElapsedTime);
1437-
UpdateUI();
14381437

14391438
m_ElapsedTime = static_cast<float>(ElapsedTime);
14401439

Samples/GLTFViewer/src/GLTFViewer.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2024 Diligent Graphics LLC
2+
* Copyright 2019-2025 Diligent Graphics LLC
33
* Copyright 2015-2019 Egor Yusov
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -65,11 +65,13 @@ class GLTFViewer final : public SampleBase
6565

6666
virtual const Char* GetSampleName() const override final { return "GLTF Viewer"; }
6767

68+
protected:
69+
virtual void UpdateUI() override final;
70+
6871
private:
6972
void LoadModel(const char* Path);
7073
void LoadEnvironmentMap(const char* Path);
7174
void UpdateScene();
72-
void UpdateUI();
7375
void CreateGLTFResourceCache();
7476
void UpdateModelsList(const std::string& Dir);
7577
bool SetEnvironmentMap(ITextureView* pEnvMap);

Samples/ImguiDemo/src/ImguiDemo.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2023 Diligent Graphics LLC
2+
* Copyright 2019-2025 Diligent Graphics LLC
33
* Copyright 2015-2019 Egor Yusov
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -106,8 +106,6 @@ void ImguiDemo::Render()
106106
void ImguiDemo::Update(double CurrTime, double ElapsedTime)
107107
{
108108
SampleBase::Update(CurrTime, ElapsedTime);
109-
110-
UpdateUI();
111109
}
112110

113111
void ImguiDemo::WindowResize(Uint32 Width, Uint32 Height)

Samples/ImguiDemo/src/ImguiDemo.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2022 Diligent Graphics LLC
2+
* Copyright 2019-2025 Diligent Graphics LLC
33
* Copyright 2015-2019 Egor Yusov
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -48,9 +48,10 @@ class ImguiDemo final : public SampleBase
4848

4949
virtual void WindowResize(Uint32 Width, Uint32 Height) override final;
5050

51-
private:
52-
void UpdateUI();
51+
protected:
52+
virtual void UpdateUI() override final;
5353

54+
private:
5455
bool m_ShowDemoWindow = true;
5556
bool m_ShowAnotherWindow = false;
5657
float4 m_ClearColor = {0.45f, 0.55f, 0.60f, 1.00f};

Samples/NuklearDemo/src/NuklearDemo.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2022 Diligent Graphics LLC
2+
* Copyright 2019-2025 Diligent Graphics LLC
33
* Copyright 2015-2019 Egor Yusov
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -98,8 +98,6 @@ void NuklearDemo::Render()
9898
void NuklearDemo::Update(double CurrTime, double ElapsedTime)
9999
{
100100
SampleBase::Update(CurrTime, ElapsedTime);
101-
102-
UpdateUI();
103101
}
104102

105103
void NuklearDemo::WindowResize(Uint32 Width, Uint32 Height)

Samples/NuklearDemo/src/NuklearDemo.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2022 Diligent Graphics LLC
2+
* Copyright 2019-2025 Diligent Graphics LLC
33
* Copyright 2015-2019 Egor Yusov
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -53,9 +53,10 @@ class NuklearDemo final : public SampleBase
5353
virtual bool HandleNativeMessage(const void* pNativeMsgData) override final;
5454
#endif
5555

56-
private:
57-
void UpdateUI();
56+
protected:
57+
virtual void UpdateUI() override final;
5858

59+
private:
5960
nk_diligent_context* m_pNkDlgCtx = nullptr;
6061
nk_context* m_pNkCtx = nullptr;
6162
};

Samples/Shadows/src/ShadowsSample.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2024 Diligent Graphics LLC
2+
* Copyright 2019-2025 Diligent Graphics LLC
33
* Copyright 2015-2019 Egor Yusov
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -646,7 +646,6 @@ void ShadowsSample::DrawMesh(IDeviceContext* pCtx, bool bIsShadowPass, const Vie
646646
void ShadowsSample::Update(double CurrTime, double ElapsedTime)
647647
{
648648
SampleBase::Update(CurrTime, ElapsedTime);
649-
UpdateUI();
650649

651650
m_Camera.Update(m_InputController, static_cast<float>(ElapsedTime));
652651
{

0 commit comments

Comments
 (0)