11 hours ago, ApochPiQ said:
Also when you get a callstack in the debugger that you don't understand (or really anything any time that you don't understand) please DO NOT ASSUME it is wrong, useless, or not worth including in your post. Challenge your assumptions and learn, don't turn into that person who assumes computers are magic.
It probably won't have anything to do with the crash location shown in the editor: brdf_scene.cpp is always the file that is automatically opened upon crashing. Visual Studio points to the closing namespace brace of that file mentioning that an exception is thrown. The stack, however, does not mention anything from brdf_scene.cpp, though if I click the topmost call I am always directed to brdf_scene.cpp (but the actual call is not in this file or anywhere close to this file?).
The crash, however, is probably still related to the stack. ModelPart is part of my model loading. If I just do not load any models in a scene, the program runs fine.
I also noticed something odd:
template< typename VertexT, typename IndexT >
void MDLReader< VertexT, IndexT >::ReadMDLSubModel() {
ModelPart model_part;
model_part.m_child = Read< string >();
model_part.m_parent = Read< string >();
model_part.m_translation = Read< F32x3 >();
model_part.m_rotation = Read< F32x3 >();
model_part.m_scale = Read< F32x3 >();
model_part.m_material = Read< string >();
model_part.m_start_index = Read< U32 >();
model_part.m_nb_indices = Read< U32 >();
m_model_output.AddModelPart(std::move(model_part)); // Break point at this statement
}
I put a break point at the last statement. model_part seems to have the correct data.
Now, I make sure that the next invocation is not inlined (which as a side effect results in the actual inlining of the previous method):
template< typename VertexT, typename IndexT >
__declspec(noinline) void ModelOutput< VertexT, IndexT >
::AddModelPart(ModelPart model_part, bool create_bounding_volumes) {
m_model_parts.push_back(std::move(model_part)); // Break point at this statement
if (create_bounding_volumes) {
SetupBoundingVolumes(m_model_parts.back());
}
}
Here, the data looks completely corrupt? The 3 strings have a <NULL> value and all the U32/F32x3's have random values? This is pretty weird for my F32x3 structs containing 3x floats and have an empty constructor ensuring zero-initialization.
The bigger question, however, is how the ModelPart can become corrupted between these break points?
Edit: If I use a reference, I succeed in importing models and meshes, but then it crashes in the game loop since the mesh data is completely corrupt?