Skip to content

Commit

Permalink
Adding support for equirectangular not fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
deltakosh committed Nov 23, 2015
1 parent e2d4816 commit 97179d0
Show file tree
Hide file tree
Showing 20 changed files with 2,616 additions and 2,707 deletions.
33 changes: 17 additions & 16 deletions dist/preview release/babylon.core.js

Large diffs are not rendered by default.

4,366 changes: 2,184 additions & 2,182 deletions dist/preview release/babylon.d.ts

Large diffs are not rendered by default.

48 changes: 24 additions & 24 deletions dist/preview release/babylon.js

Large diffs are not rendered by default.

252 changes: 115 additions & 137 deletions dist/preview release/babylon.max.js

Large diffs are not rendered by default.

48 changes: 24 additions & 24 deletions dist/preview release/babylon.noworker.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/preview release/what's new.md
Expand Up @@ -22,7 +22,7 @@
- Added `Animatable.goToFrame()` ([deltakosh](https://github.com/deltakosh))
- Fixed behavior or `Animation.CreateAndStartAnimation` and added `Animation.CreateMergeAndStartAnimation` to reproduce previous behavior ([deltakosh](https://github.com/deltakosh))
- Adding `StandardMaterial.linkEmissiveWithDiffuse` to, well, link emissive with diffuse value. (With)[http://www.babylonjs-playground.com/#2FPUCS#2] and (without)[http://www.babylonjs-playground.com/#2FPUCS#1] ([deltakosh](https://github.com/deltakosh))
- Adding support for equi-rectangular mapping. See [demo here](http://www.babylonjs-playground.com/#27FN5R#8) ([deltakosh](https://github.com/deltakosh))
- Adding support for equi-rectangular mapping. See [demo here](http://www.babylonjs-playground.com/#27FN5R#12) ([deltakosh](https://github.com/deltakosh))
- Sprites and particles scheduler updated to be resolved before transparent objects ([deltakosh](https://github.com/deltakosh))
- Added ability to deactivate ArcRotateCamera panning mechanism (by setting panningSensibility to 0) ([vouskprod](http://www.github.com/vousk))
- Added `DirectionalLight.autoUpdateExtends` to prevent directional lights to adapt to scene extends ([deltakosh](https://github.com/deltakosh))
Expand Down
9 changes: 5 additions & 4 deletions src/Cameras/babylon.arcRotateCamera.js
Expand Up @@ -73,7 +73,7 @@ var BABYLON;
_this.position.copyFrom(_this._newPosition);
var up = _this.upVector;
if (_this.allowUpsideDown && _this.beta < 0) {
var up = up.clone();
up = up.clone();
up = up.negate();
}
BABYLON.Matrix.LookAtLHToRef(_this.position, target, up, _this._viewMatrix);
Expand Down Expand Up @@ -148,7 +148,7 @@ var BABYLON;
if (this._onPointerDown === undefined) {
this._onPointerDown = function (evt) {
// Manage panning with right click
_this._isRightClick = evt.button === 2 ? true : false;
_this._isRightClick = evt.button === 2;
// manage pointers
pointers.add(evt.pointerId, { x: evt.clientX, y: evt.clientY, type: evt.pointerType });
cacheSoloPointer = pointers.item(evt.pointerId);
Expand Down Expand Up @@ -376,7 +376,7 @@ var BABYLON;
}
}
// Inertia
if (this.inertialAlphaOffset !== 0 || this.inertialBetaOffset !== 0 || this.inertialRadiusOffset != 0) {
if (this.inertialAlphaOffset !== 0 || this.inertialBetaOffset !== 0 || this.inertialRadiusOffset !== 0) {
this.alpha += this.beta <= 0 ? -this.inertialAlphaOffset : this.inertialAlphaOffset;
this.beta += this.inertialBetaOffset;
this.radius -= this.inertialRadiusOffset;
Expand Down Expand Up @@ -481,7 +481,7 @@ var BABYLON;
this.position.copyFrom(this._newPosition);
var up = this.upVector;
if (this.allowUpsideDown && this.beta < 0) {
var up = up.clone();
up = up.clone();
up = up.negate();
}
BABYLON.Matrix.LookAtLHToRef(this.position, target, up, this._viewMatrix);
Expand Down Expand Up @@ -530,6 +530,7 @@ var BABYLON;
var alphaShift = this._cameraRigParams.stereoHalfAngle * (cameraIndex === 0 ? 1 : -1);
return new ArcRotateCamera(name, this.alpha + alphaShift, this.beta, this.radius, this.target, this.getScene());
}
return null;
};
/**
* @override
Expand Down
9 changes: 5 additions & 4 deletions src/Cameras/babylon.arcRotateCamera.ts
Expand Up @@ -142,7 +142,7 @@
if (this._onPointerDown === undefined) {
this._onPointerDown = evt => {
// Manage panning with right click
this._isRightClick = evt.button === 2 ? true : false;
this._isRightClick = evt.button === 2;

// manage pointers
pointers.add(evt.pointerId, { x: evt.clientX, y: evt.clientY, type: evt.pointerType });
Expand Down Expand Up @@ -408,7 +408,7 @@
}

// Inertia
if (this.inertialAlphaOffset !== 0 || this.inertialBetaOffset !== 0 || this.inertialRadiusOffset != 0) {
if (this.inertialAlphaOffset !== 0 || this.inertialBetaOffset !== 0 || this.inertialRadiusOffset !== 0) {
this.alpha += this.beta <= 0 ? -this.inertialAlphaOffset : this.inertialAlphaOffset;
this.beta += this.inertialBetaOffset;
this.radius -= this.inertialRadiusOffset;
Expand Down Expand Up @@ -529,7 +529,7 @@

var up = this.upVector;
if (this.allowUpsideDown && this.beta < 0) {
var up = up.clone();
up = up.clone();
up = up.negate();
}

Expand Down Expand Up @@ -567,7 +567,7 @@

var up = this.upVector;
if (this.allowUpsideDown && this.beta < 0) {
var up = up.clone();
up = up.clone();
up = up.negate();
}

Expand Down Expand Up @@ -624,6 +624,7 @@
var alphaShift = this._cameraRigParams.stereoHalfAngle * (cameraIndex === 0 ? 1 : -1);
return new ArcRotateCamera(name, this.alpha + alphaShift, this.beta, this.radius, this.target, this.getScene());
}
return null;
}

/**
Expand Down
82 changes: 41 additions & 41 deletions src/Debug/babylon.debugLayer.ts
Expand Up @@ -393,7 +393,7 @@
this._rootElement.appendChild(this._globalDiv);

this._generateDOMelements();

engine.getRenderingCanvas().addEventListener("click", this._onCanvasClick);

this._syncPositions();
Expand Down Expand Up @@ -489,10 +489,10 @@
button.style.width = "150px";
button.style.marginBottom = "5px";
button.style.color = "#444444";
button.style.border = "1px solid white";
button.style.border = "1px solid white";
button.className = "debugLayerButton";

button.addEventListener("click",(evt: Event) => {
button.addEventListener("click", (evt: Event) => {
task(evt.target, tag);
});

Expand Down Expand Up @@ -708,7 +708,7 @@
}
});
this._optionsSubsetDiv.appendChild(document.createElement("br"));

this._globalDiv.appendChild(this._statsDiv);
this._globalDiv.appendChild(this._logDiv);
this._globalDiv.appendChild(this._optionsDiv);
Expand All @@ -722,46 +722,46 @@
var glInfo = engine.getGlInfo();

this._statsSubsetDiv.innerHTML = "Babylon.js v" + Engine.Version + " - <b>" + Tools.Format(engine.getFps(), 0) + " fps</b><br><br>"
+ "<div style='column-count: 2;-moz-column-count:2;-webkit-column-count:2'>"
+ "<b>Count</b><br>"
+ "Total meshes: " + scene.meshes.length + "<br>"
+ "Total vertices: " + scene.getTotalVertices() + "<br>"
+ "Total materials: " + scene.materials.length + "<br>"
+ "Total textures: " + scene.textures.length + "<br>"
+ "Active meshes: " + scene.getActiveMeshes().length + "<br>"
+ "Active indices: " + scene.getActiveIndices() + "<br>"
+ "Active bones: " + scene.getActiveBones() + "<br>"
+ "Active particles: " + scene.getActiveParticles() + "<br>"
+ "<b>Draw calls: " + engine.drawCalls + "</b><br><br>"
+ "<b>Duration</b><br>"
+ "Meshes selection:</i> " + Tools.Format(scene.getEvaluateActiveMeshesDuration()) + " ms<br>"
+ "Render Targets: " + Tools.Format(scene.getRenderTargetsDuration()) + " ms<br>"
+ "Particles: " + Tools.Format(scene.getParticlesDuration()) + " ms<br>"
+ "Sprites: " + Tools.Format(scene.getSpritesDuration()) + " ms<br><br>"
+ "Render: <b>" + Tools.Format(scene.getRenderDuration()) + " ms</b><br>"
+ "Frame: " + Tools.Format(scene.getLastFrameDuration()) + " ms<br>"
+ "Potential FPS: " + Tools.Format(1000.0 / scene.getLastFrameDuration(), 0) + "<br><br>"
+ "</div>"
+ "<div style='column-count: 2;-moz-column-count:2;-webkit-column-count:2'>"
+ "<b>Extensions</b><br>"
+ "Std derivatives: " + (engine.getCaps().standardDerivatives ? "Yes" : "No") + "<br>"
+ "Compressed textures: " + (engine.getCaps().s3tc ? "Yes" : "No") + "<br>"
+ "Hardware instances: " + (engine.getCaps().instancedArrays ? "Yes" : "No") + "<br>"
+ "Texture float: " + (engine.getCaps().textureFloat ? "Yes" : "No") + "<br>"
+ "32bits indices: " + (engine.getCaps().uintIndices ? "Yes" : "No") + "<br>"
+ "Fragment depth: " + (engine.getCaps().fragmentDepthSupported ? "Yes" : "No") + "<br>"
+ "<b>Caps.</b><br>"
+ "Max textures units: " + engine.getCaps().maxTexturesImageUnits + "<br>"
+ "Max textures size: " + engine.getCaps().maxTextureSize + "<br>"
+ "Max anisotropy: " + engine.getCaps().maxAnisotropy + "<br><br><br>"
+ "</div><br>"
+ "<b>Info</b><br>"
+ glInfo.version + "<br>"
+ glInfo.renderer + "<br>";
+ "<div style='column-count: 2;-moz-column-count:2;-webkit-column-count:2'>"
+ "<b>Count</b><br>"
+ "Total meshes: " + scene.meshes.length + "<br>"
+ "Total vertices: " + scene.getTotalVertices() + "<br>"
+ "Total materials: " + scene.materials.length + "<br>"
+ "Total textures: " + scene.textures.length + "<br>"
+ "Active meshes: " + scene.getActiveMeshes().length + "<br>"
+ "Active indices: " + scene.getActiveIndices() + "<br>"
+ "Active bones: " + scene.getActiveBones() + "<br>"
+ "Active particles: " + scene.getActiveParticles() + "<br>"
+ "<b>Draw calls: " + engine.drawCalls + "</b><br><br>"
+ "<b>Duration</b><br>"
+ "Meshes selection:</i> " + Tools.Format(scene.getEvaluateActiveMeshesDuration()) + " ms<br>"
+ "Render Targets: " + Tools.Format(scene.getRenderTargetsDuration()) + " ms<br>"
+ "Particles: " + Tools.Format(scene.getParticlesDuration()) + " ms<br>"
+ "Sprites: " + Tools.Format(scene.getSpritesDuration()) + " ms<br><br>"
+ "Render: <b>" + Tools.Format(scene.getRenderDuration()) + " ms</b><br>"
+ "Frame: " + Tools.Format(scene.getLastFrameDuration()) + " ms<br>"
+ "Potential FPS: " + Tools.Format(1000.0 / scene.getLastFrameDuration(), 0) + "<br><br>"
+ "</div>"
+ "<div style='column-count: 2;-moz-column-count:2;-webkit-column-count:2'>"
+ "<b>Extensions</b><br>"
+ "Std derivatives: " + (engine.getCaps().standardDerivatives ? "Yes" : "No") + "<br>"
+ "Compressed textures: " + (engine.getCaps().s3tc ? "Yes" : "No") + "<br>"
+ "Hardware instances: " + (engine.getCaps().instancedArrays ? "Yes" : "No") + "<br>"
+ "Texture float: " + (engine.getCaps().textureFloat ? "Yes" : "No") + "<br>"
+ "32bits indices: " + (engine.getCaps().uintIndices ? "Yes" : "No") + "<br>"
+ "Fragment depth: " + (engine.getCaps().fragmentDepthSupported ? "Yes" : "No") + "<br>"
+ "<b>Caps.</b><br>"
+ "Max textures units: " + engine.getCaps().maxTexturesImageUnits + "<br>"
+ "Max textures size: " + engine.getCaps().maxTextureSize + "<br>"
+ "Max anisotropy: " + engine.getCaps().maxAnisotropy + "<br><br><br>"
+ "</div><br>"
+ "<b>Info</b><br>"
+ glInfo.version + "<br>"
+ glInfo.renderer + "<br>";

if (this.customStatsFunction) {
this._statsSubsetDiv.innerHTML += this._statsSubsetDiv.innerHTML;
}
}
}
}
}
3 changes: 2 additions & 1 deletion src/Layer/babylon.layer.js
Expand Up @@ -3,6 +3,7 @@ var BABYLON;
var Layer = (function () {
function Layer(name, imgUrl, scene, isBackground, color) {
this.name = name;
this.alphaBlendingMode = BABYLON.Engine.ALPHA_COMBINE;
this._vertexDeclaration = [2];
this._vertexStrideSize = 2 * 4;
this.texture = imgUrl ? new BABYLON.Texture(imgUrl, scene, true) : null;
Expand Down Expand Up @@ -45,7 +46,7 @@ var BABYLON;
// VBOs
engine.bindBuffers(this._vertexBuffer, this._indexBuffer, this._vertexDeclaration, this._vertexStrideSize, this._effect);
// Draw order
engine.setAlphaMode(BABYLON.Engine.ALPHA_COMBINE);
engine.setAlphaMode(this.alphaBlendingMode);
engine.draw(true, 0, 6);
engine.setAlphaMode(BABYLON.Engine.ALPHA_DISABLE);
};
Expand Down
3 changes: 2 additions & 1 deletion src/Layer/babylon.layer.ts
Expand Up @@ -4,6 +4,7 @@
public isBackground: boolean;
public color: Color4;
public onDispose: () => void;
public alphaBlendingMode = Engine.ALPHA_COMBINE;

private _scene: Scene;
private _vertexDeclaration = [2];
Expand Down Expand Up @@ -70,7 +71,7 @@
engine.bindBuffers(this._vertexBuffer, this._indexBuffer, this._vertexDeclaration, this._vertexStrideSize, this._effect);

// Draw order
engine.setAlphaMode(Engine.ALPHA_COMBINE);
engine.setAlphaMode(this.alphaBlendingMode);
engine.draw(true, 0, 6);
engine.setAlphaMode(Engine.ALPHA_DISABLE);
}
Expand Down
1 change: 1 addition & 0 deletions src/Materials/Textures/babylon.texture.js
Expand Up @@ -199,6 +199,7 @@ var BABYLON;
Texture.SKYBOX_MODE = 5;
Texture.INVCUBIC_MODE = 6;
Texture.EQUIRECTANGULAR_MODE = 7;
Texture.FIXED_EQUIRECTANGULAR_MODE = 8;
Texture.CLAMP_ADDRESSMODE = 0;
Texture.WRAP_ADDRESSMODE = 1;
Texture.MIRROR_ADDRESSMODE = 2;
Expand Down
1 change: 1 addition & 0 deletions src/Materials/Textures/babylon.texture.ts
Expand Up @@ -13,6 +13,7 @@
public static SKYBOX_MODE = 5;
public static INVCUBIC_MODE = 6;
public static EQUIRECTANGULAR_MODE = 7;
public static FIXED_EQUIRECTANGULAR_MODE = 8;

public static CLAMP_ADDRESSMODE = 0;
public static WRAP_ADDRESSMODE = 1;
Expand Down
4 changes: 4 additions & 0 deletions src/Materials/babylon.standardMaterial.js
Expand Up @@ -102,6 +102,7 @@ var BABYLON;
this.REFLECTIONMAP_SKYBOX = false;
this.REFLECTIONMAP_EXPLICIT = false;
this.REFLECTIONMAP_EQUIRECTANGULAR = false;
this.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = false;
this.INVERTCUBICMAP = false;
this.LOGARITHMICDEPTH = false;
this._keys = Object.keys(this);
Expand Down Expand Up @@ -382,6 +383,9 @@ var BABYLON;
case BABYLON.Texture.EQUIRECTANGULAR_MODE:
this._defines.REFLECTIONMAP_EQUIRECTANGULAR = true;
break;
case BABYLON.Texture.FIXED_EQUIRECTANGULAR_MODE:
this._defines.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = true;
break;
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/Materials/babylon.standardMaterial.ts
Expand Up @@ -94,6 +94,7 @@
public REFLECTIONMAP_SKYBOX = false;
public REFLECTIONMAP_EXPLICIT = false;
public REFLECTIONMAP_EQUIRECTANGULAR = false;
public REFLECTIONMAP_EQUIRECTANGULAR_FIXED = false;
public INVERTCUBICMAP = false;
public LOGARITHMICDEPTH = false;

Expand Down Expand Up @@ -440,6 +441,9 @@
case Texture.EQUIRECTANGULAR_MODE:
this._defines.REFLECTIONMAP_EQUIRECTANGULAR = true;
break;
case Texture.FIXED_EQUIRECTANGULAR_MODE:
this._defines.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = true;
break;
}
}
}
Expand Down

0 comments on commit 97179d0

Please sign in to comment.