MCPcopy Create free account
hub / github.com/davideberly/GeometricTools / BumpMapEffect

Method BumpMapEffect

GTE/Graphics/BumpMapEffect.cpp:12–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10using namespace gte;
11
12BumpMapEffect::BumpMapEffect(std::shared_ptr<ProgramFactory> const& factory,
13 std::shared_ptr<Texture2> const& baseTexture,
14 std::shared_ptr<Texture2> const& normalTexture,
15 SamplerState::Filter filter, SamplerState::Mode mode0, SamplerState::Mode mode1)
16 :
17 mBaseTexture(baseTexture),
18 mNormalTexture(normalTexture)
19{
20 int32_t api = factory->GetAPI();
21 mProgram = factory->CreateFromSources(*msVSSource[api], *msPSSource[api], "");
22 if (mProgram)
23 {
24 mCommonSampler = std::make_shared<SamplerState>();
25 mCommonSampler->filter = filter;
26 mCommonSampler->mode[0] = mode0;
27 mCommonSampler->mode[1] = mode1;
28
29 auto const& vshader = mProgram->GetVertexShader();
30 auto const& pshader = mProgram->GetPixelShader();
31 vshader->Set("PVWMatrix", mPVWMatrixConstant);
32 pshader->Set("baseTexture", mBaseTexture, "baseSampler", mCommonSampler);
33 pshader->Set("normalTexture", mNormalTexture, "normalSampler", mCommonSampler);
34 }
35 else
36 {
37 LogError("Failed to compile shader programs.");
38 }
39}
40
41void BumpMapEffect::SetPVWMatrixConstant(std::shared_ptr<ConstantBuffer> const& buffer)
42{

Callers

nothing calls this directly

Calls 3

CreateFromSourcesMethod · 0.80
GetAPIMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected