///<summary> /// Reads and returns a Vector3FloatStruct from the specified stream. ///</summary> ///<param name="reader"> the input stream to read from</param> ///<returns> the decoded value</returns> ///<exception cref="IOException"> if an error occurs</exception> public static Vector3FloatStruct Deserialize(HlaEncodingReader reader) { Vector3FloatStruct decodedValue = new Vector3FloatStruct(); decodedValue.XComponent = reader.ReadHLAfloat32BE(); decodedValue.YComponent = reader.ReadHLAfloat32BE(); decodedValue.ZComponent = reader.ReadHLAfloat32BE(); return(decodedValue); }
/// <summary> /// Used to divide a vector by a scalar value. /// </summary> /// <param name="left"></param> /// <param name="scalar"></param> /// <returns></returns> public static Vector3FloatStruct operator /(Vector3FloatStruct left, float scalar) { Vector3FloatStruct vector = new Vector3FloatStruct(); // get the inverse of the scalar up front to avoid doing multiple divides later float inverse = 1.0f / scalar; vector.XComponent = left.XComponent * inverse; vector.YComponent = left.YComponent * inverse; vector.ZComponent = left.ZComponent * inverse; return(vector); }
///<summary> /// Writes this Vector3FloatStruct to the specified stream. ///</summary> ///<param name="writer"> the output stream to write to</param> ///<param name="obj"> the object to serialize</param> ///<exception cref="IOException"> if an error occurs</exception> public static void Serialize(HlaEncodingWriter writer, Vector3FloatStruct obj) { writer.WriteHLAfloat32BE(obj.XComponent); writer.WriteHLAfloat32BE(obj.YComponent); writer.WriteHLAfloat32BE(obj.ZComponent); }
/// <summary> /// Used to negate the elements of a vector. /// </summary> /// <param name="left"></param> /// <returns></returns> public static Vector3FloatStruct Negate(Vector3FloatStruct left) { return(-left); }
///<summary> /// Reads and returns a Vector3FloatStruct from the specified stream. ///</summary> ///<param name="reader"> the input stream to read from</param> ///<returns> the decoded value</returns> ///<exception cref="IOException"> if an error occurs</exception> public static Vector3FloatStruct Deserialize(HlaEncodingReader reader) { Vector3FloatStruct decodedValue = new Vector3FloatStruct(); decodedValue.XComponent = reader.ReadHLAfloat32BE(); decodedValue.YComponent = reader.ReadHLAfloat32BE(); decodedValue.ZComponent = reader.ReadHLAfloat32BE(); return decodedValue; }
/// <summary> /// Used when a scalar value is multiplied by a Vector3. /// </summary> /// <param name="scalar"></param> /// <param name="right"></param> /// <returns></returns> public static Vector3FloatStruct Multiply(float scalar, Vector3FloatStruct right) { return(scalar * right); }
/// <summary> /// Used to subtract a Vector3FloatStruct from another Vector3. /// </summary> /// <param name="left"></param> /// <param name="right"></param> /// <returns></returns> public static Vector3FloatStruct Subtract(Vector3FloatStruct left, Vector3FloatStruct right) { return(left - right); }
/// <summary> /// Used when a Vector3FloatStruct is multiplied by another vector. /// </summary> /// <param name="left"></param> /// <param name="right"></param> /// <returns></returns> public static Vector3FloatStruct Multiply(Vector3FloatStruct left, Vector3FloatStruct right) { return left * right; }
/// <summary> /// Used when a Vector3FloatStruct is multiplied by a scalar value. /// </summary> /// <param name="left"></param> /// <param name="scalar"></param> /// <returns></returns> public static Vector3FloatStruct Multiply(Vector3FloatStruct left, float scalar) { return(left * scalar); }
/// <summary> /// Used to divide a vector by a scalar value. /// </summary> /// <param name="left"></param> /// <param name="scalar"></param> /// <returns></returns> public static Vector3FloatStruct Divide(Vector3FloatStruct left, float scalar) { return(left / scalar); }
/// <summary> /// Used when a Vector3FloatStruct is added to another Vector3. /// </summary> /// <param name="left"></param> /// <param name="right"></param> /// <returns></returns> public static Vector3FloatStruct Add(Vector3FloatStruct left, Vector3FloatStruct right) { return left + right; }
/// <summary> /// Used to subtract a Vector3FloatStruct from another Vector3. /// </summary> /// <param name="left"></param> /// <param name="right"></param> /// <returns></returns> public static Vector3FloatStruct Subtract(Vector3FloatStruct left, Vector3FloatStruct right) { return left - right; }
/// <summary> /// Used when a Vector3FloatStruct is multiplied by another vector. /// </summary> /// <param name="left"></param> /// <param name="right"></param> /// <returns></returns> public static Vector3FloatStruct Multiply(Vector3FloatStruct left, Vector3FloatStruct right) { return(left * right); }
/// <summary> /// Used to negate the elements of a vector. /// </summary> /// <param name="left"></param> /// <returns></returns> public static Vector3FloatStruct Negate(Vector3FloatStruct left) { return -left; }
/// <summary> /// Used when a scalar value is multiplied by a Vector3. /// </summary> /// <param name="scalar"></param> /// <param name="right"></param> /// <returns></returns> public static Vector3FloatStruct Multiply(float scalar, Vector3FloatStruct right) { return scalar * right; }
/// <summary> /// Used when a Vector3FloatStruct is multiplied by a scalar value. /// </summary> /// <param name="left"></param> /// <param name="scalar"></param> /// <returns></returns> public static Vector3FloatStruct Multiply(Vector3FloatStruct left, float scalar) { return left * scalar; }
/// <summary> /// Used when a Vector3FloatStruct is added to another Vector3. /// </summary> /// <param name="left"></param> /// <param name="right"></param> /// <returns></returns> public static Vector3FloatStruct Add(Vector3FloatStruct left, Vector3FloatStruct right) { return(left + right); }
/// <summary> /// Used to divide a vector by a scalar value. /// </summary> /// <param name="left"></param> /// <param name="scalar"></param> /// <returns></returns> public static Vector3FloatStruct operator /(Vector3FloatStruct left, float scalar) { Vector3FloatStruct vector = new Vector3FloatStruct(); // get the inverse of the scalar up front to avoid doing multiple divides later float inverse = 1.0f / scalar; vector.XComponent = left.XComponent * inverse; vector.YComponent = left.YComponent * inverse; vector.ZComponent = left.ZComponent * inverse; return vector; }
/// <summary> /// Used to divide a vector by a scalar value. /// </summary> /// <param name="left"></param> /// <param name="scalar"></param> /// <returns></returns> public static Vector3FloatStruct Divide(Vector3FloatStruct left, float scalar) { return left / scalar; }