From a70c84a2bc02819975406f837a8383e2e57d9556 Mon Sep 17 00:00:00 2001 From: Shpoike Date: Sat, 11 Feb 2023 04:45:38 +0000 Subject: [PATCH] When models include two sets of texture coords, let the glsl actually access them. --- engine/common/com_mesh.c | 8 ++++++++ engine/common/com_mesh.h | 1 + 2 files changed, 9 insertions(+) diff --git a/engine/common/com_mesh.c b/engine/common/com_mesh.c index 4a9c38607..275f9b4cf 100644 --- a/engine/common/com_mesh.c +++ b/engine/common/com_mesh.c @@ -1718,6 +1718,7 @@ qboolean Alias_GAliasBuildMesh(mesh_t *mesh, vbo_t **vbop, galiasinfo_t *inf, in bytecolours = !!inf->ofs_rgbaub; #endif mesh->st_array = inf->ofs_st_array; + mesh->lmst_array[0] = inf->ofs_lmst_array; //some formats allow for two. #endif mesh->trneighbors = inf->ofs_trineighbours; @@ -1831,6 +1832,7 @@ qboolean Alias_GAliasBuildMesh(mesh_t *mesh, vbo_t **vbop, galiasinfo_t *inf, in meshcache.vbo.indexcount = inf->numindexes; meshcache.vbo.vertcount = inf->numverts; meshcache.vbo.texcoord = inf->vbotexcoords; + meshcache.vbo.lmcoord[0] = inf->vbolmtexcoords; meshcache.vbo.coord = inf->vbo_skel_verts; memset(&meshcache.vbo.coord2, 0, sizeof(meshcache.vbo.coord2)); meshcache.vbo.normals = inf->vbo_skel_normals; @@ -1897,6 +1899,7 @@ qboolean Alias_GAliasBuildMesh(mesh_t *mesh, vbo_t **vbop, galiasinfo_t *inf, in meshcache.vbo.indexcount = inf->numindexes; meshcache.vbo.vertcount = inf->numverts; meshcache.vbo.texcoord = inf->vbotexcoords; + meshcache.vbo.lmcoord[0] = inf->vbolmtexcoords; meshcache.vbo.coord = inf->vbo_skel_verts; memset(&meshcache.vbo.coord2, 0, sizeof(meshcache.vbo.coord2)); meshcache.vbo.normals = inf->vbo_skel_normals; @@ -2030,6 +2033,7 @@ qboolean Alias_GAliasBuildMesh(mesh_t *mesh, vbo_t **vbop, galiasinfo_t *inf, in meshcache.vbo.indexcount = inf->numindexes; meshcache.vbo.vertcount = inf->numverts; meshcache.vbo.texcoord = inf->vbotexcoords; + meshcache.vbo.lmcoord[0] = inf->vbolmtexcoords; #ifdef SKELETALMODELS memset(&meshcache.vbo.bonenums, 0, sizeof(meshcache.vbo.bonenums)); @@ -3083,6 +3087,8 @@ static void Mod_GenerateMeshVBO(model_t *mod, galiasinfo_t *galias) //determine the amount of space we need for our vbos. if (galias->ofs_st_array) vbospace += sizeof(*galias->ofs_st_array) * galias->numverts; + if (galias->ofs_lmst_array) + vbospace += sizeof(*galias->ofs_lmst_array) * galias->numverts; if (galias->ofs_rgbaf) vbospace += sizeof(*galias->ofs_rgbaf) * galias->numverts; else if (galias->ofs_rgbaub) @@ -3112,6 +3118,8 @@ static void Mod_GenerateMeshVBO(model_t *mod, galiasinfo_t *galias) BE_VBO_Begin(&vboctx, vbospace); if (galias->ofs_st_array) BE_VBO_Data(&vboctx, galias->ofs_st_array, sizeof(*galias->ofs_st_array) * galias->numverts, &galias->vbotexcoords); + if (galias->ofs_lmst_array) + BE_VBO_Data(&vboctx, galias->ofs_lmst_array, sizeof(*galias->ofs_lmst_array) * galias->numverts, &galias->vbolmtexcoords); if (galias->ofs_rgbaf) BE_VBO_Data(&vboctx, galias->ofs_rgbaf, sizeof(*galias->ofs_rgbaf) * galias->numverts, &galias->vborgba); else if (galias->ofs_rgbaub) diff --git a/engine/common/com_mesh.h b/engine/common/com_mesh.h index 0bd02f274..3a6220934 100644 --- a/engine/common/com_mesh.h +++ b/engine/common/com_mesh.h @@ -205,6 +205,7 @@ typedef struct galiasinfo_s #endif vboarray_t vboindicies; vboarray_t vbotexcoords; + vboarray_t vbolmtexcoords; vboarray_t vborgba; //yeah, just you try reading THAT as an actual word. void *vbomem; void *ebomem;