-- Generated by meta.cpp


export type Vec2 = {number}
export type Vec3 = {number}
export type Color = {number}
export type Quat = {number}
export type DVec3 = {number}
declare ImGui: {
	AlignTextToFramePadding : () -> (),
	Begin : (string, boolean?) -> (boolean, boolean?),
	BeginChildFrame : (string, number, number) -> boolean,
	BeginMenu : (string, boolean) -> boolean,
	BeginPopup : (string) -> boolean,
	Button : (string) -> boolean,
	CalcTextSize : (string) -> (number, number),
	Checkbox : (string, boolean) -> (boolean, boolean),
	CloseCurrentPopup : () -> (),
	CollapsingHeader : (string) -> boolean,
	Columns : (number) -> (),
	DragFloat : (string, number) -> (boolean, number),
	DragInt : (string, number) -> (boolean, number),
	Dummy : (number, number) -> (),
	End : () -> (),
	EndChildFrame : () -> (),
	EndCombo : () -> (),
	EndMenu : () -> (),
	EndPopup : () -> (),
	GetColumnWidth : (number) -> number,
	GetDisplayWidth : () -> number,
	GetDisplayHeight : () -> number,
	GetOsImePosRequest : () -> (number, number),
	GetWindowWidth : () -> (),
	GetWindowHeight : () -> (),
	GetWindowPos : () -> any,
	Indent : (number) -> (),
	InputTextMultiline : (string, string) -> (boolean, string?),
	InputTextMultilineWithCallback : (string, string, (string, number, boolean) -> ()) -> (boolean, string?),
	IsItemHovered : () -> boolean,
	IsKeyPressed : (number, boolean) -> boolean,
	IsMouseClicked : (number) -> boolean,
	IsMouseDown : (number) -> boolean,
	LabelText : (string, string) -> (),
	NewLine : () -> (),
	NextColumn : () -> (),
	OpenPopup : (string) -> (),
	PlotLines : (string, {number}, Vec2) -> (),
	PopItemWidth : () -> (),
	PopID : () -> (),
	PopStyleColor : (number) -> (),
	PopStyleVar : (number) -> (),
	PopItemWidth : () -> (),
	PushItemWidth : (number) -> (),
	PushID : (number) -> (),
	PushStyleColor : (number, any) -> (),
	PushStyleVar : (number, number, number) -> () | (number, number) -> () ,
	Rect : (number, number, number) -> (),
	SameLine : () -> (),
	Selectable : (string, boolean) -> boolean | (string) -> boolean,
	Separator : () -> (),
	SetCursorScreenPos : (number, number) -> (),
	SetKeyboardFocusHere : (number) -> (),
	SetNextWindowPos : (number, number) -> (),
	SetNextWindowPosCenter : () -> (),
	SetNextWindowSize : (number, number) -> (),
	SetStyleColor : (number, any) -> (),
	SliderFloat : (string, number, number, number) -> (boolean, number),
	Text : (string) -> (),
	Unindent : (number) -> (),
	
	Key_DownArrow : number,
	Key_Enter : number,
	Key_Escape : number,
	Key_UpArrow : number
}

export type Resource = {
	newEmpty: (Resource, string) -> Resource,
	getPath: (Resource) -> string,
	path : string,
}

declare Lumix : {
	Resource : Resource,
	Entity : Entity
}

export type World = {
	getActivePartition : (World) -> number,
	setActivePartition : (World, number) -> (),
	createPartition : (World, string) -> number,
	destroyPartition : (World, number) -> (),
	load : (World, string, any) -> (),
	getModule : (World, string) -> any,
	createEntity : (World) -> Entity,
	createEntityEx : (World, any) -> Entity,
	findEntityByName : (World, Entity, string) -> Entity,
	animation: animation_module,
	audio: audio_module,
	core: core_module,
	gui: gui_module,
	lua_script: lua_script_module,
	navigation: navigation_module,
	physics: physics_module,
	renderer: renderer_module,
}

type Ray = {
	origin: DVec3,
	dir: Vec3,
}

type RaycastHit = {
	position: Vec3,
	normal: Vec3,
	entity: Entity?,
}

type SweepHit = {
	position: Vec3,
	normal: Vec3,
	entity: Entity?,
	distance: number,
}

type RayCastModelHit = {
	is_hit: boolean,
	t: number,
	origin: DVec3,
	dir: Vec3,
	mesh: any,
	entity: Entity?,
	component_type: any,
	subindex: number,
}

type AssetBrowser = {
	openEditor: (AssetBrowser, string) -> (),
}

type GUISystem = {
	enableCursor: (GUISystem, boolean) -> (),
}

type SceneView = {
}

type animation_module = {
}

type property_animator_component =  {
	enabled: boolean,
	looped: boolean,
	animation: string,
}

