#pragma once

#include "..\..\Interfaces\IShaderParameter.h"

class ShaderParameter :
	public IShaderParameter
{
public:
	ShaderParameter(const std::string& inName, ID3DXEffect* inEffect, D3DXHANDLE inHandle, ShaderParameterType::Enumeration inType, unsigned int inArrayLength);
	virtual ~ShaderParameter();

	virtual ShaderParameterType::Enumeration get_Type() const;

	virtual void set_Float4(const D3DXVECTOR4& inValue);
	virtual D3DXVECTOR4 get_Float4() const;

	virtual void set_Float3(const D3DXVECTOR3& inValue);
	virtual D3DXVECTOR3 get_Float3() const;

	virtual void set_Float2(const D3DXVECTOR2& inValue);
	virtual D3DXVECTOR2 get_Float2() const;

	virtual void set_Float(float inValue);
	virtual float get_Float() const;

	virtual void set_Int(int inValue);
	virtual int get_Int() const;

	virtual void set_Bool(bool inValue);
	virtual bool get_Bool() const;

	virtual void set_String(const std::string& inValue);
	virtual std::string get_String() const;

	virtual void set_Matrix(const D3DXMATRIX& inValue);
	virtual D3DXMATRIX get_Matrix() const;

	virtual void set_Texture1D(IDirect3DBaseTexture9* inValue);
	virtual IDirect3DBaseTexture9* get_Texture1D() const;

	virtual void set_Texture2D(IDirect3DBaseTexture9* inValue);
	virtual IDirect3DBaseTexture9* get_Texture2D() const;

	virtual void set_Texture3D(IDirect3DBaseTexture9* inValue);
	virtual IDirect3DBaseTexture9* get_Texture3D() const;

	virtual void set_TextureCube(IDirect3DBaseTexture9* inValue);
	virtual IDirect3DBaseTexture9* get_TextureCube() const;

	virtual void set_Float4Array(const std::vector<D3DXVECTOR4>& inValue);
	virtual std::vector<D3DXVECTOR4> get_Float4Array() const;

	virtual void set_Float3Array(const std::vector<D3DXVECTOR3>& inValue);
	virtual std::vector<D3DXVECTOR3> get_Float3Array() const;

	virtual void set_Float2Array(const std::vector<D3DXVECTOR2>& inValue);
	virtual std::vector<D3DXVECTOR2> get_Float2Array() const;

	virtual void set_FloatArray(const std::vector<float>& inValue);
	virtual std::vector<float> get_FloatArray() const;

	virtual void set_IntArray(const std::vector<int>& inValue);
	virtual std::vector<int> get_IntArray() const;

	virtual unsigned int get_ArrayLength() const;

	virtual const std::string& get_Name() const;

	virtual bool isValid() const;

	virtual void Refresh(ID3DXEffect* inEffect);

	virtual D3DXHANDLE get_Handle() const;

public:
	void UpdateEffect();
	void FreeParameter();

private:
	std::string Name;
	ID3DXEffect* Effect;
	D3DXHANDLE Handle;
	ShaderParameterType::Enumeration Type;
	void* Parameter;
	unsigned int ArrayLength;
	bool PointerParameter;
	bool Valid;
};
