Exemplo n.º 1
0
    private Matrix4x4 Interp(float t, Matrix4x4 a, Matrix4x4 b)
    {
        Matrix4x4 matrixx;

        switch (this.mode)
        {
        case SlerpMode.TransformLerp:
        case SlerpMode.WorldToCameraLerp:
        case SlerpMode.CameraToWorldLerp:
            matrixx = TransitionFunctions.Linear(t, a, b);
            break;

        case SlerpMode.WorldToCameraSlerp2:
            matrixx = TransitionFunctions.SlerpWorldToCamera(t, a, b);
            break;

        default:
            matrixx = TransitionFunctions.Slerp(t, a, b);
            break;
        }
        if (this.inverse0)
        {
            if (this.transpose)
            {
                if (!this.inverse1)
                {
                    return(matrixx.inverse.transpose);
                }
                return(matrixx.inverse.transpose.inverse);
            }
            if (this.inverse1)
            {
                return(matrixx.inverse.inverse);
            }
            return(matrixx.inverse);
        }
        if (this.transpose)
        {
            if (this.inverse1)
            {
                return(matrixx.transpose.inverse);
            }
            return(matrixx.transpose);
        }
        if (this.inverse1)
        {
            return(matrixx.inverse);
        }
        return(matrixx);
    }
Exemplo n.º 2
0
    private Matrix4x4 Interp(float t, Matrix4x4 a, Matrix4x4 b)
    {
        Matrix4x4 camera;

        switch (this.mode)
        {
        case TransformLerpTest.SlerpMode.TransformSlerp:
        case TransformLerpTest.SlerpMode.WorldToCameraSlerp:
        case TransformLerpTest.SlerpMode.CameraToWorldSlerp:
        {
            camera = TransitionFunctions.Slerp(t, a, b);
            break;
        }

        case TransformLerpTest.SlerpMode.TransformLerp:
        case TransformLerpTest.SlerpMode.WorldToCameraLerp:
        case TransformLerpTest.SlerpMode.CameraToWorldLerp:
        {
            camera = TransitionFunctions.Linear(t, a, b);
            break;
        }

        case TransformLerpTest.SlerpMode.WorldToCameraSlerp2:
        {
            camera = TransitionFunctions.SlerpWorldToCamera(t, a, b);
            break;
        }

        default:
        {
            goto case TransformLerpTest.SlerpMode.CameraToWorldSlerp;
        }
        }
        if (!this.inverse0)
        {
            if (!this.transpose)
            {
                if (!this.inverse1)
                {
                    return(camera);
                }
                return(camera.inverse);
            }
            if (!this.inverse1)
            {
                return(camera.transpose);
            }
            return(camera.transpose.inverse);
        }
        if (!this.transpose)
        {
            if (!this.inverse1)
            {
                return(camera.inverse);
            }
            return(camera.inverse.inverse);
        }
        if (!this.inverse1)
        {
            return(camera.inverse.transpose);
        }
        return(camera.inverse.transpose.inverse);
    }