|
@@ -52852,6 +52852,7 @@ var BABYLON;
|
|
|
function LensFlare(size, position, color, imgUrl, system) {
|
|
|
this.size = size;
|
|
|
this.position = position;
|
|
|
+ this.alphaMode = BABYLON.Engine.ALPHA_ONEONE;
|
|
|
this.dispose = function () {
|
|
|
if (this.texture) {
|
|
|
this.texture.dispose();
|
|
@@ -53008,18 +53009,18 @@ var BABYLON;
|
|
|
engine.enableEffect(this._effect);
|
|
|
engine.setState(false);
|
|
|
engine.setDepthBuffer(false);
|
|
|
- engine.setAlphaMode(BABYLON.Engine.ALPHA_ONEONE);
|
|
|
// VBOs
|
|
|
engine.bindBuffers(this._vertexBuffers, this._indexBuffer, this._effect);
|
|
|
// Flares
|
|
|
for (var index = 0; index < this.lensFlares.length; index++) {
|
|
|
var flare = this.lensFlares[index];
|
|
|
+ engine.setAlphaMode(flare.alphaMode);
|
|
|
var x = centerX - (distX * flare.position);
|
|
|
var y = centerY - (distY * flare.position);
|
|
|
var cw = flare.size;
|
|
|
var ch = flare.size * engine.getAspectRatio(this._scene.activeCamera, true);
|
|
|
- var cx = 2 * (x / globalViewport.width) - 1.0;
|
|
|
- var cy = 1.0 - 2 * (y / globalViewport.height);
|
|
|
+ var cx = 2 * (x / (globalViewport.width + globalViewport.x * 2)) - 1.0;
|
|
|
+ var cy = 1.0 - 2 * (y / (globalViewport.height + globalViewport.y * 2));
|
|
|
var viewportMatrix = BABYLON.Matrix.FromValues(cw / 2, 0, 0, 0, 0, ch / 2, 0, 0, 0, 0, 1, 0, cx, cy, 0, 1);
|
|
|
this._effect.setMatrix("viewportMatrix", viewportMatrix);
|
|
|
// Texture
|