
///////////////////////////////////////////////////////////////////////////////
//
// File   : Asura_Streaming_Connection.h
// Author : Andy Tate
// Date   : 2-Feb-2006
//
// Copyright (C) 2006 Rebellion, All Rights Reserved.
//
///////////////////////////////////////////////////////////////////////////////

// RJT NOTE: Required for GCC builds as the file list generation doesn't account for VC project exclusion from build
#ifdef ASURA_USE_STREAMING

#ifdef ASURA_USE_PRAGMA_ONCE
	#pragma once
#endif   // ifdef ASURA_USE_PRAGMA_ONCE

#ifndef __ASURA_STREAMING_CONNECTION_H__
#define __ASURA_STREAMING_CONNECTION_H__

////////////////////////////////////////////////////////////////////////////////
// Include files...
////////////////////////////////////////////////////////////////////////////////

#include "Core/Asura_Maths.h"
#include "Core/Asura_Hash.h"
#include "Core/Asura_String.h"

////////////////////////////////////////////////////////////////////////////////
// Forward class declarations...
////////////////////////////////////////////////////////////////////////////////


////////////////////////////////////////////////////////////////////////////////
// Class declaration...
////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////
// Class        : Asura_Streaming_Connection
// Author       : Andy Tate
// Date         : 2-Feb-2006
//
// Description  : The connection used to hook one streaming zone to another.
////////////////////////////////////////////////////////////////////////////////


class Asura_Streaming_Connection
{
public:
	// Public functions...

	Asura_Streaming_Connection  (void)	{}

	Asura_Streaming_Connection  (const char* szToZoneName, const Asura_Vector_3& xRelativeOffset)
	: m_xZoneName( szToZoneName )
	, m_uToZoneHashID( Asura_GetHashID(szToZoneName) )
	, m_xRelativeOffset( xRelativeOffset )
	, m_bLowDetail( false )
	, m_bUseBoundingBoxForLoading( false )
	{
		m_xBoundingBoxForLoading.Zero();
	}

	Asura_Streaming_Connection  (const Asura_Streaming_Connection& xOther)
	: m_xZoneName( xOther.m_xZoneName )
	, m_uToZoneHashID( xOther.m_uToZoneHashID )
	, m_xRelativeOffset( xOther.m_xRelativeOffset )
	, m_bLowDetail( xOther.m_bLowDetail )
	, m_bUseBoundingBoxForLoading( xOther.m_bUseBoundingBoxForLoading )
	, m_xBoundingBoxForLoading( xOther.m_xBoundingBoxForLoading )
	#ifdef ASURA_TOOLS
	, m_xToolsFilename( xOther.m_xToolsFilename )
	#endif
	{
	}

//	~Asura_Streaming_Connection ();

	Asura_Streaming_Connection&	operator=			(const Asura_Streaming_Connection& xOther)
	{ 
		m_xZoneName = xOther.m_xZoneName; 
		m_uToZoneHashID = xOther.m_uToZoneHashID; 
		m_xRelativeOffset = xOther.m_xRelativeOffset; 
		m_bLowDetail = xOther.m_bLowDetail;
		m_bUseBoundingBoxForLoading = xOther.m_bUseBoundingBoxForLoading;
		m_xBoundingBoxForLoading = xOther.m_xBoundingBoxForLoading;
		#ifdef ASURA_TOOLS
		m_xToolsFilename = xOther.m_xToolsFilename;
		#endif
		return(*this); 
	}

	// Accessor functions...
	Asura_Hash_ID				GetToZoneHashID		(void) const								{ return(m_uToZoneHashID); }
	const Asura_Vector_3&		GetRelativeOffset	(void) const								{ return(m_xRelativeOffset); }
	const char*					GetToZoneName 		(void) const								{ return m_xZoneName.GetString();}
	bool						GetUseBoxForLoading (void) const								{ return m_bUseBoundingBoxForLoading;}
	const Asura_Bounding_Box&	GetBoxForLoading	(void) const								{	return m_xBoundingBoxForLoading;}
	bool						IsLowDetail			(void) const								{ return m_bLowDetail; }
	#ifdef ASURA_TOOLS
	const char*					GetToolsFilename	(void) const								{return m_xToolsFilename.GetString();}
	#endif

	void						SetToZoneName(const char* szName)								{m_xZoneName = szName; m_uToZoneHashID = Asura_GetHashID(szName);}
	void						SetRelativeOffset(const Asura_Vector_3& xOffset)				{m_xRelativeOffset = xOffset;}
	void						SetUseBoxForLoading	(bool bUse)									{m_bUseBoundingBoxForLoading = bUse;}
	void						SetBoxForLoading(const Asura_Bounding_Box& xBox)				{m_xBoundingBoxForLoading = xBox;}
	void						SetLowDetail(bool bSet)											{m_bLowDetail = bSet;}
	#ifdef ASURA_TOOLS
	void						SetToolsFilename(const char* szFilename)						{m_xToolsFilename = szFilename;}
	#endif
	

	//Load & Save
	void			  			ReadFromChunkStream(class Asura_Chunk_Stream& xStream,int iChunkVersion);
	#ifdef ASURA_TOOLS
	void			  			WriteToChunkStream(class Asura_Chunk_Stream& xStream) const;
	#endif


protected:
	// Protected variables...


	// Protected functions...


private:
	// Private variables...

	Asura_String	m_xZoneName;			// Name of connected zone
	Asura_Hash_ID	m_uToZoneHashID;		// Hash ID for the destination zone.
	Asura_Vector_3	m_xRelativeOffset;		// Offset from our source zone to the destination zone.

	bool			m_bLowDetail;			// The low detail version of the zone should be loaded

	bool			m_bUseBoundingBoxForLoading; //Should the box be used? If not then the connected zone should always be loaded
	Asura_Bounding_Box m_xBoundingBoxForLoading; //If within this (world space) box then the connected zone should be loaded.

	#ifdef ASURA_TOOLS
	Asura_String	m_xToolsFilename;		//Name of asura file to load in tools
	#endif

	// Private functions...

};   // End of class 'Asura_Streaming_Connection'.


#endif   // ifndef __ASURA_STREAMING_CONNECTION_H__

#endif	// ASURA_USE_STREAMING

/// End of file. ///
