public glTF_VCAST_vci_LocationLighting_LightProbe[] Export() { var probes = LightmapSettings.lightProbes; if (probes == null || probes.count == 0) { return(new glTF_VCAST_vci_LocationLighting_LightProbe[0]); } var array = new glTF_VCAST_vci_LocationLighting_LightProbe[probes.count]; for (var idx = 0; idx < probes.count; ++idx) { var pos = probes.positions[idx]; var val = probes.bakedProbes[idx]; array[idx] = new glTF_VCAST_vci_LocationLighting_LightProbe { position = new[] { -pos.x, pos.y, pos.z }, // invert X-axis sphericalHarmonicsCoefficientsRed = Enumerable.Range(0, 9).Select(x => val[0, x]).ToArray(), sphericalHarmonicsCoefficientsGreen = Enumerable.Range(0, 9).Select(x => val[1, x]).ToArray(), sphericalHarmonicsCoefficientsBlue = Enumerable.Range(0, 9).Select(x => val[2, x]).ToArray(), }; } return(array); }
public static glTF_VCAST_vci_LocationLighting_LightProbe glTF_VCAST_vci_location_lighting_Deserializevci_locationLighting_lightProbes_ITEM(JsonNode parsed) { var value = new glTF_VCAST_vci_LocationLighting_LightProbe(); foreach (var kv in parsed.ObjectItems()) { var key = kv.Key.GetString(); if (key == "position") { value.position = glTF_VCAST_vci_location_lighting_Deserializevci_locationLighting_lightProbes__position(kv.Value); continue; } if (key == "sphericalHarmonicsCoefficientsRed") { value.sphericalHarmonicsCoefficientsRed = glTF_VCAST_vci_location_lighting_Deserializevci_locationLighting_lightProbes__sphericalHarmonicsCoefficientsRed(kv.Value); continue; } if (key == "sphericalHarmonicsCoefficientsGreen") { value.sphericalHarmonicsCoefficientsGreen = glTF_VCAST_vci_location_lighting_Deserializevci_locationLighting_lightProbes__sphericalHarmonicsCoefficientsGreen(kv.Value); continue; } if (key == "sphericalHarmonicsCoefficientsBlue") { value.sphericalHarmonicsCoefficientsBlue = glTF_VCAST_vci_location_lighting_Deserializevci_locationLighting_lightProbes__sphericalHarmonicsCoefficientsBlue(kv.Value); continue; } } return(value); }
public static glTF_VCAST_vci_LocationLighting_LightProbe[] glTF_VCAST_vci_location_lighting_Deserializevci_locationLighting_lightProbes(JsonNode parsed) { var value = new glTF_VCAST_vci_LocationLighting_LightProbe[parsed.GetArrayCount()]; int i = 0; foreach (var x in parsed.ArrayItems()) { value[i++] = glTF_VCAST_vci_location_lighting_Deserializevci_locationLighting_lightProbes_ITEM(x); } return(value); }
public static void Serialize_vci_locationLighting_lightProbes_ITEM(JsonFormatter f, glTF_VCAST_vci_LocationLighting_LightProbe value) { f.BeginMap(); if (value.position != null && value.position.Length >= 0) { f.Key("position"); Serialize_vci_locationLighting_lightProbes__position(f, value.position); } if (value.sphericalHarmonicsCoefficientsRed != null && value.sphericalHarmonicsCoefficientsRed.Length >= 0) { f.Key("sphericalHarmonicsCoefficientsRed"); Serialize_vci_locationLighting_lightProbes__sphericalHarmonicsCoefficientsRed(f, value.sphericalHarmonicsCoefficientsRed); } if (value.sphericalHarmonicsCoefficientsGreen != null && value.sphericalHarmonicsCoefficientsGreen.Length >= 0) { f.Key("sphericalHarmonicsCoefficientsGreen"); Serialize_vci_locationLighting_lightProbes__sphericalHarmonicsCoefficientsGreen(f, value.sphericalHarmonicsCoefficientsGreen); } if (value.sphericalHarmonicsCoefficientsBlue != null && value.sphericalHarmonicsCoefficientsBlue.Length >= 0) { f.Key("sphericalHarmonicsCoefficientsBlue"); Serialize_vci_locationLighting_lightProbes__sphericalHarmonicsCoefficientsBlue(f, value.sphericalHarmonicsCoefficientsBlue); } f.EndMap(); }