Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: SDL_interface
Fetching contributors…

Cannot retrieve contributors at this time

file 40 lines (33 sloc) 0.728 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
// input vertex
struct VertIn
{
  float4 pos : POSITION;
  uniform float4x4 modelViewProj : state.matrix.mvp;
};
 
// output vertex
struct VertOut
{
  float4 pos : POSITION;
  float2 texcoord : TEXCOORD0;
};

uniform float4 center;
uniform float4x4 xform;

// vertex shader main entry
VertOut main(VertIn IN)
{
  VertOut OUT;
  OUT.pos = mul(IN.modelViewProj, IN.pos);
  OUT.pos = mul(xform, OUT.pos);

  // Calc texcoord values
  float d = sqrt(IN.pos.x * IN.pos.x + IN.pos.y * IN.pos.y);
  float a = atan2(IN.pos.x,IN.pos.y) / 3.1415;
  if (a < 0) a += 1;
  a *= 2;
  a -= int(a);

  IN.pos -= center;
  float h = IN.pos.z;
  h = abs(2 * atan2(h,d) / 3.1415);

  OUT.texcoord.x = a;
  OUT.texcoord.y = h;

  return OUT;
}
Something went wrong with that request. Please try again.