#pragma once #include "..\Common\DeviceResources.h" #include "ShaderStructures.h" #include "..\Common\StepTimer.h" namespace $ext_safeprojectname$ { // This sample renderer instantiates a basic rendering pipeline. class Sample3DSceneRenderer { public: Sample3DSceneRenderer(const std::shared_ptr& deviceResources); ~Sample3DSceneRenderer(); void CreateDeviceDependentResources(); void CreateWindowSizeDependentResources(); void Update(DX::StepTimer const& timer); bool Render(); void SaveState(); void StartTracking(); void TrackingUpdate(float positionX); void StopTracking(); bool IsTracking() { return m_tracking; } private: void LoadState(); void Rotate(float radians); private: // Constant buffers must be 256-byte aligned. static const UINT c_alignedConstantBufferSize = (sizeof(ModelViewProjectionConstantBuffer) + 255) & ~255; // Cached pointer to device resources. std::shared_ptr m_deviceResources; // Direct3D resources for cube geometry. Microsoft::WRL::ComPtr m_commandList; Microsoft::WRL::ComPtr m_rootSignature; Microsoft::WRL::ComPtr m_pipelineState; Microsoft::WRL::ComPtr m_cbvHeap; Microsoft::WRL::ComPtr m_vertexBuffer; Microsoft::WRL::ComPtr m_indexBuffer; Microsoft::WRL::ComPtr m_constantBuffer; ModelViewProjectionConstantBuffer m_constantBufferData; UINT8* m_mappedConstantBuffer; UINT m_cbvDescriptorSize; D3D12_RECT m_scissorRect; std::vector m_vertexShader; std::vector m_pixelShader; D3D12_VERTEX_BUFFER_VIEW m_vertexBufferView; D3D12_INDEX_BUFFER_VIEW m_indexBufferView; // Variables used with the rendering loop. bool m_loadingComplete; float m_radiansPerSecond; float m_angle; bool m_tracking; }; }