Skip to content

Commit

Permalink
Merge pull request #47 from DavidLevinsky/master
Browse files Browse the repository at this point in the history
Fixed fog
  • Loading branch information
davidmtech authored May 23, 2017
2 parents 876fb69 + 9d498c6 commit 5fd905c
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vts-browser-js",
"version": "2.4.2",
"version": "2.4.4",
"description": "JavaScript WebGL 3D maps rendering engine",
"main": "src/browser/index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/core/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ string getCoreVersion()
*/

function getCoreVersion(full) {
return (full ? 'Core: ' : '') + '2.4.2';
return (full ? 'Core: ' : '') + '2.4.4';
}


Expand Down
10 changes: 5 additions & 5 deletions src/core/map/draw-tiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ var MapDrawTiles = function(map, draw) {


MapDrawTiles.prototype.drawSurfaceTile = function(tile, node, cameraPos, pixelSize, priority, preventRedener, preventLoad, checkGpu) {
/*if (tile.id[0] == 12 &&
tile.id[1] == 690 &&
tile.id[2] == 1232) {
tile = tile;
//return true;
/*if (!(tile.id[0] == 14 &&
tile.id[1] == 4450 &&
tile.id[2] == 2749)) {
//tile = tile;
return true;
}*/

if (this.stats.gpuRenderUsed >= this.draw.maxGpuUsed) {
Expand Down
4 changes: 1 addition & 3 deletions src/core/map/draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ MapDraw.prototype.drawMap = function(skipFreeLayers) {

var t1 = 1.4, t2 = 1.6; //previous value t1=1.1

if (camera.height > 60000) { //don render ground color in aura
if (camera.height > 45000) { //don render ground color in aura
t1 = 1.4, t2 = 1.8;
params3 = [t2,1.0,t2,0];
} else {
Expand Down Expand Up @@ -595,8 +595,6 @@ MapDraw.prototype.processDrawCommands = function(cameraPos, commands, priority,
break;

case 'submesh':
//this.renderer.gpu.setState(this.drawBlendedTileState);

var mesh = command.mesh;
var texture = command.texture;

Expand Down
5 changes: 3 additions & 2 deletions src/core/renderer/gpu/shaders.js
Original file line number Diff line number Diff line change
Expand Up @@ -743,13 +743,14 @@ GpuShaders.tile3FragmentShader = 'precision mediump float;\n'+
GpuShaders.fogTileVertexShader =
'attribute vec3 aPosition;\n'+
'uniform mat4 uMV, uProj;\n'+
'uniform float uFogDensity;\n'+
// 'uniform float uFogDensity;\n'+
'uniform vec4 uParams;\n'+ //[zfactor, fogDensity, 0, 0]
'varying float vFogFactor;\n'+
'void main() {\n'+
'vec4 camSpacePos = uMV * vec4(aPosition, 1.0);\n'+
'gl_Position = uProj * camSpacePos;\n'+
'float camDist = length(camSpacePos.xyz);\n'+
'vFogFactor = exp(uFogDensity * camDist);\n'+
'vFogFactor = exp(uParams[1] * camDist);\n'+
'}';


Expand Down

0 comments on commit 5fd905c

Please sign in to comment.