Beispiel #1
0
        public void WriteCommonObjectNode(JsonWriter writer, JsonScopeObjectWriter scope)
        {
            scope.WriteKeyValue("uuid", Uuid);
            scope.WriteKeyValue("type", Type);
            scope.WriteKeyValue("name", Name);
            scope.WriteKeyValue("matrix", Matrix);
            scope.WriteKeyValue("visible", Visible);

            if ((userdata.Count + varGroupDict.Count) > 0)
            {
                writer.WritePropertyName("userdata");
                WriteUserdata(writer);
            }

            if (ChildCount > 0)
            {
                writer.WritePropertyName("children");
                using (var s = new JsonScopeArrayWriter(writer)) {
                    foreach (var child in Children)
                    {
                        child.ExportJson(writer);
                    }
                }
            }
        }
        public void WriteCommonObjectNode(JsonScopeObjectWriter scope, Object3DElem el)
        {
            scope.WriteKeyValue("uuid", el.Uuid);
            scope.WriteKeyValue("type", el.Type);
            scope.WriteKeyValue("name", el.Name);
            scope.WriteKeyValue("matrix", el.Matrix);
            scope.WriteKeyValue("visible", el.Visible);

            if (el.HasUserData())
            {
                writer.WritePropertyName("userData");
                WriteUserdata(el);
            }

            if (el.ChildCount > 0)
            {
                writer.WritePropertyName("children");
                using (var s = new JsonScopeArrayWriter(writer)) {
                    foreach (var child in el.Children)
                    {
                        child.Accept(this);
                    }
                }
            }
        }
        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);
                    }
                }
            }
        }
Beispiel #4
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);
                    }
                }
            }
        }
        public void WriteCommonObjectNode(JsonWriter writer, JsonScopeObjectWriter scope)
        {
            scope.WriteKeyValue("uuid", Uuid);
            scope.WriteKeyValue("type", Type);
            scope.WriteKeyValue("name", Name);
            scope.WriteKeyValue("matrix", Matrix);
            scope.WriteKeyValue("visible", Visible);

            if((userdata.Count + varGroupDict.Count) > 0) {
                writer.WritePropertyName("userdata");
                WriteUserdata(writer);
            }

            if (ChildCount > 0) {
                writer.WritePropertyName("children");
                using (var s = new JsonScopeArrayWriter(writer)) {
                    foreach (var child in Children) {
                        child.ExportJson(writer);
                    }
                }
            }
        }