#pragma once

#include "intorgn.h"
#include "schain.h"

//##########################################################################
//#######################    RendererOrigin    #############################
//##########################################################################

class Renderer;
class Entity;

class RendererOrigin : public InterestOrigin
{
	friend class RendererOrigin__InterestingEntityIterator;

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Public types
//
public:
	typedef RendererOrigin__InterestingEntityIterator InterestingEntityIterator;

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Constructor, Destructor, and Testing
//
public:
	RendererOrigin(Renderer *renderer, Entity *entity, InterestType interest_type, InterestDepth depth_calibration);
	~RendererOrigin();
	Logical TestInstance() const;

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Interest Manager support
//
private:
	void AddInterestingEntity(Entity *interesting_entity);
	void RemoveUninterestingEntity(Entity *uninteresting_entity);
	void RemoveUninterestingEntities();

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Private data
//
private:
	Renderer* renderer;
	SChainOf<Entity*> interestingEntitySocket;
};

//~~~~~~~~~~~~~~~~~ RendererOrigin__InterestingEntityIterator ~~~~~~~~~~~~~~

class RendererOrigin__InterestingEntityIterator : public SChainIteratorOf<Entity*>
{
public:
	RendererOrigin__InterestingEntityIterator(RendererOrigin *renderer_origin);
	~RendererOrigin__InterestingEntityIterator();
};

#if 0
	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ RendererOrigin ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

	//
	//--------------------------------------------------------------------
	// RendererOrigin
	//
	// Represent a renderers origin of interest.
	//--------------------------------------------------------------------
	//

	class RendererOrigin : public InterestOrigin
	{
	public:
		//
		//--------------------------------------------------------------------
		// Constructor, Destructor, and Testing
		//--------------------------------------------------------------------
		//
		RendererOrigin(const EntityID &entity_ID, InterestType interest_type, InterestDepth depth_calibration, Renderer *renderer);
		~RendererOrigin();
		Logical TestInstance() const;

		//
		//--------------------------------------------------------------------
		// Interest Manager support
		//--------------------------------------------------------------------
		//
		void AddInterestingEntity(Entity *interesting_entity);
		void RemoveUninterestingEntity(Entity *uninteresting_entity);
		void RemoveUninterestingEntities();

	protected:
		//
		//--------------------------------------------------------------------
		// Protected data
		//--------------------------------------------------------------------
		//
		SlotOf<Renderer*> rendererSocket;
	};
#endif
