コード例 #1
0
ファイル: matrix44.cpp プロジェクト: ChoiGimin/GameSolution
void Matrix44::SetView( const Vector3& pos, const Vector3& dir0, const Vector3& up0 )
{
	Vector3 vDir;
	Vector3 vUp;
	Vector3 vCross;

	vDir = dir0.Normal();
	vCross = up0.CrossProduct( vDir );
	vCross.Normalize();
	vUp = vDir.CrossProduct( vCross );

	_11 = vCross.x;
	_12 = vUp.x;
	_13 = vDir.x;
	_14 = 0.0f;
	_21 = vCross.y;
	_22 = vUp.y;
	_23 = vDir.y;
	_24 = 0.0f;
	_31 = vCross.z;
	_32 = vUp.z;
	_33 = vDir.z;
	_34 = 0.0f;
	_41 = -pos.DotProduct( vCross );
	_42 = -pos.DotProduct( vUp );
	_43 = -pos.DotProduct( vDir );
	_44 = 1.0f;
}
コード例 #2
0
ファイル: Matrix.cpp プロジェクト: huck12345/3D-Lecture
//---------------------------
//
//---------------------------
void Matrix44::SetView( const Vector3& vPos, const Vector3& vDir_, const Vector3& vUp_ )
{
	Vector3 vDir;
	Vector3 vUp;
	Vector3 vCross;

	vDir = vDir_.Normal();
	vCross = vUp_.CrossProduct( vDir );
	vCross.Normalize();
	vUp = vDir.CrossProduct( vCross );

	_11 = vCross.x;
	_12 = vUp.x;
	_13 = vDir.x;
	_14 = 0.0F;
	_21 = vCross.y;
	_22 = vUp.y;
	_23 = vDir.y;
	_24 = 0.0F;
	_31 = vCross.z;
	_32 = vUp.z;
	_33 = vDir.z;
	_34 = 0.0F;
	_41 = -vPos.DotProduct( vCross );
	_42 = -vPos.DotProduct( vUp );
	_43 = -vPos.DotProduct( vDir );
	_44 = 1.0F;
} //Matrix44::SetView
コード例 #3
0
	float Vector3::EulerAngle(const Vector3 &a_Term)
	{
        Vector3 VectorA = (*this).Normal();
		
		Vector3 VectorB = a_Term;
		VectorB = VectorB.Normal();
		
		float fEuler = acos((VectorA).DotProduct(VectorB));
		return fEuler;
	}
コード例 #4
0
ファイル: lightmanager.cpp プロジェクト: gdijaejung/Common
cLightManager::cLightManager()
{
	m_lights.reserve(4);

	// 기본 방향성 조명 추가. index = 0;
	cLight mainLight;
	mainLight.Init(cLight::LIGHT_DIRECTIONAL);

	const Vector3 lightPos(300,300,-300);
	mainLight.SetPosition(lightPos);
	mainLight.SetDirection(-lightPos.Normal()); 
	AddLight(mainLight);

}
コード例 #5
0
ファイル: Matrix.cpp プロジェクト: huck12345/3D-Lecture
//---------------------------
//
//---------------------------
void Matrix44::SetRotation( const Vector3& vINAxis, const float fAngle )
{
	Vector3	vAxis = vINAxis.Normal();
	float	fCos = cosf( fAngle );
	float	fSin = sinf( fAngle );

	_11 = ( vAxis.x * vAxis.x ) * ( 1.0F - fCos ) + fCos;
	_12 = ( vAxis.x * vAxis.y ) * ( 1.0F - fCos ) - ( vAxis.z * fSin );
	_13 = ( vAxis.x * vAxis.z ) * ( 1.0F - fCos ) + ( vAxis.y * fSin );

	_21 = ( vAxis.y * vAxis.x ) * ( 1.0F - fCos ) + ( vAxis.z * fSin );
	_22 = ( vAxis.y * vAxis.y ) * ( 1.0F - fCos ) + fCos;
	_23 = ( vAxis.y * vAxis.z ) * ( 1.0F - fCos ) - ( vAxis.x * fSin );

	_31 = ( vAxis.z * vAxis.x ) * ( 1.0F - fCos ) - ( vAxis.y * fSin );
	_32 = ( vAxis.z * vAxis.y ) * ( 1.0F - fCos ) + ( vAxis.x * fSin );
	_33 = ( vAxis.z * vAxis.z ) * ( 1.0F - fCos ) + fCos;

	_14 = _24 = _34 = 0.0F;
	_41 = _42 = _43 = 0.0F;
	_44 = 1.0F;
} //Matrix44::SetRotation
コード例 #6
0
ファイル: Matrix.cpp プロジェクト: huck12345/3D-Lecture
//---------------------------
//
//---------------------------
void Matrix44::SetWorld( const Vector3& vPos, const Vector3& vINDir, const Vector3& vINUp )
{
	Vector3		vDir	= vINDir.Normal();
	Vector3		vCross	= vINUp.CrossProduct( vDir ).Normal();
	Vector3		vUp		= vDir.CrossProduct( vCross );

	_11 = vCross.x;
	_12 = vCross.y;
	_13 = vCross.z;
	_14 = 0.0F;
	_21 = vUp.x;
	_22 = vUp.y;
	_23 = vUp.z;
	_24 = 0.0F;
	_31 = vDir.x;
	_32 = vDir.y;
	_33 = vDir.z;
	_34 = 0.0F;
	_41 = vPos.x;
	_42 = vPos.y;
	_43 = vPos.z;
	_44 = 1.0F;
} //Matrix44::SetWorld