Skip to content

Commit e6842c9

Browse files
committed
GITechDemo:
* added controls to HUD when app starts * cosmetic modifications to code
1 parent 8a975d7 commit e6842c9

20 files changed

+63
-45
lines changed

GITechDemo/Code/AppMain/GITechDemo/GITechDemo.cpp

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -324,9 +324,7 @@ void GITechDemo::Update(const float fDeltaTime)
324324
Vec3f(m_tCamera.mRot[0][0] * m_tCamera.vMoveVec[0], m_tCamera.mRot[0][1] * m_tCamera.vMoveVec[0], m_tCamera.mRot[0][2] * m_tCamera.vMoveVec[0]);
325325

326326
// Update mouse cursor
327-
if (cmd & APP_CMD_CTRL_PITCH ||
328-
cmd & APP_CMD_CTRL_YAW ||
329-
cmd & APP_CMD_CTRL_ROLL)
327+
if (cmd & (APP_CMD_CTRL_PITCH | APP_CMD_CTRL_YAW | APP_CMD_CTRL_ROLL))
330328
{
331329
int wLeft, wTop, wRight, wBottom;
332330
pFW->GetWindowArea(wLeft, wTop, wRight, wBottom);
@@ -434,6 +432,26 @@ void GITechDemo::Update(const float fDeltaTime)
434432
if (pAPM)
435433
pAPM->Update();
436434

435+
// Draw controls on HUD
436+
static bool bDrawControls = true;
437+
if(!pAPM->IsDrawingOnHUD() && bDrawControls)
438+
{
439+
HUD_PASS.PrintLn("Left mouse button (hold) + mouse move: control camera pitch/yaw");
440+
HUD_PASS.PrintLn("Right mouse button (hold) + mouse move: control camera roll");
441+
HUD_PASS.PrintLn("W/A/S/D: move camera forward/backward/left/right");
442+
HUD_PASS.PrintLn("LShift (hold): faster camera movement");
443+
HUD_PASS.PrintLn("LCtrl (hold): slower camera movement");
444+
445+
if (pAPM->GetParameterCount() > 0)
446+
{
447+
HUD_PASS.PrintLn("");
448+
HUD_PASS.PrintLn("Directional arrows up/down: cycle configurable parameters");
449+
HUD_PASS.PrintLn("Directional arrows left/right: modify currently selected parameter");
450+
}
451+
}
452+
if (cmd & (APP_CMD_FORWARD | APP_CMD_BACKWARD | APP_CMD_LEFT | APP_CMD_RIGHT))
453+
bDrawControls = false;
454+
437455
POP_PROFILE_MARKER();
438456
}
439457

