示例#1
0
 public static void Refract(VecFloat3 vector, VecFloat3 normal, VecFloat etaiOverEtat, VecFloat3 result)
 {
     NativeMethods.RefractFloat3(
         vector.X._buffer, vector.Y._buffer, vector.Z._buffer,
         normal.X._buffer, normal.Y._buffer, normal.Z._buffer,
         etaiOverEtat._buffer,
         result.X._buffer, result.Y._buffer, result.Z._buffer,
         result.Count);
 }
示例#2
0
        public static VecFloat3 Allocate(int count)
        {
            VecFloat3 result;

            result.X = VecFloat.Allocate(count);
            result.Y = VecFloat.Allocate(count);
            result.Z = VecFloat.Allocate(count);
            return(result);
        }
示例#3
0
 public static void SmoothStep(VecFloat3 a, VecFloat3 b, VecFloat amount, VecFloat3 result)
 {
     NativeMethods.SmoothstepFloat3(
         a.X._buffer, a.Y._buffer, a.Z._buffer,
         b.X._buffer, b.Y._buffer, b.Z._buffer,
         amount._buffer,
         result.X._buffer, result.Y._buffer, result.Z._buffer,
         result.Count);
 }
示例#4
0
        public static void LengthSquared(VecFloat3 a, VecFloat result)
        {
#if DEBUG
            if (a.X._count != result._count)
            {
                throw new ArgumentOutOfRangeException();
            }
#endif
            NativeMethods.LengthSquaredFloat3(a.X._buffer, a.Y._buffer, a.Z._buffer, result._buffer, a.X._count);
        }
示例#5
0
        public static void DistanceSquared(VecFloat3 a, VecFloat3 b, VecFloat result)
        {
#if DEBUG
            if ((a.X._count != result._count) || (b.X._count != result._count))
            {
                throw new ArgumentOutOfRangeException();
            }
#endif
            NativeMethods.DistanceSquaredFloat3(a.X._buffer, a.Y._buffer, a.Z._buffer, b.X._buffer, b.Y._buffer, b.Z._buffer, result._buffer, a.X._count);
        }
示例#6
0
 public static void Reflect(VecFloat3 vector, VecFloat matrix, VecFloat3 result)
 {
     if (matrix.Count != 16)
     {
         throw new ArgumentOutOfRangeException("matrix");
     }
     NativeMethods.TransformFloat3(
         vector.X._buffer, vector.Y._buffer, vector.Z._buffer,
         matrix._buffer,
         result.X._buffer, result.Y._buffer, result.Z._buffer,
         result.Count);
 }
示例#7
0
        public static void Lerp(VecFloat3 a, VecFloat3 b, VecFloat3 f, VecFloat3 result)
        {
#if DEBUG
            if ((a.X._count != result.X._count) || (b.X._count != result.X._count) || (f.X._count != result.X._count))
            {
                throw new ArgumentOutOfRangeException();
            }
#endif
            VecFloat.Lerp(a.X, b.X, f.X, result.X);
            VecFloat.Lerp(a.Y, b.Y, f.Y, result.Y);
            VecFloat.Lerp(a.Z, b.Z, f.Z, result.Z);
        }
示例#8
0
        public static void Release(ref VecFloat vecFloat)
        {
#if DEBUG
            if (vecFloat._buffer == IntPtr.Zero)
            {
                throw new ArgumentException("Vector is already released", "vecFloat");
            }
#endif
            NativeMethods.ReleaseFloat(vecFloat._buffer);
            vecFloat._count  = 0;
            vecFloat._buffer = IntPtr.Zero;
        }
示例#9
0
        public static void SmoothStep(VecFloat a, VecFloat b, VecFloat amount, VecFloat result)
        {
#if DEBUG
            if ((a._count != result._count) || (b._count != result._count) || (amount._count != result._count))
            {
                throw new ArgumentOutOfRangeException();
            }
            if ((result._buffer == a._buffer) || (result._buffer == b._buffer) || (result._buffer == amount._buffer))
            {
                throw new ArgumentException("Result vector may not also be input vector", "result");
            }
#endif
            NativeMethods.SmoothstepFloat(a._buffer, b._buffer, amount._buffer, result._buffer, result.Count);
        }
示例#10
0
        public static void SrgbToLinear(VecFloat a, VecFloat result)
        {
#if DEBUG
            if (a._count != result._count)
            {
                throw new ArgumentOutOfRangeException();
            }
            if (result._buffer == a._buffer)
            {
                throw new ArgumentException("Result vector may not also be input vector", "result");
            }
#endif
            NativeMethods.SrgbToLinearFloat(a._buffer, result._buffer, result._count);
        }
