#pragma once

#include <xsi_longarray.h>
#include <xsi_vector3.h>
#include <xsi_toolcontext.h>
#include <xsi_application.h>


#include "GL/glew.h"
#if defined(_WIN32)
#  include "GL/wglew.h"
#elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
#  include "GL/glxew.h"
#endif

using namespace XSI;
using namespace XSI::MATH;

#define kBrushSegments					64
#define kBrushRadiusMax					1000

class BrushTool
{
private:
	double			radius, radiusstart;
	CDoubleArray	circlepts;
	LONG			segments;
	

public:
	BrushTool(void);
	~BrushTool(void);

	double	GetRadius() { return radius; };
	void	SetRadius( double l_radius );
	void	SetBaseRadius(double l_radius) { radiusstart = l_radius; };
	double	GetBaseRadius() {  return radiusstart;};
	void	GetCirclePoints(CDoubleArray& cout) { cout = circlepts; };
	void	Setup(double l_radius = 100.0, LONG l_segments = 64);

	void	Draw(ToolContext &in_ctxt,double scale,double px, double py, double pz, double angle = 0, CVector3 orix=CVector3(0,0,0) );
	void	MouseMove();
	void	MouseDrag();
	void	MouseUp();
private:
	void	constructCircle (double in_centerx=0, double in_centery=0);
};

