/*
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
 */

#include "ArSessionArKit.h"
#include "ArSessionArKitInternal.h"

namespace OpenVulkano::AR::ArKit
{
	namespace
	{
		ArSessionCapabilities QueryNativeCapabilities()
		{
			bool supportsDepth = [ARWorldTrackingConfiguration supportsFrameSemantics:ARFrameSemanticSceneDepth];
			ArSessionCapabilities capabilities(ArType::AR_KIT, ArSessionType::NATIVE, true, supportsDepth, true, true, true);
			return capabilities;
		}
	}

	std::shared_ptr<ArSession> ArSessionArKit::Create(const ArSessionConfig& config)
	{
		return std::dynamic_pointer_cast<ArSession>(std::make_shared<ArSessionArKitInternal>(config));
	}

	bool ArSessionArKit::IsAvailable()
	{
		return true;
	}

	const ArSessionCapabilities& ArSessionArKit::GetCapabilities()
	{
		static ArSessionCapabilities capabilities = QueryNativeCapabilities();
		return capabilities;
	}

	ArSessionArKit::ArSessionArKit() : ArSession({ ArType::AR_KIT, ArDepthFormat::METER_FP32, { 0, 2 }, { 1920, 1440 }, 60 })
	{}
}
