Ejemplo n.º 1
0
            void rewrite(osg.StateSet *ss)
            {
                for (int i = 0; i < ss.getTextureAttributeList().Count; i++)
                {
                    osg.Texture2D tex = (osg.Texture2D)(ss.getTextureAttribute(i, osg.StateAttribute.TEXTURE));
                    if (tex && tex.getImage())
                    {
                        string name = tex.getImage().getFileName();

                        // fix the in-archive reference:
                        //if ( archive_name.length() > 0 )
                        //{
                        //    if ( !StringUtils.startsWith( name, archive_name ) )
                        //    {
                        //        std.string path = osgDB.concatPaths( archive_name, tex.getImage().getFileName() );
                        //        tex.getImage().setFileName( path );
                        //        osgGIS.notify(osg.INFO) << "  Rewrote " << name << " as " << path << std.endl;
                        //    }
                        //}
                        //else
                        {
                            string simple = osgDB.getSimpleFileName(name);

                            if (compress_textures)
                            {
                                simple = osgDB.getNameLessExtension(simple) + ".dds";
                            }

                            tex.getImage().setFileName(simple);
                            //TODO osgGIS.notify( osg.INFO ) << "  LayerCompiler.localizeResourceRefs, Rewrote " << name << " as " << simple << std.endl;
                        }
                    }
                }
            }
Ejemplo n.º 2
0
 static void fixMipmapSettings(osg.StateSet ss)
 {
     for (uint i = 0; i < ss.getTextureAttributeList().size(); i++)
     {
         osg.Texture2D tex = (osg.Texture2D)(ss.getTextureAttribute(i, osg.StateAttribute.TEXTURE));
         if (tex != null)
         {
             tex.setFilter(osg.Texture.MIN_FILTER, osg.Texture.LINEAR_MIPMAP_LINEAR);
             tex.setFilter(osg.Texture.MAG_FILTER, osg.Texture.LINEAR);
         }
     }
 }