Esempio n. 1
0
        // NodeFilter overrides
        protected virtual AttributedNodeList process(FragmentList input, FilterEnv env)
        {
            AttributedNodeList nodes;

            osg.Geode geode = null;
            for (FragmentList.const_iterator i = input.begin(); i != input.end(); i++)
            {
                Fragment frag = i;

                AttributeList frag_attrs = frag.getAttributes();

                if (!geode)
                {
                    geode = new osg.Geode();
                    nodes.Add(new AttributedNode(geode, frag_attrs));
                }

                for (DrawableList.const_iterator d = frag.getDrawables().begin(); d != frag.getDrawables().end(); d++)
                {
                    geode.addDrawable(d.get());
                }

                bool retire_geode = false;

                // if a fragment name is set, apply it
                if (frag.hasName())
                {
                    geode.addDescription(frag.getName());
                    retire_geode = true;
                }

                if (getEmbedAttributes())
                {
                    embedAttributes(geode, frag_attrs);
                    retire_geode = true;
                }

                // If required, reset the geode point so that the next fragment gets placed in a new geode.
                if (retire_geode)
                {
                    geode = null;
                }
            }

            // with multiple geodes or fragment names, disable geode combining to preserve the node decription.
            if (nodes.Count > 1)
            {
                env.getOptimizerHints().exclude(osgUtil.Optimizer.MERGE_GEODES);
            }

            return(process(nodes, env));
        }
Esempio n. 2
0
        /**
         * Processes a single fragment into a collection of nodes.
         *
         * @param input
         *      Individual fragment to process
         * @param env
         *      Contextual compilation environment
         * @return
         *      Resulting node list
         */
        public virtual AttributedNodeList process(Fragment input, FilterEnv env)
        {
#if TODO
            AttributedNodeList output;
            osg.Geode          geode = new osg.Geode();
            foreach (Drawable i in input.getDrawables())
            {
                geode.addDrawable(i);
            }
            output.Add(new AttributedNode(geode));
            return(output);
#endif
            throw new NotImplementedException();
        }