I am trying to tile an SKTexture on a SKSpriteNode. From what I see this is not directly possible as answered here :
How do you set a texture to tile in Sprite Kit
Upon checking the reference I noticed that SKTexture has a textureByApplyingCIFilter method.
How could this be used to tile a certain SKTexture?
This is what I have tried:
SKTexture *tile = [SKTexture textureWithImageNamed:@"tile"];
CIFilter *tileTransform = [CIFilter filterWithName:@"CIAffineTile" keysAndValues:kCIInputImageKey, conveyorTexture, nil ];
CGAffineTransform xform = CGAffineTransformIdentity;
[tile setValue:[NSValue valueWithBytes:&xform
objCType:@encode(CGAffineTransform)]
forKey:@"inputTransform"];
tile = [tile textureByApplyingCIFilter:tileTransform];
Also what would be the memory consequences of using this solution as opposed to using multiple SKSpriteNode objects with the same SKTextures ?