type animator_component =  {
	source: string,
	use_root_motion: boolean,
	default_set: number,
	applySet: (animator_component, number) -> (),
	setBoolInput: (animator_component, number, boolean) -> (),
	setFloatInput: (animator_component, number, number) -> (),
	setVec3Input: (animator_component, number, Vec3) -> (),
	getInputIndex: (animator_component, any) -> number,
}

type animable_component =  {
	animation: string,
}

type audio_module = {
	play: (audio_module, Entity, string, boolean) -> any,
	setMasterVolume: (audio_module, number) -> (),
	stop: (audio_module, any) -> (),
	isEnd: (audio_module, any) -> boolean,
	setFrequency: (audio_module, any, number) -> (),
	setVolume: (audio_module, any, number) -> (),
	setEcho: (audio_module, any, number, number, number, number) -> (),
}

type echo_zone_component =  {
	radius: number,
	delay: number,
}

type chorus_zone_component =  {
	radius: number,
	delay: number,
}

type audio_listener_component =  {
}

type ambient_sound_component =  {
	clip: string,
	is_3d: boolean,
	pause: (ambient_sound_component) -> (),
	resume: (ambient_sound_component) -> (),
}

type core_module = {
}

type spline_component =  {
}

type signal_component =  {
}

type gui_module = {
	getRectAt: (gui_module, Vec2) -> Entity?,
	isOver: (gui_module, Vec2, Entity) -> boolean,
	getSystem: (gui_module) -> GUISystem,
}

type gui_canvas_component =  {
	is_3d: boolean,
	orient_to_camera: boolean,
	virtual_size: Vec2,
}

type gui_render_target_component =  {
}

type gui_input_field_component =  {
}

type gui_rect_component =  {
	enabled: boolean,
	clip: boolean,
	left_points: number,
	left_relative: number,
	right_points: number,
	right_relative: number,
	top_points: number,
	top_relative: number,
	bottom_points: number,
	bottom_relative: number,
}

type gui_button_component =  {
	hovered_color_r_g_b_a: any,
	hovered_cursor: any,
}

type gui_image_component =  {
	enabled: boolean,
	color_r_g_b_a: any,
	sprite: string,
}

type gui_text_component =  {
	font_size: number,
	color_r_g_b_a: any,
	font_path: string,
	halign: any,
	valign: any,
	text: string,
}

type lua_script_module = {
}

type lua_script_component =  {
}

type lua_script_inline_component =  {
	code: string,
}

type navigation_module = {
}

type navmesh_zone_component =  {
	extents: Vec3,
	cell_size: number,
	cell_height: number,
	walkable_slope_angle: number,
	agent_height: number,
	agent_radius: number,
	max_climb: number,
	autoload: boolean,
	detailed: boolean,
	load: (navmesh_zone_component) -> boolean,
	drawNavmesh: (navmesh_zone_component, DVec3, boolean, boolean, boolean) -> (),
	drawCompactHeightfield: (navmesh_zone_component) -> (),
	drawHeightfield: (navmesh_zone_component) -> (),
	drawContours: (navmesh_zone_component) -> (),
	generateNavmesh: (navmesh_zone_component) -> any,
	saveZone: (navmesh_zone_component) -> boolean,
}

type navmesh_agent_component =  {
	radius: number,
	height: number,
	move_entity: boolean,
	speed: number,
	navigate: (navmesh_agent_component, DVec3, number, number) -> boolean,
	cancelNavigation: (navmesh_agent_component) -> (),
	drawPath: (navmesh_agent_component, boolean) -> (),
}

type physics_module = {
	raycast: (physics_module, Vec3, Vec3, number, Entity?) -> Entity?,
	setGravity: (physics_module, Vec3) -> (),
}

type physical_heightfield_component =  {
	source: string,
	xzscale: number,
	yscale: number,
	layer: number,
}

type d6_joint_component =  {
	xmotion: any,
	ymotion: any,
	zmotion: any,
	swing1motion: any,
	swing2motion: any,
	twist_motion: any,
	linear_limit: number,
	twist_limit: Vec2,
	swing_limit: Vec2,
	damping: number,
	stiffness: number,
	restitution: number,
	connected_body: Entity?,
	axis_position: Vec3,
	axis_direction: Vec3,
}

type distance_joint_component =  {
	connected_body: Entity?,
	axis_position: Vec3,
	damping: number,
	stiffness: number,
	tolerance: number,
	limits: Vec2,
	linear_force: Vec3,
}

type hinge_joint_component =  {
	connected_body: Entity?,
	axis_position: Vec3,
	axis_direction: Vec3,
	damping: number,
	stiffness: number,
	use_limit: boolean,
	limit: Vec2,
}

