Fidora, sorry for the late reply.
Fidora wrote:
What are your thoughts on the interface (other than streaming vs. streamable, which i agree with)?
If I were to re-implement texture streaming to reduce memory usage but keep the current interface do you think it would have any chance to get integrated into official Horde3D?
Basically your interface is quite good. But to be included in Horde, it would really have to support texture streaming for coping with limited memory.
Basically I see two types of streaming which are important: streaming of world sectors and streaming of details. World streaming is something very specific to a game world (may require non-graphics data, e.g. sounds, entities, ...) so it should be handled by the application. The only thing Horde could contribute there is a thread-safe loadResource function, so that the graphics data deserialization could be done in a separate thread. The second thing, the detail streaming, is basically the texture streaming that we have discussed so far. A simple solution for texture streaming could be implemented directly in Horde. Here a few thoughts:
I would suggest that streamable texture resources have two OpenGL textures: one low resolution version which is always loaded and kept in memory and a high resolution one that is loaded and freed as required, depending on the distance and free space in the texture pool. For the beginning, a simple distance function (e.g. log(dist) or something like that) can be used to determine which highres mip needs to be loaded. The function can always be tweaked later. Horde would add that texture to a list of requested streamed textures. The user polls the textures to be streamed, gets the file offset and size, loads it in a background thread and forwards the data to Horde. The interface for this can be very similar to what you have now.
There is still one drawback with the described solution: although a lowres mip is used for a streamable texture at loading time, the whole dds needs to be read from disk. We could implement a more complicated mechanism here (e.g. queryUnloadedResource gives back a file offset and size) but I don't know if this will really be faster. I think reading a dds file from disk without uploading it to the GPU should be very fast. A more complicated loading mechanism would require several accesses to the file. I don't know exactly how expensive seeking a file is compared to reading in a few megabytes.