DXGL r303 - Code Review
For
DXGL
(
recent comments
|
status changes
|
tags
|
authors
|
states
|
release notes
|
statistics
)
Jump to navigation
Jump to search
Repository:
DXGL
Revision:
<
r302
|
r303
|
r304
>
Date:
02:13, 13 January 2013
Author:
admin
Status:
new
Tags:
Comment:
Get vertex fog working.
Modified paths:
/ddraw/shadergen.cpp
(modified) (
history
)
Diff
[
purge
]
Index: ddraw/shadergen.cpp
—
—
@@ -274,7 +274,7 @@
275
275
static const char var_fogfactorvertex[] = "varying float fogfactor;\n";
276
276
static const char var_fogfactorpixel[] = "float fogfactor;\n";
277
277
// Operations
278
-static const char op_transform[] = "xyzw = vec4(xyz,1);\n\
278
+static const char op_transform[] = "xyzw = vec4(xyz,1.0);\n\
279
279
vec4 pos = gl_ModelViewProjectionMatrix*xyzw;\n\
280
280
gl_Position = vec4(pos.x,-pos.y,pos.z,pos.w);\n";
281
281
static const char op_normalize[] = "N = normalize(gl_NormalMatrix*nxyz);\n";
—
—
@@ -301,8 +301,8 @@
302
302
static const char op_texpassthru2strq[] = "strqX;\n";
303
303
static const char op_texpassthru2null[] = "vec4(0,0,0,1);\n";
304
304
static const char op_fogcoordstandardpixel[] = "gl_FogFragCoord = gl_FragCoord.z;\n";
305
-static const char op_fogcoordstandard[] = "gl_FogFragCoord = (gl_ModelViewMatrix*gl_Vertex).z;\n";
306
-static const char op_fogcoordrange[] = "vec4 eyepos = gl_ModelViewMatrix*gl_Vertex;\n\
305
+static const char op_fogcoordstandard[] = "gl_FogFragCoord = abs(gl_ModelViewMatrix*xyzw).z;\n";
306
+static const char op_fogcoordrange[] = "vec4 eyepos = gl_ModelViewMatrix*xyzw;\n\
307
307
vec3 eyepos3 = eyepos.xyz / eyepos.w;\n\
308
308
gl_FragFogCoord = sqrt((eyepos3.x * eyepos3.x) + (eyepos3.y * eyepos3.y) + (eyepos3.z * eyepos3.z));\n";
309
309
static const char op_foglinear[] = "fogfactor = (gl_Fog.end - gl_FogFragCoord) / (gl_Fog.end - gl_Fog.start);\n";
—
—
@@ -310,7 +310,7 @@
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
313
static const char op_fogclamp[] = "fogfactor = clamp(fogfactor,0.0,1.0);\n";
314
-static const char op_fogblend[] = "color = mix(color,gl_Fog.color,fogfactor);\n";
314
+static const char op_fogblend[] = "color = mix(gl_Fog.color,color,fogfactor);\n";
315
315
316
316
// Functions
317
317
static const char func_dirlight[] = "void DirLight(in Light light)\n\
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