mirror of
https://github.com/bjornbytes/lovr.git
synced 2024-07-07 06:43:34 +00:00
Use computed global transforms instead of local;
This commit is contained in:
parent
2f0aab03be
commit
17ffebd6ae
|
@ -10,7 +10,7 @@ static void renderNode(Model* model, int nodeIndex) {
|
||||||
bool useMaterials = currentMaterial->isDefault;
|
bool useMaterials = currentMaterial->isDefault;
|
||||||
|
|
||||||
lovrGraphicsPush();
|
lovrGraphicsPush();
|
||||||
lovrGraphicsMatrixTransform(MATRIX_MODEL, model->localNodeTransforms + 16 * nodeIndex);
|
lovrGraphicsMatrixTransform(MATRIX_MODEL, model->globalNodeTransforms + 16 * nodeIndex);
|
||||||
|
|
||||||
float globalInverse[16];
|
float globalInverse[16];
|
||||||
mat4_set(globalInverse, model->globalNodeTransforms + nodeIndex * 16);
|
mat4_set(globalInverse, model->globalNodeTransforms + nodeIndex * 16);
|
||||||
|
@ -48,11 +48,12 @@ static void renderNode(Model* model, int nodeIndex) {
|
||||||
lovrMeshDraw(model->mesh, NULL);
|
lovrMeshDraw(model->mesh, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lovrGraphicsPop();
|
||||||
|
|
||||||
for (int i = 0; i < node->children.length; i++) {
|
for (int i = 0; i < node->children.length; i++) {
|
||||||
renderNode(model, node->children.data[i]);
|
renderNode(model, node->children.data[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
lovrGraphicsPop();
|
|
||||||
if (useMaterials) {
|
if (useMaterials) {
|
||||||
lovrGraphicsSetMaterial(currentMaterial);
|
lovrGraphicsSetMaterial(currentMaterial);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue