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