GITechDemo/Code/AppMain/GITechDemo/RenderScheme/AmbientOcclusionPass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ AmbientOcclusionPass::AmbientOcclusionPass(const char* const passName, RenderPas
3030
AmbientOcclusionPass::~AmbientOcclusionPass()
3131
{}
3232

33-
void AmbientOcclusionPass::OnUpdate(const float fDeltaTime)
33+
void AmbientOcclusionPass::Update(const float fDeltaTime)
3434
{
3535
Renderer* RenderContext = Renderer::GetInstance();
3636
if (!RenderContext)
@@ -182,7 +182,7 @@ void AmbientOcclusionPass::ApplyAmbientOcclusion()
182182
POP_PROFILE_MARKER();
183183
}
184184

185-
void AmbientOcclusionPass::OnDraw()
185+
void AmbientOcclusionPass::Draw()
186186
{
187187
if (!AMBIENT_OCCLUSION_ENABLED)
188188
return;

GITechDemo/Code/AppMain/GITechDemo/RenderScheme/BloomPass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ BloomPass::BloomPass(const char* const passName, RenderPass* const parentPass)
2626
BloomPass::~BloomPass()
2727
{}
2828

29-
void BloomPass::OnUpdate(const float fDeltaTime)
29+
void BloomPass::Update(const float fDeltaTime)
3030
{
3131
Renderer* RenderContext = Renderer::GetInstance();
3232
if (!RenderContext)
@@ -189,7 +189,7 @@ void BloomPass::BloomApply()
189189
POP_PROFILE_MARKER();
190190
}
191191

192-
void BloomPass::OnDraw()
192+
void BloomPass::Draw()
193193
{
194194
if (!BLOOM_ENABLED)
195195
return;

GITechDemo/Code/AppMain/GITechDemo/RenderScheme/DepthOfFieldPass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ DepthOfFieldPass::DepthOfFieldPass(const char* const passName, RenderPass* const
2828
DepthOfFieldPass::~DepthOfFieldPass()
2929
{}
3030

31-
void DepthOfFieldPass::OnUpdate(const float fDeltaTime)
31+
void DepthOfFieldPass::Update(const float fDeltaTime)
3232
{
3333
Renderer* RenderContext = Renderer::GetInstance();
3434
if (!RenderContext)
@@ -200,7 +200,7 @@ void DepthOfFieldPass::ApplyDoF()
200200
POP_PROFILE_MARKER();
201201
}
202202

203-
void DepthOfFieldPass::OnDraw()
203+
void DepthOfFieldPass::Draw()
204204
{
205205
if (!DOF_ENABLED)
206206
return;

GITechDemo/Code/AppMain/GITechDemo/RenderScheme/DirectionalIndirectLightPass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ DirectionalIndirectLightPass::~DirectionalIndirectLightPass()
6262
delete[] f3RSMKernel;
6363
}
6464

65-
void DirectionalIndirectLightPass::OnUpdate(const float fDeltaTime)
65+
void DirectionalIndirectLightPass::Update(const float fDeltaTime)
6666
{
6767
Renderer* RenderContext = Renderer::GetInstance();
6868
if (!RenderContext)
@@ -84,7 +84,7 @@ void DirectionalIndirectLightPass::OnUpdate(const float fDeltaTime)
8484
texSource = IndirectLightAccumulationBuffer.GetRenderTarget()->GetColorBuffer(0);
8585
}
8686

87-
void DirectionalIndirectLightPass::OnDraw()
87+
void DirectionalIndirectLightPass::Draw()
8888
{
8989
if (!INDIRECT_LIGHT_ENABLED)
9090
return;

GITechDemo/Code/AppMain/GITechDemo/RenderScheme/DirectionalLightPass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ DirectionalLightPass::~DirectionalLightPass()
5555
delete[] f2PoissonDisk;
5656
}
5757

58-
void DirectionalLightPass::OnUpdate(const float fDeltaTime)
58+
void DirectionalLightPass::Update(const float fDeltaTime)
5959
{
6060
f2HalfTexelOffset = Vec2f(0.5f / GBuffer.GetRenderTarget()->GetWidth(), 0.5f / GBuffer.GetRenderTarget()->GetHeight());
6161
texDiffuseBuffer = GBuffer.GetRenderTarget()->GetColorBuffer(0);
@@ -74,7 +74,7 @@ void DirectionalLightPass::OnUpdate(const float fDeltaTime)
7474
texEnvMap = EnvironmentTexture.GetTextureIndex();
7575
}
7676

77-
void DirectionalLightPass::OnDraw()
77+
void DirectionalLightPass::Draw()
7878
{
7979
if (!DIRECTIONAL_LIGHT_ENABLED)
8080
return;

GITechDemo/Code/AppMain/GITechDemo/RenderScheme/FXAAPass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ FXAAPass::FXAAPass(const char* const passName, RenderPass* const parentPass)
2525
FXAAPass::~FXAAPass()
2626
{}
2727

28-
void FXAAPass::OnUpdate(const float fDeltaTime)
28+
void FXAAPass::Update(const float fDeltaTime)
2929
{
3030
Renderer* RenderContext = Renderer::GetInstance();
3131
if (!RenderContext)
@@ -46,7 +46,7 @@ void FXAAPass::OnUpdate(const float fDeltaTime)
4646

4747
}
4848

49-
void FXAAPass::OnDraw()
49+
void FXAAPass::Draw()
5050
{
5151
if (!FXAA_ENABLED)
5252
return;

GITechDemo/Code/AppMain/GITechDemo/RenderScheme/GBufferPass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ GBufferPass::GBufferPass(const char* const passName, RenderPass* const parentPas
2727
GBufferPass::~GBufferPass()
2828
{}
2929

30-
void GBufferPass::OnUpdate(const float fDeltaTime)
30+
void GBufferPass::Update(const float fDeltaTime)
3131
{
3232
Renderer* RenderContext = Renderer::GetInstance();
3333
if (!RenderContext)
@@ -45,7 +45,7 @@ void GBufferPass::OnUpdate(const float fDeltaTime)
4545
f44WorldViewProjMat = f44ProjMat * f44WorldViewMat;
4646
}
4747

48-
void GBufferPass::OnDraw()
48+
void GBufferPass::Draw()
4949
{
5050
Renderer* RenderContext = Renderer::GetInstance();
5151
if (!RenderContext)

GITechDemo/Code/AppMain/GITechDemo/RenderScheme/HDRDownsamplePass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ HDRDownsamplePass::HDRDownsamplePass(const char* const passName, RenderPass* con
1919
HDRDownsamplePass::~HDRDownsamplePass()
2020
{}
2121

22-
void HDRDownsamplePass::OnUpdate(const float fDeltaTime)
22+
void HDRDownsamplePass::Update(const float fDeltaTime)
2323
{
2424
Renderer* RenderContext = Renderer::GetInstance();
2525
if (!RenderContext)
@@ -65,7 +65,7 @@ void HDRDownsamplePass::DownsamplePass(GITechDemoApp::RenderTarget* const pSourc
6565
pDest->Disable();
6666
}
6767

68-
void HDRDownsamplePass::OnDraw()
68+
void HDRDownsamplePass::Draw()
6969
{
7070
Renderer* RenderContext = Renderer::GetInstance();
7171
if (!RenderContext)

GITechDemo/Code/AppMain/GITechDemo/RenderScheme/HDRToneMappingPass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ HDRToneMappingPass::HDRToneMappingPass(const char* const passName, RenderPass* c
2424
HDRToneMappingPass::~HDRToneMappingPass()
2525
{}
2626

27-
void HDRToneMappingPass::OnUpdate(const float fDeltaTime)
27+
void HDRToneMappingPass::Update(const float fDeltaTime)
2828
{
2929
Renderer* RenderContext = Renderer::GetInstance();
3030
if (!RenderContext)
@@ -182,7 +182,7 @@ void HDRToneMappingPass::ToneMappingPass()
182182
POP_PROFILE_MARKER();
183183
}
184184

185-
void HDRToneMappingPass::OnDraw()
185+
void HDRToneMappingPass::Draw()
186186
{
187187
LuminanceMeasurementPass();
188188
LuminanceAdaptationPass();

GITechDemo/Code/AppMain/GITechDemo/RenderScheme/HUDPass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ HUDPass::HUDPass(const char* const passName, RenderPass* const parentPass)
8484
HUDPass::~HUDPass()
8585
{}
8686

87-
void HUDPass::OnUpdate(const float fDeltaTime)
87+
void HUDPass::Update(const float fDeltaTime)
8888
{
8989
Renderer* RenderContext = Renderer::GetInstance();
9090
if (!RenderContext)
@@ -115,7 +115,7 @@ void HUDPass::OnUpdate(const float fDeltaTime)
115115
texSource = m_nHUDTextureIdx;
116116
}
117117

118-
void HUDPass::OnDraw()
118+
void HUDPass::Draw()
119119
{
120120
Renderer* RenderContext = Renderer::GetInstance();
121121
if (!RenderContext)

GITechDemo/Code/AppMain/GITechDemo/RenderScheme/LightingPass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ LightingPass::LightingPass(const char* const passName, RenderPass* const parentP
1919
LightingPass::~LightingPass()
2020
{}
2121

22-
void LightingPass::OnUpdate(const float fDeltaTime)
22+
void LightingPass::Update(const float fDeltaTime)
2323
{
2424
Renderer* RenderContext = Renderer::GetInstance();
2525
if (!RenderContext)
@@ -79,7 +79,7 @@ void LightingPass::CopyDepthBuffer()
7979
POP_PROFILE_MARKER();
8080
}
8181

82-
void LightingPass::OnDraw()
82+
void LightingPass::Draw()
8383
{
8484
Renderer* RenderContext = Renderer::GetInstance();
8585
if (!RenderContext)

GITechDemo/Code/AppMain/GITechDemo/RenderScheme/PostProcessingPass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ PostProcessingPass::PostProcessingPass(const char* const passName, RenderPass* c
3232
PostProcessingPass::~PostProcessingPass()
3333
{}
3434

35-
void PostProcessingPass::OnUpdate(const float fDeltaTime)
35+
void PostProcessingPass::Update(const float fDeltaTime)
3636
{
3737
if (POST_PROCESSING_ENABLED)
3838
{
@@ -88,7 +88,7 @@ void PostProcessingPass::CopyResultToBackBuffer(LibRendererDll::RenderTarget* co
8888
POP_PROFILE_MARKER();
8989
}
9090

91-
void PostProcessingPass::OnDraw()
91+
void PostProcessingPass::Draw()
9292
{
9393
Renderer* RenderContext = Renderer::GetInstance();
9494
if (!RenderContext)

GITechDemo/Code/AppMain/GITechDemo/RenderScheme/RSMDirectionalLightPass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ RSMDirectionalLightPass::RSMDirectionalLightPass(const char* const passName, Ren
2626
RSMDirectionalLightPass::~RSMDirectionalLightPass()
2727
{}
2828

29-
void RSMDirectionalLightPass::OnUpdate(const float fDeltaTime)
29+
void RSMDirectionalLightPass::Update(const float fDeltaTime)
3030
{
3131
Renderer* RenderContext = Renderer::GetInstance();
3232
if (!RenderContext)
@@ -69,7 +69,7 @@ void RSMDirectionalLightPass::OnUpdate(const float fDeltaTime)
6969
}
7070
}
7171

72-
void RSMDirectionalLightPass::OnDraw()
72+
void RSMDirectionalLightPass::Draw()
7373
{
7474
if (!INDIRECT_LIGHT_ENABLED)
7575
return;

GITechDemo/Code/AppMain/GITechDemo/RenderScheme/RenderPass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ void RenderPass::DrawChildren()
3535
if (m_arrChildList[child] != nullptr)
3636
{
3737
PUSH_PROFILE_MARKER(m_arrChildList[child]->GetPassName());
38-
m_arrChildList[child]->OnUpdate(((GITechDemo*)AppMain)->GetDeltaTime());
39-
m_arrChildList[child]->OnDraw();
38+
m_arrChildList[child]->Update(((GITechDemo*)AppMain)->GetDeltaTime());
39+
m_arrChildList[child]->Draw();
4040
POP_PROFILE_MARKER();
4141
}
4242
}

GITechDemo/Code/AppMain/GITechDemo/RenderScheme/RenderPass.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
Class (const char* const passName, RenderPass* const parentPass); \
99
~ Class (); \
1010
protected: \
11-
void OnUpdate(const float fDeltaTime); \
12-
void OnDraw();
11+
void Update(const float fDeltaTime); \
12+
void Draw();
1313

1414
namespace GITechDemoApp
1515
{
@@ -23,8 +23,8 @@ namespace GITechDemoApp
2323
const char* GetPassName() { return m_szPassName.c_str(); }
2424

2525
protected:
26-
virtual void OnUpdate(const float fDeltaTime) {}
27-
virtual void OnDraw() {}
26+
virtual void Update(const float fDeltaTime) {}
27+
virtual void Draw();
2828

2929
void DrawChildren();
3030

@@ -34,8 +34,6 @@ namespace GITechDemoApp
3434
RenderPass(const RenderPass&);
3535
void operator=(const RenderPass&) {}
3636

37-
void Draw();
38-
3937
std::string m_szPassName;
4038
std::vector<RenderPass*> m_arrChildList;
4139

GITechDemo/Code/AppMain/GITechDemo/RenderScheme/ShadowMapDirectionalLightPass.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ namespace GITechDemoApp
2424

2525
// Cascaded Shadow Maps (CSM) and directional light related variables
2626
float CASCADE_SPLIT_FACTOR = 0.7f;
27-
float CASCADE_MAX_VIEW_DEPTH = 2500.f;
27+
float CASCADE_MAX_VIEW_DEPTH = 3000.f;
2828

2929
extern const unsigned int PCF_MAX_SAMPLE_COUNT = 16;
3030
const unsigned int NUM_CASCADES = 4;
@@ -118,7 +118,7 @@ void ShadowMapDirectionalLightPass::UpdateSceneAABB()
118118
SceneAABB.setInitialized();
119119
}
120120

121-
void ShadowMapDirectionalLightPass::OnUpdate(const float fDeltaTime)
121+
void ShadowMapDirectionalLightPass::Update(const float fDeltaTime)
122122
{
123123
Renderer* RenderContext = Renderer::GetInstance();
124124
if (!RenderContext)
@@ -307,7 +307,7 @@ void ShadowMapDirectionalLightPass::OnUpdate(const float fDeltaTime)
307307
}
308308
}
309309

310-
void ShadowMapDirectionalLightPass::OnDraw()
310+
void ShadowMapDirectionalLightPass::Draw()
311311
{
312312
if (!DIRECTIONAL_LIGHT_ENABLED)
313313
return;

GITechDemo/Code/AppMain/GITechDemo/RenderScheme/SkyPass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ void SkyPass::ReleaseSkyBoxVB()
9191
m_pSkyBoxCube = nullptr;
9292
}
9393

94-
void SkyPass::OnUpdate(const float fDeltaTime)
94+
void SkyPass::Update(const float fDeltaTime)
9595
{
9696
if (!AppMain)
9797
return;
@@ -107,7 +107,7 @@ void SkyPass::OnUpdate(const float fDeltaTime)
107107
// Draw a world axis-aligned cube with its' center coinciding with the camera's position.
108108
// The vertex shader sets the visible face(s) at max depth so as to not draw over
109109
// other objects that aren't inside the cube (which, at 2x2x2, is quite small)
110-
void SkyPass::OnDraw()
110+
void SkyPass::Draw()
111111
{
112112
Renderer* RenderContext = Renderer::GetInstance();
113113
if (!RenderContext)

GITechDemo/Code/AppMain/GITechDemo/Resources/ArtistParameter.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,16 +122,15 @@ void ArtistParameterManager::Update()
122122
sprintf_s(szTempBuffer, "Step: Negate", fStep);
123123
HUD_PASS.PrintLn(szTempBuffer);
124124

125-
if (cmd & APM_CMD_STEP_UP || cmd & APM_CMD_STEP_DOWN)
125+
if (cmd & (APM_CMD_STEP_UP | APM_CMD_STEP_DOWN))
126126
*(bool*)pCurrAP->pParam = !(*(bool*)pCurrAP->pParam);
127127
}
128128
else
129129
assert(0);
130130

131131
HUD_PASS.PrintLn("");
132-
HUD_PASS.PrintLn("Hold CtrlR or ShiftR to scale step value.");
132+
HUD_PASS.PrintLn("Hold RCtrl or RShift to scale step value.");
133133
}
134-
135134
}
136135

137136
void ArtistParameterManager::SetupInput(gainput::InputManager* pInputManager)

GITechDemo/Code/AppMain/GITechDemo/Resources/ArtistParameter.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ namespace GITechDemoApp
2424
void Update();
2525
void SetupInput(gainput::InputManager* pInputManager);
2626

27+
bool IsDrawingOnHUD() { return m_nCurrParam != -1; }
28+
unsigned int GetParameterCount() { return (unsigned int)ms_arrParams.size(); }
29+
2730
static void CreateInstance() { ms_pInstance = new ArtistParameterManager(); }
2831
static void DestroyInstance() { if (ms_pInstance) delete ms_pInstance; ms_pInstance = nullptr; }
2932
static ArtistParameterManager* GetArtistParameterManager() { return ms_pInstance; }

0 commit comments

Comments
 (0)