ARCamera介绍

ARCamera是一个相机,它是连接虚拟场景与现实场景之间的枢纽。在ARKit中,它是捕捉现实图像的相机,在SceneKit中它又是3D虚拟世界中的相机

一般我们无需去创建一个相机,因为当我们初始化一个AR试图时,他会为我们默认创建一个相机,而且这个相机就是摄像头的位置,同时也是3D世界中的原点所在(x=0,y=0,z=0)


@interface ARCamera : NSObject

/**4x4矩阵表示相机位置,同ARAnchor*/

@property (nonatomic, readonly) matrix_float4x4 transform;

/**相机方向(旋转)的矢量欧拉角分别是x/y/z*/

@property (nonatomic, readonly) vector_float3 eulerAngles;

/**相机追踪状态(在下方会有枚举值介绍)*/

@property (nonatomic, readonly) ARTrackingState trackingState NS_REFINED_FOR_SWIFT;

/**追踪运动类型*

/@property (nonatomic, readonly) ARTrackingStateReason trackingStateReason NS_REFINED_FOR_SWIFT;

/**相机曲率 3x3矩阵fx 0  px0  fy  py0  0  1*/ 

@property (nonatomic

, readonly) matrix_float3x3 intrinsics;

/**摄像头分辨率*/

@property (nonatomic, readonly) CGSize imageResolution;

/**投影矩阵*/

@property (nonatomic, readonly) matrix_float4x4 projectionMatrix;

/**创建相机投影矩阵*/

- (matrix_float4x4)projectionMatrixWithViewportSize:(CGSize)viewportSize orientation:(UIInterfaceOrientation)orientation zNear:(CGFloat)zNear zFar:(CGFloat)zFar;

@end

//相机追踪状态枚举

typedef NS_ENUM(NSInteger, ARTrackingState) {   

/** 不被允许 */ 

ARTrackingStateNotAvailable,   

/** 最小 */ 

ARTrackingStateLimited,   

/** 正常. */ 

ARTrackingStateNormal,} NS_REFINED_FOR_SWIFT;

/**追踪运动类型*/

API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos)

typedef NS_ENUM(NSInteger, ARTrackingStateReason) {   

/** 无. */ 

ARTrackingStateReasonNone,   

/** 运动. */ 

ARTrackingStateReasonExcessiveMotion,   

/** 脸部捕捉. */ 

ARTrackingStateReasonInsufficientFeatures,} NS_REFINED_FOR_SWIFT;

你可能感兴趣的:(ARCamera介绍)