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

Method Texture2Effect

GTE/Graphics/Texture2Effect.cpp:12–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10using namespace gte;
11
12Texture2Effect::Texture2Effect(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 mSampler = std::make_shared<SamplerState>();
23 mSampler->filter = filter;
24 mSampler->mode[0] = mode0;
25 mSampler->mode[1] = mode1;
26
27 mProgram->GetVertexShader()->Set("PVWMatrix", mPVWMatrixConstant);
28 mProgram->GetPixelShader()->Set("baseTexture", texture, "baseSampler", mSampler);
29 }
30 else
31 {
32 LogError("Failed to compile shader programs.");
33 }
34}
35
36void Texture2Effect::SetPVWMatrixConstant(std::shared_ptr<ConstantBuffer> const& buffer)
37{

Callers

nothing calls this directly

Calls 3

CreateFromSourcesMethod · 0.80
GetAPIMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected