Pastebin is 300% more awesome when you are logged in. Sign Up, it's FREE!
Guest

vars.h

By: a guest on May 12th, 2011  |  syntax: C++  |  size: 1.80 KB  |  hits: 71  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. // include the basic windows header files and the Direct3D header files
  2. #include <windows.h>
  3. #include <windowsx.h>
  4. #include <d3d11.h>
  5. #include <d3dx11.h>
  6. #include <d3dx10.h>
  7.  
  8. // include the Direct3D Library file
  9. #pragma comment (lib, "d3d11.lib")
  10. #pragma comment (lib, "d3dx11.lib")
  11. #pragma comment (lib, "d3dx10.lib")
  12.  
  13. // define the screen resolution
  14. #define SCREEN_WIDTH  800
  15. #define SCREEN_HEIGHT 600
  16.  
  17.         int m_vertexCount, m_indexCount;
  18.         int m_terrainWidth=100, m_terrainHeight=100;
  19.  
  20. // global declarations
  21. IDXGISwapChain *swapchain;              // the pointer to the swap chain interface
  22. ID3D11Device *dev;                      // the pointer to our Direct3D device interface
  23. ID3D11DeviceContext *devcon;            // the pointer to our Direct3D device context
  24. ID3D11RenderTargetView *backbuffer;    // the pointer to our back buffer
  25. ID3D11DepthStencilView *zbuffer;        // the pointer to our depth buffer
  26. ID3D11InputLayout *pLayout;            // the pointer to the input layout
  27. ID3D11VertexShader *pVS;                // the pointer to the vertex shader
  28. ID3D11PixelShader *pPS;                // the pointer to the pixel shader
  29. ID3D11Buffer *pVBuffer;                // the pointer to the vertex buffer
  30. ID3D11Buffer *pIBuffer;                // the pointer to the index buffer
  31.  
  32.  
  33. // a struct to define a single vertex
  34.         struct VertexType
  35.         {
  36.                 D3DXVECTOR3 position;
  37.                 D3DXVECTOR4 color;
  38.         };
  39.  
  40.  
  41. // function prototypes
  42. void InitD3D(HWND hWnd);    // sets up and initializes Direct3D
  43. void RenderFrame(void);         // renders a single frame
  44. void CleanD3D(void);        // closes Direct3D and releases memory
  45. void InitGraphics(void);    // creates the shape to render
  46. void InitPipeline(void);    // loads and prepares the shaders