//	ThreeFloats.h - Simple struct containing three floats.
//  ----------------------------------------------------------------------------

#ifndef THREEFLOATS_H_
#define THREEFLOATS_H_

///	Simple struct containing three floats.
struct ThreeFloats
{
	float x;
	float y;
	float z;

	///	Default constructor.
	ThreeFloats()
	{
		x = y = z = 0.0f;
	}

	///	Constructor, all members set to val.
	ThreeFloats(float val)
	{
		x = y = z = val;
	}

	///	Constructor.
	ThreeFloats(float xVal, float yVal, float zVal)
	{
		x = xVal;
		y = yVal;
		z = zVal;
	}

	///	Assignment operator.
	ThreeFloats& operator=(const ThreeFloats& op2)
	{
		x = op2.x;
		y = op2.y;
		z = op2.z;
		return *this;
	}

	///	Assignment operator (assigns all members the value of val).
	ThreeFloats& operator=(float val)
	{
		x = val;
		y = val;
		z = val;
		return *this;
	}

	///	Addition operator.
	ThreeFloats operator+(const ThreeFloats& op2)
	{
		ThreeFloats retval;

		retval.x = x + op2.x;
		retval.y = y + op2.y;
		retval.z = z + op2.z;

		return retval;
	}

	///	Subtraction operator.
	ThreeFloats operator-(const ThreeFloats& op2)
	{
		ThreeFloats retval;

		retval.x = x - op2.x;
		retval.y = y - op2.y;
		retval.z = z - op2.z;

		return retval;
	}

	///	Multiplication operator.
	ThreeFloats operator*(const ThreeFloats& op2)
	{
		ThreeFloats retval;

		retval.x = x * op2.x;
		retval.y = y * op2.y;
		retval.z = z * op2.z;

		return retval;
	}

	///	Multiplication operator (float).
	ThreeFloats operator*(float val)
	{
		ThreeFloats retval;

		retval.x = x * val;
		retval.y = y * val;
		retval.z = z * val;

		return retval;
	}

	///	Division operator (ThreeFloats).
	ThreeFloats operator/(const ThreeFloats& op2)
	{
		ThreeFloats retval;

		retval.x = x * op2.x;
		retval.y = y * op2.y;
		retval.z = z * op2.z;

		return retval;
	}

	///	Division operator (float).
	ThreeFloats operator/(float val)
	{
		ThreeFloats retval;

		retval.x = x / val;
		retval.y = y / val;
		retval.z = z / val;

		return retval;
	}

	///	Addition assignment operator.
	ThreeFloats& operator+=(const ThreeFloats& op2)
	{
		x += op2.x;
		y += op2.y;
		z += op2.z;

		return *this;
	}

	///	Subtraction assignment operator.
	ThreeFloats& operator-=(const ThreeFloats& op2)
	{
		x -= op2.x;
		y -= op2.y;
		z -= op2.z;

		return *this;
	}

	///	Multiplication assignment operator.
	ThreeFloats& operator*=(const ThreeFloats& op2)
	{
		x *= op2.x;
		y *= op2.y;
		z *= op2.z;

		return *this;
	}

	///	Multiplication assignment operator.
	ThreeFloats& operator*=(float op2)
	{
		x *= op2;
		y *= op2;
		z *= op2;

		return *this;
	}

	///	Division assignment operator.
	ThreeFloats& operator/=(const ThreeFloats& op2)
	{
		x /= op2.x;
		y /= op2.y;
		z /= op2.z;

		return *this;
	}

	///	Division assignment operator.
	ThreeFloats& operator/=(float op2)
	{
		x /= op2;
		y /= op2;
		z /= op2;

		return *this;
	}

	///	Equality operator.
	bool operator==(const ThreeFloats& op2)
	{
		return (x==op2.x)&&(y==op2.y)&&(z==op2.z);
	}

	///	Inequality operator.
	bool operator!=(const ThreeFloats& op2)
	{
		return (x!=op2.x)||(y!=op2.y)||(z!=op2.z);
	}

	friend ThreeFloats operator*(float op1, const ThreeFloats& op2);
};

#endif
