PSSMDemo.UniformLightCameraBuilder.GetCameraDirectionLS C# (CSharp) Метод

GetCameraDirectionLS() защищенный Метод

protected GetCameraDirectionLS ( Matrix &lightSpace, Vector3 &result ) : void
lightSpace Matrix
result Vector3
Результат void
        protected void GetCameraDirectionLS(ref Matrix lightSpace, out Vector3 result)
        {
            Vector3 e;
            Vector3 b;

            GetNearCameraPointWS(out e);
            b = e + eyeDirection;

            // ライト空間へ変換。
            Vector3 eLS;
            Vector3 bLS;
            Vector3Helper.TransformCoordinate(ref e, ref lightSpace, out eLS);
            Vector3Helper.TransformCoordinate(ref b, ref lightSpace, out bLS);

            // 方向。
            result = bLS - eLS;

            // xz 平面 (シャドウ マップ) に平行 (射影)。
            result.Y = 0.0f;

            // 正規化。
            const float zeroTolerance = 1e-6f;
            if (result.Length() < zeroTolerance)
            {
                // 概ねゼロ ベクトルである場合はデフォルトの前方方向 (0, 0, -1)。
                result = Vector3.Forward;
            }
            else
            {
                result.Normalize();
            }
        }