我正在使用iOS 11(for ARKit),虽然许多人指出SceneKit来自Apple 的示例应用程序与Fox,我在该示例项目(文件)中使用的扩展程序有问题,以添加动画:
extension CAAnimation {
class func animationWithSceneNamed(_ name: String) -> CAAnimation? {
var animation: CAAnimation?
if let scene = SCNScene(named: name) {
scene.rootNode.enumerateChildNodes({ (child, stop) in
if child.animationKeys.count > 0 {
animation = child.animation(forKey: child.animationKeys.first!)
stop.initialize(to: true)
}
})
}
return animation
}
}
Run Code Online (Sandbox Code Playgroud)
看来这个扩展非常方便,但我不确定如何迁移它现在它已被弃用?它SceneKit现在是默认内置的吗?
该文档并未真正显示有关其被弃用的原因或从何处开始的详细信息.
谢谢
我目前正在iOS11b6工作,我的代码部分打开一个事件EKEventViewController并没有显示事件详细信息 - 它只显示'新事件','2001年1月1日','无标题日历'.
我的代码显示事件的部分如下(在iOS10中正常工作)
func openEvent() {
eventIdentifier = eventClipboardIdentifier
let eventViewController = EKEventViewController.init()
eventViewController.event = self.getEventFromEventClipboard()
print(eventViewController.event.title)
eventViewController.delegate = self
eventViewController.allowsCalendarPreview = false
eventViewController.allowsEditing = true
let navBar = UINavigationController(rootViewController: eventViewController)
print(eventViewController.event.title)
present(navBar, animated: true, completion: nil)
}
Run Code Online (Sandbox Code Playgroud)
我在Xcode调试器中遇到的错误如下.
2017-08-20 20:25:48.001329+1000 CalendarApp[1113:281191] *** -[__NSCFCalendar components:fromDate:]: date cannot be nil
Future exception.
A few of these errors are going to be reported with this complaint, then further violations will simply be ignored.
Here is the backtrace where this …Run Code Online (Sandbox Code Playgroud) 是否有访问最后一个片段的颜色(目标色)的金属着色修饰类似的方式gl_LastFragData在GLES?
我的目标是使用着色器修改器执行自定义混合(SCNBlendMode在我的情况下,SceneKit 不够用).目前我正在使用SCNTechnique3次传球(渲染目的地,渲染源,组合)来实现这一点,这对我来说似乎是一个重大的矫枉过正+在没有引入新传球的情况下很难有几个混合组.
SCNProgram似乎不是一个选项有几个原因(我正在使用PBR,曲面细分/细分;我宁愿坚持使用技术,我猜).
我已尝试#extension GL_EXT_shader_framebuffer_fetch : require按照此答案中的建议使用,但即使对于GLSL着色器修饰符(我正在使用Xcode 9.0和iOS 11)它也不起作用.
我也偶然发现了这个具有SceneKit默认金属着色器实现的精彩要点,但似乎没有在那里执行混合.这让我想知道这是否是我找不到目的地颜色参考的原因:混合发生在其他地方.
是SCNProgram被除的唯一途径SCNTechnique暴行?
PS:gl_LastFragData在Metal我发现的上下文中
唯一提到的是金属着色语言规范的章节4.8 Programmable Blending,如果我可以以某种方式访问着色器修饰符中的类似内容(如果可能的话),将会有所帮助.[[color(0)]]
我想做的就是采用基本的arkit视图并将其转换为黑白视图.现在基本视图是正常的,我不知道如何添加过滤器.理想情况下,在截取屏幕截图时,黑白过滤器会添加到屏幕截图中.
import UIKit
import SceneKit
import ARKit
class ViewController: UIViewController, ARSCNViewDelegate {
@IBOutlet var sceneView: ARSCNView!
override func viewDidLoad() {
super.viewDidLoad()
sceneView.delegate = self
sceneView.showsStatistics = true
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
let configuration = ARWorldTrackingConfiguration()
sceneView.session.run(configuration)
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
sceneView.session.pause()
}
@IBAction func changeTextColour(){
let snapShot = self.augmentedRealityView.snapshot()
UIImageWriteToSavedPhotosAlbum(snapShot, self, #selector(image(_:didFinishSavingWithError:contextInfo:)), nil)
}
}
Run Code Online (Sandbox Code Playgroud)