duration を TimeInterval で与えてるのにクロージャの elapsedTime が CGFloat で来るのおかしくないですか? Obj-C で型の違いが軽視されてたから? class func customAction(duration seconds: TimeInterval, action block: @escaping (SCNNode, CGFloat) -> Void) -> SCNAction
https://developer.apple.com/documentation/scenekit/scnaction/1523692-customactionelapsedTime じゃなくて rate でほしい・・・public typealias TimeInterval = Double TImeIntervalはエイリアス#if defined(__LP64__) && __LP64__ # define CGFLOAT_TYPE double # define CGFLOAT_IS_DOUBLE 1 # define CGFLOAT_MIN DBL_MIN # define CGFLOAT_MAX DBL_MAX #else # define CGFLOAT_TYPE float # define CGFLOAT_IS_DOUBLE 0 # define CGFLOAT_MIN FLT_MIN # define CGFLOAT_MAX FLT_MAX #endif /* Definition of the `CGFloat' type and `CGFLOAT_DEFINED'. */ typedef CGFLOAT_TYPE CGFloat;rate がほしかったので、↓になった。 extension SCNAction { class func customActionWithRate(duration: TimeInterval, action block: @escaping (SCNNode, CGFloat) -> Void) -> SCNAction { return customAction(duration: duration) { node, elapsedTime in block(node, elapsedTime / CGFloat(duration)) } } } let plane = SCNPlane() self.plane = plane let planeNode = SCNNode(geometry: plane) scene.rootNode.addChildNode(planeNode) planeNode.scale = SCNVector3(4, 4, 4) let surfaceShader = """ auto diffuse = _surface.diffuse; diffuse = vec4(diffuse.r, 0, 0, 1); _surface.diffuse = diffuse; """ plane.firstMaterial!.shaderModifiers = [ SCNShaderModifierEntryPoint.surface: surfaceShader]SCNScene.init(url:options:)しか知らなかったですSceneKit produces soft-edged shadows by rendering the silhouettes of scene geometry into a 2D shadow map and then using several weighted samples from the shadow map to determine the strength of the shadow at each pixel in the rendered scene. generateAmbientOcclusionTextureでAOのテクスチャをランタイムで生成できるのだけど、iOSで実行しても 2019-02-10 19:06:15.462995+0900 xxxxx[1179:222116] IIOImageWriteSession:115: cannot create: '/tmp/originalAOTexture.png.sb-7dc5bb5d-hKjFB0' error = 1 (Operation not permitted) と言われて生成できない…。 /tmp/にアプリから書き込め無いようなCALayer を貼り付けてるのはここですね。 https://github.com/folio-sec/Slideshow/blob/master/Slideshow/SlideshowView.swift#L115CALayer として組み立ててるのはなんでですか?パフォーマンス上の理由? NSView にして auto layout でレイアウトとかもできるわけですよね? https://github.com/folio-sec/Slideshow/blob/master/Slideshow/PhotoLayer.swift
(edited)UIView + AutoLayout を SceneKit のテクスチャとして使ってやってみたいことがあるので、もし試して何か知見が得られたら報告します。やるにしても少し先になりそうですが・・・。UIView の layer を貼ってできない?