示例#1
0
//----------------------------------------------------------------//
USMatrix4x4 MOAIGfxDevice::GetWndToNormMtx () const {

	USRect rect = this->mViewRect;

	float hWidth = rect.Width () * 0.5f;
	float hHeight = rect.Height () * 0.5f;

	// Inv Wnd
	USMatrix4x4 wndToNorm;
	wndToNorm.Translate ( -hWidth - rect.mXMin, -hHeight - rect.mYMin, 0.0f );
	
	USMatrix4x4 mtx;
	mtx.Scale (( 1.0f / hWidth ), -( 1.0f / hHeight ), 1.0f );
	wndToNorm.Append ( mtx );
	
	return wndToNorm;
}
示例#2
0
//----------------------------------------------------------------//
USMatrix4x4 MOAIGfxDevice::GetNormToWndMtx () const {

	USRect rect = this->mViewRect;

	float hWidth = rect.Width () * 0.5f;
	float hHeight = rect.Height () * 0.5f;

	// Wnd
	USMatrix4x4 normToWnd;
	normToWnd.Scale ( hWidth, -hHeight, 1.0f );
	
	USMatrix4x4 mtx;
	mtx.Translate ( hWidth + rect.mXMin, hHeight + rect.mYMin, 0.0f );
	normToWnd.Append ( mtx );
	
	return normToWnd;
}
示例#3
0
//----------------------------------------------------------------//
USMatrix4x4 MOAIGfxDevice::GetWorldToWndMtx ( float xScale, float yScale ) const {

	USMatrix4x4 worldToWnd;
	USMatrix4x4 mtx;

	USRect rect = this->GetViewRect ();
	
	float hWidth = rect.Width () * 0.5f;
	float hHeight = rect.Height () * 0.5f;

	// viewproj
	worldToWnd = this->GetViewProjMtx ();
	
	// wnd
	mtx.Scale ( hWidth * xScale, hHeight * yScale, 1.0f );
	worldToWnd.Append ( mtx );
		
	mtx.Translate ( hWidth + rect.mXMin, hHeight + rect.mYMin, 0.0f );
	worldToWnd.Append ( mtx );
	
	return worldToWnd;
}
示例#4
0
//----------------------------------------------------------------//
USMatrix4x4 MOAIGfxDevice::GetWndToWorldMtx () const {

	USMatrix4x4 wndToWorld;
	USMatrix4x4 mtx;

	USRect rect = this->GetViewRect ();
	
	float hWidth = rect.Width () * 0.5f;
	float hHeight = rect.Height () * 0.5f;

	// Inv Wnd
	wndToWorld.Translate ( -hWidth - rect.mXMin, -hHeight - rect.mYMin, 0.0f );
		
	mtx.Scale (( 1.0f / hWidth ), -( 1.0f / hHeight ), 1.0f );
	wndToWorld.Append ( mtx );
	
	// inv viewproj
	mtx = this->GetViewProjMtx ();
	mtx.Inverse ();
	wndToWorld.Append ( mtx );
	
	return wndToWorld;
}