SpOOky wrote:
So it would it would be possible to load resources in a thread and pass them to Horde3D running in another one?
I've done this in my last few Horde projects.
I had my main (horde) thread and the file-loading thread communicate via thread-safe queues. I would get the list of assets that horde is asking for, and put them into a queue to the loader. The loading thread would read items from the queue, load the data into buffers, and put those buffers into another queue to send them back to the main thread. The main thread would read from this data-queue once per-frame, and send the data to Horde.
I would only ever send one asset to Horde per frame (even if the loader has put two into the queue), because Horde can be quite slow when processing large resources.
Time for some ASCII art:
Code:
| Main thread | Loading thread |
| | |
| +-----+-----+ |
| name>-|thread-safe|-> name |
| | queue | L|
| +-----+-----+ O|
| | A|
| +-----+-----+ D|
| data<-|thread-safe|-< data |
| | queue | |
| +-----+-----+ |
| | |