#include <hxcpp.h>

#ifndef INCLUDED_Luxe
#include <Luxe.h>
#endif
#ifndef INCLUDED_Std
#include <Std.h>
#endif
#ifndef INCLUDED_luxe_Debug
#include <luxe/Debug.h>
#endif
#ifndef INCLUDED_luxe_Draw
#include <luxe/Draw.h>
#endif
#ifndef INCLUDED_luxe_Emitter
#include <luxe/Emitter.h>
#endif
#ifndef INCLUDED_luxe_Objects
#include <luxe/Objects.h>
#endif
#ifndef INCLUDED_luxe_Screen
#include <luxe/Screen.h>
#endif
#ifndef INCLUDED_luxe_debug_BatcherDebugView
#include <luxe/debug/BatcherDebugView.h>
#endif
#ifndef INCLUDED_luxe_debug_DebugView
#include <luxe/debug/DebugView.h>
#endif
#ifndef INCLUDED_luxe_resource_Resource
#include <luxe/resource/Resource.h>
#endif
#ifndef INCLUDED_luxe_structural_BalancedBST
#include <luxe/structural/BalancedBST.h>
#endif
#ifndef INCLUDED_luxe_structural_BalancedBSTNode
#include <luxe/structural/BalancedBSTNode.h>
#endif
#ifndef INCLUDED_phoenix_Batcher
#include <phoenix/Batcher.h>
#endif
#ifndef INCLUDED_phoenix_Camera
#include <phoenix/Camera.h>
#endif
#ifndef INCLUDED_phoenix_Color
#include <phoenix/Color.h>
#endif
#ifndef INCLUDED_phoenix_PrimitiveType
#include <phoenix/PrimitiveType.h>
#endif
#ifndef INCLUDED_phoenix_Rectangle
#include <phoenix/Rectangle.h>
#endif
#ifndef INCLUDED_phoenix_Renderer
#include <phoenix/Renderer.h>
#endif
#ifndef INCLUDED_phoenix_Shader
#include <phoenix/Shader.h>
#endif
#ifndef INCLUDED_phoenix_TextAlign
#include <phoenix/TextAlign.h>
#endif
#ifndef INCLUDED_phoenix_Texture
#include <phoenix/Texture.h>
#endif
#ifndef INCLUDED_phoenix_Vector
#include <phoenix/Vector.h>
#endif
#ifndef INCLUDED_phoenix_geometry_CompositeGeometry
#include <phoenix/geometry/CompositeGeometry.h>
#endif
#ifndef INCLUDED_phoenix_geometry_Geometry
#include <phoenix/geometry/Geometry.h>
#endif
#ifndef INCLUDED_phoenix_geometry_LineGeometry
#include <phoenix/geometry/LineGeometry.h>
#endif
#ifndef INCLUDED_phoenix_geometry_RectangleGeometry
#include <phoenix/geometry/RectangleGeometry.h>
#endif
#ifndef INCLUDED_snow_platform_native_render_opengl_GLObject
#include <snow/platform/native/render/opengl/GLObject.h>
#endif
#ifndef INCLUDED_snow_platform_native_render_opengl_GLTexture
#include <snow/platform/native/render/opengl/GLTexture.h>
#endif
namespace luxe{
namespace debug{

Void BatcherDebugView_obj::__construct()
{
HX_STACK_FRAME("luxe.debug.BatcherDebugView","new",0xed05fff6,"luxe.debug.BatcherDebugView.new","luxe/debug/BatcherDebugView.hx",11,0xdc49bab8)
{
	HX_STACK_LINE(63)
	this->as_immediate = false;
	HX_STACK_LINE(35)
	this->dragging = false;
	HX_STACK_LINE(14)
	super::__construct();
	HX_STACK_LINE(15)
	this->name = HX_CSTRING("Batcher Debug");
}
;
	return null();
}

//BatcherDebugView_obj::~BatcherDebugView_obj() { }

Dynamic BatcherDebugView_obj::__CreateEmpty() { return  new BatcherDebugView_obj; }
hx::ObjectPtr< BatcherDebugView_obj > BatcherDebugView_obj::__new()
{  hx::ObjectPtr< BatcherDebugView_obj > result = new BatcherDebugView_obj();
	result->__construct();
	return result;}

Dynamic BatcherDebugView_obj::__Create(hx::DynamicArray inArgs)
{  hx::ObjectPtr< BatcherDebugView_obj > result = new BatcherDebugView_obj();
	result->__construct();
	return result;}

Void BatcherDebugView_obj::create( ){
{
		HX_STACK_FRAME("luxe.debug.BatcherDebugView","create",0x7eca9926,"luxe.debug.BatcherDebugView.create","luxe/debug/BatcherDebugView.hx",22,0xdc49bab8)
		HX_STACK_THIS(this)
		struct _Function_1_1{
			inline static Dynamic Block( ){
				HX_STACK_FRAME("*","closure",0x5bdab937,"*.closure","luxe/debug/BatcherDebugView.hx",22,0xdc49bab8)
				{
					hx::Anon __result = hx::Anon_obj::Create();
					__result->Add(HX_CSTRING("name") , HX_CSTRING("debug_batcher_view"),false);
					struct _Function_2_1{
						inline static Dynamic Block( ){
							HX_STACK_FRAME("*","closure",0x5bdab937,"*.closure","luxe/debug/BatcherDebugView.hx",24,0xdc49bab8)
							{
								hx::Anon __result = hx::Anon_obj::Create();
								__result->Add(HX_CSTRING("camera_name") , HX_CSTRING("batcher_debug_view"),false);
								return __result;
							}
							return null();
						}
					};
					__result->Add(HX_CSTRING("camera") , ::phoenix::Camera_obj::__new(_Function_2_1::Block()),false);
					__result->Add(HX_CSTRING("layer") , (int)1000,false);
					return __result;
				}
				return null();
			}
		};
		HX_STACK_LINE(22)
		this->batcher = ::Luxe_obj::renderer->create_batcher(_Function_1_1::Block());
	}
return null();
}


Void BatcherDebugView_obj::refresh( ){
{
		HX_STACK_FRAME("luxe.debug.BatcherDebugView","refresh",0x4e318c71,"luxe.debug.BatcherDebugView.refresh","luxe/debug/BatcherDebugView.hx",30,0xdc49bab8)
		HX_STACK_THIS(this)
		HX_STACK_LINE(31)
		this->clear_batcher_tree();
		HX_STACK_LINE(32)
		this->draw_batcher_tree();
	}
return null();
}


Void BatcherDebugView_obj::onmousedown( Dynamic e){
{
		HX_STACK_FRAME("luxe.debug.BatcherDebugView","onmousedown",0x5ec63d9e,"luxe.debug.BatcherDebugView.onmousedown","luxe/debug/BatcherDebugView.hx",39,0xdc49bab8)
		HX_STACK_THIS(this)
		HX_STACK_ARG(e,"e")
		HX_STACK_LINE(40)
		this->dragmstart = e->__Field(HX_CSTRING("pos"),true)->__Field(HX_CSTRING("clone"),true)();
		HX_STACK_LINE(41)
		this->dragstart = this->batcher->view->get_pos()->clone();
		HX_STACK_LINE(42)
		this->dragging = true;
	}
return null();
}


Void BatcherDebugView_obj::onmouseup( Dynamic e){
{
		HX_STACK_FRAME("luxe.debug.BatcherDebugView","onmouseup",0x175fa497,"luxe.debug.BatcherDebugView.onmouseup","luxe/debug/BatcherDebugView.hx",45,0xdc49bab8)
		HX_STACK_THIS(this)
		HX_STACK_ARG(e,"e")
		HX_STACK_LINE(45)
		this->dragging = false;
	}
return null();
}


Void BatcherDebugView_obj::onmousemove( Dynamic e){
{
		HX_STACK_FRAME("luxe.debug.BatcherDebugView","onmousemove",0x64b9284d,"luxe.debug.BatcherDebugView.onmousemove","luxe/debug/BatcherDebugView.hx",48,0xdc49bab8)
		HX_STACK_THIS(this)
		HX_STACK_ARG(e,"e")
		HX_STACK_LINE(48)
		if ((this->dragging)){
			HX_STACK_LINE(49)
			::phoenix::Vector diff = ::phoenix::Vector_obj::Subtract(e->__Field(HX_CSTRING("pos"),true),this->dragmstart);		HX_STACK_VAR(diff,"diff");
			HX_STACK_LINE(50)
			this->batcher->view->set_pos(::phoenix::Vector_obj::Subtract(this->dragstart,diff));
		}
	}
return null();
}


Void BatcherDebugView_obj::onmousewheel( Dynamic e){
{
		HX_STACK_FRAME("luxe.debug.BatcherDebugView","onmousewheel",0x7a9e83df,"luxe.debug.BatcherDebugView.onmousewheel","luxe/debug/BatcherDebugView.hx",55,0xdc49bab8)
		HX_STACK_THIS(this)
		HX_STACK_ARG(e,"e")
		HX_STACK_LINE(55)
		if (((e->__Field(HX_CSTRING("y"),true) < (int)0))){
			HX_STACK_LINE(56)
			::phoenix::Camera _g = this->batcher->view;		HX_STACK_VAR(_g,"_g");
			HX_STACK_LINE(56)
			_g->set_zoom((_g->zoom - 0.1));
		}
		else{
			HX_STACK_LINE(58)
			::phoenix::Camera _g = this->batcher->view;		HX_STACK_VAR(_g,"_g");
			HX_STACK_LINE(58)
			_g->set_zoom((_g->zoom + 0.1));
		}
	}
return null();
}


Void BatcherDebugView_obj::clear_batcher_tree( ){
{
		HX_STACK_FRAME("luxe.debug.BatcherDebugView","clear_batcher_tree",0x9faccb92,"luxe.debug.BatcherDebugView.clear_batcher_tree","luxe/debug/BatcherDebugView.hx",66,0xdc49bab8)
		HX_STACK_THIS(this)
		HX_STACK_LINE(66)
		if (((this->_tree_geom != null()))){
			HX_STACK_LINE(67)
			this->_tree_geom->drop(null());
			HX_STACK_LINE(68)
			this->_tree_geom = null();
		}
	}
return null();
}


HX_DEFINE_DYNAMIC_FUNC0(BatcherDebugView_obj,clear_batcher_tree,(void))

::String BatcherDebugView_obj::keystr( Dynamic key,Dynamic key2){
	HX_STACK_FRAME("luxe.debug.BatcherDebugView","keystr",0x42b5de9c,"luxe.debug.BatcherDebugView.keystr","luxe/debug/BatcherDebugView.hx",72,0xdc49bab8)
	HX_STACK_THIS(this)
	HX_STACK_ARG(key,"key")
	HX_STACK_ARG(key2,"key2")
	HX_STACK_LINE(74)
	::String _g = ((((((((HX_CSTRING("ts: ") + key->__Field(HX_CSTRING("timestamp"),true)) + HX_CSTRING("\n")) + HX_CSTRING("seq: ")) + key->__Field(HX_CSTRING("sequence"),true)) + HX_CSTRING("\n")) + HX_CSTRING("primitive_type: ")) + ::Std_obj::string(key->__Field(HX_CSTRING("primitive_type"),true))) + HX_CSTRING(" "));		HX_STACK_VAR(_g,"_g");
	HX_STACK_LINE(74)
	::String _g1 = (((_g + key->__Field(HX_CSTRING("primitive_type"),true)->__Index()) + HX_CSTRING("\n")) + HX_CSTRING("texture: "));		HX_STACK_VAR(_g1,"_g1");
	HX_STACK_LINE(74)
	::String _g2;		HX_STACK_VAR(_g2,"_g2");
	HX_STACK_LINE(74)
	_g2 = (((_g1 + ((  (((key->__Field(HX_CSTRING("texture"),true) == null()))) ? ::String(HX_CSTRING("null")) : ::String(::Std_obj::string(key->__Field(HX_CSTRING("texture"),true)->__Field(HX_CSTRING("texture"),true))) ))) + HX_CSTRING("\n")) + HX_CSTRING("texture id: "));
	HX_STACK_LINE(74)
	::String _g3;		HX_STACK_VAR(_g3,"_g3");
	HX_STACK_LINE(74)
	_g3 = (((_g2 + ((  (((key->__Field(HX_CSTRING("texture"),true) == null()))) ? ::String(HX_CSTRING("null")) : ::String(key->__Field(HX_CSTRING("texture"),true)->__Field(HX_CSTRING("id"),true)) ))) + HX_CSTRING("\n")) + HX_CSTRING("shader: "));
	HX_STACK_LINE(74)
	::String _g4;		HX_STACK_VAR(_g4,"_g4");
	HX_STACK_LINE(74)
	_g4 = (((((((((_g3 + ((  (((key->__Field(HX_CSTRING("shader"),true) == null()))) ? ::String(HX_CSTRING("null")) : ::String(key->__Field(HX_CSTRING("shader"),true)->__Field(HX_CSTRING("id"),true)) ))) + HX_CSTRING("\n")) + HX_CSTRING("group: ")) + key->__Field(HX_CSTRING("group"),true)) + HX_CSTRING("\n")) + HX_CSTRING("depth: ")) + key->__Field(HX_CSTRING("depth"),true)) + HX_CSTRING("\n")) + HX_CSTRING("clip: "));
	HX_STACK_LINE(74)
	return (_g4 + ::Std_obj::string(key->__Field(HX_CSTRING("clip"),true)));
}


HX_DEFINE_DYNAMIC_FUNC2(BatcherDebugView_obj,keystr,return )

Void BatcherDebugView_obj::draw_geom_node( bool l,::luxe::structural::BalancedBSTNode _leaf,::phoenix::Vector _p,hx::Null< Float >  __o__bbw){
Float _bbw = __o__bbw.Default(20);
	HX_STACK_FRAME("luxe.debug.BatcherDebugView","draw_geom_node",0xc8abfe94,"luxe.debug.BatcherDebugView.draw_geom_node","luxe/debug/BatcherDebugView.hx",85,0xdc49bab8)
	HX_STACK_THIS(this)
	HX_STACK_ARG(l,"l")
	HX_STACK_ARG(_leaf,"_leaf")
	HX_STACK_ARG(_p,"_p")
	HX_STACK_ARG(_bbw,"_bbw")
{
		HX_STACK_LINE(87)
		Float _bw = (int)128;		HX_STACK_VAR(_bw,"_bw");
		HX_STACK_LINE(88)
		Float _bwhalf = (Float(_bw) / Float((int)2));		HX_STACK_VAR(_bwhalf,"_bwhalf");
		HX_STACK_LINE(89)
		Float _bh = (int)128;		HX_STACK_VAR(_bh,"_bh");
		HX_STACK_LINE(91)
		::phoenix::geometry::Geometry _g = _leaf->value;		HX_STACK_VAR(_g,"_g");
		HX_STACK_LINE(93)
		::phoenix::Color c = ::phoenix::Color_obj::__new((int)1,(int)1,(int)1,0.4)->rgb((int)16777215);		HX_STACK_VAR(c,"c");
		HX_STACK_LINE(95)
		if ((_g->dropped)){
			HX_STACK_LINE(96)
			c = ::phoenix::Color_obj::__new((int)1,(int)1,(int)1,(int)1)->rgb((int)13369344);
		}
		struct _Function_1_1{
			inline static Dynamic Block( Float &_bh,::luxe::debug::BatcherDebugView_obj *__this,::phoenix::Color &c,Float &_bwhalf,Float &_bw,::phoenix::Vector &_p){
				HX_STACK_FRAME("*","closure",0x5bdab937,"*.closure","luxe/debug/BatcherDebugView.hx",100,0xdc49bab8)
				{
					hx::Anon __result = hx::Anon_obj::Create();
					__result->Add(HX_CSTRING("immediate") , __this->as_immediate,false);
					__result->Add(HX_CSTRING("x") , (_p->x - _bwhalf),false);
					__result->Add(HX_CSTRING("y") , _p->y,false);
					__result->Add(HX_CSTRING("w") , _bw,false);
					__result->Add(HX_CSTRING("h") , _bh,false);
					__result->Add(HX_CSTRING("color") , c,false);
					__result->Add(HX_CSTRING("batcher") , __this->batcher,false);
					__result->Add(HX_CSTRING("depth") , 999.4,false);
					return __result;
				}
				return null();
			}
		};
		HX_STACK_LINE(99)
		this->_tree_geom->add_geometry(::Luxe_obj::draw->rectangle(_Function_1_1::Block(_bh,this,c,_bwhalf,_bw,_p)));
		HX_STACK_LINE(113)
		::phoenix::Rectangle _g1 = ::phoenix::Rectangle_obj::__new((_p->x - _bwhalf),_p->y,_bw,_bh);		HX_STACK_VAR(_g1,"_g1");
		struct _Function_1_2{
			inline static Dynamic Block( ::luxe::debug::BatcherDebugView_obj *__this,::phoenix::Rectangle &_g1,::phoenix::Color &c,::luxe::structural::BalancedBSTNode &_leaf,::phoenix::geometry::Geometry &_g){
				HX_STACK_FRAME("*","closure",0x5bdab937,"*.closure","luxe/debug/BatcherDebugView.hx",111,0xdc49bab8)
				{
					hx::Anon __result = hx::Anon_obj::Create();
					__result->Add(HX_CSTRING("immediate") , __this->as_immediate,false);
					__result->Add(HX_CSTRING("bounds") , _g1,false);
					__result->Add(HX_CSTRING("size") , (int)13,false);
					__result->Add(HX_CSTRING("color") , c,false);
					__result->Add(HX_CSTRING("batcher") , __this->batcher,false);
					__result->Add(HX_CSTRING("depth") , 999.4,false);
					__result->Add(HX_CSTRING("text") , __this->keystr(_leaf->key,_g->key),false);
					__result->Add(HX_CSTRING("align") , ::phoenix::TextAlign_obj::center,false);
					__result->Add(HX_CSTRING("align_vertical") , ::phoenix::TextAlign_obj::center,false);
					return __result;
				}
				return null();
			}
		};
		HX_STACK_LINE(110)
		this->_tree_geom->add_geometry(::Luxe_obj::draw->text(_Function_1_2::Block(this,_g1,c,_leaf,_g)));
		HX_STACK_LINE(124)
		::phoenix::Vector t = _p->clone()->set_xy(_p->x,(_p->y - (int)16));		HX_STACK_VAR(t,"t");
		HX_STACK_LINE(125)
		::phoenix::Vector t2 = _p->clone()->set_xy(_p->x,((_p->y + _bw) + (int)2));		HX_STACK_VAR(t2,"t2");
		HX_STACK_LINE(126)
		::phoenix::TextAlign talign = ::phoenix::TextAlign_obj::center;		HX_STACK_VAR(talign,"talign");
		struct _Function_1_3{
			inline static Dynamic Block( ::luxe::debug::BatcherDebugView_obj *__this,::phoenix::Color &c,::phoenix::geometry::Geometry &_g,::phoenix::Vector &t,::phoenix::TextAlign &talign){
				HX_STACK_FRAME("*","closure",0x5bdab937,"*.closure","luxe/debug/BatcherDebugView.hx",133,0xdc49bab8)
				{
					hx::Anon __result = hx::Anon_obj::Create();
					__result->Add(HX_CSTRING("immediate") , __this->as_immediate,false);
					__result->Add(HX_CSTRING("pos") , t,false);
					__result->Add(HX_CSTRING("size") , (int)13,false);
					__result->Add(HX_CSTRING("color") , c,false);
					__result->Add(HX_CSTRING("batcher") , __this->batcher,false);
					__result->Add(HX_CSTRING("depth") , 999.4,false);
					__result->Add(HX_CSTRING("text") , _g->short_id(),false);
					__result->Add(HX_CSTRING("align") , talign,false);
					return __result;
				}
				return null();
			}
		};
		HX_STACK_LINE(132)
		this->_tree_geom->add_geometry(::Luxe_obj::draw->text(_Function_1_3::Block(this,c,_g,t,talign)));
		HX_STACK_LINE(145)
		::phoenix::Color c2 = ::phoenix::Color_obj::__new((int)1,(int)1,(int)1,0.4)->rgb((int)16750916);		HX_STACK_VAR(c2,"c2");
		HX_STACK_LINE(146)
		::String notes_l = HX_CSTRING("none");		HX_STACK_VAR(notes_l,"notes_l");
		HX_STACK_LINE(147)
		::String notes_r = HX_CSTRING("none");		HX_STACK_VAR(notes_r,"notes_r");
		HX_STACK_LINE(149)
		if (((_leaf->left != null()))){
			HX_STACK_LINE(150)
			notes_l = HX_CSTRING("node");
			HX_STACK_LINE(151)
			int compare = ::Luxe_obj::renderer->batcher->compare_rule(_leaf->key,_leaf->left->key);		HX_STACK_VAR(compare,"compare");
			HX_STACK_LINE(152)
			notes_l = ::Luxe_obj::renderer->batcher->compare_rule_to_string(compare);
		}
		HX_STACK_LINE(155)
		if (((_leaf->right != null()))){
			HX_STACK_LINE(156)
			notes_r = HX_CSTRING("node");
			HX_STACK_LINE(157)
			int compare = ::Luxe_obj::renderer->batcher->compare_rule(_leaf->key,_leaf->right->key);		HX_STACK_VAR(compare,"compare");
			HX_STACK_LINE(158)
			notes_r = ::Luxe_obj::renderer->batcher->compare_rule_to_string(compare);
		}
		struct _Function_1_4{
			inline static Dynamic Block( ::luxe::debug::BatcherDebugView_obj *__this,::phoenix::Color &c2,::phoenix::Vector &t2,::phoenix::TextAlign &talign,::String &notes_l,::String &notes_r){
				HX_STACK_FRAME("*","closure",0x5bdab937,"*.closure","luxe/debug/BatcherDebugView.hx",162,0xdc49bab8)
				{
					hx::Anon __result = hx::Anon_obj::Create();
					__result->Add(HX_CSTRING("immediate") , __this->as_immediate,false);
					__result->Add(HX_CSTRING("pos") , t2,false);
					__result->Add(HX_CSTRING("size") , (int)13,false);
					__result->Add(HX_CSTRING("color") , c2,false);
					__result->Add(HX_CSTRING("batcher") , __this->batcher,false);
					__result->Add(HX_CSTRING("depth") , 999.4,false);
					__result->Add(HX_CSTRING("text") , ((notes_l + HX_CSTRING(" / ")) + notes_r),false);
					__result->Add(HX_CSTRING("align") , talign,false);
					return __result;
				}
				return null();
			}
		};
		HX_STACK_LINE(161)
		this->_tree_geom->add_geometry(::Luxe_obj::draw->text(_Function_1_4::Block(this,c2,t2,talign,notes_l,notes_r)));
	}
return null();
}


HX_DEFINE_DYNAMIC_FUNC4(BatcherDebugView_obj,draw_geom_node,(void))

Void BatcherDebugView_obj::draw_geom_leaf( bool L,::luxe::structural::BalancedBSTNode _leaf,::phoenix::Vector _p){
{
		HX_STACK_FRAME("luxe.debug.BatcherDebugView","draw_geom_leaf",0xc751f830,"luxe.debug.BatcherDebugView.draw_geom_leaf","luxe/debug/BatcherDebugView.hx",175,0xdc49bab8)
		HX_STACK_THIS(this)
		HX_STACK_ARG(L,"L")
		HX_STACK_ARG(_leaf,"_leaf")
		HX_STACK_ARG(_p,"_p")
		HX_STACK_LINE(177)
		if (((_leaf == null()))){
			HX_STACK_LINE(178)
			return null();
		}
		HX_STACK_LINE(181)
		Float _bw = (Float(_leaf->nodecount) / Float((int)20));		HX_STACK_VAR(_bw,"_bw");
		HX_STACK_LINE(182)
		Float _bwb = (_leaf->nodecount * (int)25);		HX_STACK_VAR(_bwb,"_bwb");
		HX_STACK_LINE(183)
		Float _bh = (int)128;		HX_STACK_VAR(_bh,"_bh");
		HX_STACK_LINE(184)
		Float _bh2 = (int)148;		HX_STACK_VAR(_bh2,"_bh2");
		HX_STACK_LINE(185)
		Float _bwhalf = (Float(_bw) / Float((int)2));		HX_STACK_VAR(_bwhalf,"_bwhalf");
		HX_STACK_LINE(187)
		::phoenix::Color c = ::phoenix::Color_obj::__new((int)1,(int)1,(int)1,0.4)->rgb((int)16777215);		HX_STACK_VAR(c,"c");
		HX_STACK_LINE(189)
		if (((_leaf != null()))){
			HX_STACK_LINE(191)
			this->draw_geom_node(L,_leaf,_p,_bw);
			HX_STACK_LINE(193)
			if (((_leaf->left != null()))){
				HX_STACK_LINE(195)
				if (((::Luxe_obj::renderer->batcher->geometry_compare(_leaf->left->key,_leaf->key) < (int)0))){
					HX_STACK_LINE(196)
					c = ::phoenix::Color_obj::__new((int)1,(int)1,(int)1,(int)1)->rgb((int)52224);
				}
				else{
					HX_STACK_LINE(198)
					c = ::phoenix::Color_obj::__new((int)1,(int)1,(int)1,(int)1)->rgb((int)13369344);
				}
				HX_STACK_LINE(204)
				::phoenix::Vector _g = ::phoenix::Vector_obj::__new((_p->x - _bwhalf),(_p->y + _bh),null(),null());		HX_STACK_VAR(_g,"_g");
				struct _Function_3_1{
					inline static Dynamic Block( ::luxe::debug::BatcherDebugView_obj *__this,Float &_bwb,::phoenix::Color &c,Float &_bh2,::phoenix::Vector &_g,::phoenix::Vector &_p){
						HX_STACK_FRAME("*","closure",0x5bdab937,"*.closure","luxe/debug/BatcherDebugView.hx",202,0xdc49bab8)
						{
							hx::Anon __result = hx::Anon_obj::Create();
							__result->Add(HX_CSTRING("immediate") , __this->as_immediate,false);
							__result->Add(HX_CSTRING("p0") , _g,false);
							__result->Add(HX_CSTRING("p1") , ::phoenix::Vector_obj::__new((_p->x - _bwb),(_p->y + _bh2),null(),null()),false);
							__result->Add(HX_CSTRING("color") , c,false);
							__result->Add(HX_CSTRING("batcher") , __this->batcher,false);
							__result->Add(HX_CSTRING("depth") , 999.4,false);
							return __result;
						}
						return null();
					}
				};
				HX_STACK_LINE(201)
				this->_tree_geom->add_geometry(::Luxe_obj::draw->line(_Function_3_1::Block(this,_bwb,c,_bh2,_g,_p)));
				HX_STACK_LINE(212)
				this->draw_geom_leaf(true,_leaf->left,::phoenix::Vector_obj::__new((_p->x - _bwb),(_p->y + _bh2),null(),null()));
			}
			HX_STACK_LINE(214)
			if (((_leaf->right != null()))){
				HX_STACK_LINE(216)
				if (((::Luxe_obj::renderer->batcher->geometry_compare(_leaf->right->key,_leaf->key) > (int)0))){
					HX_STACK_LINE(217)
					c = ::phoenix::Color_obj::__new((int)1,(int)1,(int)1,(int)1)->rgb((int)52224);
				}
				else{
					HX_STACK_LINE(219)
					c = ::phoenix::Color_obj::__new((int)1,(int)1,(int)1,(int)1)->rgb((int)13369344);
				}
				HX_STACK_LINE(225)
				::phoenix::Vector _g1 = ::phoenix::Vector_obj::__new((_p->x + _bwhalf),(_p->y + _bh),null(),null());		HX_STACK_VAR(_g1,"_g1");
				struct _Function_3_1{
					inline static Dynamic Block( ::luxe::debug::BatcherDebugView_obj *__this,::phoenix::Vector &_g1,Float &_bwb,::phoenix::Color &c,Float &_bh2,::phoenix::Vector &_p){
						HX_STACK_FRAME("*","closure",0x5bdab937,"*.closure","luxe/debug/BatcherDebugView.hx",223,0xdc49bab8)
						{
							hx::Anon __result = hx::Anon_obj::Create();
							__result->Add(HX_CSTRING("immediate") , __this->as_immediate,false);
							__result->Add(HX_CSTRING("p0") , _g1,false);
							__result->Add(HX_CSTRING("p1") , ::phoenix::Vector_obj::__new((_p->x + _bwb),(_p->y + _bh2),null(),null()),false);
							__result->Add(HX_CSTRING("color") , c,false);
							__result->Add(HX_CSTRING("batcher") , __this->batcher,false);
							__result->Add(HX_CSTRING("depth") , 999.4,false);
							return __result;
						}
						return null();
					}
				};
				HX_STACK_LINE(222)
				this->_tree_geom->add_geometry(::Luxe_obj::draw->line(_Function_3_1::Block(this,_g1,_bwb,c,_bh2,_p)));
				HX_STACK_LINE(233)
				this->draw_geom_leaf(false,_leaf->right,::phoenix::Vector_obj::__new((_p->x + _bwb),(_p->y + _bh2),null(),null()));
			}
		}
	}
return null();
}


HX_DEFINE_DYNAMIC_FUNC3(BatcherDebugView_obj,draw_geom_leaf,(void))

Void BatcherDebugView_obj::draw_batcher_tree( ){
{
		HX_STACK_FRAME("luxe.debug.BatcherDebugView","draw_batcher_tree",0x1ae0d3a7,"luxe.debug.BatcherDebugView.draw_batcher_tree","luxe/debug/BatcherDebugView.hx",238,0xdc49bab8)
		HX_STACK_THIS(this)
		HX_STACK_LINE(240)
		this->_tree_geom = null();
		struct _Function_1_1{
			inline static Dynamic Block( ::luxe::debug::BatcherDebugView_obj *__this){
				HX_STACK_FRAME("*","closure",0x5bdab937,"*.closure","luxe/debug/BatcherDebugView.hx",241,0xdc49bab8)
				{
					hx::Anon __result = hx::Anon_obj::Create();
					__result->Add(HX_CSTRING("batcher") , __this->batcher,false);
					__result->Add(HX_CSTRING("immediate") , __this->as_immediate,false);
					__result->Add(HX_CSTRING("depth") , 999.4,false);
					return __result;
				}
				return null();
			}
		};
		HX_STACK_LINE(241)
		this->_tree_geom = ::phoenix::geometry::CompositeGeometry_obj::__new(_Function_1_1::Block(this));
		HX_STACK_LINE(248)
		::phoenix::Vector _p = ::phoenix::Vector_obj::__new((Float(::Luxe_obj::get_screen()->w) / Float((int)2)),((::Luxe_obj::debug->padding->y * (int)2) + (int)10),null(),null());		HX_STACK_VAR(_p,"_p");
		HX_STACK_LINE(250)
		::luxe::structural::BalancedBSTNode _node = ::Luxe_obj::renderer->batcher->geometry->root;		HX_STACK_VAR(_node,"_node");
		HX_STACK_LINE(252)
		this->draw_geom_leaf(true,_node,_p);
	}
return null();
}


HX_DEFINE_DYNAMIC_FUNC0(BatcherDebugView_obj,draw_batcher_tree,(void))

Void BatcherDebugView_obj::process( ){
{
		HX_STACK_FRAME("luxe.debug.BatcherDebugView","process",0x525b5505,"luxe.debug.BatcherDebugView.process","luxe/debug/BatcherDebugView.hx",257,0xdc49bab8)
		HX_STACK_THIS(this)
		HX_STACK_LINE(257)
		if ((this->visible)){
			HX_STACK_LINE(258)
			if ((::Luxe_obj::renderer->batcher->tree_changed)){
				HX_STACK_LINE(259)
				this->refresh();
			}
		}
	}
return null();
}


Void BatcherDebugView_obj::show( ){
{
		HX_STACK_FRAME("luxe.debug.BatcherDebugView","show",0x7b8a48a7,"luxe.debug.BatcherDebugView.show","luxe/debug/BatcherDebugView.hx",264,0xdc49bab8)
		HX_STACK_THIS(this)
		HX_STACK_LINE(265)
		this->super::show();
		HX_STACK_LINE(266)
		this->refresh();
	}
return null();
}


Void BatcherDebugView_obj::hide( ){
{
		HX_STACK_FRAME("luxe.debug.BatcherDebugView","hide",0x7445a86c,"luxe.debug.BatcherDebugView.hide","luxe/debug/BatcherDebugView.hx",269,0xdc49bab8)
		HX_STACK_THIS(this)
		HX_STACK_LINE(270)
		this->super::hide();
		HX_STACK_LINE(271)
		this->clear_batcher_tree();
	}
return null();
}



BatcherDebugView_obj::BatcherDebugView_obj()
{
}

void BatcherDebugView_obj::__Mark(HX_MARK_PARAMS)
{
	HX_MARK_BEGIN_CLASS(BatcherDebugView);
	HX_MARK_MEMBER_NAME(batcher,"batcher");
	HX_MARK_MEMBER_NAME(dragging,"dragging");
	HX_MARK_MEMBER_NAME(dragstart,"dragstart");
	HX_MARK_MEMBER_NAME(dragmstart,"dragmstart");
	HX_MARK_MEMBER_NAME(_tree_geom,"_tree_geom");
	HX_MARK_MEMBER_NAME(as_immediate,"as_immediate");
	::luxe::Objects_obj::__Mark(HX_MARK_ARG);
	HX_MARK_END_CLASS();
}

void BatcherDebugView_obj::__Visit(HX_VISIT_PARAMS)
{
	HX_VISIT_MEMBER_NAME(batcher,"batcher");
	HX_VISIT_MEMBER_NAME(dragging,"dragging");
	HX_VISIT_MEMBER_NAME(dragstart,"dragstart");
	HX_VISIT_MEMBER_NAME(dragmstart,"dragmstart");
	HX_VISIT_MEMBER_NAME(_tree_geom,"_tree_geom");
	HX_VISIT_MEMBER_NAME(as_immediate,"as_immediate");
	::luxe::Objects_obj::__Visit(HX_VISIT_ARG);
}

Dynamic BatcherDebugView_obj::__Field(const ::String &inName,bool inCallProp)
{
	switch(inName.length) {
	case 4:
		if (HX_FIELD_EQ(inName,"show") ) { return show_dyn(); }
		if (HX_FIELD_EQ(inName,"hide") ) { return hide_dyn(); }
		break;
	case 6:
		if (HX_FIELD_EQ(inName,"create") ) { return create_dyn(); }
		if (HX_FIELD_EQ(inName,"keystr") ) { return keystr_dyn(); }
		break;
	case 7:
		if (HX_FIELD_EQ(inName,"batcher") ) { return batcher; }
		if (HX_FIELD_EQ(inName,"refresh") ) { return refresh_dyn(); }
		if (HX_FIELD_EQ(inName,"process") ) { return process_dyn(); }
		break;
	case 8:
		if (HX_FIELD_EQ(inName,"dragging") ) { return dragging; }
		break;
	case 9:
		if (HX_FIELD_EQ(inName,"dragstart") ) { return dragstart; }
		if (HX_FIELD_EQ(inName,"onmouseup") ) { return onmouseup_dyn(); }
		break;
	case 10:
		if (HX_FIELD_EQ(inName,"dragmstart") ) { return dragmstart; }
		if (HX_FIELD_EQ(inName,"_tree_geom") ) { return _tree_geom; }
		break;
	case 11:
		if (HX_FIELD_EQ(inName,"onmousedown") ) { return onmousedown_dyn(); }
		if (HX_FIELD_EQ(inName,"onmousemove") ) { return onmousemove_dyn(); }
		break;
	case 12:
		if (HX_FIELD_EQ(inName,"onmousewheel") ) { return onmousewheel_dyn(); }
		if (HX_FIELD_EQ(inName,"as_immediate") ) { return as_immediate; }
		break;
	case 14:
		if (HX_FIELD_EQ(inName,"draw_geom_node") ) { return draw_geom_node_dyn(); }
		if (HX_FIELD_EQ(inName,"draw_geom_leaf") ) { return draw_geom_leaf_dyn(); }
		break;
	case 17:
		if (HX_FIELD_EQ(inName,"draw_batcher_tree") ) { return draw_batcher_tree_dyn(); }
		break;
	case 18:
		if (HX_FIELD_EQ(inName,"clear_batcher_tree") ) { return clear_batcher_tree_dyn(); }
	}
	return super::__Field(inName,inCallProp);
}

Dynamic BatcherDebugView_obj::__SetField(const ::String &inName,const Dynamic &inValue,bool inCallProp)
{
	switch(inName.length) {
	case 7:
		if (HX_FIELD_EQ(inName,"batcher") ) { batcher=inValue.Cast< ::phoenix::Batcher >(); return inValue; }
		break;
	case 8:
		if (HX_FIELD_EQ(inName,"dragging") ) { dragging=inValue.Cast< bool >(); return inValue; }
		break;
	case 9:
		if (HX_FIELD_EQ(inName,"dragstart") ) { dragstart=inValue.Cast< ::phoenix::Vector >(); return inValue; }
		break;
	case 10:
		if (HX_FIELD_EQ(inName,"dragmstart") ) { dragmstart=inValue.Cast< ::phoenix::Vector >(); return inValue; }
		if (HX_FIELD_EQ(inName,"_tree_geom") ) { _tree_geom=inValue.Cast< ::phoenix::geometry::CompositeGeometry >(); return inValue; }
		break;
	case 12:
		if (HX_FIELD_EQ(inName,"as_immediate") ) { as_immediate=inValue.Cast< bool >(); return inValue; }
	}
	return super::__SetField(inName,inValue,inCallProp);
}

void BatcherDebugView_obj::__GetFields(Array< ::String> &outFields)
{
	outFields->push(HX_CSTRING("batcher"));
	outFields->push(HX_CSTRING("dragging"));
	outFields->push(HX_CSTRING("dragstart"));
	outFields->push(HX_CSTRING("dragmstart"));
	outFields->push(HX_CSTRING("_tree_geom"));
	outFields->push(HX_CSTRING("as_immediate"));
	super::__GetFields(outFields);
};

static ::String sStaticFields[] = {
	String(null()) };

#if HXCPP_SCRIPTABLE
static hx::StorageInfo sMemberStorageInfo[] = {
	{hx::fsObject /*::phoenix::Batcher*/ ,(int)offsetof(BatcherDebugView_obj,batcher),HX_CSTRING("batcher")},
	{hx::fsBool,(int)offsetof(BatcherDebugView_obj,dragging),HX_CSTRING("dragging")},
	{hx::fsObject /*::phoenix::Vector*/ ,(int)offsetof(BatcherDebugView_obj,dragstart),HX_CSTRING("dragstart")},
	{hx::fsObject /*::phoenix::Vector*/ ,(int)offsetof(BatcherDebugView_obj,dragmstart),HX_CSTRING("dragmstart")},
	{hx::fsObject /*::phoenix::geometry::CompositeGeometry*/ ,(int)offsetof(BatcherDebugView_obj,_tree_geom),HX_CSTRING("_tree_geom")},
	{hx::fsBool,(int)offsetof(BatcherDebugView_obj,as_immediate),HX_CSTRING("as_immediate")},
	{ hx::fsUnknown, 0, null()}
};
#endif

static ::String sMemberFields[] = {
	HX_CSTRING("batcher"),
	HX_CSTRING("create"),
	HX_CSTRING("refresh"),
	HX_CSTRING("dragging"),
	HX_CSTRING("dragstart"),
	HX_CSTRING("dragmstart"),
	HX_CSTRING("onmousedown"),
	HX_CSTRING("onmouseup"),
	HX_CSTRING("onmousemove"),
	HX_CSTRING("onmousewheel"),
	HX_CSTRING("_tree_geom"),
	HX_CSTRING("as_immediate"),
	HX_CSTRING("clear_batcher_tree"),
	HX_CSTRING("keystr"),
	HX_CSTRING("draw_geom_node"),
	HX_CSTRING("draw_geom_leaf"),
	HX_CSTRING("draw_batcher_tree"),
	HX_CSTRING("process"),
	HX_CSTRING("show"),
	HX_CSTRING("hide"),
	String(null()) };

static void sMarkStatics(HX_MARK_PARAMS) {
	HX_MARK_MEMBER_NAME(BatcherDebugView_obj::__mClass,"__mClass");
};

#ifdef HXCPP_VISIT_ALLOCS
static void sVisitStatics(HX_VISIT_PARAMS) {
	HX_VISIT_MEMBER_NAME(BatcherDebugView_obj::__mClass,"__mClass");
};

#endif

Class BatcherDebugView_obj::__mClass;

void BatcherDebugView_obj::__register()
{
	hx::Static(__mClass) = hx::RegisterClass(HX_CSTRING("luxe.debug.BatcherDebugView"), hx::TCanCast< BatcherDebugView_obj> ,sStaticFields,sMemberFields,
	&__CreateEmpty, &__Create,
	&super::__SGetClass(), 0, sMarkStatics
#ifdef HXCPP_VISIT_ALLOCS
    , sVisitStatics
#endif
#ifdef HXCPP_SCRIPTABLE
    , sMemberStorageInfo
#endif
);
}

void BatcherDebugView_obj::__boot()
{
}

} // end namespace luxe
} // end namespace debug
