Hi, On Monday 29 September 2008 16:23, John Cummings wrote: > I have one small suggestion. Instead of always creating both the > repeating and clamped texture, I might delay the instantiation until > needed. I started making this change by putting the texture > initialization in the toTextureStateSet method. However, that method is > declared a "const" method, which I could have either removed the "const" > or declared the two texture objects mutable. I assumed that was a reason > for the method to be "const," so I stopped work on this change and > decided just to send this email.
Hmm, that would not work - at least in the current implementation. Just because of that TextureData class is not passed by reference or pointer to its users. There is a whole copy of that class having the pointers to the original Texture2D instances. So, if you delay allocating them, you will create new ones in a local copy of TextureData but not in the one caching them on a per file basis. The per file global original copy of that TextureData will *never* have any Texture2D pointer set ... I am currently not sure why this is copied, but there may be a reason ... If you can make sure that the class is not copied by intention and if you can make sure that you will not copy the content, doing that on demand is ok. Anyway, I would just leave it like that. That extra allocation that might be needless is done for every image file that is loaded or at least queried from osgDB. So I doubt that you will even notice that. > So, other than this small suggestion, I am happy with this patch. I > think the temporary overhead of at most one extra texture object per > texture used in an AC3D model could be considered negligible enough to > not bother. So, unless Mathias considers my suggestion worth pursuing, I > would just commit his patch. ... You name it :) Greetings Mathias -- Dr. Mathias Fröhlich, science + computing ag, Software Solutions Hagellocher Weg 71-75, D-72070 Tuebingen, Germany Phone: +49 7071 9457-268, Fax: +49 7071 9457-511 -- Vorstand/Board of Management: Dr. Bernd Finkbeiner, Dr. Florian Geyer, Dr. Roland Niemeier, Dr. Arno Steitz, Dr. Ingrid Zech Vorsitzender des Aufsichtsrats/ Chairman of the Supervisory Board: Prof. Dr. Hanns Ruder Sitz/Registered Office: Tuebingen Registergericht/Registration Court: Stuttgart Registernummer/Commercial Register No.: HRB 382196 _______________________________________________ osg-submissions mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
