我有一个应用程序,当你按下屏幕时,应用程序会在该位置创建一个圆圈并开始增长,直到达到最大尺寸并被删除。
如何优化我的代码以绘制大量圈子?绘制很多圈子 - 优化
Iterator<CircleShape> it = mCircles.iterator();
while (it.hasNext()) {
CircleShape shape = it.next();
if (shape.getScale().x <= shape.getMaxScale()) {
shape.setScale(shape.getScale().x + mGrowSpeed * smoothedDeltaRealTime_ms);
draw(shape);
} else {
it.remove();
}
}
的圆圈在片段着色器通过丢弃像素创建我不需要:
void main()
{
float d = distance(v_texCoord, vec2(0.5, 0.5));
if (d > 0.5f)
discard;
gl_FragColor = uColor;
}
这里是我的应用程序的图片: