@@ -9,7 +9,7 @@ import Foundation
9
9
// Test out some explicit renames of typedefs and globals, which are now new
10
10
// wrapper types with nestest values.
11
11
@available ( macOS 10 . 11 , * )
12
- func testRenames ( ) {
12
+ func testNestingRenames ( ) {
13
13
let _ = SCNGeometrySourceSemantic
14
14
// expected-error@-1{{'SCNGeometrySourceSemantic' has been renamed to 'SCNGeometrySource.Semantic'}}
15
15
let _ = SCNLightType
@@ -98,6 +98,7 @@ func testRenames() {
98
98
// expected-error@-1{{'SCNPreferLowPowerDeviceKey' has been renamed to 'SCNView.Option.preferLowPowerDevice'}}
99
99
}
100
100
101
+ // All OK
101
102
@available ( macOS 10 . 11 , * )
102
103
func useRenamedValues( ) {
103
104
let _ = SCNGeometrySource . Semantic. self
@@ -144,3 +145,93 @@ func useRenamedValues() {
144
145
let _ = SCNView . Option. preferredDevice
145
146
let _ = SCNView . Option. preferLowPowerDevice
146
147
}
148
+
149
+ // All OK
150
+ @available ( macOS 10 . 12 , * )
151
+ func useRenamedAPIs( actionable: SCNActionable , action: SCNAction , data: Data ,
152
+ timeInterval: TimeInterval , vec3: SCNVector3 , node: SCNNode ,
153
+ audioSource: SCNAudioSource , animatable: SCNAnimatable ,
154
+ lookAtConstraint: SCNLookAtConstraint , mat4: SCNMatrix4 ,
155
+ particleSystem: SCNParticleSystem , event: SCNParticleEvent ,
156
+ stage: SCNParticleModifierStage , animation: CAAnimation ,
157
+ bindingBlock: SCNBindingBlock , material: SCNMaterial ,
158
+ bufferBindingBlock: SCNBufferBindingBlock , vec4: SCNVector4 ,
159
+ eventBlock: SCNParticleEventBlock , morpher: SCNMorpher ,
160
+ modifierBlock: SCNParticleModifierBlock , scene: SCNScene ,
161
+ physicsBehavior: SCNPhysicsBehavior , geometry: SCNGeometry ,
162
+ physicsBody: SCNPhysicsBody , sceneSource: SCNSceneSource ,
163
+ physicsWorld: SCNPhysicsWorld , point: CGPoint ,
164
+ physicsShape: SCNPhysicsShape , shadable: SCNShadable ,
165
+ voidPtr: UnsafeMutableRawPointer , program: SCNProgram ,
166
+ renderer: SCNSceneRenderer , bufferStream: SCNBufferStream ,
167
+ bufferFrequency: SCNBufferFrequency ,
168
+ semantic: SCNGeometrySource . Semantic ,
169
+ prop: SCNParticleSystem . ParticleProperty ) {
170
+ actionable. runAction ( action)
171
+ actionable. runAction ( action, completionHandler: { } )
172
+ actionable. runAction ( action, forKey: " key " , completionHandler: { } )
173
+
174
+ let _ = SCNAction . rotateTo ( x: 1.0 , y: 2.0 , z: 3.0 , duration: timeInterval,
175
+ usesShortestUnitArc: false )
176
+ let _ = SCNAction . rotate ( by: 1.0 , around: vec3, duration: timeInterval)
177
+ let _ = SCNAction . fadeIn ( duration: timeInterval)
178
+ let _ = SCNAction . fadeOut ( duration: timeInterval)
179
+ let _ = SCNAction . wait ( duration: timeInterval)
180
+ let _ = SCNAction . wait ( duration: timeInterval, withRange: timeInterval)
181
+ let _ = SCNAction . customAction ( duration: timeInterval,
182
+ action: { ( a, b) in ( ) } )
183
+ let _ = SCNAction . playAudio ( audioSource, waitForCompletion: false )
184
+
185
+ animatable. addAnimation ( animation, forKey: " key " )
186
+ let _ = animatable. isAnimationPaused ( forKey: " key " )
187
+ let _ = animatable. setAnimationSpeed ( 1.0 , forKey: " key " )
188
+
189
+ let _ = lookAtConstraint. isGimbalLockEnabled
190
+ let _ = SCNIKConstraint . inverseKinematicsConstraint ( chainRootNode: node)
191
+
192
+ let _ = geometry. material ( named: " mat " )
193
+ let _ = geometry. getGeometrySources ( for: semantic)
194
+ let geoSrc = SCNGeometrySource ( data: data, semantic: semantic, vectorCount: 2 ,
195
+ usesFloatComponents: false ,
196
+ componentsPerVector: 3 ,
197
+ bytesPerComponent: 11 , dataOffset: - 2 ,
198
+ dataStride: - 3 )
199
+ let _ = geoSrc. usesFloatComponents
200
+
201
+ let _ = material. lightingModel
202
+ let _ = morpher. weight ( forTargetAt: 1 )
203
+ let _ = node. hitTestWithSegment ( from: vec3, to: vec3, options: [ : ] )
204
+
205
+ let _ = particleSystem. isAffectedByGravity
206
+ let _ = particleSystem. isAffectedByPhysicsFields
207
+ particleSystem. handle ( event, forProperties: [ prop] , handler: eventBlock)
208
+ particleSystem. addModifier ( forProperties: [ prop] , at: stage,
209
+ modifier: modifierBlock)
210
+ particleSystem. removeModifiers ( at: stage)
211
+ scene. addParticleSystem ( particleSystem, transform: mat4)
212
+
213
+ physicsBody. applyForce ( vec3, asImpulse: false )
214
+ physicsBody. applyForce ( vec3, at: vec3, asImpulse: false )
215
+ physicsBody. applyTorque ( vec4, asImpulse: false )
216
+ let _ = SCNPhysicsField . noiseField ( smoothness: 1.0 , animationSpeed: 1.0 )
217
+ let _ = SCNPhysicsField . turbulenceField ( smoothness: 1.0 , animationSpeed: 1.0 )
218
+ physicsWorld. addBehavior ( physicsBehavior)
219
+ physicsWorld. removeBehavior ( physicsBehavior)
220
+ let _ = physicsWorld. rayTestWithSegment ( from: vec3, to: vec3, options: [ : ] )
221
+ let _ = physicsWorld. contactTestBetween ( physicsBody, physicsBody,
222
+ options: [ : ] )
223
+ let _ = physicsWorld. contactTest ( with: physicsBody, options: [ : ] )
224
+ let _ = physicsWorld. convexSweepTest ( with: physicsShape, from: mat4, to: mat4)
225
+
226
+ let _ = renderer. isNode ( node, insideFrustumOf: node)
227
+ let _ = renderer. nodesInsideFrustum ( of: node)
228
+ renderer. prepare ( [ ] , completionHandler: { b in ( ) } )
229
+ let _ = sceneSource. identifiersOfEntries ( withClass: SCNNode . self)
230
+
231
+ bufferStream. writeBytes ( voidPtr, count: 2 )
232
+
233
+ shadable. handleBinding!( ofSymbol: " sym " , handler: bindingBlock)
234
+ shadable. handleUnbinding!( ofSymbol: " sym " , handler: bindingBlock)
235
+ program. handleBinding ( ofBufferNamed: " str " , frequency: bufferFrequency,
236
+ handler: bufferBindingBlock)
237
+ }
0 commit comments