예제 #1
0
파일: graph.cpp 프로젝트: kolzar/sail7
bool Graph::Init()
{
	double Margin;
	
	if(m_bIsPrinting)
	{
		Margin =  1500;

	}
	else
	{
		Margin = m_iMargin;
	}
	//graph width and height
	m_w =  m_rCltRect.width()  -2*Margin;
	m_h =  m_rCltRect.height() -2*Margin;

	SetXScale();
	SetYScale();

	if(m_bXAutoMinGrid) m_XMinorUnit = xunit/5.0;
	if(m_bYAutoMinGrid) m_YMinorUnit = yunit/5.0;

	return true;
}
예제 #2
0
void CSkyBox::Initialize(LPDIRECT3DDEVICE9 pDevice, float fWidth, float fRotSpeed, D3DXVECTOR3 vecPos)
{
	m_pDevice = pDevice;
	m_fRotateSpeed = fRotSpeed;

	SetXScale(fWidth);
	SetYScale(fWidth);
	SetZScale(fWidth);
	SetXPosition(vecPos.x);
	SetYPosition(vecPos.y);
	SetZPosition(vecPos.z);

	SKYBOXVERTEX skyboxVertex[] =
	{	
		{0.5f, -0.5f,  0.5f,   0.0f, 1.0f},		//Right
		{0.5f,  0.5f,  0.5f,   0.0f, 0.0f},		
		{0.5f, -0.5f, -0.5f,   1.0f, 1.0f},		
		{0.5f,  0.5f, -0.5f,   1.0f, 0.0f},

		{0.5f, -0.5f, -0.5f,   0.0f, 1.0f},		//Back 
		{0.5f,  0.5f, -0.5f,   0.0f, 0.0f},
		{-0.5f, -0.5f, -0.5f,  1.0f, 1.0f},		
		{-0.5f,  0.5f, -0.5f,  1.0f, 0.0f},

		{-0.5f, -0.5f, -0.5f,  0.0f, 1.0f},		//Left
		{-0.5f,  0.5f, -0.5f,  0.0f, 0.0f},
		{-0.5f, -0.5f,  0.5f,  1.0f, 1.0f},		
		{-0.5f,  0.5f,  0.5f,  1.0f, 0.0f},

		{-0.5f, -0.5f,  0.5f,  0.0f, 1.0f},		//Front
		{-0.5f,  0.5f,  0.5f,  0.0f, 0.0f},
		{0.5f, -0.5f,  0.5f,   1.0f, 1.0f},	
		{0.5f,  0.5f,  0.5f,   1.0f, 0.0f},

		{0.5f,  0.5f,  0.5f,   0.0f, 0.0f},		//up
		{-0.5f,  0.5f,  0.5f,  1.0f, 0.0f},		
		{0.5f,  0.5f, -0.5f,   0.0f, 1.0f},	     
		{-0.5f,  0.5f, -0.5f,  1.0f, 1.0f},

		{-0.5f, -0.5f,  0.5f,  0.0f, 0.0f},		//down
		{0.5f, -0.5f,  0.5f,   0.0f, 1.0f},
		{-0.5f, -0.5f, -0.5f,  1.0f, 0.0f},	
		{0.5f, -0.5f, -0.5f,   1.0f, 1.0f},
	};

	m_pDevice->CreateVertexBuffer(sizeof(skyboxVertex), 0, 
		D3DFVF_SKYBOX, D3DPOOL_MANAGED, &m_pVertexBuffer,NULL);
	
	void * pVertices;
	m_pVertexBuffer->Lock(0, 0, &pVertices, 0);
	memcpy(pVertices,(void *)skyboxVertex,sizeof(skyboxVertex));
	m_pVertexBuffer->Unlock();
}