type spherical_joint_component =  {
	connected_body: Entity?,
	axis_position: Vec3,
	axis_direction: Vec3,
	use_limit: boolean,
	limit: Vec2,
}

type physical_controller_component =  {
	layer: number,
	radius: number,
	height: number,
	custom_gravity: boolean,
	custom_gravity_acceleration: number,
	use_root_motion: boolean,
	getGravitySpeed: (physical_controller_component) -> number,
	move: (physical_controller_component, Vec3) -> (),
	isCollisionDown: (physical_controller_component) -> boolean,
	resize: (physical_controller_component, number) -> (),
}

type rigid_actor_component =  {
	velocity: Vec3,
	speed: number,
	layer: number,
	dynamic_type: any,
	is_trigger: boolean,
	mesh: string,
	material: string,
	ccd: boolean,
	putToSleep: (rigid_actor_component) -> (),
	addForceAtPos: (rigid_actor_component, Vec3, Vec3) -> (),
	applyForce: (rigid_actor_component, Vec3) -> (),
	applyImpulse: (rigid_actor_component, Vec3) -> (),
}

type wheel_component =  {
	spring_strength: number,
	spring_max_compression: number,
	spring_max_droop: number,
	spring_damper_rate: number,
	radius: number,
	width: number,
	mass: number,
	moi: number,
	slot: any,
	rpm: number,
}

type vehicle_component =  {
	peak_torque: number,
	max_r_p_m: number,
	rpm: number,
	current_gear: number,
	speed: number,
	chassis: string,
	mass: number,
	moimultiplier: number,
	center_of_mass: Vec3,
	wheels_layer: number,
	chassis_layer: number,
}

type physical_instanced_cube_component =  {
	half_extents: Vec3,
	layer: number,
}

type physical_instanced_mesh_component =  {
	layer: number,
	geom_path: string,
}

type renderer_module = {
	castRay: (renderer_module, Ray, Entity?) -> RayCastModelHit,
	castRayTerrain: (renderer_module, Ray) -> RayCastModelHit,
	addDebugTriangle: (renderer_module, DVec3, DVec3, DVec3, Color) -> (),
	addDebugLine: (renderer_module, DVec3, DVec3, Color) -> (),
	addDebugCross: (renderer_module, DVec3, number, Color) -> (),
	addDebugBone: (renderer_module, DVec3, Vec3, Vec3, Vec3, Color) -> (),
	addDebugCube: (renderer_module, DVec3, Vec3, Vec3, Vec3, Color) -> (),
	addDebugCubeSolid: (renderer_module, DVec3, DVec3, Color) -> (),
	setActiveCamera: (renderer_module, Entity) -> (),
	setActiveEnvironment: (renderer_module, Entity) -> (),
}

type camera_component =  {
	fov: number,
	near: number,
	far: number,
	is_ortho: boolean,
	ortho_size: number,
	film_grain_intensity: number,
	dof_enabled: boolean,
	dof_distance: number,
	dof_range: number,
	dof_max_blur_size: number,
	dof_sharp_range: number,
	bloom_enabled: boolean,
	bloom_tonemap_enabled: boolean,
	bloom_accomodation_speed: number,
	bloom_avg_bloom_multiplier: number,
	bloom_exposure: number,
	getRay: (camera_component, Vec2) -> Ray,
}

type decal_component =  {
	uv_scale: Vec2,
	material_path: string,
	half_extents: Vec3,
}

type environment_component =  {
	light_color: Vec3,
	direct_intensity: number,
	indirect_intensity: number,
	sky_intensity: number,
	scatter_rayleigh: Vec3,
	scatter_mie: Vec3,
	absorb_mie: Vec3,
	sunlight_color: Vec3,
	fog_scattering: Vec3,
	fog_density: number,
	sunlight_strength: number,
	height_distribution_rayleigh: number,
	height_distribution_mie: number,
	ground_r: number,
	atmo_r: number,
	fog_top: number,
	godrays_enabled: boolean,
	atmo_enabled: boolean,
	clouds_enabled: boolean,
	clouds_top: number,
	clouds_bottom: number,
	cast_shadows: boolean,
	sky_texture: string,
	shadowmap_cascades: any,
}

type point_light_component =  {
	color: Vec3,
	intensity: number,
	fov: number,
	attenuation_param: number,
	range: number,
	cast_shadows: boolean,
	dynamic: boolean,
}

type reflection_probe_component =  {
	size: number,
	half_extents: Vec3,
	enabled: boolean,
}

type environment_probe_component =  {
	inner_range: Vec3,
	outer_range: Vec3,
	enabled: boolean,
}

type fur_component =  {
	layers: number,
	scale: number,
	gravity: number,
	enabled: boolean,
}

