iOS开发之SceneKit框架--SCNCamera.h
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的更多相关文章
- iOS开发之SceneKit框架--SCNNode.h
1.SCNNode简介 SCNNode是场景图的结构元素,表示3D坐标空间中的位置和变换,您可以将模型,灯光,相机或其他可显示内容附加到该元素.也可以对其做动画. 2.相关API简介 初始化方法 // ...
- iOS开发之SceneKit框架--SCNParametricGeometry.h
1.SCNParametricGeometry简介 SCNParametricGeometry用于创建简单的3D模型,比如SCNPlane 平面.SCNPyramid 锥形(金字塔).SCNBox 立 ...
- iOS开发之SceneKit框架--SCNAction.h
1.SCNAction简介 主要负责节点SCNNode的属性,实现node的渐变.移动.出现.消失.实现动画等. 2.相关API 节点的移动(earthNode的初始坐标(5,0,0)) //从当前位 ...
- iOS开发之SceneKit框架--SCNLight.h
1.SCNLight简介 用于添加光源,连接到一个节点照亮现场,可以给场景添加不同的灯光,模拟逼真的环境. 2.四种灯光的简介 添加一个box立方体.一个tube圆柱管道和一个地板floor,没有灯光 ...
- iOS开发之SceneKit框架--SCNGeometry.h
1.SCNGeometry简介 SCNGeometry负责呈现三维模型的类,它管理者物体的形状.纹理等.它可以由SCNGeometrySource和SCNGeometryElement来构造, 一个S ...
- iOS开发之SceneKit框架--SCNScene.h
1.SCNScene SCNScene是一个场景图——具有附加几何形状.光照.摄像机和其他属性的节点的层次结构,共同形成可显示的3D场景. 2.相关API简介 初始化方法 //懒加载 + (insta ...
- iOS开发之SceneKit框架--SCNView.h
1.SCNView 在macOS中,SCNView是NSView的子类,在iOS和tvOS中,SCNView是UIView的子类.SCNView用于显示SceneKit的3D场景,而需要设置场景的相关 ...
- iOS开发之SceneKit框架--加载多个模型.dae/.scn文件
1.通过SCNGeometry或子类SCNParametricGeometry创建 相关链接:iOS开发之SceneKit框架--SCNGeometry.h iOS开发之SceneKit框架--SCN ...
- iOS开发之SceneKit框架--实战地月系统围绕太阳旋转
1.创建地月太阳系统scn文件 注意:moon在earth结构下,earth和moon在sun结构下. 2.获取scn中模型的对应节点和自转(太阳为例) 获取节点: name是对应的Identity字 ...
随机推荐
- 关于mysql的权限的问题
昨天因为同学的mysql数据库不知道做了什么操作,从而导致root用户无法使用了 具体是使用root用户不需要密码 进去只能看 看到 infomation_schema 表 ,感觉root权限丢失了 ...
- js 默认事件取消
防止事件捕获和冒泡 :子类的事件会会发父类相同类型的事件, w3c 标准 window.event.stopPropagation也是事件对象(Event)的一个方法,作用是阻止目标元素的冒泡事件 ...
- python+selenium遍历某一个标签中的内容
一.python+selenium遍历某一个标签中的内容 举个例子:我要获取列表标签<li></li>的内容 根据python+selenium定位到列表整体,使用for循环获 ...
- html中没有不能随意嵌套的标签
在HTML里有几个元素是比较特别的:<ul>.<ol>.<dl>.<table>,它们的子一层必须是指定元素,<ul>.<ol> ...
- scala中的闭包
scala闭包 代码示例: package test.close_pack import scala.collection.mutable.ArrayBuffer /** * AUTHOR Guozy ...
- List<Map<String,Object>> 中文排序
@RequestMapping(value = "/getBaseCodess", method = RequestMethod.GET) public ModelAndView ...
- MapReduce计算原理及步骤
步骤:input从HDFS读取内容, split()切割分片内容,key/value, map()方法对输入的key/value进行计算处理,先写到内存,在内存中进行分区.排序,之后将Key/valu ...
- HTML——列表标签
什么是列表? 把…制成表,以表显示. 容器里面装载着文字或图表的一种形式,叫列表. 列表最大的特点就是 整齐 .整洁. 有序. 无序列表 ul (重点) 无序列表的各个列表项之间没有顺序级别之分,是并 ...
- 【CSS】float
写在前面的话: 由于CSS内容比较多,小菜没有精力从头到尾讲一遍,只能有针对性的讲解. 如果读者理解CSS盒子模型,但对于浮动不理解,那么这篇文章可以帮助你. 小菜水平有限,本文仅仅是入门教程,不当之 ...
- LeakCanary 与 鹅场Matrix ResourceCanary对比分析
推荐阅读: 滴滴Booster移动App质量优化框架-学习之旅 一 Android 模块Api化演练 不一样视角的Glide剖析(一) LeakCanary是Square公司基于MAT开源的一个内存泄 ...