mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2025-02-19 02:22:01 +00:00
add credits for borrowed code from RMQEngine
This commit is contained in:
parent
3483a74c91
commit
77306075d1
4 changed files with 26 additions and 10 deletions
|
@ -355,6 +355,13 @@ void GL_MakeAliasModelDisplayLists (qmodel_t *m, aliashdr_t *hdr)
|
||||||
unsigned int r_meshindexbuffer = 0;
|
unsigned int r_meshindexbuffer = 0;
|
||||||
unsigned int r_meshvertexbuffer = 0;
|
unsigned int r_meshvertexbuffer = 0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
================
|
||||||
|
GL_MakeAliasModelDisplayLists_VBO
|
||||||
|
|
||||||
|
Original code by MH from RMQEngine
|
||||||
|
================
|
||||||
|
*/
|
||||||
void GL_MakeAliasModelDisplayLists_VBO (void)
|
void GL_MakeAliasModelDisplayLists_VBO (void)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
|
@ -450,6 +457,13 @@ extern float r_avertexnormals[NUMVERTEXNORMALS][3];
|
||||||
GLuint r_meshvbo = 0;
|
GLuint r_meshvbo = 0;
|
||||||
GLuint r_meshindexesvbo = 0;
|
GLuint r_meshindexesvbo = 0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
================
|
||||||
|
GLMesh_LoadVertexBuffers
|
||||||
|
|
||||||
|
Original code by MH from RMQEngine
|
||||||
|
================
|
||||||
|
*/
|
||||||
void GLMesh_LoadVertexBuffers (void)
|
void GLMesh_LoadVertexBuffers (void)
|
||||||
{
|
{
|
||||||
int j;
|
int j;
|
||||||
|
|
|
@ -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
|
// split out to keep vertex sizes down
|
||||||
typedef struct aliasmesh_s
|
typedef struct aliasmesh_s
|
||||||
{
|
{
|
||||||
|
@ -295,11 +296,11 @@ typedef struct meshxyz_s
|
||||||
float normal[3];
|
float normal[3];
|
||||||
} meshxyz_t;
|
} meshxyz_t;
|
||||||
|
|
||||||
|
|
||||||
typedef struct meshst_s
|
typedef struct meshst_s
|
||||||
{
|
{
|
||||||
float st[2];
|
float st[2];
|
||||||
} meshst_t;
|
} meshst_t;
|
||||||
|
//--
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
|
|
@ -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)
|
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 vec3 Pose1Normal;\n"
|
||||||
"attribute vec4 Pose2Vert;\n"
|
"attribute vec4 Pose2Vert;\n"
|
||||||
"attribute vec3 Pose2Normal;\n"
|
"attribute vec3 Pose2Normal;\n"
|
||||||
"float r_avertexnormal_dot(vec3 vertexnormal)\n"
|
"float r_avertexnormal_dot(vec3 vertexnormal) // from MH \n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" float dot = dot(vertexnormal, ShadeVector);\n"
|
" float dot = dot(vertexnormal, ShadeVector);\n"
|
||||||
" // wtf - this reproduces anorm_dots within as reasonable a degree of tolerance as the >= 0 case\n"
|
" // wtf - this reproduces anorm_dots within as reasonable a degree of tolerance as the >= 0 case\n"
|
||||||
|
@ -237,19 +239,18 @@ 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_VertexAttribPointerFunc (pose2NormalAttrIndex, 3, GL_FLOAT, GL_FALSE, sizeof (meshxyz_t), GLARB_GetNormalOffset (paliashdr, lerpdata.pose2));
|
||||||
GL_EnableVertexAttribArrayFunc (pose2NormalAttrIndex);
|
GL_EnableVertexAttribArrayFunc (pose2NormalAttrIndex);
|
||||||
|
|
||||||
// Uniform
|
// set uniforms
|
||||||
|
|
||||||
GL_Uniform1fFunc(blendLoc, blend);
|
GL_Uniform1fFunc(blendLoc, blend);
|
||||||
GL_Uniform3fFunc(shadevectorLoc, shadevector[0], shadevector[1], shadevector[2]);
|
GL_Uniform3fFunc(shadevectorLoc, shadevector[0], shadevector[1], shadevector[2]);
|
||||||
GL_Uniform4fFunc(lightColorLoc, lightcolor[0], lightcolor[1], lightcolor[2], entalpha);
|
GL_Uniform4fFunc(lightColorLoc, lightcolor[0], lightcolor[1], lightcolor[2], entalpha);
|
||||||
|
|
||||||
//
|
// draw
|
||||||
// ericw -- bind it and stuff
|
|
||||||
|
|
||||||
// GL_SelectTexture (GL_TEXTURE0_ARB);
|
|
||||||
// glEnable(GL_TEXTURE_2D);
|
|
||||||
glDrawElements(GL_TRIANGLES, paliashdr->numindexes, GL_UNSIGNED_SHORT, (void *)(intptr_t)paliashdr->vboindexofs);
|
glDrawElements(GL_TRIANGLES, paliashdr->numindexes, GL_UNSIGNED_SHORT, (void *)(intptr_t)paliashdr->vboindexofs);
|
||||||
|
|
||||||
|
// clean up
|
||||||
|
|
||||||
GL_DisableVertexAttribArrayFunc(pose1VertexAttrIndex);
|
GL_DisableVertexAttribArrayFunc(pose1VertexAttrIndex);
|
||||||
GL_DisableVertexAttribArrayFunc(pose2VertexAttrIndex);
|
GL_DisableVertexAttribArrayFunc(pose2VertexAttrIndex);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue