#pragma once
#include "SceneNode.h"
#include "WICTextureLoader.h"
#include "DirectXFramework.h"

class TexturedCubeNode : public SceneNode
{
public:
	TexturedCubeNode(wstring name, wstring textureName) : SceneNode(name) { _textureName = textureName; }

	bool Initialise(void);	
	void Render(void);
	void Shutdown(void);

private:
	ComPtr<ID3D11Device> _device;
	ComPtr<ID3D11DeviceContext> _deviceContext;
	
	ComPtr<ID3D11Buffer> _vertexBuffer;
	ComPtr<ID3D11Buffer> _indexBuffer;

	ComPtr<ID3DBlob> _vertexShaderByteCode = nullptr;
	ComPtr<ID3DBlob> _pixelShaderByteCode = nullptr;
	ComPtr<ID3D11VertexShader> _vertexShader;
	ComPtr<ID3D11PixelShader> _pixelShader;
	ComPtr<ID3D11InputLayout> _layout;
	ComPtr<ID3D11Buffer> _constantBuffer;

	ComPtr<ID3D11ShaderResourceView> _texture;

	wstring _textureName;
		
	void BuildGeometryBuffers();
	void BuildShaders();
	void BuildVertexLayout();
	void BuildConstantBuffer();
	void BuildTexture();
};

