group = "Transform"
display_name = "World To Object"
depends_on = ["core/stingray_renderer/output_nodes/standard_base", "core/stingray_renderer/output_nodes/light_base"]

inputs = {
	"39c3e91e-9dab-4fc1-916c-02b46390fb19" = { name = "v" display_name = "Vector" type = "float3" }
}

options = {
	"157d0a11-6e9d-4360-bbf2-0348cb7432d1" = "ROTATE_ONLY"
}

ui = [
	{
		type = "drop_down"
		display_name = "Mode"
		options = {
			"Full Transform" = "00000000-0000-0000-0000-000000000000"
			"Rotation only" = "157d0a11-6e9d-4360-bbf2-0348cb7432d1"
		}
	}
]

defines = ["NEEDS_INVERSE_WORLD_POSE"]

imports = {
	inv_world = {
		type = "float4x4"
		domain = "global"
		source = "engine"
	}
}

output = {
	type = { typeof: "v" }
}

code = """
	#if defined(ROTATE_ONLY)
		RESULT(mul(v, to_mat3(inv_world)));
	#else
		RESULT(mul(float4(v, 1), inv_world).xyz);
	#endif
"""
