public void ExportJson(JsonWriter writer)
        {
            var visitor = new ThreeSceneExportVisitor(writer);

            using (var s = new JsonScopeObjectWriter(writer)) {
                writer.WritePropertyName("metadata");
                metadata.Accept(visitor);

                writer.WritePropertyName("geometries");
                using (var s1 = new JsonScopeArrayWriter(writer)) {
                    foreach (var geometry in SharedNodeTable.GetEnumerable <AbstractGeometryElem>())
                    {
                        geometry.Accept(visitor);
                    }
                }

                writer.WritePropertyName("materials");
                using (var s1 = new JsonScopeArrayWriter(writer)) {
                    foreach (var material in SharedNodeTable.GetEnumerable <MaterialElem>())
                    {
                        material.Accept(visitor);
                    }
                }

                if (root != null)
                {
                    writer.WritePropertyName("object");
                    root.Accept(visitor);
                }

                writer.WritePropertyName("images");
                using (var s1 = new JsonScopeArrayWriter(writer)) {
                    foreach (var image in SharedNodeTable.GetEnumerable <ImageElem>())
                    {
                        image.Accept(visitor);
                    }
                }

                writer.WritePropertyName("textures");
                using (var s1 = new JsonScopeArrayWriter(writer)) {
                    foreach (var tex in SharedNodeTable.GetEnumerable <TextureElem>())
                    {
                        tex.Accept(visitor);
                    }
                }
            }
        }
Пример #2
0
        public void ExportJson(JsonWriter writer)
        {
            using (var s = new JsonScopeObjectWriter(writer)) {
                writer.WritePropertyName("metadata");
                metadata.ExportJson(writer);

                writer.WritePropertyName("geometries");
                using (var s1 = new JsonScopeArrayWriter(writer)) {
                    foreach (var geometry in SharedNodeTable.GetEnumerable <BufferGeometryElem>())
                    {
                        geometry.ExportJson(writer);
                    }
                }

                writer.WritePropertyName("materials");
                using (var s1 = new JsonScopeArrayWriter(writer)) {
                    foreach (var material in SharedNodeTable.GetEnumerable <MaterialElem>())
                    {
                        material.ExportJson(writer);
                    }
                }

                if (root != null)
                {
                    writer.WritePropertyName("object");
                    root.ExportJson(writer);
                }

                writer.WritePropertyName("images");
                using (var s1 = new JsonScopeArrayWriter(writer)) {
                    foreach (var image in SharedNodeTable.GetEnumerable <ImageElem>())
                    {
                        image.ExportJson(writer);
                    }
                }

                writer.WritePropertyName("textures");
                using (var s1 = new JsonScopeArrayWriter(writer)) {
                    foreach (var tex in SharedNodeTable.GetEnumerable <TextureElem>())
                    {
                        tex.ExportJson(writer);
                    }
                }
            }
        }