DXGL r186 - Code Review
For
DXGL
(
recent comments
|
status changes
|
tags
|
authors
|
states
|
release notes
|
statistics
)
Jump to navigation
Jump to search
Repository:
DXGL
Revision:
<
r185
|
r186
|
r187
>
Date:
15:16, 29 June 2012
Author:
admin
Status:
new
Tags:
Comment:
Support transformed vertices
Modified paths:
/ddraw/glRenderer.cpp
(modified) (
history
)
/ddraw/shadergen.cpp
(modified) (
history
)
Diff
[
purge
]
Index: ddraw/glRenderer.cpp
—
—
@@ -1473,7 +1473,8 @@
1474
1474
else SetTexture(i,0);
1475
1475
glUniform1i(prog.uniforms[128+i],i);
1476
1476
}
1477
-
1477
+ if(prog.uniforms[137]!= -1) glUniform1f(prog.uniforms[137],device->glDDS7->fakex);
1478
+ if(prog.uniforms[138]!= -1) glUniform1f(prog.uniforms[138],device->glDDS7->fakey);
1478
1479
if(device->glDDS7->zbuffer) SetFBO(device->glDDS7->texture,device->glDDS7->zbuffer->texture,device->glDDS7->zbuffer->hasstencil);
1479
1480
else SetFBO(device->glDDS7->texture,0,false);
1480
1481
glViewport(device->viewport.dwX,device->viewport.dwY,device->viewport.dwWidth,device->viewport.dwHeight);
Index: ddraw/shadergen.cpp
—
—
@@ -264,6 +264,8 @@
265
265
static const char unif_light[] = "uniform Light lightX;\n";
266
266
static const char unif_ambient[] = "uniform vec4 ambientcolor;\n";
267
267
static const char unif_tex[] = "uniform sampler2D texX;\n";
268
+static const char unif_size[] = "uniform float width;\n\
269
+uniform float height;\n";
268
270
// Variables
269
271
static const char var_common[] = "vec4 diffuse;\n\
270
272
vec4 specular;\n\
—
—
@@ -278,7 +280,7 @@
279
281
gl_Position = vec4(pos.x,-pos.y,pos.z,pos.w);\n";
280
282
static const char op_normalize[] = "N = normalize(normalmat*nxyz);\n";
281
283
static const char op_normalpassthru[] = "N = normalmat*nxyz;\n";
282
-static const char op_passthru[] = "gl_Position = vec4(xyz/640.0,1.0/rhw);\n";
284
+static const char op_passthru[] = "gl_Position = vec4((xyz.x/(width/2.0))-1.0,(xyz.y/(height/2.0))-1.0,xyz.z,1.0/rhw);\n";
283
285
static const char op_resetcolor[] = "diffuse = specular = vec4(0.0);\n\
284
286
ambient = ambientcolor / 255.0;\n";
285
287
static const char op_dirlight[] = "DirLight(lightX);\n";
—
—
@@ -447,6 +449,7 @@
448
450
vsrc->append(unif_matrices); // Material
449
451
vsrc->append(unif_material);
450
452
vsrc->append(unif_ambient);
453
+ if((id>>50)&1) vsrc->append(unif_size);
451
454
numlights = (id>>18)&7;
452
455
if(numlights) // Lighting
453
456
{
—
—
@@ -934,4 +937,6 @@
935
938
genshaders[index].shader.uniforms[128+i] = glGetUniformLocation(genshaders[index].shader.prog,uniftex);
936
939
}
937
940
genshaders[index].shader.uniforms[136] = glGetUniformLocation(genshaders[index].shader.prog,"ambientcolor");
941
+ genshaders[index].shader.uniforms[137] = glGetUniformLocation(genshaders[index].shader.prog,"width");
942
+ genshaders[index].shader.uniforms[138] = glGetUniformLocation(genshaders[index].shader.prog,"height");
938
943
}
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