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. docker启动elasticsearch异常Failed to create node environment(解决)

    异常说是创建节点环境失败,操作/usr/share/elasticsearch/data/nodes的IO错误,尝试给此目录添加读写权限后,依旧没什么**用,灵机一动是不是挂载目录没有权限导致的? c ...

  2. CSIC_716_20191203【 socket网络编程,以及沾包问题的高级解决方式】

    AF_UNIX(本机通信) AF_INET(TCP/IP – IPv4) AF_INET6(TCP/IP – IPv6) SOCK_STREAM(TCP流) SOCK_DGRAM(UDP数据报) 远程 ...

  3. 百度网盘Mac版如何分享链接?创建百度网盘 for Mac分享链接的方法

    想把自己百度网盘里的数据分享给朋友,该怎么操作呢?有很多朋友使用百度网盘,可以很轻松的自己的文件上传到网盘上,并可跨终端随时随地查看和分享.下面Mac down小编就给大家介绍一下创建百度网盘 for ...

  4. HIVE的数据类型

  5. 【设计】schema

    Schema:表的模式:   设计数据的表,索引,以及表和表的关系 在数据建模的基础上将关系模型转为数据库表 满足业务模型需要基础上根据数据库和应用特点优化表结构   关系模型图:   Schema关 ...

  6. NX二次开发-获取矩阵值UF_CSYS_ask_matrix_values

    NX9+VS2012 #include <uf.h> #include <uf_csys.h> UF_initialize(); //获取WCS标识 tag_t WcsId = ...

  7. git rm --cached (解决:modified: .idea/workspace.xml,git idea 操作完之后不能pull)

    错误解决:modified: .idea/workspace.xml 这个错误是本地的.idea提交到了远端. 解决办法: .gitignore文件加上: .dea/workspace.xml 可是. ...

  8. class7_Checkbutton 勾选项

    最终的运行效果(程序见序号3):   #!/usr/bin/env python# -*- coding:utf-8 -*-# ------------------------------------ ...

  9. 20140401 cudaHOG代码

    1.cudaHOG代码(删减没有必要的目录) cudaHOGDetect需要boost库:boost_date_time-vc100-mt-1_40.lib VC++目录->附加库目录D:\bo ...

  10. java-day13

    异常 指的是程序在执行过程中,出现的非正常情况,最终会导致JVM的非正常停止 异常分类:编译异常,运行期异常 异常的产生过程分析 throw关键字:指方法中抛出指定异常 使用格式:throw new ...