//-------------------------------------------------------------------------------------- // SkyboxEffect.h // // A sky box effect for DirectX 11. // // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. //-------------------------------------------------------------------------------------- #pragma once #include #include #include #include namespace DX { class SkyboxEffect : public DirectX::IEffect, public DirectX::IEffectMatrices { public: explicit SkyboxEffect(_In_ ID3D11Device* device); SkyboxEffect(SkyboxEffect&&) = delete; SkyboxEffect& operator= (SkyboxEffect&&) = delete; SkyboxEffect(SkyboxEffect const&) = delete; SkyboxEffect& operator= (SkyboxEffect const&) = delete; // IEffect methods. virtual void __cdecl Apply(_In_ ID3D11DeviceContext* deviceContext) override; virtual void __cdecl GetVertexShaderBytecode( _Out_ void const** pShaderByteCode, _Out_ size_t* pByteCodeLength) override; // Camera settings. void XM_CALLCONV SetWorld(DirectX::FXMMATRIX value) override; void XM_CALLCONV SetView(DirectX::FXMMATRIX value) override; void XM_CALLCONV SetProjection(DirectX::FXMMATRIX value) override; void XM_CALLCONV SetMatrices(DirectX::FXMMATRIX world, DirectX::CXMMATRIX view, DirectX::CXMMATRIX projection) override; // Texture settings. void __cdecl SetTexture(_In_opt_ ID3D11ShaderResourceView* value); private: Microsoft::WRL::ComPtr m_vs; Microsoft::WRL::ComPtr m_ps; uint32_t m_dirtyFlags; DirectX::SimpleMath::Matrix m_view; DirectX::SimpleMath::Matrix m_proj; DirectX::SimpleMath::Matrix m_worldViewProj; Microsoft::WRL::ComPtr m_texture; std::vector m_vsBlob; XM_ALIGNED_STRUCT(16) SkyboxEffectConstants { DirectX::XMMATRIX worldViewProj; }; DirectX::ConstantBuffer m_constantBuffer; }; }