Advertisement
Guest User

Renderer.h

a guest
Nov 22nd, 2013
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.90 KB | None | 0 0
  1. #pragma once
  2.  
  3. #include "Direct3DBase.h"
  4. #include "Asteroid.h"
  5. #include "Placement.h"
  6. #include "AccelerometerDelegate.h"
  7. #include "Rotation.h"
  8.  
  9. #include "ppltasks.h" // Concurrency::task
  10. #include <vector>
  11.  
  12. using std::vector;
  13.  
  14. struct ModelViewProjectionConstantBuffer
  15. {
  16.     DirectX::XMFLOAT4X4 model;
  17.     DirectX::XMFLOAT4X4 view;
  18.     DirectX::XMFLOAT4X4 projection;
  19. };
  20.  
  21. struct VertexPositionColor
  22. {
  23.     DirectX::XMFLOAT3 pos;
  24.     DirectX::XMFLOAT3 color;
  25. };
  26.  
  27. // This class renders a simple spinning cube.
  28. ref class Renderer sealed : public Direct3DBase
  29. {
  30. public:
  31.     Renderer();
  32.  
  33.     // Direct3DBase methods.
  34.     virtual void CreateDeviceResources() override;
  35.     virtual void CreateWindowSizeDependentResources() override;
  36.     virtual void Render() override;
  37.    
  38.     // Method for updating time-dependent objects.
  39.     void RenderBackground();
  40.  
  41.     void Update( Placement^ placement );
  42.     void UpdateAsteroid( Placement^ placement);
  43.     void ComposeFrame();
  44.     void SetUpViewingAngle();
  45.     void GetBuffer();
  46.  
  47.     void PreparePlayer();
  48.     void PrepareAsteroids( int index );
  49.  
  50. private: // Methods
  51.     void PrepareObjects( Concurrency::task<void> createPSTask, Concurrency::task<void> createVSTask );
  52. private: // Properties
  53.     bool m_playerLoadComplete;
  54.     bool m_asteroidsLoadComplete;
  55.  
  56.     Microsoft::WRL::ComPtr<ID3D11InputLayout> m_inputLayout;
  57.  
  58.     // Player Buffers
  59.     Microsoft::WRL::ComPtr<ID3D11Buffer> playerVertexBuffer;
  60.     Microsoft::WRL::ComPtr<ID3D11Buffer> playerIndexBuffer;
  61.     uint32 playerIndexCount;
  62.    
  63.     // Asteroid Buffers
  64.     vector<Microsoft::WRL::ComPtr<ID3D11Buffer>> asteroidVertexBuffers;
  65.     vector<Microsoft::WRL::ComPtr<ID3D11Buffer>> asteroidIndexBuffers;
  66.     vector<uint32> asteroidIndexCounts;
  67.  
  68.     Microsoft::WRL::ComPtr<ID3D11VertexShader> m_vertexShader;
  69.     Microsoft::WRL::ComPtr<ID3D11PixelShader> m_pixelShader;
  70.     Microsoft::WRL::ComPtr<ID3D11Buffer> m_constantBuffer;
  71.  
  72.     ModelViewProjectionConstantBuffer m_constantBufferData;
  73. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement