Ejemplo n.º 1
0
        //-------------------------------------------------------------------------------
        // handle mouse input for the light rotation
        //
        // Axes: global x/y axis
        //-------------------------------------------------------------------------------
        private void HandleMouseInputLightRotate()
        {
	        Point mousePos;
	        mousePos = Control.MousePosition;
            mousePos = PointToClient(mousePos);

	        g_mousePos.X = mousePos.X;
	        g_mousePos.Y = mousePos.Y;

	        if (g_bMousePressedR)
		    {
		        int nXDiff = -(g_mousePos.X - g_LastmousePos.X);
		        int nYDiff = -(g_mousePos.Y - g_LastmousePos.Y);

		        Vector3 v = new Vector3(1.0f,0.0f,0.0f);
		        Matrix mTemp;
                mTemp = Matrix.RotationAxis(v, Geometry.DegreeToRadian((float)nYDiff / 2.0f));
		        D3DXMatrixRotationAxis( (D3DXMATRIX*) &mTemp, (D3DXVECTOR3*)&v, D3DXToRadian((float)nYDiff / 2.0f));
                Vector3.TransformCoordinate(
		        D3DXVec3TransformCoord((D3DXVECTOR3*)&g_avLightDirs[0],
			        (const D3DXVECTOR3*)&g_avLightDirs[0],(const D3DXMATRIX*)&mTemp);

		        v = aiVector3D(0.0f,1.0f,0.0f);
		        D3DXMatrixRotationAxis( (D3DXMATRIX*) &mTemp, (D3DXVECTOR3*)&v, D3DXToRadian((float)nXDiff / 2.0f));
		        D3DXVec3TransformCoord((D3DXVECTOR3*)&g_avLightDirs[0],
			        (const D3DXVECTOR3*)&g_avLightDirs[0],(const D3DXMATRIX*)&mTemp);
            }
        }
Ejemplo n.º 2
0
 private static extern D3DXMATRIX *D3DXMatrixTranslation(
     D3DXMATRIX *pOut,
     Single x,
     Single y,
     Single z
     );
Ejemplo n.º 3
0
 private static extern D3DXMATRIX *D3DXMatrixMultiply(
     D3DXMATRIX *pOut,
     D3DXMATRIX *pM1,
     D3DXMATRIX *pM2
     );
Ejemplo n.º 4
0
 private static extern D3DXMATRIX *D3DXMatrixRotationY(
     D3DXMATRIX *pOut,
     Single Angle
     );