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

Method TextEffect

GTE/Graphics/TextEffect.cpp:13–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11using namespace gte;
12
13TextEffect::TextEffect(std::shared_ptr<ProgramFactory> const& factory,
14 std::shared_ptr<Texture2> const& texture)
15{
16 int32_t api = factory->GetAPI();
17 mProgram = factory->CreateFromSources(*msVSSource[api], *msPSSource[api], "");
18 if (mProgram)
19 {
20 mTranslate = std::make_shared<ConstantBuffer>(sizeof(Vector3<float>), true);
21 mColor = std::make_shared<ConstantBuffer>(sizeof(Vector4<float>), true);
22 mSamplerState = std::make_shared<SamplerState>();
23
24 SetTranslate(0.0f, 0.0f);
25 SetNormalizedZ(msDefaultNormalizedZ[api]);
26 mProgram->GetVertexShader()->Set("Translate", mTranslate);
27
28 SetColor({ 0.0f, 0.0f, 0.0f, 0.0f });
29 auto const& pshader = mProgram->GetPixelShader();
30 pshader->Set("TextColor", mColor);
31 pshader->Set("baseTexture", texture, "baseSampler", mSamplerState);
32 }
33}
34
35void TextEffect::SetTranslate(float x, float y)
36{

Callers

nothing calls this directly

Calls 3

CreateFromSourcesMethod · 0.80
GetAPIMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected