Skip to content

Commit 3343f0f

Browse files
* 删掉没用的镜子相关代码
1 parent 98acd04 commit 3343f0f

File tree

2 files changed

+10
-28
lines changed

2 files changed

+10
-28
lines changed

Chapter 12 The Geometry Shader/GameApp.cpp

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -265,34 +265,16 @@ void GameApp::drawRenderItems(GraphicsContext& gfxContext, std::vector<RenderIte
265265
}
266266
}
267267

268-
void GameApp::setLightContantsBuff(GraphicsContext& gfxContext, bool inMirror /* = false */)
268+
void GameApp::setLightContantsBuff(GraphicsContext& gfxContext)
269269
{
270-
if (!inMirror)
271-
{
272-
// 设置通用的常量缓冲区
273-
PassConstants psc;
274-
psc.viewProj = Transpose(m_ViewProjMatrix);
275-
psc.eyePosW = m_Camera.GetPosition();
276-
psc.ambientLight = { 0.25f, 0.25f, 0.35f, 1.0f };
277-
psc.Lights[0].Direction = { 0.0f, -1.0f, 0.0f };
278-
psc.Lights[0].Strength = { 1.0f, 1.0f, 0.9f };
279-
gfxContext.SetDynamicConstantBufferView(1, sizeof(psc), &psc);
280-
}
281-
else
282-
{
283-
// 设置镜子中的光照,偷个懒,直接设置了
284-
PassConstants psc;
285-
psc.viewProj = Transpose(m_ViewProjMatrix);
286-
psc.eyePosW = m_Camera.GetPosition();
287-
psc.ambientLight = { 0.25f, 0.25f, 0.35f, 1.0f };
288-
psc.Lights[0].Direction = { 0.57735f, -0.57735f, -0.57735f };
289-
psc.Lights[0].Strength = { 0.6f, 0.6f, 0.6f };
290-
psc.Lights[1].Direction = { -0.57735f, -0.57735f, -0.57735f };
291-
psc.Lights[1].Strength = { 0.3f, 0.3f, 0.3f };
292-
psc.Lights[2].Direction = { 0.0f, -0.707f, 0.707f };
293-
psc.Lights[2].Strength = { 0.15f, 0.15f, 0.15f };
294-
gfxContext.SetDynamicConstantBufferView(1, sizeof(psc), &psc);
295-
}
270+
// 设置通用的常量缓冲区
271+
PassConstants psc;
272+
psc.viewProj = Transpose(m_ViewProjMatrix);
273+
psc.eyePosW = m_Camera.GetPosition();
274+
psc.ambientLight = { 0.25f, 0.25f, 0.35f, 1.0f };
275+
psc.Lights[0].Direction = { 0.0f, -1.0f, -1.0f };
276+
psc.Lights[0].Strength = { 1.0f, 1.0f, 0.9f };
277+
gfxContext.SetDynamicConstantBufferView(1, sizeof(psc), &psc);
296278
}
297279

298280
void GameApp::buildLandGeo()

Chapter 12 The Geometry Shader/GameApp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class GameApp : public GameCore::IGameApp
3131
void buildRenderItem();
3232

3333
void drawRenderItems(GraphicsContext& gfxContext, std::vector<RenderItem*>& ritems);
34-
void setLightContantsBuff(GraphicsContext& gfxContext, bool inMirror = false);
34+
void setLightContantsBuff(GraphicsContext& gfxContext);
3535

3636
private:
3737
float GetHillsHeight(float x, float z) const;

0 commit comments

Comments
 (0)