src/video/windowsrt/CubeRenderer.h
author David Ludwig <dludwig@pobox.com>
Sat, 27 Oct 2012 21:20:00 -0400
changeset 8322 839cd578a474
permissions -rw-r--r--
WinRT: moved contents of platform-specific SDLmain into SDL.dll, where it should probably have been in the first place
dludwig@8322
     1
#pragma once
dludwig@8322
     2
dludwig@8322
     3
#include "Direct3DBase.h"
dludwig@8322
     4
dludwig@8322
     5
struct ModelViewProjectionConstantBuffer
dludwig@8322
     6
{
dludwig@8322
     7
	DirectX::XMFLOAT4X4 model;
dludwig@8322
     8
	DirectX::XMFLOAT4X4 view;
dludwig@8322
     9
	DirectX::XMFLOAT4X4 projection;
dludwig@8322
    10
};
dludwig@8322
    11
dludwig@8322
    12
struct VertexPositionColor
dludwig@8322
    13
{
dludwig@8322
    14
	DirectX::XMFLOAT3 pos;
dludwig@8322
    15
	DirectX::XMFLOAT3 color;
dludwig@8322
    16
};
dludwig@8322
    17
dludwig@8322
    18
// This class renders a simple spinning cube.
dludwig@8322
    19
ref class CubeRenderer sealed : public Direct3DBase
dludwig@8322
    20
{
dludwig@8322
    21
public:
dludwig@8322
    22
	CubeRenderer();
dludwig@8322
    23
dludwig@8322
    24
	// Direct3DBase methods.
dludwig@8322
    25
	virtual void CreateDeviceResources() override;
dludwig@8322
    26
	virtual void CreateWindowSizeDependentResources() override;
dludwig@8322
    27
	virtual void Render() override;
dludwig@8322
    28
	
dludwig@8322
    29
	// Method for updating time-dependent objects.
dludwig@8322
    30
	void Update(float timeTotal, float timeDelta);
dludwig@8322
    31
dludwig@8322
    32
private:
dludwig@8322
    33
	bool m_loadingComplete;
dludwig@8322
    34
dludwig@8322
    35
	Microsoft::WRL::ComPtr<ID3D11InputLayout> m_inputLayout;
dludwig@8322
    36
	Microsoft::WRL::ComPtr<ID3D11Buffer> m_vertexBuffer;
dludwig@8322
    37
	Microsoft::WRL::ComPtr<ID3D11Buffer> m_indexBuffer;
dludwig@8322
    38
	Microsoft::WRL::ComPtr<ID3D11VertexShader> m_vertexShader;
dludwig@8322
    39
	Microsoft::WRL::ComPtr<ID3D11PixelShader> m_pixelShader;
dludwig@8322
    40
	Microsoft::WRL::ComPtr<ID3D11Buffer> m_constantBuffer;
dludwig@8322
    41
dludwig@8322
    42
	uint32 m_indexCount;
dludwig@8322
    43
	ModelViewProjectionConstantBuffer m_constantBufferData;
dludwig@8322
    44
};