mirror of
https://github.com/bjornbytes/lovr.git
synced 2024-07-02 12:33:52 +00:00
Fix Mesh unmapping;
This commit is contained in:
parent
30647c97c5
commit
25e6f3ce4e
|
@ -637,6 +637,8 @@ int l_lovrGraphicsNewMesh(lua_State* L) {
|
||||||
|
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lovrMeshUnmap(mesh);
|
||||||
}
|
}
|
||||||
|
|
||||||
vec_deinit(&format);
|
vec_deinit(&format);
|
||||||
|
|
|
@ -93,6 +93,7 @@ Model* lovrModelCreate(ModelData* modelData) {
|
||||||
model->mesh = lovrMeshCreate(vertices.length / components, &format, MESH_TRIANGLES, MESH_STATIC);
|
model->mesh = lovrMeshCreate(vertices.length / components, &format, MESH_TRIANGLES, MESH_STATIC);
|
||||||
void* data = lovrMeshMap(model->mesh, 0, vertices.length / components);
|
void* data = lovrMeshMap(model->mesh, 0, vertices.length / components);
|
||||||
memcpy(data, vertices.data, vertices.length * sizeof(float));
|
memcpy(data, vertices.data, vertices.length * sizeof(float));
|
||||||
|
lovrMeshUnmap(model->mesh);
|
||||||
lovrMeshSetVertexMap(model->mesh, indices.data, indices.length);
|
lovrMeshSetVertexMap(model->mesh, indices.data, indices.length);
|
||||||
|
|
||||||
model->texture = NULL;
|
model->texture = NULL;
|
||||||
|
|
|
@ -32,7 +32,7 @@ ModelData* lovrModelDataCreate(Blob* blob) {
|
||||||
modelData->hasNormals = 0;
|
modelData->hasNormals = 0;
|
||||||
modelData->hasTexCoords = 0;
|
modelData->hasTexCoords = 0;
|
||||||
|
|
||||||
unsigned int flags = aiProcessPreset_TargetRealtime_MaxQuality | aiProcess_OptimizeGraph;
|
unsigned int flags = aiProcessPreset_TargetRealtime_MaxQuality | aiProcess_OptimizeGraph | aiProcess_FlipUVs;
|
||||||
const struct aiScene* scene = aiImportFileFromMemory(blob->data, blob->size, flags, NULL);
|
const struct aiScene* scene = aiImportFileFromMemory(blob->data, blob->size, flags, NULL);
|
||||||
|
|
||||||
// Meshes
|
// Meshes
|
||||||
|
|
Loading…
Reference in a new issue