nice clean maths, nice perf boost :D

git-svn-id: svn://svn.ijw.co.nz/svn/OpenRa@1163 993157c7-ee19-0410-b2c4-bb4e9862e678
This commit is contained in:
chrisf
2007-07-10 08:13:35 +00:00
parent 88d24e18da
commit c59850008e
2 changed files with 18 additions and 12 deletions

View File

@@ -4,7 +4,8 @@
shared texture DiffuseTexture;
shared float2 Scroll;
const float2 ScreenSize = { 640, 400 };
shared float2 r1, r2; // matrix elements
sampler s_DiffuseTexture = sampler_state {
Texture = <DiffuseTexture>;
@@ -33,10 +34,9 @@ struct FragmentIn {
VertexOut Simple_vp(VertexIn v) {
VertexOut o;
o.Position = float4(
v.Position.x / ScreenSize.x - 0.5f - Scroll.x,
Scroll.y - v.Position.y / ScreenSize.y,
0, 1 );
float2 p = (v.Position.xy - Scroll.xy) * r1 + r2;
o.Position = float4(p.x,p.y,0,1);
o.Tex0 = v.Tex0;
return o;
}