将[-1,1]映射到[0,1]

有时写shader时需要将屏幕坐标的值当作颜色值,但颜色值的范围是[0,1],坐标是[-1,1]

v.vertex.x/2 + 0.5

原文地址:https://www.cnblogs.com/mcyushao/p/11733286.html