Ejemplo n.º 1
0
        public static Matrix4x4 ExtractPointLightMatrix(VisibleLight vl, uint faceIdx, float fovBias, out Matrix4x4 view, out Matrix4x4 proj, out Vector4 lightDir, out ShadowSplitData splitData, CullResults cullResults, int lightIndex)
        {
            Debug.Assert(faceIdx <= (uint)CubemapFace.NegativeZ, "Tried to extract cubemap face " + faceIdx + ".");

            splitData = new ShadowSplitData();
            splitData.cullingSphere.Set(0.0f, 0.0f, 0.0f, float.NegativeInfinity);
            splitData.cullingPlaneCount = 0;
            // get lightDir
            lightDir = vl.light.transform.forward;
            // TODO: At some point this logic should be moved to C#, then the parameters cullResults and lightIndex can be removed as well
            cullResults.ComputePointShadowMatricesAndCullingPrimitives(lightIndex, (CubemapFace)faceIdx, fovBias, out view, out proj, out splitData);
            // and the compound
            return(proj * view);
        }