// sight
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
// Parameters:
//
//   float4 bones[60];
//   float4 cam;
//   float4 cv4;
//   float4x4 viewproj;
//
//
// Registers:
//
//   Name         Reg   Size
//   ------------ ----- ----
//   bones        c0      60
//   viewproj     c60      4
//   cv4          c64      1
//   cam          c65      1
//
//
// Default values:
//
//   bones
//     c0   = { 0, 0, 0, 0 };
//     c1   = { 0, 0, 0, 0 };
//     c2   = { 0, 0, 0, 0 };
//     c3   = { 0, 0, 0, 0 };
//     c4   = { 0, 0, 0, 0 };
//     c5   = { 0, 0, 0, 0 };
//     c6   = { 0, 0, 0, 0 };
//     c7   = { 0, 0, 0, 0 };
//     c8   = { 0, 0, 0, 0 };
//     c9   = { 0, 0, 0, 0 };
//     c10  = { 0, 0, 0, 0 };
//     c11  = { 0, 0, 0, 0 };
//     c12  = { 0, 0, 0, 0 };
//     c13  = { 0, 0, 0, 0 };
//     c14  = { 0, 0, 0, 0 };
//     c15  = { 0, 0, 0, 0 };
//     c16  = { 0, 0, 0, 0 };
//     c17  = { 0, 0, 0, 0 };
//     c18  = { 0, 0, 0, 0 };
//     c19  = { 0, 0, 0, 0 };
//     c20  = { 0, 0, 0, 0 };
//     c21  = { 0, 0, 0, 0 };
//     c22  = { 0, 0, 0, 0 };
//     c23  = { 0, 0, 0, 0 };
//     c24  = { 0, 0, 0, 0 };
//     c25  = { 0, 0, 0, 0 };
//     c26  = { 0, 0, 0, 0 };
//     c27  = { 0, 0, 0, 0 };
//     c28  = { 0, 0, 0, 0 };
//     c29  = { 0, 0, 0, 0 };
//     c30  = { 0, 0, 0, 0 };
//     c31  = { 0, 0, 0, 0 };
//     c32  = { 0, 0, 0, 0 };
//     c33  = { 0, 0, 0, 0 };
//     c34  = { 0, 0, 0, 0 };
//     c35  = { 0, 0, 0, 0 };
//     c36  = { 0, 0, 0, 0 };
//     c37  = { 0, 0, 0, 0 };
//     c38  = { 0, 0, 0, 0 };
//     c39  = { 0, 0, 0, 0 };
//     c40  = { 0, 0, 0, 0 };
//     c41  = { 0, 0, 0, 0 };
//     c42  = { 0, 0, 0, 0 };
//     c43  = { 0, 0, 0, 0 };
//     c44  = { 0, 0, 0, 0 };
//     c45  = { 0, 0, 0, 0 };
//     c46  = { 0, 0, 0, 0 };
//     c47  = { 0, 0, 0, 0 };
//     c48  = { 0, 0, 0, 0 };
//     c49  = { 0, 0, 0, 0 };
//     c50  = { 0, 0, 0, 0 };
//     c51  = { 0, 0, 0, 0 };
//     c52  = { 0, 0, 0, 0 };
//     c53  = { 0, 0, 0, 0 };
//     c54  = { 0, 0, 0, 0 };
//     c55  = { 0, 0, 0, 0 };
//     c56  = { 0, 0, 0, 0 };
//     c57  = { 0, 0, 0, 0 };
//     c58  = { 0, 0, 0, 0 };
//     c59  = { 0, 0, 0, 0 };
//
//   viewproj
//     c60  = { 0, 0, 0, 0 };
//     c61  = { 0, 0, 0, 0 };
//     c62  = { 0, 0, 0, 0 };
//     c63  = { 0, 0, 0, 0 };
//
//   cv4
//     c64  = { 0, 0, 0, 0 };
//
//   cam
//     c65  = { 0, 0, 0, 0 };
//

    vs_3_0
	def c66, 3, 1, 0, 0.999000013
	def c67, 1000, 0, 0, 0
//def c67, 1000, 0, 0, 0
// key for scale : 0=> std; 1 => /2, 2 => /3
def c240, 0, 1, 2, 0
//standard settings
// unused, scale, dx, dy
def c241, 0, 1, 0, 0
// divide by 3 settings (BF109)
def c242, 0, 3, -1, 1
// divide by 4 settings (Lagg)
def c243, 0, 4, 0, 1
// correction of clipping zone for Bf109 or Lagg 
def c244, 3, 1, 0, 0.9975
    dcl_position o10
	dcl_texcoord1 o1.xyz
	dcl_texcoord2 o2.xyz
	dcl_texcoord o0.xy
	dcl_position v0
    dcl_normal v1
    dcl_texcoord v2
    dcl_blendindices v3
    dcl_texcoord1 v4
    mov r0.w, c64.w
    mov r1.xyz, v0
    mov r1.w, c64.w
    mul r2.x, v3.x, c66.x
    mova a0.x, r2.x
    dp4 r0.x, r1, c0[a0.x]
    dp4 r0.y, r1, c1[a0.x]
    dp4 r0.z, r1, c2[a0.x]
    dp4 o10.x, r0, c60
    dp4 o10.y, r0, c61
    dp4 o10.z, r0, c62
    dp4 o10.w, r0, c63
    dp3 r1.x, v1, c0[a0.x]
    dp3 r1.y, v1, c1[a0.x]
    dp3 r1.z, v1, c2[a0.x]
    dp3 r0.w, r1, r1
    rsq r0.w, r0.w
    mul r1.xyz, r0.w, r1	
    mad r3, v4.xyzx, c66.yyyz, c66.zzzy
    dp4 r4.x, r3, c0[a0.x]
    dp4 r4.y, r3, c1[a0.x]
    dp4 r4.z, r3, c2[a0.x]
    add r2.xyz, -r4, c65
    dp3 r0.w, r2, r1
// set sight clipping correction info regarding value of c221.y (const2)
// by befault c66.w (no corrections)
mul r0.w, r0.w, c66.w
mov r5.y, c221.y
if_ne r5.y, c240.x
mul r0.w, r0.w, c244
endif
    mad r2.xyz, r1, r0.w, r4
	mov o1.xyz, r1
    add r1.xyz, -r2, c65
    mad r1.xyz, r1, -c67.x, r4
	add o2.xyz, -r0, r1

// set sight correction info regarding value of c221.y (const2)
// by befault c241 (no corrections)
mov r6, c241
// mov r5.y, c221.y
if_eq r5.y, c240.y
// const=1 => div by 2 scale
mov r6, c242
endif
if_eq r5.y, c240.z
// const=2 => div by 3 scale
mov r6, c243
endif
	
//apply scale to sight
mov r7.xy, v2
mul r7.xy, r7.xy, r6.y
add r7.x, r7.x, r6.z
add r7.y, r7.y, r6.w

mov o0.xy ,r7.xy

// approximately 31 instruction slots used

