#include "Vec4f.h"
#include "Vec3f.h"

Vec4f::Vec4f(float x, float y, float z, float w )
{
	this->x = x;
	this->y = y;
	this->z = z;
	this->w = w;
}

Vec4f::Vec4f(Vec3f source)
{
	this->x = source.x;
	this->y = source.y;
	this->z = source.z;
	this->w = 1;
}

Vec4f::~Vec4f()
{

}

Vec4f &Vec4f::operator = (const Vec4f& other)
{
	this->x = other.x;
	this->y = other.y;
	this->z = other.z;
	this->w = other.w;

	return *this;
}

void Vec4f::toVec3f(Vec3f* target)
{
	float scale = 1.0f / this->w;
	(*target).x = this->x * scale;
	(*target).y = this->y * scale;
	(*target).z = this->z * scale;
}

void Vec4f::scale(float factor)
{
	this->x *= factor;
	this->y *= factor;
	this->z *= factor;
	this->w *= factor;
}

void Vec4f::mult(Vec4f* other)
{
	this->x *= other->x;
	this->y *= other->y;
	this->z *= other->z;
	this->w *= other->w;
}