diff --git a/quakespasm/Quake/gl_mesh.c b/quakespasm/Quake/gl_mesh.c index 0a21a403..ad7b0ac8 100644 --- a/quakespasm/Quake/gl_mesh.c +++ b/quakespasm/Quake/gl_mesh.c @@ -355,6 +355,13 @@ void GL_MakeAliasModelDisplayLists (qmodel_t *m, aliashdr_t *hdr) unsigned int r_meshindexbuffer = 0; unsigned int r_meshvertexbuffer = 0; +/* +================ +GL_MakeAliasModelDisplayLists_VBO + +Original code by MH from RMQEngine +================ +*/ void GL_MakeAliasModelDisplayLists_VBO (void) { int i, j; @@ -450,6 +457,13 @@ extern float r_avertexnormals[NUMVERTEXNORMALS][3]; GLuint r_meshvbo = 0; GLuint r_meshindexesvbo = 0; +/* +================ +GLMesh_LoadVertexBuffers + +Original code by MH from RMQEngine +================ +*/ void GLMesh_LoadVertexBuffers (void) { int j; diff --git a/quakespasm/Quake/gl_model.c b/quakespasm/Quake/gl_model.c index 4bf29171..1cb58449 100644 --- a/quakespasm/Quake/gl_model.c +++ b/quakespasm/Quake/gl_model.c @@ -2515,7 +2515,7 @@ void Mod_LoadAliasModel (qmodel_t *mod, void *buffer) Sys_Error ("model %s has too many vertices", mod->name); pheader->numtris = LittleLong (pinmodel->numtris); - + if (pheader->numtris <= 0) Sys_Error ("model %s has no triangles", mod->name); diff --git a/quakespasm/Quake/gl_model.h b/quakespasm/Quake/gl_model.h index 8bc1d879..d724fb32 100644 --- a/quakespasm/Quake/gl_model.h +++ b/quakespasm/Quake/gl_model.h @@ -282,6 +282,7 @@ Alias models are position independent, so the cache manager can move them. ============================================================================== */ +//-- from RMQEngine // split out to keep vertex sizes down typedef struct aliasmesh_s { @@ -295,11 +296,11 @@ typedef struct meshxyz_s float normal[3]; } meshxyz_t; - typedef struct meshst_s { float st[2]; } meshst_t; +//-- typedef struct { diff --git a/quakespasm/Quake/r_alias.c b/quakespasm/Quake/r_alias.c index 45de854c..b40cc30a 100644 --- a/quakespasm/Quake/r_alias.c +++ b/quakespasm/Quake/r_alias.c @@ -86,7 +86,9 @@ void *GLARB_GetNormalOffset (aliashdr_t *hdr, int pose) /* ============= -GL_DrawAliasFrame_GLSL +GL_DrawAliasFrame_GLSL -- ericw + +Based on code by MH from RMQEngine ============= */ void GL_DrawAliasFrame_GLSL (aliashdr_t *paliashdr, lerpdata_t lerpdata) @@ -127,7 +129,7 @@ void GL_DrawAliasFrame_GLSL (aliashdr_t *paliashdr, lerpdata_t lerpdata) "attribute vec3 Pose1Normal;\n" "attribute vec4 Pose2Vert;\n" "attribute vec3 Pose2Normal;\n" - "float r_avertexnormal_dot(vec3 vertexnormal)\n" + "float r_avertexnormal_dot(vec3 vertexnormal) // from MH \n" "{\n" " float dot = dot(vertexnormal, ShadeVector);\n" " // wtf - this reproduces anorm_dots within as reasonable a degree of tolerance as the >= 0 case\n" @@ -237,18 +239,17 @@ void GL_DrawAliasFrame_GLSL (aliashdr_t *paliashdr, lerpdata_t lerpdata) GL_VertexAttribPointerFunc (pose2NormalAttrIndex, 3, GL_FLOAT, GL_FALSE, sizeof (meshxyz_t), GLARB_GetNormalOffset (paliashdr, lerpdata.pose2)); GL_EnableVertexAttribArrayFunc (pose2NormalAttrIndex); - // Uniform + // set uniforms GL_Uniform1fFunc(blendLoc, blend); GL_Uniform3fFunc(shadevectorLoc, shadevector[0], shadevector[1], shadevector[2]); GL_Uniform4fFunc(lightColorLoc, lightcolor[0], lightcolor[1], lightcolor[2], entalpha); - -// -// ericw -- bind it and stuff -// GL_SelectTexture (GL_TEXTURE0_ARB); -// glEnable(GL_TEXTURE_2D); + // draw + glDrawElements(GL_TRIANGLES, paliashdr->numindexes, GL_UNSIGNED_SHORT, (void *)(intptr_t)paliashdr->vboindexofs); + + // clean up GL_DisableVertexAttribArrayFunc(pose1VertexAttrIndex); GL_DisableVertexAttribArrayFunc(pose2VertexAttrIndex);