DXGL r304 - Code Review
For
DXGL
(
recent comments
|
status changes
|
tags
|
authors
|
states
|
release notes
|
statistics
)
Jump to navigation
Jump to search
Repository:
DXGL
Revision:
<
r303
|
r304
|
r305
>
Date:
02:22, 13 January 2013
Author:
admin
Status:
new
Tags:
Comment:
Get pixel fog working.
Modified paths:
/ddraw/shadergen.cpp
(modified) (
history
)
Diff
[
purge
]
Index: ddraw/shadergen.cpp
—
—
@@ -300,7 +300,7 @@
301
301
static const char op_texpassthru2str[] = "vec4(strX,1);\n";
302
302
static const char op_texpassthru2strq[] = "strqX;\n";
303
303
static const char op_texpassthru2null[] = "vec4(0,0,0,1);\n";
304
-static const char op_fogcoordstandardpixel[] = "gl_FogFragCoord = gl_FragCoord.z;\n";
304
+static const char op_fogcoordstandardpixel[] = "float fogcoord = gl_FragCoord.z / gl_FragCoord.w;\n";
305
305
static const char op_fogcoordstandard[] = "gl_FogFragCoord = abs(gl_ModelViewMatrix*xyzw).z;\n";
306
306
static const char op_fogcoordrange[] = "vec4 eyepos = gl_ModelViewMatrix*xyzw;\n\
307
307
vec3 eyepos3 = eyepos.xyz / eyepos.w;\n\
—
—
@@ -309,6 +309,10 @@
310
310
static const char op_fogexp[] = "fogfactor = 1.0 / exp(gl_FogFragCoord * gl_Fog.density);\n";
311
311
static const char op_fogexp2[] = "fogfactor = 1.0 / exp(gl_FogFragCoord * gl_FogFragCoord *\n\
312
312
gl_Fog.density * gl_Fog.density);\n";
313
+static const char op_foglinearpixel[] = "fogfactor = (gl_Fog.end - fogcoord) / (gl_Fog.end - gl_Fog.start);\n";
314
+static const char op_fogexppixel[] = "fogfactor = 1.0 / exp(fogcoord * gl_Fog.density);\n";
315
+static const char op_fogexp2pixel[] = "fogfactor = 1.0 / exp(fogcoord * fogcoord *\n\
316
+gl_Fog.density * gl_Fog.density);\n";
313
317
static const char op_fogclamp[] = "fogfactor = clamp(fogfactor,0.0,1.0);\n";
314
318
static const char op_fogblend[] = "color = mix(gl_Fog.color,color,fogfactor);\n";
315
319
—
—
@@ -999,15 +1003,16 @@
1000
1004
switch(pixelfog)
1001
1005
{
1002
1006
case D3DFOG_LINEAR:
1003
- vsrc->append(op_foglinear);
1007
+ fsrc->append(op_foglinearpixel);
1004
1008
break;
1005
1009
case D3DFOG_EXP:
1006
- vsrc->append(op_fogexp);
1010
+ fsrc->append(op_fogexppixel);
1007
1011
break;
1008
1012
case D3DFOG_EXP2:
1009
- vsrc->append(op_fogexp2);
1013
+ fsrc->append(op_fogexp2pixel);
1010
1014
break;
1011
1015
}
1016
+ fsrc->append(op_fogclamp);
1012
1017
fsrc->append(op_fogblend);
1013
1018
}
1014
1019
fsrc->append(op_colorfragout);
Navigation menu
Personal tools
Log in
Namespaces
Special page
English
expanded
collapsed
Views
More
expanded
collapsed
Search
Navigation
Home
Main page
Recent changes
Random page
MediaWiki help
Introduction
Progress
Downloads
Source code
Build from source
AppDB
Bug reports
Forums
Tools
Special pages
Printable version