/*
	ZShaderProgramBase.hpp
	Author: Chris Ertel <crertel@762studios.com>,
			James Russell <jcrussell@762studios.com>
	Created: 04/03/2011

	Purpose: 
	
	ZShaderProgramBase handles the simple logistics for shader programs (e.g., log access, check usability). It 
	is intended to be extended by subclasses to handle implementation-specific issues.

	License:

	TODO
	
*/

#pragma once

#ifndef _ZSHADERPROGRAMBASE_HPP
#define _ZSHADERPROGRAMBASE_HPP

#include <ZRenderer/ZShaderProgram.hpp>

#include <ZUtil/ZUtil.hpp>

class ZShaderProgramBase : public ZShaderProgram
{
protected:
	//Default Constructor
	ZShaderProgramBase();

	//Our attached shaders (currently only support vertex and fragment)
	ZPtr<ZShader> VertexShader;
	ZPtr<ZShader> FragmentShader;

	ZArray< ZPtr<ZShader> > Shaders;

	//Our cached set of uniform blocks, samplers, and vertex streams
	ZArray<ZShaderUniformBlock>		UniformBlocks;
	ZArray<ZShaderSampler>			Samplers;
	ZArray<ZShaderStreamAttribute>	Streams;

	//Link log for shader program
	ZString Log;

	//Flag for shader in usable state
	bool bIsUsable;

public:
	//Virtual destructor
	virtual ~ZShaderProgramBase();

	//Subclass Implementation
	virtual bool AttachShader(ZPtr<ZShader> _shader);

	//Subclass Implementation
	virtual void ClearLog();

	//Subclass Implementation
	virtual void DetachShaders();

	//Subclass Implementation
	virtual const ZString& GetLinkLog();

	//Subclass Implementation
	virtual const ZArray<ZShaderStreamAttribute>& GetStreamDeclarations();

	//Subclass Implementation
	virtual const ZArray<ZShaderUniformBlock>& GetUniformBlockDeclarations();

	//Subclass Implementation
	virtual const ZArray<ZShaderSampler>& GetShaderSamplerDeclarations(); 

	//Subclass Implementation
	virtual const ZArray< ZPtr<ZShader> >& GetShaders();

	//Subclass Implementation
	virtual bool IsUsable();	
		
	//Not Implemented
	virtual bool Link() = 0;
};

#endif
