Tweak comments

This commit is contained in:
Eric Wasylishen 2014-10-23 21:45:38 -06:00
parent 6fac2507ee
commit efa05251f1
3 changed files with 39 additions and 13 deletions

View file

@ -125,7 +125,7 @@ void GL_DrawAliasFrame_ARB (aliashdr_t *paliashdr, lerpdata_t lerpdata)
const GLuint blendLoc = 9;
const GLuint shadevectorLoc = 10;
const GLuint lightColorLoc = 11;
// vertex attribute indices - copied from vpalias.h
const GLint pose1VertexAttrIndex = 0;
const GLint pose1NormalAttrIndex = 1;

View file

@ -1,3 +1,25 @@
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2009 John Fitzgibbons and others
Copyright (C) 2010-2014 QuakeSpasm developers
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#version 110
// Note: were not loading this directly but first compiling it to ARB_vertex_program
@ -11,8 +33,7 @@ attribute vec3 Pose1Normal;
attribute vec4 Pose2Vert;
attribute vec3 Pose2Normal;
// Note about r_avertexnormal_dot:
// The function in the shader produces the same result as the lookup table
// r_avertexnormal_dot() produces the same result as the lookup table in r_alias.c
// (r_avertexnormal_dots[quantized entity angle, from 0-15][compressed vertex normal, 0-161])
// but takes an ordinary vec3 vertex normal instead of a 1-byte compressed normal,
// and requires a ShadeVector uniform variable set as follows:
@ -25,9 +46,8 @@ attribute vec3 Pose2Normal;
//
// where quantangle is the qunatized entity angle, from 0-15.
//
// Thanks MH for providing that (from: http://forums.inside3d.com/viewtopic.php?p=39361#p39361 )
float r_avertexnormal_dot(vec3 vertexnormal) // from MH
// Thanks MH for providing this (from: http://forums.inside3d.com/viewtopic.php?p=39361#p39361 )
float r_avertexnormal_dot(vec3 vertexnormal)
{
float dot = dot(vertexnormal, ShadeVector);
// wtf - this reproduces anorm_dots within as reasonable a degree of tolerance as the >= 0 case
@ -39,14 +59,20 @@ float r_avertexnormal_dot(vec3 vertexnormal) // from MH
void main()
{
gl_TexCoord[0] = gl_MultiTexCoord0;
gl_TexCoord[1] = gl_MultiTexCoord0;
// texture coordinates
gl_TexCoord[0] = gl_MultiTexCoord0; // regular skin
gl_TexCoord[1] = gl_MultiTexCoord0; // fullbright skin (same coordinates as regular)
// lerped vertex
vec4 lerpedVert = mix(Pose1Vert, Pose2Vert, Blend);
gl_Position = gl_ModelViewProjectionMatrix * lerpedVert;
// lerped color
float dot1 = r_avertexnormal_dot(Pose1Normal);
float dot2 = r_avertexnormal_dot(Pose2Normal);
gl_FrontColor = LightColor * vec4(vec3(mix(dot1, dot2, Blend)), 1.0);
// fog
// fog calculation, from the Orange Book, 2nd ed, section 9.6
vec3 ecPosition = vec3(gl_ModelViewMatrix * lerpedVert);
gl_FogFragCoord = abs(ecPosition.z);
};

View file

@ -802,7 +802,7 @@ void R_DrawTextureChains_Multitexture_VBO (qmodel_t *model, entity_t *ent, texch
GL_BindBufferFunc (GL_ARRAY_BUFFER, gl_bmodel_vbo);
GL_BindBufferFunc (GL_ELEMENT_ARRAY_BUFFER, 0); // indices come from client memory!
// setup vertex array. this will need to move if we use vertex arrays for other things
// Setup vertex array pointers
glVertexPointer (3, GL_FLOAT, VERTEXSIZE * sizeof(float), ((float *)0));
glEnableClientState (GL_VERTEX_ARRAY);
@ -813,12 +813,12 @@ void R_DrawTextureChains_Multitexture_VBO (qmodel_t *model, entity_t *ent, texch
GL_ClientActiveTextureFunc (GL_TEXTURE1_ARB);
glTexCoordPointer (2, GL_FLOAT, VERTEXSIZE * sizeof(float), ((float *)0) + 5);
glEnableClientState (GL_TEXTURE_COORD_ARRAY);
// TMU 2 is for fullbrights; same texture coordinates as TMU 0
GL_ClientActiveTextureFunc (GL_TEXTURE2_ARB);
glTexCoordPointer (2, GL_FLOAT, VERTEXSIZE * sizeof(float), ((float *)0) + 3);
glEnableClientState (GL_TEXTURE_COORD_ARRAY);
// Setup TMU 1 (lightmap)
GL_SelectTexture (GL_TEXTURE1_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
@ -827,7 +827,7 @@ void R_DrawTextureChains_Multitexture_VBO (qmodel_t *model, entity_t *ent, texch
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_TEXTURE);
glTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, gl_overbright.value ? 2.0f : 1.0f);
glEnable(GL_TEXTURE_2D);
// Setup TMU 2 (fullbrights)
GL_SelectTexture (GL_TEXTURE2_ARB);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_ADD);