//***********************************************************//
// Demo:    Lens Flare Editor
// Author:  terror
// Spec:    demo for gamedev.ru
//***********************************************************//
#pragma once
#include <math.h>
typedef unsigned int   uint;


struct vector
{
	vector() {v[0] = v[1] = v[2] = 0;}
	vector(float px, float py, float pz) {v[0] = px; v[1] = py; v[2] = pz;}
	vector(const vector &pVec) {v[0] = pVec.v[0]; v[1] = pVec.v[1]; v[2] = pVec.v[2];}
	vector operator=(const vector &pVec)
	{return vector(v[0] = pVec.v[0], v[1] = pVec.v[1], v[2] = pVec.v[2]);}
	const float &operator[](int ndx) const {return v[ndx];}
	float &operator[](int ndx)             {return v[ndx];}
	operator float*(void)                  {return v;}
	void Set(float x, float y, float z) {v[0] = x; v[1] = y; v[2] = z;}
	void Set(const vector &p)           {v[0] = p[0]; v[1] = p[1]; v[2] = p[2];}
	void Set ( float val )
	{ v[0] = val; v[1] = val; v[2] = val; }
public:
	float v[3];
};


struct vector4
{
	vector4() {v[0] = v[1] = v[2] = 0;}
	vector4(float px, float py, float pz) {v[0] = px; v[1] = py; v[2] = pz;}
	vector4(const float *pVec) {v[0] = pVec[0]; v[1] = pVec[1]; v[2] = pVec[2];}
	vector4 operator=(const vector4 &pVec)
	{return vector4(v[0] = pVec.v[0], v[1] = pVec.v[1], v[2] = pVec.v[2]);}
	const float &operator[](int ndx) const {return v[ndx];}
	float &operator[](int ndx)             {return v[ndx];}
	operator float*(void)                  {return v;}
	void Set(float x, float y, float z, float a) {v[0] = x; v[1] = y; v[2] = z; v[3] = a;}
	void Set(const vector4 &p)           {v[0] = p[0]; v[1] = p[1]; v[2] = p[2];}
	void Set ( float val )
	{ v[0] = val; v[1] = val; v[2] = val; v[3] = val;}
public:
	float v[4];
};



#define VECTOR_SET3(vec,x,y,z)		 vec.v[0]=x;vec.v[1]=y;vec.v[2]=z;
#define VECTOR_SET(vec,vl)				 vec.v[0]=vec.v[1]=vec.v[2]=vl;
#define VECTOR4_SET4(vec,x,y,z,a)  vec.v[0]=x;vec.v[1]=y;vec.v[2]=z;vec.v[3]=a;
#define VECTOR4_SET(vec,vl)        vec.v[0]=vec.v[1]=vec.v[2]=vec.v[3]=vl;

