#pragma once
#include "Gui/3D/Texture.h"

#ifdef GUI_WIN32

namespace gui {

	class D3DTexture {
	public:
		// Create from a texture.
		D3DTexture(Texture *t, ID3D10Device *device);

		// The texture itself.
		ComPtr<ID3D10Texture2D> texture;

		// The resource view, needed to bind it to a shader.
		ComPtr<ID3D10ShaderResourceView> view;

		// Update the buffer.
		void update(Texture *t);

		// Cleanup.
		static void cleanup(void *mem) {
			delete (D3DTexture *)mem;
		}

		// Update.
		void update(Texture *t, const DirtyRange &range);

	private:
		// (re-)create the data.
		void create(Texture *t, ID3D10Device *device);
	};

}

#endif
