Path: blob/master/samples/wp8/OcvImageManipulation/PhoneXamlDirect3DApp1/PhoneXamlDirect3DApp1Comp/QuadRenderer.h
16349 views
#pragma once12#include "Direct3DBase.h"3#include <d3d11.h>456struct ModelViewProjectionConstantBuffer7{8DirectX::XMFLOAT4X4 model;9DirectX::XMFLOAT4X4 view;10DirectX::XMFLOAT4X4 projection;11};1213struct Vertex //Overloaded Vertex Structure14{15Vertex(){}16Vertex(float x, float y, float z,17float u, float v)18: pos(x,y,z), texCoord(u, v){}1920DirectX::XMFLOAT3 pos;21DirectX::XMFLOAT2 texCoord;22};2324// This class renders a simple quad.25ref class QuadRenderer sealed : public Direct3DBase26{27public:28QuadRenderer();2930void Update(float timeTotal = 0.0f, float timeDelta = 0.0f);31void CreateTextureFromByte(byte * buffer,int width,int height);3233// Direct3DBase methods.34virtual void CreateDeviceResources() override;35virtual void CreateWindowSizeDependentResources() override;36virtual void Render() override;3738private:39void Render(Microsoft::WRL::ComPtr<ID3D11RenderTargetView> renderTargetView, Microsoft::WRL::ComPtr<ID3D11DepthStencilView> depthStencilView);40bool m_loadingComplete;41uint32 m_indexCount;42ModelViewProjectionConstantBuffer m_constantBufferData;43Microsoft::WRL::ComPtr<ID3D11InputLayout> m_inputLayout;44Microsoft::WRL::ComPtr<ID3D11Buffer> m_vertexBuffer;45Microsoft::WRL::ComPtr<ID3D11Buffer> m_indexBuffer;46Microsoft::WRL::ComPtr<ID3D11VertexShader> m_vertexShader;47Microsoft::WRL::ComPtr<ID3D11PixelShader> m_pixelShader;48Microsoft::WRL::ComPtr<ID3D11Buffer> m_constantBuffer;49Microsoft::WRL::ComPtr<ID3D11Texture2D> m_Texture;50Microsoft::WRL::ComPtr<ID3D11ShaderResourceView> m_SRV;51Microsoft::WRL::ComPtr<ID3D11SamplerState> m_QuadsTexSamplerState;52Microsoft::WRL::ComPtr<ID3D11BlendState> m_Transparency;53Microsoft::WRL::ComPtr<ID3D11RasterizerState> CCWcullMode;54Microsoft::WRL::ComPtr<ID3D11RasterizerState> CWcullMode;55};565758