diff --git a/openVulkanoCpp/AR/Provider/ArKit/ArSessionArKitInternal.mm b/openVulkanoCpp/AR/Provider/ArKit/ArSessionArKitInternal.mm index c950528..2cfc6c8 100644 --- a/openVulkanoCpp/AR/Provider/ArKit/ArSessionArKitInternal.mm +++ b/openVulkanoCpp/AR/Provider/ArKit/ArSessionArKitInternal.mm @@ -23,6 +23,45 @@ namespace openVulkanoCpp::AR::ArKit { + namespace + { + std::string SupportedVideoFormatsToString() + { + std::stringstream ss("[ "); + auto vidFormats = [ARWorldTrackingConfiguration supportedVideoFormats]; + for (ARVideoFormat* format: vidFormats) + { + if (ss.gcount() > 1) ss << ", "; + ss << format.imageResolution.width << 'x' << format.imageResolution.height; + ss << '@' << format.framesPerSecond; + if (@available + (iOS + 16.0, *)) + { + if (format.videoHDRSupported) ss << "_HDR"; + if (format.isRecommendedForHighResolutionFrameCapturing) ss << "_HdCaptureRecommended"; + } + } + ss << " ]"; + return ss.str(); + } + + void LogFormat(std::string_view formatUsage, ARVideoFormat* format) + { + bool hdr = false, hdCapture = false; + if (@available + (iOS + 16.0, *)) + { + hdr = format.videoHDRSupported; + hdCapture = format.isRecommendedForHighResolutionFrameCapturing; + } + Logger::AR->info("{}: {}x{}@{}{}{}", formatUsage, + format.imageResolution.width, format.imageResolution.height, format.framesPerSecond, + hdr ? " HDR" : "", hdCapture ? " HdCaptureRecommended" : ""); + } + } + ArSessionArKitInternal::ArSessionArKitInternal(const ArSessionConfig& config) : m_frameId(0) { @@ -33,6 +72,18 @@ namespace openVulkanoCpp::AR::ArKit m_arConfig.frameSemantics = ARFrameSemanticSceneDepth; } + // Set video format + { + Logger::AR->debug("Supported Video Formats: {}", SupportedVideoFormatsToString()); + //TODO handle ar video format in settings + if (@available(iOS 16.0, *)) + { + //m_arConfig.videoFormat = [ARWorldTrackingConfiguration recommendedVideoFormatFor4KResolution]; + //m_arConfig.videoFormat = [ARWorldTrackingConfiguration recommendedVideoFormatForHighResolutionFrameCapturing]; + } + LogFormat("Using video format", m_arConfig.videoFormat); + } + m_arSession = [ARSession new]; m_arSession.delegate = m_arKitDelegate; m_loopClosureDetectionAnchor = nil;