type bone_attachment_component =  {
	parent: Entity?,
	bone: number,
	position: Vec3,
	rotation: Vec3,
	setRotation: (bone_attachment_component, Quat) -> (),
}

type particle_emitter_component =  {
	path: string,
	autodestroy: boolean,
}

type instanced_model_component =  {
	path: string,
}

type model_instance_component =  {
	enabled: boolean,
	path: string,
	overrideMaterialVec4: (model_instance_component, number, any, any) -> boolean,
	getModel: (model_instance_component) -> any,
}

type curve_decal_component =  {
	material_path: string,
	half_extents: number,
	uvscale: Vec2,
	bezier_p0: Vec2,
	bezier_p2: Vec2,
}

type terrain_component =  {
	size: Vec2,
	material_path: string,
	xzscale: number,
	tesselation: number,
	base_grid_resolution: number,
	yscale: number,
	getHeightAt: (terrain_component, number, number) -> number,
	getNormalAt: (terrain_component, number, number) -> Vec3,
}

type procedural_geom_component =  {
	material: string,
}


export type Entity = {
	NULL : Entity,
	world : World,
	name : string,
	parent : Entity?,
	rotation : any,
	position : Vec3,
	scale : Vec3,
	hasComponent : (Entity, any) -> boolean,
	getComponent : (Entity, any) -> any,
	destroy : (Entity) -> (),
	createComponent : (Entity, any) -> any,
	property_animator: property_animator_component,
	animator: animator_component,
	animable: animable_component,
	echo_zone: echo_zone_component,
	chorus_zone: chorus_zone_component,
	audio_listener: audio_listener_component,
	ambient_sound: ambient_sound_component,
	spline: spline_component,
	signal: signal_component,
	gui_canvas: gui_canvas_component,
	gui_render_target: gui_render_target_component,
	gui_input_field: gui_input_field_component,
	gui_rect: gui_rect_component,
	gui_button: gui_button_component,
	gui_image: gui_image_component,
	gui_text: gui_text_component,
	lua_script: lua_script_component,
	lua_script_inline: lua_script_inline_component,
	navmesh_zone: navmesh_zone_component,
	navmesh_agent: navmesh_agent_component,
	physical_heightfield: physical_heightfield_component,
	d6_joint: d6_joint_component,
	distance_joint: distance_joint_component,
	hinge_joint: hinge_joint_component,
	spherical_joint: spherical_joint_component,
	physical_controller: physical_controller_component,
	rigid_actor: rigid_actor_component,
	wheel: wheel_component,
	vehicle: vehicle_component,
	physical_instanced_cube: physical_instanced_cube_component,
	physical_instanced_mesh: physical_instanced_mesh_component,
	camera: camera_component,
	decal: decal_component,
	environment: environment_component,
	point_light: point_light_component,
	reflection_probe: reflection_probe_component,
	environment_probe: environment_probe_component,
	fur: fur_component,
	bone_attachment: bone_attachment_component,
	particle_emitter: particle_emitter_component,
	instanced_model: instanced_model_component,
	model_instance: model_instance_component,
	curve_decal: curve_decal_component,
	terrain: terrain_component,
	procedural_geom: procedural_geom_component,
}


declare this : Entity
	
	type ActionDesc = {
		name : string,
		label : string,
		run : () -> ()
	}
	
	declare Editor: {
		RESOURCE_PROPERTY : number,
		COLOR_PROPERTY : number,
		ENTITY_PROPERTY : number,
		BOOLEAN_PROPERTY : number,
		setPropertyType : (any, string, number, string?) -> (),
		setArrayPropertyType : (any, string, number, string?) -> (),
		getSelectedEntitiesCount : () -> number,
		getSelectedEntity : (number) -> Entity,
		addAction : (ActionDesc) -> (),
		createEntityEx : (any) -> Entity,
		scene_view : SceneView,
		asset_browser : AssetBrowser
	}
	
	declare LumixAPI: {
		hasFilesystemWork : () -> boolean,
		
		INPUT_KEYCODE_SHIFT: number,
		INPUT_KEYCODE_LEFT : number,
		INPUT_KEYCODE_RIGHT : number,
		engine : any,
		logError : (string) -> (),
		logInfo : (string) -> (),
		loadResource : (any, path:string, restype:string) -> any,
		writeFile : (string, string) -> boolean
	}
	
	type InputDevice = {
		type : "mouse" | "keyboard",
		index : number
	}
	
	type AxisInputEvent = {
		type : "axis",
		device : InputDevice,
		x : number,
		y : number,
		x_abs : number,
		y_abs : number
	}
	
	type ButtonInputEvent = {
		type : "button",
		device : InputDevice,
		key_id : number,
		down : boolean,
		is_repeat : boolean,
		x : number,
		y : number
	}
	
	export type InputEvent = ButtonInputEvent | AxisInputEvent
	
