public static PackedGeometry Pack(IndexedLineSet ils)
        {
            PackedGeometry packed;
            Coordinate     coordinate;

            packed = new PackedGeometry();
            //packed.Texturing = ifs.texCoordinate != null;// || parentShape.texturingEnabled;

            coordinate = (Coordinate)ils.ChildrenWithAppliedReferences.FirstOrDefault(n => n.GetType() == typeof(Coordinate));

            packed.RGBA             = false;
            packed.RGB              = false;
            packed.Coloring         = false;
            packed.generateColorMap = false;

            if (coordinate != null && !string.IsNullOrEmpty(ils.coordIndex))
            {
                packed._indices = X3DTypeConverters.ParseIndicies(ils.coordIndex);
                packed._coords  = X3DTypeConverters.MFVec3f(coordinate.point);

                if (ils.coordIndex.Contains(RESTART_INDEX.ToString()))
                {
                    packed.restartIndex = RESTART_INDEX;
                }

                packed.vertexStride = 2;

                packed.Interleave();
            }

            return(packed);
        }
        public static PackedGeometry Pack(IndexedFaceSet ifs)
        {
            PackedGeometry    packed;
            TextureCoordinate texCoordinate;
            Coordinate        coordinate;
            Color             colorNode;
            ColorRGBA         colorRGBANode;

            packed = new PackedGeometry();
            //packed.Texturing = ifs.texCoordinate != null;// || parentShape.texturingEnabled;

            texCoordinate = (TextureCoordinate)ifs.ChildrenWithAppliedReferences.FirstOrDefault(n => n.GetType() == typeof(TextureCoordinate));
            coordinate    = (Coordinate)ifs.ChildrenWithAppliedReferences.FirstOrDefault(n => n.GetType() == typeof(Coordinate));
            colorNode     = (Color)ifs.ChildrenWithAppliedReferences.FirstOrDefault(n => n.GetType() == typeof(Color));
            colorRGBANode = (ColorRGBA)ifs.ChildrenWithAppliedReferences.FirstOrDefault(n => n.GetType() == typeof(ColorRGBA));

            packed.RGBA             = colorRGBANode != null;
            packed.RGB              = colorNode != null;
            packed.Coloring         = packed.RGBA || packed.RGB;
            packed.generateColorMap = packed.Coloring;

            if (packed.RGB && !packed.RGBA)
            {
                packed.color = X3DTypeConverters.Floats(colorNode.color);
            }
            else if (packed.RGBA && !packed.RGB)
            {
                packed.color = X3DTypeConverters.Floats(colorRGBANode.color);
            }

            if (texCoordinate != null && !string.IsNullOrEmpty(ifs.texCoordIndex))
            {
                packed._texIndices = X3DTypeConverters.ParseIndicies(ifs.texCoordIndex);
                packed._texCoords  = X3DTypeConverters.MFVec2f(texCoordinate.point);
                packed.Texturing   = true;
            }

            if (coordinate != null && !string.IsNullOrEmpty(ifs.coordIndex))
            {
                packed._indices = X3DTypeConverters.ParseIndicies(ifs.coordIndex);
                packed._coords  = X3DTypeConverters.MFVec3f(coordinate.point);

                if (!string.IsNullOrEmpty(ifs.colorIndex))
                {
                    packed._colorIndicies = X3DTypeConverters.ParseIndicies(ifs.colorIndex);
                }

                if (ifs.coordIndex.Contains(RESTART_INDEX.ToString()))
                {
                    packed.restartIndex = RESTART_INDEX;
                }

                packed.Interleave();
            }

            return(packed);
        }