Well, I'll try to post all the relevant code about resource loading.
edit: These are the only options I am manually setting. Any material settings and such are set when they are loaded, and it works fine if I force it to load all at once.
Code:
h3dSetOption(H3DOptions::LoadTextures, 1);
h3dSetOption(H3DOptions::TexCompression, 0);
h3dSetOption(H3DOptions::FastAnimation, 0);
h3dSetOption(H3DOptions::MaxAnisotropy, 4);
h3dSetOption(H3DOptions::ShadowMapSize, 2048);
Code:
// Resource addition
void ModelAttachment::init(){
_resHandle = h3dAddResource(H3DResTypes::SceneGraph, _resName.c_str(), 0);
...
}
// Task addition - runs on main thread
void ResourceManager::FinalizeResource(){
...
loadedTask->Finalize()
...
if (loadNextHordeRes){
H3DRes res = h3dQueryUnloadedResource(0);
if (res != 0){
HordeResPtr r_ptr = new HordeResPtr(new HordeRes(res));
HordeResTaskPtr t_ptr = new HordeResTaskPtr(new HordeResTask(r_ptr));
AddResourceTask(t_ptr);
}
}
}
// Runs on a separate thread
void HordeResTask::Load(){
_dataSize = 0;
_data = 0;
std::fstream in;
in.open(_resource->getFileName(), std::ios::in | std::ios::binary);
if (in.is_open()){
in.seekg(0, in.end);
_dataSize = in.tellg();
in.seekg(0, in.beg);
if (_dataSize > 0){
_data = new char[_dataSize];
in.read(_data, _dataSize);
}
else {
_resource->_loadFailed = true;
}
}
else {
_resource->_loadFailed = true;
}
}
// Runs on main thread
void HordeResTask::Finalize(){
if (h3dLoadResource(_resource->_resHandle, _data, _dataSize) && !_resource->_loadFailed)
_resource->_isLoaded = true;
else
_resource->_loadFailed = true;
if (_dataSize > 0){
delete[] _data;
_dataSize = 0;
}
}
// Check before using a resource
bool ModelAttachment::isReady(){
if (!_ready){
if (h3dIsResLoaded(_resHandle)){
_node = h3dAddNodes(H3DRootNode, _resHandle);
_ready = true;
}
}
return _ready;
}
Some log output if it helps.
Code:
Initializing GL2 backend using OpenGL driver '4.4.0 NVIDIA 344.75' by 'NVIDIA Corporation' on 'GeForce GTX 760/PCIe/SSE2'
Loading resource 'models/knight/knight.scene.xml'
Loading resource 'animations/knight_order.anim'
Loading resource 'animations/knight_attack.anim'
Loading resource 'particles/particleSys1/particleSys1.scene.xml'
Loading resource 'models/knight/knight.geo'
Loading resource 'models/knight/knight.material.xml'
Loading resource 'particles/particleSys1/particle1.material.xml'
Loading resource 'particles/particleSys1/particle1.particle.xml'
Loading resource 'particles/particleSys1/particle2.material.xml'
Loading resource 'particles/particleSys1/particle2.particle.xml'
Loading resource 'shaders/model.shader'
Loading resource 'models/knight/knight.jpg'
Loading resource 'models/skybox/skybox.dds'
Loading resource 'shaders/particle.shader'
Loading resource 'textures/particles/particle1.tga'
Loading resource 'overlays/logo.tga'
Loading resource 'shaders/utilityLib/vertCommon.glsl'
Loading resource 'shaders/utilityLib/vertSkinning.glsl'
---- C O M P I L I N G . S H A D E R . shaders/model.shader@SHADOWMAP[1] ----
Loading resource 'shaders/utilityLib/fragDeferredWrite.glsl'
---- C O M P I L I N G . S H A D E R . shaders/model.shader@ATTRIBPASS[1] ----
Loading resource 'shaders/utilityLib/fragLighting.glsl'
---- C O M P I L I N G . S H A D E R . shaders/model.shader@LIGHTING[1] ----
---- C O M P I L I N G . S H A D E R . shaders/model.shader@AMBIENT[9] ----
Loading resource 'textures/common/white.tga'
Loading resource 'textures/common/defnorm.tga'
Loading resource 'shaders/utilityLib/vertParticle.glsl'
---- C O M P I L I N G . S H A D E R . shaders/particle.shader@TRANSLUCENT[0] ----
Loading resource 'models/sphere/sphere.scene.xml'
Loading resource 'pipelines/forward.pipeline.xml'
Loading resource 'pipelines/hdr.pipeline.xml'
Loading resource 'models/sphere/stones.material.xml'
---- C O M P I L I N G . S H A D E R . shaders/model.shader@ATTRIBPASS[4] ----
---- C O M P I L I N G . S H A D E R . shaders/model.shader@SHADOWMAP[0] ----
---- C O M P I L I N G . S H A D E R . shaders/model.shader@LIGHTING[4] ----
---- C O M P I L I N G . S H A D E R . shaders/model.shader@AMBIENT[4] ----
Loading resource 'pipelines/globalSettings.material.xml'
Loading resource 'pipelines/postHDR.material.xml'
Loading resource 'models/sphere/sphere.geo'
Loading resource 'textures/models/layingrock.jpg'
Loading resource 'textures/ambientMap.dds'
Loading resource 'shaders/postHDR.shader'
---- C O M P I L I N G . S H A D E R . shaders/postHDR.shader@FINALPASS[0] ----
Loading resource 'textures/models/layingrockBump.tga'
Loading resource 'shaders/utilityLib/fragPostProcess.glsl'
---- C O M P I L I N G . S H A D E R . shaders/postHDR.shader@BRIGHTPASS[0] ----
---- C O M P I L I N G . S H A D E R . shaders/postHDR.shader@BLUR[0] ----