⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 3dobject.cpp

📁 刚上传内容的相关CODEC不能单独上传。于是
💻 CPP
字号:
// 3DObject.cpp: implementation of the C3DObject class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "MagicScissors.h"
#include "3DObject.h"

#include "Image/Image.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

C3DObject::C3DObject()
{
	m_bValidate = FALSE;
	m_nType = 0;
	m_ptCenter = CPoint(0,0);
	m_fRotate = 0.f;
	m_fDepth = -250.f;
	m_fXScale = 1.f;
	m_fYScale = 1.f;
	m_XMove = 0;
	m_YMove = 0;
	m_pTexture = NULL;
	m_strTexture = "";
}
C3DObject::~C3DObject()
{

}

void C3DObject::Render(GLUquadricObj* pQuad, CImage* pImage, BOOL bGlobal)
{

}

BOOL C3DObject::Create(CEdgeList* pList, CRect rect, int height)
{
	return FALSE;
}

BOOL C3DObject::Write(CFile* pFile)
{
	// write type
	pFile->Write( &m_nType, sizeof(int) );

	// write bound rect
	pFile->Write( &m_Rect, sizeof(CRect) );
	// write Screen Height
	pFile->Write( &m_nY, sizeof(int) );

	// write centroid 
	pFile->Write( &m_ptCenter, sizeof(CPoint) );
	// write depth
	pFile->Write( &m_fDepth, sizeof(float) );
	// write xscale
	pFile->Write( &m_fXScale, sizeof(float) );
	// write yscale
	pFile->Write( &m_fYScale, sizeof(float) );
	// write rotate angle
	pFile->Write( &m_fRotate, sizeof(float) );
	// write X shift
	pFile->Write( &m_XMove, sizeof(int) );
	// write Y shift
	pFile->Write( &m_YMove, sizeof(int) );

	return TRUE;
}

BOOL C3DObject::Read(CFile* pFile)
{
	// read bound rect
	pFile->Read( &m_Rect, sizeof(CRect) );
	// read Screen Height
	pFile->Read( &m_nY, sizeof(int) );

	// read centroid 
	pFile->Read( &m_ptCenter, sizeof(CPoint) );
	// read depth
	pFile->Read( &m_fDepth, sizeof(float) );
	// read xscale
	pFile->Read( &m_fXScale, sizeof(float) );
	// read yscale
	pFile->Read( &m_fYScale, sizeof(float) );
	// read rotate angle
	pFile->Read( &m_fRotate, sizeof(float) );
	// read X shift
	pFile->Read( &m_XMove, sizeof(int) );
	// read Y shift
	pFile->Read( &m_YMove, sizeof(int) );

	m_bValidate = TRUE;
	return TRUE;
}

void C3DObject::SetDepth(float depth)
{
	m_fDepth = depth;
}

void C3DObject::ChangeScale( int dir, int inc )
{
	if( dir == 0 )
	{
		if( inc > 0 )
			m_fXScale += 0.05f;
		else
			m_fXScale -= 0.05f;
	}
	else
	{
		if( inc > 0 )
			m_fYScale += 0.05f;
		else
			m_fYScale -= 0.05f;
	}
}

void C3DObject::Move(int dir)
{
	switch( dir )
	{
	case 0:
		m_XMove -= 2;
		break;
	case 1:
		m_XMove += 2;
		break;
	case 2:
		m_YMove -= 2;
		break;
	case 3:
		m_YMove += 2;
	}
}

void C3DObject::Rotate(int dir)
{
	if( dir == 0 )
		m_fRotate += 0.5f;
	else
		m_fRotate -= 0.5f;
}

void C3DObject::SetCenter(CPoint point)
{
	m_ptCenter = point;
}

BOOL C3DObject::CopyParam(C3DObject* pObject)
{
	return FALSE;
}

void C3DObject::SetList(CEdgeList* pList)
{
	m_pList = pList;
}

void C3DObject::SetTexture(CString name)
{
	m_strTexture = name;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -