#ifndef RENDER_H
#define RENDER_H

#include "gl_shared.h"
#include "render_shared.h"

#include <string>

class GPUBuffer;
class Model;

class Render
{
public:
	Render();
	~Render();

	void Init(SDL_Window* pWindow);
	void InitGLExtensions();
	void Shutdown();

	void RenderScene();
	void RenderStats();

	void Present(bool vsync = false);

	void ResetStates();

	void SetViewMatrix(const glm::mat4& matView);
	void SetProjectionMatrix(const glm::mat4& matProjection);

	inline const glm::mat4& GetViewMatrix() { return m_viewMatrix; }
	inline const glm::mat4& GetProjectionMatrix() { return m_projectionMatrix; }

	void LoadSceneXML(const char* filename);

	SDL_GLContext GetGLContext() { return m_pGLContext; }

	void ToggleShowStats();

private:
	glm::mat4 m_viewMatrix;
	glm::mat4 m_projectionMatrix;

	SDL_Window* m_pWindow;
	SDL_GLContext m_pGLContext;

	GPUBuffer* m_pStretchedPicVBuf;

	bool m_usingVAO;
	bool m_showStats;
};

extern Render* g_render;

// TEMP
extern glm::vec3 g_viewOrigin;
extern glm::vec3 g_viewOrient;

#endif // !RENDER_H
