Created
December 4, 2012 06:17
-
-
Save typpo/4201220 to your computer and use it in GitHub Desktop.
ANGLE-generated HLSL code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is ANGLE HLSL output. GLSL input here: https://gist.github.com/4209605 | |
float3 vec3(float x0, float x1, float x2) { | |
return float3(x0, x1, x2); | |
} | |
float4 vec4(float3 x0, float x1) { | |
return float4(x0, x1); | |
} | |
// Attributes | |
static float _P = { | |
0 | |
}; | |
static float _a = { | |
0 | |
}; | |
static float _e = { | |
0 | |
}; | |
static float _epoch = { | |
0 | |
}; | |
static float _i = { | |
0 | |
}; | |
static float _locked = { | |
0 | |
}; | |
static float _ma = { | |
0 | |
}; | |
static float _n = { | |
0 | |
}; | |
static float _o = { | |
0 | |
}; | |
static float _size = { | |
0 | |
}; | |
static float3 _value_color = { | |
0, 0, 0 | |
}; | |
static float _w = { | |
0 | |
}; | |
static float4 gl_Position = float4(0, 0, 0, 0); | |
static float gl_PointSize = float(1); | |
// Varyings | |
static float3 _vColor = { | |
0, 0, 0 | |
}; | |
static float _vLocked = { | |
0 | |
}; | |
uniform float2 dx_HalfPixelSize; | |
uniform float _earth_i; | |
uniform float _earth_om; | |
uniform float _jed; | |
uniform float4x4 _modelViewMatrix; | |
uniform float4x4 _projectionMatrix; | |
#define GL_USES_POINT_SIZE;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
float3 _getAstroPos() { | |
{ | |
float _i_rad = (((_i - _earth_i) * 3.1415927) / 180.0); | |
float _o_rad = (((_o - _earth_om) * 3.1415927) / 180.0); | |
float _p_rad = ((_w * 3.1415927) / 180.0); | |
float _ma_rad = ((_ma * 3.1415927) / 180.0); | |
float _n_rad = { | |
0 | |
}; | |
if ((_n > -1.0)) { | |
(_n_rad = ((_n * 3.1415927) / 180.0)); | |
} else { | |
{ | |
(_n_rad = (6.2831855 / _P)); | |
}; | |
}; | |
float _d = (_epoch - _jed); | |
float _M = (_ma_rad + (_n_rad * (-_d))); | |
float _E0 = _M; | |
float _lastdiff = { | |
0 | |
}; | |
float _E1 = (_M + (_e * sin(_E0))); | |
(_lastdiff = abs((_E1 - _E0))); | |
(_E0 = _E1); { | |
for (int _foo = 0; | |
(_foo < 6); | |
(_foo++)) { | |
{ | |
float _E1 = (_M + (_e * sin(_E0))); | |
(_lastdiff = abs((_E1 - _E0))); | |
(_E0 = _E1); | |
if ((_lastdiff > 1e-007)) { | |
{ | |
break;; | |
}; | |
}; | |
}; | |
} | |
}; | |
float _E = _E0; | |
float _v = (2.0 * atan((sqrt(((1.0 + _e) / (1.0 - _e))) * tan((_E / 2.0))))); | |
float _r = (((_a * (1.0 - (_e * _e))) / (1.0 + (_e * cos(_v)))) * 50.0); | |
float _X = (_r * ((cos(_o_rad) * cos(((_v + _p_rad) - _o_rad))) - ((sin(_o_rad) * sin(((_v + _p_rad) - _o_rad))) * cos(_i_rad)))); | |
float _Y = (_r * ((sin(_o_rad) * cos(((_v + _p_rad) - _o_rad))) + ((cos(_o_rad) * sin(((_v + _p_rad) - _o_rad))) * cos(_i_rad)))); | |
float _Z = (_r * (sin(((_v + _p_rad) - _o_rad)) * sin(_i_rad))); | |
return vec3(_X, _Y, _Z);; | |
} | |
} | |
float3 _getAstroPosLod0() { | |
{ | |
float _i_rad = (((_i - _earth_i) * 3.1415927) / 180.0); | |
float _o_rad = (((_o - _earth_om) * 3.1415927) / 180.0); | |
float _p_rad = ((_w * 3.1415927) / 180.0); | |
float _ma_rad = ((_ma * 3.1415927) / 180.0); | |
float _n_rad = { | |
0 | |
}; | |
if ((_n > -1.0)) { | |
(_n_rad = ((_n * 3.1415927) / 180.0)); | |
} else { | |
{ | |
(_n_rad = (6.2831855 / _P)); | |
}; | |
}; | |
float _d = (_epoch - _jed); | |
float _M = (_ma_rad + (_n_rad * (-_d))); | |
float _E0 = _M; | |
float _lastdiff = { | |
0 | |
}; | |
float _E1 = (_M + (_e * sin(_E0))); | |
(_lastdiff = abs((_E1 - _E0))); | |
(_E0 = _E1); { | |
for (int _foo = 0; | |
(_foo < 6); | |
(_foo++)) { | |
{ | |
float _E1 = (_M + (_e * sin(_E0))); | |
(_lastdiff = abs((_E1 - _E0))); | |
(_E0 = _E1); | |
if ((_lastdiff > 1e-007)) { | |
{ | |
break;; | |
}; | |
}; | |
}; | |
} | |
}; | |
float _E = _E0; | |
float _v = (2.0 * atan((sqrt(((1.0 + _e) / (1.0 - _e))) * tan((_E / 2.0))))); | |
float _r = (((_a * (1.0 - (_e * _e))) / (1.0 + (_e * cos(_v)))) * 50.0); | |
float _X = (_r * ((cos(_o_rad) * cos(((_v + _p_rad) - _o_rad))) - ((sin(_o_rad) * sin(((_v + _p_rad) - _o_rad))) * cos(_i_rad)))); | |
float _Y = (_r * ((sin(_o_rad) * cos(((_v + _p_rad) - _o_rad))) + ((cos(_o_rad) * sin(((_v + _p_rad) - _o_rad))) * cos(_i_rad)))); | |
float _Z = (_r * (sin(((_v + _p_rad) - _o_rad)) * sin(_i_rad))); | |
return vec3(_X, _Y, _Z);; | |
} | |
}; | |
void gl_main() { | |
{ | |
(_vColor = _value_color); | |
(_vLocked = _locked); | |
float3 _newpos = _getAstroPos(); | |
float4 _mvPosition = mul(transpose(_modelViewMatrix), vec4(_newpos, 1.0)); | |
(gl_Position = mul(transpose(_projectionMatrix), _mvPosition)); | |
(gl_PointSize = _size); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment