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

@ -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 #version 110
// Note: were not loading this directly but first compiling it to ARB_vertex_program // 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 vec4 Pose2Vert;
attribute vec3 Pose2Normal; attribute vec3 Pose2Normal;
// Note about r_avertexnormal_dot: // r_avertexnormal_dot() produces the same result as the lookup table in r_alias.c
// The function in the shader produces the same result as the lookup table
// (r_avertexnormal_dots[quantized entity angle, from 0-15][compressed vertex normal, 0-161]) // (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, // but takes an ordinary vec3 vertex normal instead of a 1-byte compressed normal,
// and requires a ShadeVector uniform variable set as follows: // 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. // 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 ) // Thanks MH for providing this (from: http://forums.inside3d.com/viewtopic.php?p=39361#p39361 )
float r_avertexnormal_dot(vec3 vertexnormal)
float r_avertexnormal_dot(vec3 vertexnormal) // from MH
{ {
float dot = dot(vertexnormal, ShadeVector); float dot = dot(vertexnormal, ShadeVector);
// wtf - this reproduces anorm_dots within as reasonable a degree of tolerance as the >= 0 case // 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() void main()
{ {
gl_TexCoord[0] = gl_MultiTexCoord0; // texture coordinates
gl_TexCoord[1] = gl_MultiTexCoord0; 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); vec4 lerpedVert = mix(Pose1Vert, Pose2Vert, Blend);
gl_Position = gl_ModelViewProjectionMatrix * lerpedVert; gl_Position = gl_ModelViewProjectionMatrix * lerpedVert;
// lerped color
float dot1 = r_avertexnormal_dot(Pose1Normal); float dot1 = r_avertexnormal_dot(Pose1Normal);
float dot2 = r_avertexnormal_dot(Pose2Normal); float dot2 = r_avertexnormal_dot(Pose2Normal);
gl_FrontColor = LightColor * vec4(vec3(mix(dot1, dot2, Blend)), 1.0); 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); vec3 ecPosition = vec3(gl_ModelViewMatrix * lerpedVert);
gl_FogFragCoord = abs(ecPosition.z); 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_ARRAY_BUFFER, gl_bmodel_vbo);
GL_BindBufferFunc (GL_ELEMENT_ARRAY_BUFFER, 0); // indices come from client memory! 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)); glVertexPointer (3, GL_FLOAT, VERTEXSIZE * sizeof(float), ((float *)0));
glEnableClientState (GL_VERTEX_ARRAY); glEnableClientState (GL_VERTEX_ARRAY);