DXGL r299 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r298‎ | r299 | r300 >
Date:01:47, 4 January 2013
Author:admin
Status:new
Tags:
Comment:
Make vertex fog compile. (still broken)
Modified paths:
  • /ddraw/shadergen.cpp (modified) (history)

Diff [purge]

Index: ddraw/shadergen.cpp
@@ -1,5 +1,5 @@
22 // DXGL
3 -// Copyright (C) 2012 William Feely
 3+// Copyright (C) 2012-2013 William Feely
44
55 // This library is free software; you can redistribute it and/or
66 // modify it under the terms of the GNU Lesser General Public
@@ -35,7 +35,7 @@
3636 int current_genshader;
3737
3838 /* Bits in Shader ID:
39 -Bits 0-1 - Shading mode: 00=flat 01=gouraud 11=phong 10=flat per-pixel VS/FS
 39+Bits 0-1 - Shading mode: 00=flat 01=gouraud 11=phong 10=flat per-pixel GL/VS/FS
4040 Bit 2 - Alpha test enable FS
4141 Bits 3-5 - Alpha test function: FS
4242 000=never 001=less 010=equal 011=lessequal
@@ -80,9 +80,9 @@
8181 Bits 37-38: Texture coordinate flags VS
8282 Bits 39-40: U Texture address GL
8383 Bits 41-42: V Texture address GL
84 -Bits 43-45: Texture magnification filter GL/FS
85 -Bits 46-47: Texture minification filter GL/FS
86 -Bits 48-49: Texture mip filter GL/FS
 84+Bits 43-45: Texture magnification filter GL/FS?
 85+Bits 46-47: Texture minification filter GL/FS?
 86+Bits 48-49: Texture mip filter GL/FS?
8787 Bit 50: Enable texture coordinate transform VS
8888 Bits 51-52: Number of texcoord dimensions VS
8989 Bit 53: Projected texcoord VS
@@ -305,10 +305,10 @@
306306 static const char op_fogcoordrange[] = "vec4 eyepos = gl_ModelViewMatrix*gl_Vertex;\n\
307307 vec3 eyepos3 = eyepos.xyz / eyepos.w;\n\
308308 gl_FragFogCoord = sqrt((eyepos3.x * eyepos3.x) + (eyepos3.y * eyepos3.y) + (eyepos3.z * eyepos3.z));\n";
309 -static const char op_foglinear[] = "fogfactor = (gl_Fog.end - gl_FogFragCoord) / (gl_Fog.end - glFog.start);\n";
310 -static const char op_fogexp[] = "fogfactor = 1 / exp(gl_FogFragCoord * gl_Fog.density);\n";
311 -static const char op_fogexp2[] = "fogfactor = 1 / exp(gl_FogFragCoord * gl_FogFragCoord *\n\
312 -gl_Fog.density * gl_Fog.density)\n";
 309+static const char op_foglinear[] = "fogfactor = (gl_Fog.end - gl_FogFragCoord) / (gl_Fog.end - gl_Fog.start);\n";
 310+static const char op_fogexp[] = "fogfactor = 1.0 / exp(gl_FogFragCoord * gl_Fog.density);\n";
 311+static const char op_fogexp2[] = "fogfactor = 1.0 / exp(gl_FogFragCoord * gl_FogFragCoord *\n\
 312+gl_Fog.density * gl_Fog.density);\n";
313313 static const char op_fogclamp[] = "fogfactor = clamp(fogfactor,0.0,1.0);\n";
314314 static const char op_fogblend[] = "color = mix(color,gl_Fog.color,fogfactor);\n";
315315
@@ -394,6 +394,7 @@
395395 int count;
396396 int numlights;
397397 int vertexfog,pixelfog;
 398+ vertexfog = pixelfog = 0;
398399 if((id>>61)&1)
399400 {
400401 vertexfog = (id>>8)&3;