示例#11
0
        public static void MultiplyAdd(VecFloat a, VecFloat b, VecFloat c, VecFloat result)
        {
#if DEBUG
            if ((a._count != result._count) || (b._count != result._count) || (c._count != result._count))
            {
                throw new ArgumentOutOfRangeException();
            }
            if ((result._buffer == a._buffer) || (result._buffer == b._buffer) || (result._buffer == c._buffer))
            {
                throw new ArgumentException("Result vector may not also be input vector", "result");
            }
#endif
            NativeMethods.MultiplyAddFloat(a._buffer, b._buffer, c._buffer, result._buffer, result._count);
        }
示例#12
0
        public static void Barycentric(VecFloat v1, VecFloat v2, VecFloat v3, VecFloat a1, VecFloat a2, VecFloat result)
        {
#if DEBUG
            if ((v1._count != result._count) || (v2._count != result._count) || (v3._count != result._count) || (a1._count != result._count) || (a2._count != result._count))
            {
                throw new ArgumentOutOfRangeException();
            }
            if ((result._buffer == v1._buffer) || (result._buffer == v2._buffer) || (result._buffer == v3._buffer) || (result._buffer == a1._buffer) || (result._buffer == a2._buffer))
            {
                throw new ArgumentException("Result vector may not also be input vector", "result");
            }
#endif
            NativeMethods.BarycentricFloat(v1._buffer, v2._buffer, v3._buffer, a1._buffer, a2._buffer, result._buffer, result._count);
        }
示例#13
0
        public static void Clamp(VecFloat values, VecFloat min, VecFloat max, VecFloat result)
        {
#if DEBUG
            if ((values._count != min._count) || (values._count != max._count) || (values._count != result._count))
            {
                throw new ArgumentOutOfRangeException();
            }
            if ((result._buffer == values._buffer) || (result._buffer == min._buffer) || (result._buffer == max._buffer))
            {
                throw new ArgumentException("Result vector may not also be input vector", "result");
            }
#endif
            NativeMethods.ClampFloat(values._buffer, min._buffer, max._buffer, result._buffer, result._count);
        }
示例#14
0
        public static void CatmullRom(VecFloat a, VecFloat b, VecFloat c, VecFloat d, VecFloat amount, VecFloat result)
        {
#if DEBUG
            if ((a._count != result._count) || (b._count != result._count) || (c._count != result._count) || (d._count != result._count) || (amount._count != result._count))
            {
                throw new ArgumentOutOfRangeException();
            }
            if ((result._buffer == a._buffer) || (result._buffer == b._buffer) || (result._buffer == c._buffer) || (result._buffer == d._buffer) || (result._buffer == amount._buffer))
            {
                throw new ArgumentException("Result vector may not also be input vector", "result");
            }
#endif
            NativeMethods.CatmullRomFloat(a._buffer, b._buffer, c._buffer, d._buffer, amount._buffer, result._buffer, result._count);
        }
示例#15
0
 public static void Release(ref VecFloat3 vector)
 {
     VecFloat.Release(ref vector.X);
     VecFloat.Release(ref vector.Y);
     VecFloat.Release(ref vector.Z);
 }
示例#16
0
 public static float Sum(VecFloat vecFloat)
 {
     return(NativeMethods.SumFloat(vecFloat._buffer, vecFloat._count));
 }
示例#17
0
 public static void Multiply(VecFloat3 a, VecFloat3 b, VecFloat3 result)
 {
     VecFloat.Multiply(a.X, b.X, result.X);
     VecFloat.Multiply(a.Y, b.Y, result.Y);
     VecFloat.Multiply(a.Z, b.Z, result.Z);
 }
示例#18
0
 public static void Subtract(VecFloat3 a, VecFloat b, VecFloat3 result)
 {
     VecFloat.Subtract(a.X, b, result.X);
     VecFloat.Subtract(a.Y, b, result.Y);
     VecFloat.Subtract(a.Z, b, result.Z);
 }
示例#19
0
 public static void Hermite(VecFloat3 a, VecFloat3 ta, VecFloat3 b, VecFloat3 tb, VecFloat amount, VecFloat3 result)
 {
     NativeMethods.HermiteFloat3(
         a.X._buffer, a.Y._buffer, a.Z._buffer,
         ta.X._buffer, ta.Y._buffer, ta.Z._buffer,
         b.X._buffer, b.Y._buffer, b.Z._buffer,
         tb.X._buffer, tb.Y._buffer, tb.Z._buffer,
         amount._buffer,
         result.X._buffer, result.Y._buffer, result.Z._buffer,
         result.Count);
 }
