Example #1
0
 public float3x3(float4 x, float4 y, float4 z)
 {
     m00 = x.x;
     m01 = x.y;
     m02 = x.z;
     m10 = y.x;
     m11 = y.y;
     m12 = y.z;
     m20 = z.x;
     m21 = z.y;
     m22 = z.z;
 }
Example #2
0
 public float4 Min(float4 v)
 {
     float4 ret = new float4();
     ret.x = x < v.x ? x : v.x;
     ret.y = y < v.y ? y : v.y;
     ret.z = z < v.z ? z : v.z;
     ret.w = w < v.w ? w : v.w;
     return ret;
 }
Example #3
0
 public float4x4(float4 x, float4 y, float4 z, float4 p)
 {
     m = new float[4,4];
     m[0,0] = x.x;
     m[0,1] = x.y;
     m[0,2] = x.z;
     m[0,3] = x.w;
     m[1,0] = y.x;
     m[1,1] = y.y;
     m[1,2] = y.z;
     m[1,3] = y.w;
     m[2,0] = z.x;
     m[2,1] = z.y;
     m[2,2] = z.z;
     m[2,3] = z.w;
     m[3,0] = p.x;
     m[3,1] = p.y;
     m[3,2] = p.z;
     m[3,3] = p.w;
 }
Example #4
0
 public float4 Lerp(float4 v, float alpha)
 {
     return v * alpha + this * (1.0f - alpha);
 }
Example #5
0
 public float4 Max(float4 v)
 {
     float4 ret = new float4();
     ret.x = x > v.x ? x : v.x;
     ret.y = y > v.y ? y : v.y;
     ret.z = z > v.z ? z : v.z;
     ret.w = w > v.w ? w : v.w;
     return ret;
 }
Example #6
0
 // math functions
 public float Dot(float4 v)
 {
     return (x * v.x) + (y * v.y) + (z * v.z) + (w * v.w);
 }
Example #7
0
 public float4 Clamp(float4 min, float4 max)
 {
     return this.Max(min).Min(max);
 }
Example #8
0
 public static float4 Lerp(float4 a, float4 b, float alpha)
 {
     return (a * (1.0f - alpha)) + (b * alpha);
 }
Example #9
0
 public static float dot(float4 a, float4 b)
 {
     return a.Dot(b);
 }
Example #10
0
 public float4(float4 v)
 {
     x = v.x;
     y = v.y;
     z = v.z;
     w = v.w;
 }