ARQuickLook
示例
要运行示例项目,首先克隆仓库,然后从示例目录运行pod install
。
需求
安装
ARQuickLook 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中
pod "ARQuickLook"
作者
lapbay, [email protected]
许可协议
ARQuickLook在MIT许可下提供。有关更多信息,请参阅LICENSE文件。
使用方法
在Xcode项目中添加Info.plist中的隐私使用声明
NSCameraUsageDescription 摄像头用于增强现实。
Swift
import ARQuickLook
let translations: Dictionary<String, String> = [
"Initializing": "Inicializando",
]
let settings: Dictionary<String, Any> = [
"max": 1,
"scale": 0.1,
"lighting": false,
"gestures": ["scale": true, "rotate": false, "drag": true, "tap": false]
]
let models: Array<Dictionary<String, String>> = [[
"m": "https://storage.googleapis.com/ar-answers-in-search-models/static/Tiger/model.glb",
"tn": "https://storage.googleapis.com/support-forums-api/attachment/thread-36849721-3973664935013022854.png",
"t": "google tiger",
]]
let controller = ARQuickLookController(models: models, settings: args)
controller.translations = translations
controller.launchAR(self) {
print("presented")
}
Objective-C
@import ARQuickLook;
NSDictionary *translations = @{@"Initializing": @"Inicializando"};
NSDictionary *settings = @{
@"max": @1,
@"scale": @1,
@"lighting": @true,
@"gestures": @{@"scale": @true, @"rotate": @false, @"drag": @true, @"tap": @false}
};
NSDictionary *models = @{
@"m": @"https://storage.googleapis.com/ar-answers-in-search-models/static/Tiger/model.glb",
@"tn": @"https://storage.googleapis.com/support-forums-api/attachment/thread-36849721-3973664935013022854.png",
@"t": @"google tiger"
};
ARQuickLookController *controller = [[ARQuickLookController alloc] initWithModels: models settings: settings translations: translations onPrepared: nil];
[controller launchAR: self completion: nil];
翻译键
[
"Initializing": "",
"TRACKING UNAVAILABLE": "",
"TRACKING NORMAL": "",
"TRACKING LIMITED\nExcessive motion": "",
"TRACKING LIMITED\nLow detail": "",
"Recovering from interruption": "",
"Unknown tracking state.": "",
"Try slowing down your movement, or reset the session.": "",
"Try pointing at a flat surface, or reset the session.": "",
"Return to the location where you left off or try resetting the session.": "",
"FIND A SURFACE TO PLACE AN OBJECT": "",
"TRY MOVING LEFT OR RIGHT": "",
"TAP + TO PLACE AN OBJECT": "",
"SURFACE DETECTED": "",
"CANNOT PLACE OBJECT\nTry moving left or right.": ""
]
模型字段
"m": "https://storage.googleapis.com/ar-answers-in-search-models/static/Tiger/model.glb", // 必需的模型URL,支持https或文件方案,文件格式全选项:["GLB", "GLTF", "OBJ", "DAE", "ABC", "PLY", "STL", "USD", "USDZ", "USDA", "USDC", "SCN"]
"tn": "https://storage.googleapis.com/ar-answers-in-search-models/static/Tiger/model.glb", // 作为模型缩略图的可选URL。
"t": "model title", // 作为一个可选的模型标题。
设置
"max": 1, // 三个维度的大小上限,超过此值将强制调整模型大小。
"scale": 1, // 加载时缩小对象。
"lighting": true, // 是否在AR场景中设置默认照明。
"gestures": ["scale": false, "rotate": true, "drag": true, "tap": true] // 启用或禁用AR视图中的手势