示例#20
0
 public static void Clamp(VecFloat3 values, VecFloat min, VecFloat max, VecFloat3 result)
 {
     VecFloat.Clamp(values.X, min, max, result.X);
     VecFloat.Clamp(values.Y, min, max, result.Y);
     VecFloat.Clamp(values.Z, min, max, result.Z);
 }
示例#21
0
 public static void SrgbToLinear(VecFloat3 a, VecFloat3 result)
 {
     VecFloat.SrgbToLinear(a.X, result.X);
     VecFloat.SrgbToLinear(a.Y, result.Y);
     VecFloat.SrgbToLinear(a.Z, result.Z);
 }
示例#22
0
 public static void Abs(VecFloat3 a, VecFloat3 result)
 {
     VecFloat.Abs(a.X, result.X);
     VecFloat.Abs(a.Y, result.Y);
     VecFloat.Abs(a.Z, result.Z);
 }
示例#23
0
 public static void Verlet(VecFloat3 positionIn, VecFloat3 velocityIn, VecFloat3 accelerationIn, VecFloat3 forceIn, VecFloat drag, VecFloat mass, float deltaTime, VecFloat3 positionOut, VecFloat3 velocityOut, VecFloat3 accelerationOut)
 {
     NativeMethods.VerletFloat3(
         positionIn.X._buffer, positionIn.Y._buffer, positionIn.Z._buffer,
         velocityIn.X._buffer, velocityIn.Y._buffer, velocityIn.Z._buffer,
         accelerationIn.X._buffer, accelerationIn.Y._buffer, accelerationIn.Z._buffer,
         forceIn.X._buffer, forceIn.Y._buffer, forceIn.Z._buffer,
         drag._buffer,
         mass._buffer,
         deltaTime,
         positionOut.X._buffer, positionOut.Y._buffer, positionOut.Z._buffer,
         velocityOut.X._buffer, velocityOut.Y._buffer, velocityOut.Z._buffer,
         accelerationOut.X._buffer, accelerationOut.Y._buffer, accelerationOut.Z._buffer,
         positionIn.Count);
 }
示例#24
0
 public static void BarycentricFloat3(VecFloat3 v1, VecFloat3 v2, VecFloat3 v3, VecFloat a1, VecFloat a2, VecFloat3 result)
 {
     NativeMethods.BarycentricFloat3(
         v1.X._buffer, v1.Y._buffer, v1.Z._buffer,
         v2.X._buffer, v2.Y._buffer, v2.Z._buffer,
         v3.X._buffer, v3.Y._buffer, v3.Z._buffer,
         a1._buffer,
         a2._buffer,
         result.X._buffer, result.Y._buffer, result.Z._buffer,
         result.Count);
 }
示例#25
0
 public static void CatmullRom(VecFloat3 a, VecFloat3 b, VecFloat3 c, VecFloat3 d, VecFloat amount, VecFloat3 result)
 {
     VecFloat.CatmullRom(a.X, b.X, c.X, d.X, amount, result.X);
     VecFloat.CatmullRom(a.Y, b.Y, c.Y, d.Y, amount, result.Y);
     VecFloat.CatmullRom(a.Z, b.Z, c.Z, d.Z, amount, result.Z);
 }
示例#26
0
 public static void Add(VecFloat3 a, VecFloat b, VecFloat3 result)
 {
     VecFloat.Add(a.X, b, result.X);
     VecFloat.Add(a.Y, b, result.Y);
     VecFloat.Add(a.Z, b, result.Z);
 }
示例#27
0
 public static void Ceil(VecFloat3 a, VecFloat3 result)
 {
     VecFloat.Floor(a.X, result.X);
     VecFloat.Floor(a.Y, result.Y);
     VecFloat.Floor(a.Z, result.Z);
 }
示例#28
0
 public static void Negate(VecFloat3 a, VecFloat3 result)
 {
     VecFloat.Negate(a.X, result.X);
     VecFloat.Negate(a.Y, result.Y);
     VecFloat.Negate(a.Z, result.Z);
 }
示例#29
0
 public static void LinearToSrgb(VecFloat3 a, VecFloat3 result)
 {
     VecFloat.LinearToSrgb(a.X, result.X);
     VecFloat.LinearToSrgb(a.Y, result.Y);
     VecFloat.LinearToSrgb(a.Z, result.Z);
 }
示例#30
0
 // result[i] = a[i] ? b[i] : c[i]
 public static void Select(VecFloat a, VecFloat3 b, VecFloat3 c, VecFloat3 result)
 {
     VecFloat.Select(a, b.X, c.X, result.X);
     VecFloat.Select(a, b.Y, c.Y, result.Y);
     VecFloat.Select(a, b.Z, c.Z, result.Z);
 }