不同的Sprite Kit SKBlendMode选项有哪些等式?

时间:2013-12-24 05:04:46

标签: ios objective-c sprite-kit blending

精灵套件SKBlendMode常见问题

对于每个Sprite Kit SKBlendMode选项:

  • SKBlendModeAlpha
  • SKBlendModeAdd
  • SKBlendModeSubtract
  • SKBlendModeMultiply
  • SKBlendModeMultiplyX2
  • SKBlendModeScreen
  • SKBlendModeReplace

  1. 控制混合的等式是什么?
  2. 是否有等效的OpenGL混合模式(例如使用glBlendFunc)?

1 个答案:

答案 0 :(得分:2)

<强> SKBlendModeAlpha

// Equations
output.r = src.r * src.alpha + dst.r * (1 - src.alpha);
output.g = src.g * src.alpha + dst.g * (1 - src.alpha);
output.b = src.b * src.alpha + dst.b * (1 - src.alpha);
output.a = src.a * src.alpha + dst.a * (1 - src.alpha);

// OpenGL Equivalent
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);