#pragma once #include "../Common/DeviceResources.h" #include "../Common/StepTimer.h" #include "ShaderStructures.h" namespace Immersive { // This sample renderer instantiates a basic rendering pipeline. class SpinningCubeRenderer { public: SpinningCubeRenderer( std::shared_ptr const &deviceResources); std::future CreateDeviceDependentResources(); void ReleaseDeviceDependentResources(); void Update(DX::StepTimer const &timer); void Render(); // Repositions the sample hologram. void PositionHologram(winrt::Windows::UI::Input::Spatial::SpatialPointerPose const &pointerPose); // Property accessors. void SetPosition(winrt::Windows::Foundation::Numerics::float3 const &pos) { m_position = pos; } winrt::Windows::Foundation::Numerics::float3 const &GetPosition() { return m_position; } private: // Cached pointer to device resources. std::shared_ptr m_deviceResources; // Direct3D resources for cube geometry. Microsoft::WRL::ComPtr m_inputLayout; Microsoft::WRL::ComPtr m_vertexBuffer; Microsoft::WRL::ComPtr m_indexBuffer; Microsoft::WRL::ComPtr m_vertexShader; Microsoft::WRL::ComPtr m_geometryShader; Microsoft::WRL::ComPtr m_pixelShader; Microsoft::WRL::ComPtr m_modelConstantBuffer; // System resources for cube geometry. ModelConstantBuffer m_modelConstantBufferData; uint32_t m_indexCount = 0; // Variables used with the rendering loop. bool m_loadingComplete = false; float m_degreesPerSecond = 45.f; winrt::Windows::Foundation::Numerics::float3 m_position = {0.f, 0.f, -2.f}; // If the current D3D Device supports VPRT, we can avoid using a geometry // shader just to set the render target array index. bool m_usingVprtShaders = false; }; } // namespace Immersive