diff --git a/src/com/badlogic/gdx/graphics/g2d/UnpackedColourSpriteBatch.java b/src/com/badlogic/gdx/graphics/g2d/UnpackedColourSpriteBatch.java index 681b36333..0b5424a2b 100644 --- a/src/com/badlogic/gdx/graphics/g2d/UnpackedColourSpriteBatch.java +++ b/src/com/badlogic/gdx/graphics/g2d/UnpackedColourSpriteBatch.java @@ -103,6 +103,8 @@ public class UnpackedColourSpriteBatch extends SpriteBatch { * @param size The max number of sprites in a single batch. Max of 8191. * @param defaultShader The default shader to use. This is not owned by the SpriteBatch and must be disposed separately. */ public UnpackedColourSpriteBatch (int size, ShaderProgram defaultShader) { + super(size, defaultShader); + // 32767 is max vertex index, so 32767 / 4 vertices per sprite = 8191 sprites max. if (size > 8191) throw new IllegalArgumentException("Can't have more than 8191 sprites per batch: " + size); @@ -116,7 +118,7 @@ public class UnpackedColourSpriteBatch extends SpriteBatch { projectionMatrix.setToOrtho2D(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); - vertices = new float[size * 4 * 8]; + vertices = new float[size * 48]; int len = size * 6; short[] indices = new short[len]; @@ -1222,7 +1224,7 @@ public class UnpackedColourSpriteBatch extends SpriteBatch { renderCalls++; totalRenderCalls++; - int spritesInBatch = idx / 20; + int spritesInBatch = idx / 48; if (spritesInBatch > maxSpritesInBatch) maxSpritesInBatch = spritesInBatch; int count = spritesInBatch * 6; diff --git a/src/shaders/clouds.frag b/src/shaders/clouds.frag index 0c6ff58f6..50bedf6cc 100644 --- a/src/shaders/clouds.frag +++ b/src/shaders/clouds.frag @@ -2,7 +2,7 @@ in vec4 v_color; // lightCol -in vec4 v_generic; // gamma values +in vec4 v_generic; // gamma values [rgb gam, a gam, 0, 0] in vec2 v_texCoords; uniform sampler2D u_texture; out vec4 fragColor; @@ -12,14 +12,6 @@ const vec2 boolean = vec2(0.0, 1.0); uniform vec4 shadeCol; void main() { - // vertex colour format: - // rrrrrrMM ggggggLL bbbbbbAA aaaaaaaa - // where: - // rrrrrr: 6-bit red component - // gggggg: 6-bit green component - // bbbbbb: 6-bit blue component - // MMLL: index to the rgbGammas - // AA: index to the aGammas vec4 cloudCol = v_color; float rgbGamma = v_generic.x; float aGamma = v_generic.y;