Fixes two problems: (1) Overwriting externs with the same name and (2) not using unused texture units properly.
1) Sending two different images to two different effects using the same extern name would use the same image for both effects, e.g.:
effect_1:send('img', img_1)
effect_2:send('img', img_2) -- also changes img to point to img_2 in effect_1!
Fixed by localizing the name -> texture unit mapping for each pixel effect.
2) When a pixel effect was destroyed, the allocated texture units were not marked as being available again. Fixed by having a vector<bool> marking the free units instead of just a counter how many units are in use.
Still problematic: Sending more than GL_MAX_TEXTURE_IMAGE_UNITS (>= 16, depending on the implementation) images/canvases *in total* to pixel effects. Effects could hold references to used *texture-ids* and bind/unbind them dynamically on a effect switch. Con: Introduces additional complexity when switching effects. However, benchmarks by Alexander Szpakowski have shown the performance loss is negligible.
- VertexBuffer holds permanent copy of the vertex data and is only read from
GPU memory was written outside a sb:bind()/sb:unbind() pair.
- "Orphan" the current GPU buffer on unmap() before uploading the changed data
to the GPU to avoid implicit synchronisation lags.
* Add `love.graphics.isSupported("hdrcanvas")' to query whether the hardware
actually supports HDR canvases.
* Add optional third argument to `love.graphics.newCanvas(w,h, type)', where
`type' is one of "normal" or "hdr" and defaults to "normal". HDR canvases
use floating point that can have values > 1 to store pixels, allowing for
HDR rendering and other higher level lighting techniques when combined with
pixel effects.
* Add `canvas:getType()'.
New particles are spawned around the particle emitter position according to a
configurabe distribution.
New functionality:
particlesystem:setAreaSpread(distributon, x, y)
distribution, x, y = particlesystem:getAreaSpread()
Where `distribution' is one of "none", "uniform", "normal".
`x' and `y' take different meaning based on the distribution:
* none: no area spread - particles spawned at emitter position.
* uniform: particle spawned at px,py in the rectangle around emitter
position ex,ey, i.e.:
ex - x < px < ex + x, ey - y < py < ey + y,
* normal: particle position drawn from a normal/gaussian distribution
with mean ex,ey and standard deviation x,y, i.e.:
px \in N(ex, x²), py \in N(ey, y²).