Beispiel #1
0
void CDlgCalc4x4::OnEnChangeEditAngle2()
{
	UpdateData();

	SECOND_VARIABLE second = (SECOND_VARIABLE)m_ComboSecond.GetCurSel();
	CommonDataInterface *secondData = dynamic_cast<CommonDataInterface *>(m_Second[ m_ComboSecond.GetCurSel()]);
	if (!secondData)
		return;

	m_Second[ m_ComboSecond.GetCurSel()]->UpdateData();

	Matrix44 mat;
	switch (second)
	{
	case VAR2_MAT_ROTATEX:
		mat.SetRotationX(m_Angle2);
		break;

	case VAR2_MAT_ROTATEY:
		mat.SetRotationY(m_Angle2);
		break;

	case VAR2_MAT_ROTATEZ:
		mat.SetRotationZ(m_Angle2);
		break;

	case VAR2_MAT_SCALE:
		mat.SetScale(Vector3(m_Angle2, m_Angle2, m_Angle2));
		break;
	}

	secondData->SetMatrix(mat);
}
Beispiel #2
0
void cCube2::SetCube(const Vector3 &vMin, const Vector3 &vMax )
{
	if (m_vtxBuff.GetVertexCount() <= 0)
		InitCube();

	const Vector3 center = (vMin + vMax) / 2.f;
	const Vector3 v1 = vMin - vMax;
	const Vector3 v2 = m_max - m_min;
	Vector3 scale(sqrt(v1.x*v1.x) / sqrt(v2.x*v2.x),
		sqrt(v1.y*v1.y) / sqrt(v2.y*v2.y),
		sqrt(v1.z*v1.z) / sqrt(v2.z*v2.z));

	Matrix44 S;
	S.SetScale(scale);
	Matrix44 T;
	T.SetTranslate( center );
	Matrix44 tm = S * T;

	sVertexNormTex *vbuff = (sVertexNormTex*)m_vtxBuff.Lock();
	for (int i=0; i < m_vtxBuff.GetVertexCount(); ++i)
		vbuff[ i].p *= tm;
	m_vtxBuff.Unlock();

	m_min = vMin;
	m_max = vMax;
}
Beispiel #3
0
void CDlgCalc4x4::OnEnChangeEditAngle1()
{
	UpdateData();

	FIRST_VARIABLE first = (FIRST_VARIABLE)m_ComboFirst.GetCurSel();
	CommonDataInterface *firstData = dynamic_cast<CommonDataInterface *>(m_First[ m_ComboFirst.GetCurSel()]);
	if (!firstData)
		return;

	m_First[ m_ComboFirst.GetCurSel()]->UpdateData();

	Matrix44 mat;
	switch (first)
	{
	case VAR1_MAT_ROTATEX:
		mat.SetRotationX(m_Angle1);
		break;

	case VAR1_MAT_ROTATEY:
		mat.SetRotationY(m_Angle1);
		break;

	case VAR1_MAT_ROTATEZ:
		mat.SetRotationZ(m_Angle1);
		break;

	case VAR1_MAT_SCALE:
		mat.SetScale(Vector3(m_Angle1, m_Angle1, m_Angle1));
		break;
	}

	firstData->SetMatrix(mat);
}
Beispiel #4
0
// screen pixel 좌표 pos 값이 스프라이트 안에 있다면 true를 리턴한다.
bool cSprite::IsContain(const Vector2 &pos)
{
	Vector3 leftTop(0,0,0);
	Vector3 rightBottom = Vector3(m_rect.Width(), m_rect.Height(), 0);

	Matrix44 S;
	S.SetScale(m_scale);
	Matrix44 C;
	C.SetTranslate(-m_center);
	Matrix44 tm = S * C * m_accTM;
	leftTop *= tm;
	rightBottom *= tm;

	return ((leftTop.x <= pos.x) &&
		(leftTop.y <= pos.y) &&
		(rightBottom.x >= pos.x) &&
		(rightBottom.y >= pos.y));
}