DXGL r176 - Code Review
For
DXGL
(
recent comments
|
status changes
|
tags
|
authors
|
states
|
release notes
|
statistics
)
Jump to navigation
Jump to search
Repository:
DXGL
Revision:
<
r175
|
r176
|
r177
>
Date:
18:34, 23 June 2012
Author:
admin
Status:
new
Tags:
Comment:
Tweak point lights. Enable positional lighting.
Modified paths:
/ddraw/glDirect3D.cpp
(modified) (
history
)
/ddraw/shadergen.cpp
(modified) (
history
)
Diff
[
purge
]
Index: ddraw/glDirect3D.cpp
—
—
@@ -92,7 +92,7 @@
93
93
IID_IDirect3DHALDevice, //deviceGUID
94
94
0, //wMaxUserClipPlanes
95
95
0, //wMaxVertexBlendMatrices
96
- D3DVTXPCAPS_DIRECTIONALLIGHTS, //dwVertexProcessingCaps
96
+ D3DVTXPCAPS_DIRECTIONALLIGHTS|D3DVTXPCAPS_POSITIONALLIGHTS, //dwVertexProcessingCaps
97
97
0,0,0,0 //dwReserved1 through dwReserved4
98
98
};
99
99
Index: ddraw/shadergen.cpp
—
—
@@ -317,10 +317,11 @@
318
318
}\n";
319
319
static const char func_spotlight[] = "void SpotLight(in Light light)\n\
320
320
{\n\
321
-float NdotHV = 0.0\n\
322
-vec3 V = normalize(eye - P);\n\
323
-float d = length( light.position - V );\n\
324
-vec3 L = normalize( light.position - V );\n\
321
+float NdotHV = 0.0;\n\
322
+vec3 V = ((view*world)*xyzw).xyz;\n\
323
+float d = length(light.position - V);\n\
324
+vec3 L = normalize(light.position - V);\n\
325
+vec3 H = normalize(L + vec3(0.0, 0.0, 1.0));\n\
325
326
float NdotL = max(dot(N,L),0.0);\n\
326
327
float NdotH = max(dot(N,H),0.0);\n\
327
328
diffuse += light.diffuse*NdotL;\n\
—
—
@@ -442,7 +443,7 @@
443
444
}
444
445
}
445
446
bool hasspecular = (id >> 11) & 1;
446
- if(hasspot) FIXME("Add spot lights");
447
+ if(hasspot) vsrc->append(func_spotlight);
447
448
if(hasdir) vsrc->append(func_dirlight);
448
449
//Main
449
450
vsrc->append(mainstart);
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