public static ILightData ParseData(LightBuffer lightBuffer) { ILightData data = null; LightDataType dataType = lightBuffer.ReadDataType(); switch (dataType) { case LightDataType.Object: byte[] tempBuffer = new byte[lightBuffer.buffer.Length - lightBuffer.offset]; Buffer.BlockCopy(lightBuffer.buffer, lightBuffer.offset, tempBuffer, 0, tempBuffer.Length); LightBuffer objectBuffer = new LightBuffer(tempBuffer); LightObject tempObj = new LightObject(); tempObj.key = objectBuffer.ReadByte(); int dataCount = objectBuffer.ReadByte(); for (int i = 0; i < dataCount; i++) { tempObj.AddLightData(ParseData(objectBuffer)); } data = tempObj; lightBuffer.offset += objectBuffer.offset; break; case LightDataType.Int: data = LightInt.Deserialize(lightBuffer); break; } return(data); }
serializableUnityARLightData(UnityARLightData lightData) { whichLight = lightData.arLightingType; if (whichLight == LightDataType.DirectionalLightEstimate) { lightSHC = lightData.arDirectonalLightEstimate.sphericalHarmonicsCoefficients; Vector3 lightDir = lightData.arDirectonalLightEstimate.primaryLightDirection; float lightIntensity = lightData.arDirectonalLightEstimate.primaryLightIntensity; primaryLightDirAndIntensity = new SerializableVector4(lightDir.x, lightDir.y, lightDir.z, lightIntensity); } else { ambientIntensity = lightData.arLightEstimate.ambientIntensity; ambientColorTemperature = lightData.arLightEstimate.ambientColorTemperature; } }
public UnityARLightData(LightDataType ldt, UnityARLightEstimate ule, UnityARDirectionalLightEstimate udle) { arLightingType = ldt; arLightEstimate = ule; arDirectonalLightEstimate = udle; }
public UnityMarshalLightData(LightDataType ldt, UnityARLightEstimate ule, MarshalDirectionalLightEstimate mdle) { arLightingType = ldt; arLightEstimate = ule; arDirectonalLightEstimate = mdle; }