When models include two sets of texture coords, let the glsl actually access them.

This commit is contained in:
Shpoike 2023-02-11 04:45:38 +00:00
parent 4431972ff6
commit a70c84a2bc
2 changed files with 9 additions and 0 deletions

View file

@ -1718,6 +1718,7 @@ qboolean Alias_GAliasBuildMesh(mesh_t *mesh, vbo_t **vbop, galiasinfo_t *inf, in
bytecolours = !!inf->ofs_rgbaub; bytecolours = !!inf->ofs_rgbaub;
#endif #endif
mesh->st_array = inf->ofs_st_array; mesh->st_array = inf->ofs_st_array;
mesh->lmst_array[0] = inf->ofs_lmst_array; //some formats allow for two.
#endif #endif
mesh->trneighbors = inf->ofs_trineighbours; 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.indexcount = inf->numindexes;
meshcache.vbo.vertcount = inf->numverts; meshcache.vbo.vertcount = inf->numverts;
meshcache.vbo.texcoord = inf->vbotexcoords; meshcache.vbo.texcoord = inf->vbotexcoords;
meshcache.vbo.lmcoord[0] = inf->vbolmtexcoords;
meshcache.vbo.coord = inf->vbo_skel_verts; meshcache.vbo.coord = inf->vbo_skel_verts;
memset(&meshcache.vbo.coord2, 0, sizeof(meshcache.vbo.coord2)); memset(&meshcache.vbo.coord2, 0, sizeof(meshcache.vbo.coord2));
meshcache.vbo.normals = inf->vbo_skel_normals; 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.indexcount = inf->numindexes;
meshcache.vbo.vertcount = inf->numverts; meshcache.vbo.vertcount = inf->numverts;
meshcache.vbo.texcoord = inf->vbotexcoords; meshcache.vbo.texcoord = inf->vbotexcoords;
meshcache.vbo.lmcoord[0] = inf->vbolmtexcoords;
meshcache.vbo.coord = inf->vbo_skel_verts; meshcache.vbo.coord = inf->vbo_skel_verts;
memset(&meshcache.vbo.coord2, 0, sizeof(meshcache.vbo.coord2)); memset(&meshcache.vbo.coord2, 0, sizeof(meshcache.vbo.coord2));
meshcache.vbo.normals = inf->vbo_skel_normals; 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.indexcount = inf->numindexes;
meshcache.vbo.vertcount = inf->numverts; meshcache.vbo.vertcount = inf->numverts;
meshcache.vbo.texcoord = inf->vbotexcoords; meshcache.vbo.texcoord = inf->vbotexcoords;
meshcache.vbo.lmcoord[0] = inf->vbolmtexcoords;
#ifdef SKELETALMODELS #ifdef SKELETALMODELS
memset(&meshcache.vbo.bonenums, 0, sizeof(meshcache.vbo.bonenums)); 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. //determine the amount of space we need for our vbos.
if (galias->ofs_st_array) if (galias->ofs_st_array)
vbospace += sizeof(*galias->ofs_st_array) * galias->numverts; 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) if (galias->ofs_rgbaf)
vbospace += sizeof(*galias->ofs_rgbaf) * galias->numverts; vbospace += sizeof(*galias->ofs_rgbaf) * galias->numverts;
else if (galias->ofs_rgbaub) else if (galias->ofs_rgbaub)
@ -3112,6 +3118,8 @@ static void Mod_GenerateMeshVBO(model_t *mod, galiasinfo_t *galias)
BE_VBO_Begin(&vboctx, vbospace); BE_VBO_Begin(&vboctx, vbospace);
if (galias->ofs_st_array) if (galias->ofs_st_array)
BE_VBO_Data(&vboctx, galias->ofs_st_array, sizeof(*galias->ofs_st_array) * galias->numverts, &galias->vbotexcoords); 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) if (galias->ofs_rgbaf)
BE_VBO_Data(&vboctx, galias->ofs_rgbaf, sizeof(*galias->ofs_rgbaf) * galias->numverts, &galias->vborgba); BE_VBO_Data(&vboctx, galias->ofs_rgbaf, sizeof(*galias->ofs_rgbaf) * galias->numverts, &galias->vborgba);
else if (galias->ofs_rgbaub) else if (galias->ofs_rgbaub)

View file

@ -205,6 +205,7 @@ typedef struct galiasinfo_s
#endif #endif
vboarray_t vboindicies; vboarray_t vboindicies;
vboarray_t vbotexcoords; vboarray_t vbotexcoords;
vboarray_t vbolmtexcoords;
vboarray_t vborgba; //yeah, just you try reading THAT as an actual word. vboarray_t vborgba; //yeah, just you try reading THAT as an actual word.
void *vbomem; void *vbomem;
void *ebomem; void *ebomem;