CubeRenderer.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #pragma once
  2. #include "Direct3DBase.h"
  3. struct ModelViewProjectionConstantBuffer
  4. {
  5. DirectX::XMFLOAT4X4 model;
  6. DirectX::XMFLOAT4X4 view;
  7. DirectX::XMFLOAT4X4 projection;
  8. };
  9. struct VertexPositionColor
  10. {
  11. DirectX::XMFLOAT3 pos;
  12. DirectX::XMFLOAT3 color;
  13. };
  14. // This class renders a simple spinning cube.
  15. ref class CubeRenderer sealed : public Direct3DBase
  16. {
  17. public:
  18. CubeRenderer();
  19. // Direct3DBase methods.
  20. virtual void CreateDeviceResources() override;
  21. virtual void CreateWindowSizeDependentResources() override;
  22. virtual void Render() override;
  23. // Method for updating time-dependent objects.
  24. void Update(float timeTotal, float timeDelta);
  25. private:
  26. bool m_loadingComplete;
  27. Microsoft::WRL::ComPtr<ID3D11InputLayout> m_inputLayout;
  28. Microsoft::WRL::ComPtr<ID3D11Buffer> m_vertexBuffer;
  29. Microsoft::WRL::ComPtr<ID3D11Buffer> m_indexBuffer;
  30. Microsoft::WRL::ComPtr<ID3D11VertexShader> m_vertexShader;
  31. Microsoft::WRL::ComPtr<ID3D11PixelShader> m_pixelShader;
  32. Microsoft::WRL::ComPtr<ID3D11Buffer> m_constantBuffer;
  33. uint32 m_indexCount;
  34. ModelViewProjectionConstantBuffer m_constantBufferData;
  35. };