diff --git a/changes.txt b/changes.txt index 7f73258d5..af8ce6717 100644 --- a/changes.txt +++ b/changes.txt @@ -5,6 +5,7 @@ Released: N/A * Added a (work-in-progress) iOS port. * Added the flag t.accelerometerjoystick to love.conf. Disables accelerometer-as-joystick functionality on mobile devices when false. + * Added the flag t.gammacorrect to love.conf (replaces t.window.srgb.) Enabling it globally enables gamma-correct rendering, when supported. * Added love.touch module. Note that it has important differences from the touch implementation in the LÖVE 0.9 Android and iOS ports. * Added love.touchpressed, love.touchreleased, and love.touchmoved. * Added love.filesystem.setRequirePath and love.filesystem.getRequirePath. @@ -19,12 +20,15 @@ Released: N/A * Added Source:getType (replaces Source:isStatic.) * Added love.graphics.ellipse. * Added rounded-rectangle support to love.graphics.rectangle. + * Added an optional boolean argument to love.graphics.setBlendMode which indicates whether the blend mode should multiply alpha with rgb for the source color. It is true by default. * Added love.graphics.getSupported (replaces love.graphics.isSupported.) * Added love.graphics.getSystemLimits (replaces love.graphics.getSystemLimit.) * Added love.graphics.stencil and love.graphics.setStencilTest (replaces love.graphics.setStencil.) * Added love.graphics.isActive. * Added color arguments to love.graphics.clear. It no longer always uses the background color value. * Added love.graphics.discard. + * Added love.graphics.isGammaCorrect. + * Added the ability to specify custom mipmaps when creating an image, via love.graphics.newImage(filename, {mipmaps={mip1, mip2, ...}}) * Added optional x/y/width/height arguments to Image:refresh and Canvas:newImageData. * Added Image:getFlags. * Added one- and two-channel Canvas formats: r8, rg8, r16f, rg16f, r32f, and rg32f. @@ -35,12 +39,16 @@ Released: N/A * Added Mesh:setVertexAttribute and Mesh:getVertexAttribute, Mesh:getVertexFormat, and Mesh:flush. * Added Mesh:setAttributeEnabled and Mesh:isAttributeEnabled. * Added Mesh:attachAttribute. + * Added Shader:sendColor. + * Added new shader functions: gammaCorrectColor, gammaToLinear, and linearToGamma. The functions also have 'precise' and 'fast' variants. * Added Text objects and love.graphics.newText. * Added BMFont bitmap font file support to love.graphics.newFont and love.font. + * Added kerning support for TrueType/OpenType and BMFont Fonts. * Added an optional font hinting argument to love.graphics.newFont when loading TrueType fonts. * Added an optional spacing argument to love.graphics.newImageFont, which applies additional spacing to all rendered glyphs. * Added Font:setFallbacks. * Added love.window.maximize. + * Added love.window.close. * Added love.window.requestAttention. * Added BezierCurve:renderSegment and BezierCurve:removePoint. * Added BezierCurve:getSegment. @@ -59,13 +67,15 @@ Released: N/A * Removed love.graphics.getSystemLimit (replaced by love.graphics.getSystemLimits.) * Removed love.graphics.setStencil (replaced by love.graphics.stencil and love.graphics.setStencilTest.) * Removed the "canvas", "shader", "npot", "subtractive", and "mipmap" Graphics Feature constant (the features always have guaranteed support now.) + * Removed the "srgb" Graphics Feature constant (use love.graphics.isGammaCorrect() or love.graphics.getCanvasFormats().srgb instead.) + * Removed the "srgb" flag in love.window.setMode and in the t.window table in love.conf (Replaced by t.gammacorrect.) + * Removed the "premultiplied" blend mode (love.graphics.setBlendMode"alpha", false) now does the same thing.) * Removed Canvas:getPixel (use Canvas:newImageData instead.) * Removed Canvas:clear (use love.graphics.clear instead.) * Removed Mesh:getVertices. * Removed Mesh:setVertexColors and Mesh:hasVertexColors (use Mesh:setAttributeEnabled("VertexColor", enable) instead.) * Removed functions deprecated in LOVE 0.9.x: - * Removed love.graphics.getMaxImageSize (replaced by love.graphics.getSystemLimits.) - * Removed love.graphics.getMaxPointSize (replaced by love.graphics.getSystemLimits.) + * Removed love.graphics.getMaxImageSize and love.graphics.getMaxPointSize (replaced by love.graphics.getSystemLimits.) * Removed Mesh:set/getImage, SpriteBatch:set/getImage, and ParticleSystem:set/getImage (replaced by set/getTexture.) * Removed SpriteBatch:bind/unbind. * Removed Canvas:getFSAA and the "fsaa" flag in love.conf and love.window.setMode (replaced by Canvas:getMSAA and "msaa".) @@ -83,6 +93,8 @@ Released: N/A * Fixed utf8.char. * Fixed detection of fused love games. + * Fixed World:getCallbacks and World:getContactFilter when used in coroutines. + * Fixed crashes when objects which store Lua callback functions are garbage collected after being used in coroutines. * Fixed love.keyboard.getKeyFromScancode crashing when an invalid scancode is given. * Fixed decoding of 8-bit WAV files. * Fixed love.audio.stop() not rewinding streaming Sources. @@ -90,9 +102,11 @@ Released: N/A * Fixed love.graphics.getColorMask. * Fixed the default offset for particles when ParticleSystem:setQuads or ParticleSystem:setTexture is used. * Fixed love.graphics.shear resetting all love.graphics transformations. + * Fixed the "add" and "subtract" blend modes to no longer modify the alpha of the Canvas / screen. - * Updated the compatibility warning notice to use a message box. + * Updated the compatibility warning notice to use a message box and to show the version specified in love.conf. * Updated the compatibility warning notice to display before main.lua is loaded. + * Updated the __tostring metamethod of love objects to output the pointer value, similar to tostring(table). * Updated love.keypressed to be love.keypressed(key, scancode, isrepeat). * Updated love.keyreleased to be love.keyreleased(key, scancode). * Updated love.mousepressed, love.mousereleased, and love.mouse.isDown to use button numbers instead of named button constants. @@ -104,15 +118,19 @@ Released: N/A * Updated ImageFonts to no longer treat separator pixels as spacing. * Updated the default font to use less memory. * Updated Font:getWrap's second return value to be a table containing the text split into lines. + * Updated love.graphics color functions to automatically apply love.graphics.gammaToLinear to color values when gamma-correct rendering is enabled. + * Updated the 'normal' Canvas format to internally use 'srgb' rather than 'rgba8' when gamma-correct rendering is enabled. * Updated love.graphics.setColor to affect all drawn objects, including ParticleSystems, SpriteBatches, and Meshes. * Updated the default fullscreen type to be "desktop" rather than "exclusive". * Updated the minimum runtime system requirements of LOVE to require OpenGL 2.1 or OpenGL ES 2 support. * Updated the pixel shader effect function so screen_coords.y is 0 at the top of the screen instead of the bottom. - * Updated love.graphics.newImage's optional second argument to be a table of flags (flags are "mipmaps" and "srgb".) + * Updated the arguments for the standard variants of love.graphics.newMesh. They're now newMesh(vertices [, drawmode, usage]) and newMesh(vertexcount [, drawmode, usage]). + * Updated line drawing code to be more efficient. + * Updated love.graphics.newImage's optional second argument to be a table of flags (flags are "mipmaps" and "linear".) * Updated Images to require setting the mipmaps flag to true on creation in order to use mipmaps. * Updated Images to allow mipmaps for non-power-of-two sizes. - * Updated the arguments for the standard variants of love.graphics.newMesh. They're now newMesh(vertices [, drawmode, usage]) and newMesh(vertexcount [, drawmode, usage]). * Updated the width/height variant of love.image.newImageData to take an additional optional string containing raw pixel data. + * Updated ImageData:encode to return a FileData object. ImageData:encode's first parameter is now the format to encode to, and the second parameter is an optional filename to write to. * Updated ImageData and SoundData methods to use efficient LuaJIT FFI code, when the JIT compiler is enabled. LOVE 0.9.2 [Baby Inspector] diff --git a/src/modules/graphics/opengl/ParticleSystem.cpp b/src/modules/graphics/opengl/ParticleSystem.cpp index 6a9552b89..2c295c91c 100644 --- a/src/modules/graphics/opengl/ParticleSystem.cpp +++ b/src/modules/graphics/opengl/ParticleSystem.cpp @@ -256,35 +256,34 @@ void ParticleSystem::initParticle(Particle *p, float t) p->life = (float) rng.random(min, max); p->lifetime = p->life; - p->position[0] = pos.x; - p->position[1] = pos.y; + p->position = pos; switch (areaSpreadDistribution) { case DISTRIBUTION_UNIFORM: - p->position[0] += (float) rng.random(-areaSpread.getX(), areaSpread.getX()); - p->position[1] += (float) rng.random(-areaSpread.getY(), areaSpread.getY()); + p->position.x += (float) rng.random(-areaSpread.getX(), areaSpread.getX()); + p->position.y += (float) rng.random(-areaSpread.getY(), areaSpread.getY()); break; case DISTRIBUTION_NORMAL: - p->position[0] += (float) rng.randomNormal(areaSpread.getX()); - p->position[1] += (float) rng.randomNormal(areaSpread.getY()); + p->position.x += (float) rng.randomNormal(areaSpread.getX()); + p->position.y += (float) rng.randomNormal(areaSpread.getY()); break; case DISTRIBUTION_NONE: default: break; } - min = direction - spread/2.0f; - max = direction + spread/2.0f; - p->direction = (float) rng.random(min, max); - p->origin = pos; min = speedMin; max = speedMax; float speed = (float) rng.random(min, max); - p->velocity = love::Vector(cosf(p->direction), sinf(p->direction)); - p->velocity *= speed; + + min = direction - spread/2.0f; + max = direction + spread/2.0f; + float dir = (float) rng.random(min, max); + + p->velocity = love::Vector(cosf(dir), sinf(dir)) * speed; p->linearAcceleration.x = (float) rng.random(linearAccelerationMin.x, linearAccelerationMax.x); p->linearAcceleration.y = (float) rng.random(linearAccelerationMin.y, linearAccelerationMax.y); @@ -872,8 +871,8 @@ void ParticleSystem::draw(float x, float y, float angle, float sx, float sy, flo if (useQuads) textureVerts = quads[p->quadIndex]->getVertices(); - // particle vertices are image vertices transformed by particle information - t.setTransformation(p->position[0], p->position[1], p->angle, p->size, p->size, offset.x, offset.y, 0.0f, 0.0f); + // particle vertices are image vertices transformed by particle info + t.setTransformation(p->position.x, p->position.y, p->angle, p->size, p->size, offset.x, offset.y, 0.0f, 0.0f); t.transform(pVerts, textureVerts, 4); // set the texture coordinate and color data for particle vertices @@ -882,7 +881,8 @@ void ParticleSystem::draw(float x, float y, float angle, float sx, float sy, flo pVerts[v].s = textureVerts[v].s; pVerts[v].t = textureVerts[v].t; - // particle colors are stored as floats (0-1) but vertex colors are stored as unsigned bytes (0-255) + // Particle colors are stored as floats (0-1) but vertex colors are + // unsigned bytes (0-255). pVerts[v].r = (unsigned char) (p->color.r*255); pVerts[v].g = (unsigned char) (p->color.g*255); pVerts[v].b = (unsigned char) (p->color.b*255); @@ -928,7 +928,7 @@ void ParticleSystem::update(float dt) { // Temp variables. love::Vector radial, tangential; - love::Vector ppos(p->position[0], p->position[1]); + love::Vector ppos = p->position; // Get vector from particle center to particle. radial = ppos - p->origin; @@ -957,8 +957,7 @@ void ParticleSystem::update(float dt) // Modify position. ppos += p->velocity * dt; - p->position[0] = ppos.getX(); - p->position[1] = ppos.getY(); + p->position = ppos; const float t = 1.0f - p->life / p->lifetime; diff --git a/src/modules/graphics/opengl/ParticleSystem.h b/src/modules/graphics/opengl/ParticleSystem.h index 6a1be26d4..1774d0eab 100644 --- a/src/modules/graphics/opengl/ParticleSystem.h +++ b/src/modules/graphics/opengl/ParticleSystem.h @@ -534,8 +534,7 @@ protected: float lifetime; float life; - float position[2]; - float direction; + love::Vector position; // Particles gravitate towards this point. love::Vector origin;