//===========================================================================//
// File:	vidrend.hh																			  //
// Project: MUNGA           Brick: Video Renderer Manager	                 //
// Contents: Interface specification Video Renderer Manager       			  //
//---------------------------------------------------------------------------//
//   Date    Who  Modification                                               //
// --------  ---  ---------------------------------------------------------- //
// 01/11/95  GAC  Initial coding.                                            //
//---------------------------------------------------------------------------//
// Copyright (C) 1995, Virtual World Entertainment, Inc.                     //
// All Rights reserved worldwide                                             //
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL               //
//===========================================================================//

#if !defined(VIDREND_HPP)
#	define VIDREND_HPP

#	if !defined(SLOT_HPP)
#		include <slot.hpp>
#	endif

#	if !defined(CHAIN_HPP)
#		include <chain.hpp>
#	endif

#	if !defined(RENDERER_HPP)
#		include <renderer.hpp>
#	endif

#	if defined(TRACE_VIDEO_RENDERER) || defined(USE_ONE_VIDEO_TRACE)
		extern BitTrace Video_Renderer;
#	endif

#	if defined(TRACE_VIDEO_RENDERER)
#		define SET_VIDEO_RENDERER() Video_Renderer.Set()
#		define CLEAR_VIDEO_RENDERER() Video_Renderer.Clear()
#	else
#		define SET_VIDEO_RENDERER()
#		define CLEAR_VIDEO_RENDERER()
#	endif

#	if defined(TRACE_VIDEO_BECOME_INTERESTING)
#		if defined(USE_ONE_VIDEO_TRACE)
#			define SET_VIDEO_BECOME_INTERESTING() Video_Renderer.Set()
#			define CLEAR_VIDEO_BECOME_INTERESTING() Video_Renderer.Clear()
#		else
			extern BitTrace Video_Become_Interesting;
#			define SET_VIDEO_BECOME_INTERESTING() Video_Become_Interesting.Set()
#			define CLEAR_VIDEO_BECOME_INTERESTING()\
				Video_Become_Interesting.Clear()
#		endif
#	else
#		define SET_VIDEO_BECOME_INTERESTING()
#		define CLEAR_VIDEO_BECOME_INTERESTING()
#	endif

#	if defined(TRACE_VIDEO_BECOME_UNINTERESTING)
#		if defined(USE_ONE_VIDEO_TRACE)
#			define SET_VIDEO_BECOME_UNINTERESTING() Video_Renderer.Set()
#			define CLEAR_VIDEO_BECOME_UNINTERESTING() Video_Renderer.Clear()
#		else
			extern BitTrace Video_Become_Uninteresting;
#			define SET_VIDEO_BECOME_UNINTERESTING()\
				Video_Become_Uninteresting.Set()
#			define CLEAR_VIDEO_BECOME_UNINTERESTING()\
				Video_Become_Uninteresting.Clear()
#		endif
#	else
#		define SET_VIDEO_BECOME_UNINTERESTING()
#		define CLEAR_VIDEO_BECOME_UNINTERESTING()
#	endif

	class VideoRenderer:
		public Renderer
	{
	public:
		VideoRenderer(
			RendererRate calibration_rate,
			RendererComplexity calibration_complexity,
			RendererPriority calibration_priority,
			InterestType interest_type,
			InterestDepth depth_calibration
		);
		~VideoRenderer();

		Logical
      	TestInstance() const;

		//
		//--------------------------------------------------------------------
		// NotifyOfNewInterestingEntity
		//
		// This method tells the renderer that a new entity will be in it's
		// interest list the next time the Execute method is called.
		//--------------------------------------------------------------------
		//
		void
			NotifyOfNewInterestingEntity(Entity *interesting_entity);

		void
			NotifyOfBecomingUninterestingEntity(Entity *uninteresting_entity);

	private:
		void
			LoadMissionImplementation(Mission *mission);
		void
			ShutdownImplementation();
		void
			SuspendImplementation();
		void
			ResumeImplementation();
		void
			ExecuteImplementation(
				RendererComplexity complexity_update,
				RendererOrigin::InterestingEntityIterator *iterator
			);

	protected:

		enum ViewFrom
		{
			outsideEntity,			// The external view of an entity will be displayed
			insideEntity,			// The internal view of the entity will be displayed
			collisionEntity		// The collision solids of the entity will be displayed
		};

		//
		//--------------------------------------------------------------------
		// MakeEntityRenderables
		//
		// This method is called to create the renderables for a given entity
		// it must be provided by the hardware specific renderer.
		//--------------------------------------------------------------------
		//
		virtual void
			MakeEntityRenderables(
				Entity*,						// The entity we are dealing with
				ResourceDescription*,	// Pointer to the video resource
				ViewFrom						// Type of reference (inside/outside...etc.)
			);

		Logical
			Disconnected_Eye;				// If this is true, we will construct an outside
												// version of the viewpoint entity.  This is so
												// higher level renderers can fix the eye in one
                                    // spot and watch the viewpoint entity drive around.

	};

#endif
