| 10 | using namespace gte; |
| 11 | |
| 12 | BumpMapEffect::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 | |
| 41 | void BumpMapEffect::SetPVWMatrixConstant(std::shared_ptr<ConstantBuffer> const& buffer) |
| 42 | { |
nothing calls this directly
no test coverage detected