1、SCNCamera简介

  被称为照相机或者摄像机,可以附加到节点以提供显示场景的角度。其实就是用户视角和人的眼睛一样。

2、相关API简介

  • 初始化
//懒加载
+ (instancetype)camera;
  • 管理相机属性
//名字
@property(nonatomic, copy, nullable) NSString *name;
  • 调整镜头角度
//决定了相机和可见表面之间的最小距离。如果一个表面离摄像机的距离比这个最小距离更近,那么表面就会被剪掉。默认为1
@property(nonatomic) double zNear; //决定了相机和可见表面之间的最大距离。如果一个表面离摄像机远超过这个最大距离,那么表面就被剪掉了。默认为100
@property(nonatomic) double zFar; //是否自动调整zNear和zFar值,默认为NO
//YES:近距离和远平面将自动设置为在渲染时匹配整个场景的边界框。
@property(nonatomic) BOOL automaticallyAdjustsZRange API_AVAILABLE(macos(10.9));
  • 管理相机视野
//相机的垂直或水平视角。默认60°
@property(nonatomic) CGFloat fieldOfView API_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(4.0)); //相机的焦距,默认50mm
@property(nonatomic) CGFloat focalLength API_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(4.0)); //相机成像平面的垂直尺寸,默认24mm
@property(nonatomic) CGFloat sensorHeight API_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(4.0)); //确定视场或正投影尺度的轴是垂直还是水平。默认垂直
@property(nonatomic) SCNCameraProjectionDirection projectionDirection API_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(4.0));
typedef NS_ENUM(NSInteger, SCNCameraProjectionDirection) {
SCNCameraProjectionDirectionVertical = ,//相机的视场或正投影尺度是垂直测量的。
SCNCameraProjectionDirectionHorizontal = ,// 相机的视场或正投影尺度是水平测量的。
} API_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(4.0));
  • 管理投影变换
//确定接收器是否使用正投影,默认为NO
@property(nonatomic) BOOL usesOrthographicProjection; //这个设置决定了相机可视区域的大小。只有当usesOrthographicProjection设置为YES时才启用。
//当使用正投影时,指定相机的放大倍数。默认为1.
@property(nonatomic) double orthographicScale API_AVAILABLE(macos(10.9)); //确定摄像机用于投影世界的投影变换。
@property(nonatomic) SCNMatrix4 projectionTransform;
  • 选择要对相机可见的节点
//确定从接收者可见的节点类别。默认值是所有
@property(nonatomic) NSUInteger categoryBitMask API_AVAILABLE(macos(10.10));
  • 增加景深效果的影响(景深效果是指当焦点对准某一点时,其前后都仍可清晰的范围。它能决定是把背景模糊化来突出拍摄对象,还是拍出清晰的背景。)、
//是否为相机渲染了景深模糊效果。默认为NO
@property(nonatomic) BOOL wantsDepthOfField API_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(4.0)); //确定相机的焦点距离 默认为2.5
@property(nonatomic) CGFloat focusDistance API_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(4.0)); //模拟的物理相机孔径,用于景深效果 默认值5.6
@property(nonatomic) CGFloat fStop API_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(4.0)); //模拟的物理摄像机光圈的数量,以获得景深效果。默认值为6
@property(nonatomic) NSInteger apertureBladeCount API_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(4.0)); //像素样本的数量用于创建景深模糊效果。默认为25
@property(nonatomic) NSInteger focalBlurSampleCount API_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(4.0));
  • 添加动态模糊效果
//确定运动模糊的强度。可以做成动画。默认值为0。
//强度为零意味着没有运动模糊。强度不应超过1
@property(nonatomic) CGFloat motionBlurIntensity API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0));
  • 添加高动态范围效果。
//是否将高动态范围(HDR)处理后效果应用到场景中。默认为NO
@property(nonatomic) BOOL wantsHDR API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0)); //对数偏差,调整SceneKit的色调映射操作的结果,场景可见亮或变暗。默认为0
@property(nonatomic) CGFloat exposureOffset API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0)); //确定最终图像中所需的平均灰度值。默认为0.18。
@property(nonatomic) CGFloat averageGray API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0)); //确定在最终图像中映射为白色的最小亮度级别。默认为1。
@property(nonatomic) CGFloat whitePoint API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0)); //在色调映射中使用的最小曝光值。默认为-15。
@property(nonatomic) CGFloat minimumExposure API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0)); //在色调映射中使用的最大曝光值。默认为-15。
@property(nonatomic) CGFloat maximumExposure API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0));
  • 添加自动HDR曝光适应
//否自动调整暴露水平。默认值为YES。
@property(nonatomic) BOOL wantsExposureAdaptation API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0)); //从明亮到黑暗区域自动动画曝光的相对持续时间 默认0.4
@property(nonatomic) CGFloat exposureAdaptationBrighteningSpeedFactor API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0)); //从黑暗到明亮区域自动动画曝光的相对持续时间 默认0.6
@property(nonatomic) CGFloat exposureAdaptationDarkeningSpeedFactor API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0));
  • 调整呈现的颜色
