Beispiel #1
0
        public static PackedLightData ToPackedLightData(EnvLightData data)
        {
            PackedLightData outData = default(PackedLightData);

            outData.packedData1   = data.capturePositionRWS;
            outData.packedData1.w = (float)data.lightLayers + Epsilon; //防止1,转换为float变成0.999999999998;

            outData.packedData2   = data.proxyForward;
            outData.packedData2.w = (int)data.influenceShapeType + Epsilon; //防止1,转换为float变成0.999999999998;

            outData.packedData3   = data.proxyRight;
            outData.packedData3.w = data.minProjectionDistance;

            outData.packedData4   = data.proxyUp;
            outData.packedData4.w = data.weight;

            outData.packedData5   = data.proxyExtents;
            outData.packedData5.w = data.multiplier;

            outData.packedData6   = data.influencePositionRWS;
            outData.packedData6.w = data.envIndex + Epsilon; //防止1,转换为float变成0.999999999998;

            outData.packedData7   = data.influenceForward;
            outData.packedData7.w = data.boxSideFadeNegative.x;

            outData.packedData8   = data.influenceUp;
            outData.packedData8.w = data.boxSideFadeNegative.y;

            outData.packedData9   = data.influenceRight;
            outData.packedData9.w = data.boxSideFadeNegative.z;

            outData.packedData10   = data.influenceExtents;
            outData.packedData10.w = data.boxSideFadePositive.x;

            outData.packedData11   = data.blendDistancePositive;
            outData.packedData11.w = data.boxSideFadePositive.y;

            outData.packedData12   = data.blendDistanceNegative;
            outData.packedData12.w = data.boxSideFadePositive.z;

            outData.packedData13   = data.blendNormalDistancePositive;
            outData.packedData13.w = 0;

            outData.packedData14   = data.blendNormalDistanceNegative;
            outData.packedData14.w = 0;

            return(outData);
        }
Beispiel #2
0
        public static EnvLightData UnPackedLightDataToEnvLightData(PackedLightData data)
        {
            EnvLightData outData = default(EnvLightData);

            outData.capturePositionRWS = data.packedData1;
            outData.lightLayers        = (uint)data.packedData1.w;

            outData.proxyForward       = data.packedData2;
            outData.influenceShapeType = (EnvShapeType)(int)data.packedData2.w;

            outData.proxyRight            = data.packedData3;
            outData.minProjectionDistance = data.packedData3.w;

            outData.proxyUp = data.packedData4;
            outData.weight  = data.packedData4.w;

            outData.proxyExtents = data.packedData5;
            outData.multiplier   = data.packedData5.w;

            outData.influencePositionRWS = data.packedData6;
            outData.envIndex             = (int)data.packedData6.w;

            outData.influenceForward      = data.packedData7;
            outData.boxSideFadeNegative.x = data.packedData7.w;

            outData.influenceUp           = data.packedData8;
            outData.boxSideFadeNegative.y = data.packedData8.w;

            outData.influenceRight        = data.packedData9;
            outData.boxSideFadeNegative.z = data.packedData9.w;

            outData.influenceExtents      = data.packedData10;
            outData.boxSideFadePositive.x = data.packedData10.w;

            outData.blendDistancePositive = data.packedData11;
            outData.boxSideFadePositive.y = data.packedData11.w;

            outData.blendDistanceNegative = data.packedData12;
            outData.boxSideFadePositive.z = data.packedData12.w;

            outData.blendNormalDistancePositive = data.packedData13;

            outData.blendNormalDistanceNegative = data.packedData14;

            return(outData);
        }