| 11 | using namespace gte; |
| 12 | |
| 13 | TextEffect::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 | |
| 35 | void TextEffect::SetTranslate(float x, float y) |
| 36 | { |
nothing calls this directly
no test coverage detected