コード例 #1
0
        public static void Serialize(JsonFormatter f, glTF_VCAST_materials_pbr value)
        {
            f.BeginMap();


            if (value.emissiveFactor != null && value.emissiveFactor.Length >= 0)
            {
                f.Key("emissiveFactor");
                Serialize_vci_emissiveFactor(f, value.emissiveFactor);
            }

            f.EndMap();
        }
コード例 #2
0
        public static glTF_VCAST_materials_pbr Deserialize(JsonNode parsed)
        {
            var value = new glTF_VCAST_materials_pbr();

            foreach (var kv in parsed.ObjectItems())
            {
                var key = kv.Key.GetString();

                if (key == "emissiveFactor")
                {
                    value.emissiveFactor = glTF_VCAST_materials_pbr_Deserializevci_emissiveFactor(kv.Value);
                    continue;
                }
            }
            return(value);
        }
コード例 #3
0
ファイル: VCIMaterialExporter.cs プロジェクト: oocytanb/VCI
        static void ExportMaterialExtension(Material m, glTFMaterial material)
        {
            // HDR Emission
            if (m.IsKeywordEnabled("_EMISSION") && m.HasProperty("_EmissionColor"))
            {
                var color = m.GetColor("_EmissionColor");
                if (color.maxColorComponent > 1)
                {
                    var extensions = new glTF_VCAST_materials_pbr();

                    extensions.emissiveFactor = new float[] { color.r, color.g, color.b };

                    var f = new UniJSON.JsonFormatter();
                    glTF_VCAST_materials_pbr_Serializer.Serialize(f, extensions);
                    glTFExtensionExport.GetOrCreate(ref material.extensions).Add(glTF_VCAST_materials_pbr.ExtensionName, f.GetStore().Bytes);
                }
            }
        }