SKShader performance slowdown

前端 未结 2 893
广开言路
广开言路 2021-02-11 09:04

I need to implement a custom shader node using SpriteKit. In simulator everything is ok. On a device (iPad 3rd gen) shader animation is smooth just for first ~30 seconds, after

2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-11 09:58

    Gelan Almagro's answer above works perfectly. I'm adding the Objective-C code for the update: method.

    SKSpriteNode *shadedNode = (SKSpriteNode*)[self childNodeWithName:@"shadedNode"];
    SKUniform *uniform = [shadedNode.shader uniformNamed:@"myUniform"];
    uniform.floatValue = (float)currentTime;
    

提交回复
热议问题