/* ====================================================================
 * 파    일 :	PlaneObject.h
 * 목    적 :	2D 랜더링 기본 객체
 * 작 성 자 :	이법석
 * 작 성 일 :	2006.12
 * 주의사항 :	항상 같은 Property로 찍게 되는 객체들은 따로 관리하세요
 * =================================================================== */
#pragma once

class NiTexture;
class NiTexturingProperty;
class NiAlphaProperty;
class NiZBufferProperty;

class cPlaneObject
{
public:
	cPlaneObject();
	virtual ~cPlaneObject();

	/// 생성부
	virtual bool Create( const char* pathName, 
				short screenX, short screenY, unsigned short screenW, unsigned short screenH,
				unsigned short texLeft, unsigned short texTop, unsigned short texRight, unsigned short texBottom );

	/// 생성부
	virtual bool Create( NiTexture* pTexture, 
				short screenX, short screenY, unsigned short screenW, unsigned short screenH,
				unsigned short texLeft, unsigned short texTop, unsigned short texRight, unsigned short texBottom );

	/// 출력부
	virtual void Draw();

	inline short GetScreenX() { return mScreenX; }
	inline short GetScreenY() { return mScreenY; }
	inline unsigned short GetScreenW() { return mScreenW; }
	inline unsigned short GetScreenH() { return mScreenH; }

	/// 스크린 좌표 셋팅
	void SetScreenXY( short screenX, short screenY );
	void SetScreenX( short screenX );
	void SetScreenY( short screenY );

	/// 스크린 상에서 크기
	void SetScreenWH( unsigned short screenW, unsigned short screenH );
	void SetScreenWidth( unsigned short screenW );
	void SetScreenHeight( unsigned short screenH );

	void SetScreenRect( short screenX, short screenY, unsigned short screenW, unsigned short screenH );

	/// 텍스쳐 UV 셋팅
	virtual void SetTextureRect( unsigned short texLeft, unsigned short texTop, unsigned short texRight, unsigned short texBottom );

	/// 정점 컬러 정보 셋팅
	void SetColorA( float r, float g, float b, float a );
	void SetColorA( NiColorA color );

	/// 회전 및 이동
	/// 절대좌표.
	void UpdateImage();
	void SetTranslate( short x, short y );
	void SetRotate( float angle );

	inline NiAlphaProperty* GetAlphaProp() { return mpAlphaProp; }
	inline NiTexturingProperty* GetTexturingProp() { return mpTextureProp; }
	inline NiScreenElements* GetScreenElements() { return mpScreenElement; }

protected:
	///	정점 정보와 관리 정보를 갖는 기본 객체
	NiScreenElements*		mpScreenElement;

	/// 텍스쳐 정보의 변경을 용이하게 하기 위한 참조 및 관리 변수
	NiTexturingProperty*	mpTextureProp;

	/// 알파 블랜딩을 위한 참조 및 관리 변수
	NiAlphaProperty*		mpAlphaProp;

	/// 사용 텍스쳐의 전체 크기
	unsigned int	mTextureWidth;
	unsigned int	mTextureHeight;

	/// 텍스쳐상에서의 위치
	unsigned short	mTexLeft;
	unsigned short	mTexTop;
	unsigned short	mTexRight;
	unsigned short	mTexBottom;

	/// 화면상에서의 위치 및 크기
	short			mScreenX;
	short			mScreenY;
	unsigned short	mScreenW;
	unsigned short	mScreenH;

	float mScaleX;
	float mScaleY;

	/// 회전 각도
	float mAngle;
	NiPoint2 mVertex[4];
	NiPoint2 mCenter;
};