Exemple #1
0
        int fogVoidDistanceComparer(FogVoid v1, FogVoid v2)
        {
            float dist1 = (v1.transform.position - trackingCenter.position).sqrMagnitude;
            float dist2 = (v2.transform.position - trackingCenter.position).sqrMagnitude;

            if (dist1 < dist2)
            {
                return(-1);
            }
            if (dist1 > dist2)
            {
                return(1);
            }
            return(0);
        }
Exemple #2
0
        void SubmitFogVoidData()
        {
            int k = 0;

            for (int i = 0; k < MAX_FOG_VOID && i < fogVoids.Length; i++)
            {
                FogVoid fogVoid = fogVoids[i];
                if (fogVoid == null || !fogVoid.isActiveAndEnabled)
                {
                    continue;
                }
                Vector3 pos = fogVoid.transform.position;
                fogVoidPositionAndSizes[k].x = pos.x;
                fogVoidPositionAndSizes[k].y = 10f * (1f - fogVoid.falloff);
                fogVoidPositionAndSizes[k].z = pos.z;
                fogVoidPositionAndSizes[k].w = 1f / (0.0001f + fogVoid.radius * fogVoid.radius);
                k++;
            }
            Shader.SetGlobalVectorArray("_VF2_FogVoidPositionAndSizes", fogVoidPositionAndSizes);
            Shader.SetGlobalInt("_VF2_FogVoidCount", k);
        }