mirror of https://github.com/bjornbytes/lovr.git
Error instead of crashing when skin has too many joints;
ModelData is still allowed to load skins with more joints, since the limitation is in the graphics side of things (Model). Eventually we will use a buffer for joints to alleviate this.
This commit is contained in:
parent
f160ed75e9
commit
b0289de9a6
|
@ -184,6 +184,12 @@ Model* lovrModelCreate(ModelData* data) {
|
|||
}
|
||||
}
|
||||
|
||||
// Ensure skin bone count doesn't exceed the maximum supported limit
|
||||
for (uint32_t i = 0; i < data->skinCount; i++) {
|
||||
uint32_t jointCount = data->skins[i].jointCount;
|
||||
lovrAssert(jointCount < MAX_BONES, "ModelData skin '%d' has too many joints (%d, max is %d)", i, jointCount, MAX_BONES);
|
||||
}
|
||||
|
||||
model->localTransforms = malloc(sizeof(NodeTransform) * data->nodeCount);
|
||||
model->globalTransforms = malloc(16 * sizeof(float) * data->nodeCount);
|
||||
lovrModelResetPose(model);
|
||||
|
|
Loading…
Reference in New Issue