I cannot figure it out how to apply mipmaps for SKTexture texture. I'm using XCode 8.2.1 with Swift.
Here is my method:
override func sceneDidLoad() {
logo = childNode(withName: "logo") as! SKSpriteNode
let texture: SKTexture! = SKTexture.init(imageNamed: "logo")
texture.usesMipmaps = true
logo.texture = texture
}
I use sample image png 512*512 size (pot both) Full size it looks like this:
Then I want to decrease its size to 128*128 pixels
And here is the output with mipmapping enabled:
And for example output without mipmapping (only default linear filtering)
They both looks the same. So I think mipmaps didn't apply. Help me please, I've spent 3 days trying solve this problem.
UPD: As Confused told me, I made all job in code. Created texture with mipmaping enabled, assign it to SKSpriteNode and then perform scaling by scale method or action.
let texture = SKTexture.init(imageNamed: "logo")
texture.usesMipmaps = true
logo = SKSpriteNode.init(texture: texture)
logo.position = CGPoint(x: 0, y: 0)
self.addChild(logo)
//logo.scale(to: CGSize(width: 128, height: 128))
let scaleAction = SKAction.scale(to: CGSize(width: 128, height: 128), duration: 1)
logo.run(scaleAction)