Пример #1
0
        private void Parse(agxCollide.Geometry geometry, Node parent)
        {
            var geometryNode = GetOrCreateGeometry(geometry, parent == null);

            if (parent != null)
            {
                parent.AddChild(geometryNode);
            }

            foreach (var shape in geometry.getShapes())
            {
                var shapeNode = GetOrCreateShape(shape.get());
                geometryNode.AddChild(shapeNode);
            }

            if (geometry.getMaterial() != null)
            {
                var materialNode = GetOrCreateMaterial(geometry.getMaterial());
                geometryNode.AddReference(materialNode);
            }

            var groupsCollection = geometry.findGroupIdCollection();

            foreach (var name in groupsCollection.getNames())
            {
                geometryNode.AddReference(new Node()
                {
                    Type = NodeType.GroupId, Object = name
                });
            }
            foreach (var id in groupsCollection.getIds())
            {
                geometryNode.AddReference(new Node()
                {
                    Type = NodeType.GroupId, Object = id.ToString()
                });
            }
        }