/****************************************************************************************

		VectorS.h

  		Copyright: (c) 2001 Eovia Corp. All rights reserved.

		Vector Math Library, Release 2.0,  1/1/96 
		Copyright 1996 Alec Miller, All Rights Reserved 

		Revision History

		when		who			what & why
		==========	==========	======================================================
		11/5/96		Alec		new today - brought over conversions to struct vectors
									to keep MSDev happy about old ID unions with vecs

*****************************************************************************************/

#ifndef __VectorS__
#define __VectorS__

#if CP_PRAGMA_ONCE
#pragma once
#endif

#include "Vector2.h"
#include "Vector3.h"
#include "Vector4.h"

// Because MSDev has a problem with classes with void constructors (even with no code) in a union, 
// the vectors from the vector math library are defined as structs below.  Do not define any
// ctors for these structs or else we're right back at the same problem.  Also do not define
// any new members here, we should be using the class equivalents not beefing these up
// with duplicate member functions.  These structs are simply to get the union to compile.

#if _MSC_VER || __GNUC__

	/******************************************************************************\
	*                                                                              *
	*      SVector2                                                                *
	*                                                                              *
	\******************************************************************************/

	struct SVector2
	{ 
		TVector2& operator=			(TVector2& v)
			{ x = v.x; y = v.y; return *this; } 
			
		TVector2& operator=			(const TVector2& v)
			{ x = v.x; y = v.y; return *this; } 
		
		operator  TVector2&			(void)
			{ return *(TVector2*)this; }

		operator const TVector2&	(void) const
			{ return *(TVector2*)this; }
		
		real x, y;
	};


	
	/******************************************************************************\
	*                                                                              *
	*      SVector3                                                                *
	*                                                                              *
	\******************************************************************************/

	struct SVector3
	{ 
		TVector3& operator=			(TVector3& v)
			{ *this = v; return *this; } 
		
		operator TVector3&			(void)
			{ return *(TVector3*)this; }

		operator const TVector3&	(void) const
			{ return *(TVector3*)this; }
		
		real x, y, z; 
	};



	/******************************************************************************\
	*                                                                              *
	*      SVector4                                                                *
	*                                                                              *
	\******************************************************************************/

	struct SVector4
	{
		TVector4& operator=			(TVector4& v)
			{ *this = v; return *this; } 
			
		operator TVector4&			(void)
			{ return *(TVector4*)this; }

		operator const TVector4&	(void) const
			{ return *(TVector4*)this; }
		
		real x, y, z, w; 
	};

#else

	// hopefully all other compilers don't care about the union
	#define SVector2 TVector2
	#define SVector3 TVector3
	#define SVector4 TVector4
	
#endif


#endif