//控制整个场景的饱和度。默认为1(无效果)。
@property(nonatomic) CGFloat saturation API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0)); //控制整个场景的对比。默认为0(无效果)。
@property(nonatomic) CGFloat contrast API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0)); //一种将颜色分级效果应用到整个渲染场景的纹理。
@property(nonatomic, readonly) SCNMaterialProperty *colorGrading API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0));
  • 添加风格的视觉效果(Bloom、渐变、渐晕)
//Bloom,又称“全屏泛光”,是游戏中常用的一种镜头效果,是一种比较廉价的“伪HDR”
//在渲染的场景中应用于高光的亮度的大小。可以做成动画。默认为0(无效果)。
@property(nonatomic) CGFloat bloomIntensity API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0)); //设置Booom效果的亮度阈值 可以做成动画。默认为1
@property(nonatomic) CGFloat bloomThreshold API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0)); //以像素为单位的半径,确定Bloom效果的半径。可以做成动画。默认为4
@property(nonatomic) CGFloat bloomBlurRadius API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0)); //控制色彩渐变。默认为1。
@property(nonatomic) CGFloat colorFringeIntensity API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0)); //控制色彩渐变的强度。默认为0(无效果)。
@property(nonatomic) CGFloat colorFringeStrength API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0)); //控制渐晕效果的强度。默认为0(无效果)。
@property(nonatomic) CGFloat vignettingIntensity API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0)); //控制渐晕效果的形状。默认为0(无效果)。
@property(nonatomic) CGFloat vignettingPower API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0));
  • 添加屏幕空间环境遮挡。
//施加在照相机渲染中的屏幕空间环境遮挡效应的强度。可动画、默认为0
@property(nonatomic) CGFloat screenSpaceAmbientOcclusionIntensity API_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(4.0)); //设置屏幕空间环境遮挡的作用半径。可动画 默认为5
@property(nonatomic) CGFloat screenSpaceAmbientOcclusionRadius API_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(4.0)); //设置遮挡偏差 ,默认0.03
@property(nonatomic) CGFloat screenSpaceAmbientOcclusionBias API_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(4.0)); //确定场景单元的深度模糊阈值。默认值0.2
@property(nonatomic) CGFloat screenSpaceAmbientOcclusionDepthThreshold API_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(4.0)); //确定正常模糊阈值。默认0.3
@property(nonatomic) CGFloat screenSpaceAmbientOcclusionNormalThreshold API_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(4.0));
  • 被废弃方法
//确定物理相机孔径。默认值为0。
@property(nonatomic) CGFloat focalBlurRadius API_DEPRECATED("Use fStop instead", macos(10.8, 10.13), ios(8.0, 11.0), tvos(9.0, 11.0), watchos(3.0, 4.0)); //确定接收器在X轴上的视场。可以做成动画。
@property(nonatomic) double xFov API_DEPRECATED("Use -[SCNCamera fieldOfView] or -[SCNCamera focalLength] instead", macos(10.8, 10.13), ios(8.0, 11.0), tvos(9.0, 11.0), watchos(3.0, 4.0)); //确定接收器在Y轴上的视场。可以做成动画。
@property(nonatomic) double yFov API_DEPRECATED("Use -[SCNCamera fieldOfView] or -[SCNCamera focalLength] instead", macos(10.8, 10.13), ios(8.0, 11.0), tvos(9.0, 11.0), watchos(3.0, 4.0)); //决定了接收机的光圈。可以做成动画。默认值1/8.0. 可动画
@property(nonatomic) CGFloat aperture API_DEPRECATED("Use -[SCNCamera fStop] instead with fStop = sensorHeight / aperture.", macos(10.8, 10.13), ios(8.0, 11.0), tvos(9.0, 11.0), watchos(3.0, 4.0)); //确定接收器的焦距。可以做成动画。默认0
@property(nonatomic) CGFloat focalSize API_DEPRECATED_WITH_REPLACEMENT("-focusDistance", macos(10.9, 10.13), ios(8.0, 11.0), tvos(9.0, 11.0), watchos(3.0, 4.0)); //确定接收器的焦距
//当非零值时,焦距决定了相机在三维场景中如何聚焦对象。在macOS 10.13、ios11、tvos11和watchOS 4之前,默认值为10.0。否则默认为2.5。
@property(nonatomic) CGFloat focalDistance API_DEPRECATED_WITH_REPLACEMENT("-focusDistance", macos(10.9, 10.13), ios(8.0, 11.0), tvos(9.0, 11.0), watchos(3.0, 4.0));

