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

Method SphereMapEffect

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

Source from the content-addressed store, hash-verified

10using namespace gte;
11
12SphereMapEffect::SphereMapEffect(std::shared_ptr<ProgramFactory> const& factory,
13 std::shared_ptr<Texture2> const& texture,
14 SamplerState::Filter filter, SamplerState::Mode mode0, SamplerState::Mode mode1)
15 :
16 mTexture(texture)
17{
18 int32_t api = factory->GetAPI();
19 mProgram = factory->CreateFromSources(*msVSSource[api], *msPSSource[api], "");
20 if (mProgram)
21 {
22 mVWMatrixConstant = std::make_shared<ConstantBuffer>(sizeof(Matrix4x4<float>), true);
23 *mVWMatrixConstant->Get<Matrix4x4<float>>() = Matrix4x4<float>::Identity();
24
25 mSampler = std::make_shared<SamplerState>();
26 mSampler->filter = filter;
27 mSampler->mode[0] = mode0;
28 mSampler->mode[1] = mode1;
29
30 auto const& vshader = mProgram->GetVertexShader();
31 vshader->Set("PVWMatrix", mPVWMatrixConstant);
32 vshader->Set("VWMatrix", mVWMatrixConstant);
33 mProgram->GetPixelShader()->Set("baseTexture", texture, "baseSampler", mSampler);
34 }
35 else
36 {
37 LogError("Failed to compile shader programs.");
38 }
39}
40
41void SphereMapEffect::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