#pragma once

class StylizedGUI;

#pragma warning(push)
#pragma warning(disable:4312)
#pragma warning(disable:4311)
#include <Fl/Fl_Gl_Window.h>
#pragma warning(pop)

#include "BetterCamera.h"
#include <vector>
class StylizedGLWindow : public Fl_Gl_Window
{

public:

	StylizedGLWindow(int x, int y, int w, int h, const char* l = 0);

	StylizedGUI* sw;
	
	BetterCamera* dasCamera;

	unsigned long lastClock;
	unsigned long timeT;

	//1 if we're doing the stylizations, 0 otherwise.
	//int style;

	virtual int handle(int);
	virtual void draw();

	void setProjection();
	void drawStuff();
	void paintStuff(int height, int width, float* depthBuf, char* brush2,
									char* brush4, char* brush6, char* brush8, char* brush10, unsigned char* buf,
									unsigned char* paintbuf);
	/*void paintOutlines(int height, int width, float* depthBuf, char* brush2,
									char* brush4, char* brush6, char* brush8, char* brush10, unsigned char* buf,
									unsigned char* paintbuf);*/

	/*void paint(float* depthBuf, char* brush2,
									char* brush4, char* brush6, char* brush8, char* brush10, unsigned char* buf,
									unsigned char* paintbuf);
	*/
	void paintBetsy(float* depthBuf,unsigned char* buf, unsigned char* paintbuf);

	void paintOutlines(int height, int width, float* depthBuf, unsigned char* buf, unsigned char* paintbuf);

	void createStroke(int imageHeight, int imageWidth, int startIndex, 
									char* x_gradient, char* y_gradient, unsigned char* buf,
									unsigned char* paintbuf, float* depthbuf);

	void drawLine(int x1, int y1, int x2, int y2, char red, char green, char blue, unsigned char* paintbuf, int recLimit, float depth);
	
	void drawStroke(std::vector<int> controlPoints, char red, char green, char blue, unsigned char* paintbuf, float depth);
	float f_cardinal(float u, float p0, float p1, float p2, float p3);

	int doneOnce;
	int modelLoaded;
private:
	
	float largestMagnitudeDepth;
	float secondLMD;
	char* onceComputedBuf;


	//GLuint texture_obj;
};