iOS开发之SceneKit框架--SCNCamera.h的更多相关文章

  1. iOS开发之SceneKit框架--SCNNode.h

    1.SCNNode简介 SCNNode是场景图的结构元素,表示3D坐标空间中的位置和变换,您可以将模型,灯光,相机或其他可显示内容附加到该元素.也可以对其做动画. 2.相关API简介 初始化方法 // ...

  2. iOS开发之SceneKit框架--SCNParametricGeometry.h

    1.SCNParametricGeometry简介 SCNParametricGeometry用于创建简单的3D模型,比如SCNPlane 平面.SCNPyramid 锥形(金字塔).SCNBox 立 ...

  3. iOS开发之SceneKit框架--SCNAction.h

    1.SCNAction简介 主要负责节点SCNNode的属性,实现node的渐变.移动.出现.消失.实现动画等. 2.相关API 节点的移动(earthNode的初始坐标(5,0,0)) //从当前位 ...

  4. iOS开发之SceneKit框架--SCNLight.h

    1.SCNLight简介 用于添加光源,连接到一个节点照亮现场,可以给场景添加不同的灯光,模拟逼真的环境. 2.四种灯光的简介 添加一个box立方体.一个tube圆柱管道和一个地板floor,没有灯光 ...

  5. iOS开发之SceneKit框架--SCNGeometry.h

    1.SCNGeometry简介 SCNGeometry负责呈现三维模型的类,它管理者物体的形状.纹理等.它可以由SCNGeometrySource和SCNGeometryElement来构造, 一个S ...

  6. iOS开发之SceneKit框架--SCNScene.h

    1.SCNScene SCNScene是一个场景图——具有附加几何形状.光照.摄像机和其他属性的节点的层次结构,共同形成可显示的3D场景. 2.相关API简介 初始化方法 //懒加载 + (insta ...

  7. iOS开发之SceneKit框架--SCNView.h

    1.SCNView 在macOS中,SCNView是NSView的子类,在iOS和tvOS中,SCNView是UIView的子类.SCNView用于显示SceneKit的3D场景,而需要设置场景的相关 ...

  8. iOS开发之SceneKit框架--加载多个模型.dae/.scn文件

    1.通过SCNGeometry或子类SCNParametricGeometry创建 相关链接:iOS开发之SceneKit框架--SCNGeometry.h iOS开发之SceneKit框架--SCN ...

  9. iOS开发之SceneKit框架--实战地月系统围绕太阳旋转

    1.创建地月太阳系统scn文件 注意:moon在earth结构下,earth和moon在sun结构下. 2.获取scn中模型的对应节点和自转(太阳为例) 获取节点: name是对应的Identity字 ...

随机推荐

  1. echarts图表自适应,容器宽度设置为百分比,但是图表显示不全,缩到一起

    <div  id="chartContainer" style="height:100%;width:100%;"></div> cha ...

  2. 微信小程序之自定义组件

    在微信小程序项目中 肯定会存在很多功能和样式上相似的部分 面对这种情况 只是单单的ctrl+c ctrl+v 就显得很low了,而且也不便于后期维护那么这时候 使用微信小程序中的自定义组件功能就很合适 ...

  3. Winform 奇怪的 英文字体错乱显示问题

    效果如图: 字体是Calibri 后来看了一下,我在vs设计器中为了预览效果定义了这些中文,然后在构造函数中将其改成英文,可能是已经为中文渲染出了位置?在改变就会冲突? 我的设计器 如何修改: 将vs ...

  4. leetcood学习笔记-160*-相交链表

    题目描述: 方法一: class Solution(object): def getIntersectionNode(self, headA, headB): """ : ...

  5. JAVA SE Download

    { //https://www.oracle.com/technetwork/java/javase/downloads/index.html }

  6. Python self的用法

    1)不加self是局部变量,只在这个方法里有效:加self则是实例变量,相当于别的函数定义的变量你实例化出来就可以使用 #coding:utf-8 class Person: def __init__ ...

  7. delphi如何设计不规则窗体

    制作多边形窗体的关键在于设定多边形的区域,并根据这个指定的区域改变窗体的形状.Windows的CreatePolygonRgn和SetWindowRgn函数可以解决这两个难点.利用以下代码即可将窗体设 ...

  8. NX二次开发-删除经典工具栏UF_UI_remove_toolbar

    NX9+VS2012 1.打开D:\Program Files\Siemens\NX 9.0\UGII\menus\ug_main.men 找到装配和PMI,在中间加上一段 TOGGLE_BUTTON ...

  9. idea 社区版+spring boot+ssm+swagger创建rest api

    新手上路,出了好多错,记录一下 1.创建数据库:springBootSsmTest 2.打开IDEA创建 Spring boot项目:File——New——Project——Spring Assist ...

  10. Mybatis笔记 - Mapper动态代理

    使用Mybatis开发Dao,通常有两个方法,即原始Dao开发方法和Mapper接口开发方法. Mapper接口开发方式是基于入门程序的基础上,对 控制程序 进行分层开发,程序员只需要 编写mappe ...