<#@ template debug="false" hostspecific="false" language="C#" #> <#@ output extension=".cs" #> namespace OpenTK { <# string[] types = new string[]{"double", "float", "int", "uint", "bool"}; #> <# string[] suffix = new string[]{"d", "", "i", "u", "b"}; #> <# for(int typeIndex = 0; typeIndex < types.Length; ++typeIndex){ #> <# for(int size= 2; size <= 4; ++size){ #> public partial struct Vector<#= size#><#= suffix[typeIndex] #> { public <#= types[typeIndex] #> X; public <#= types[typeIndex] #> Y; <# if(size>=3){ #> public <#= types[typeIndex] #> Z; <# if(size>=4){ #> public <#= types[typeIndex] #> W; <#}#> <#}#> public Vector<#= size#><#= suffix[typeIndex] #>(<#= types[typeIndex] #> X, <#= types[typeIndex] #> Y<#= size<3 ? "" : ", "+types[typeIndex]+" Z" #><#= size<4 ? "" : ", "+types[typeIndex]+" W" #>) { this.X = X; this.Y = Y; <# if(size>=3){ #> this.Z = Z; <# if(size>=4){ #> this.W = W; <#}#> <#}#> } public Vector<#= size#><#= suffix[typeIndex] #>(Vector2<#= suffix[typeIndex] #> xy<#= size<3 ? "" : ", "+types[typeIndex]+" Z" #><#= size<4 ? "" : ", "+types[typeIndex]+" W" #>) { this.X = xy.X; this.Y = xy.Y; <# if(size>=3){ #> this.Z = Z; <# if(size>=4){ #> this.W = W; <#}#> <#}#> } <# if(size>=3){ #> public Vector<#= size#><#= suffix[typeIndex] #>(Vector3<#= suffix[typeIndex] #> xyz<#= size==3 ? "" : ", "+types[typeIndex]+" W" #>) { this.X = xyz.X; this.Y = xyz.Y; this.Z = xyz.Z; <# if(size>=4){ #> this.W = W; <#}#> } <#}#> <# if(size==4){ #> public Vector<#= size#><#= suffix[typeIndex] #>(Vector4<#= suffix[typeIndex] #> xyzw) { this.X = xyzw.X; this.Y = xyzw.Y; this.Z = xyzw.Z; this.W = xyzw.W; } <#}#> } <#}#> <#}#> }