Skip to content

Commit

Permalink
Revert some changes that are no longer required.
Browse files Browse the repository at this point in the history
  • Loading branch information
kring committed Feb 26, 2014
1 parent 92e66bd commit 215af9f
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 47 deletions.
36 changes: 16 additions & 20 deletions Source/Scene/BillboardCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -588,19 +588,19 @@ define([
return directionsVertexBuffer;
}

var directions = new Float32Array(sixteenK * 4 * 2);
var directions = new Uint8Array(sixteenK * 4 * 2);
for (var i = 0, j = 0; i < sixteenK; ++i) {
directions[j++] = 0;
directions[j++] = 0;

directions[j++] = 1.0;
directions[j++] = 255;
directions[j++] = 0.0;

directions[j++] = 1.0;
directions[j++] = 1.0;
directions[j++] = 255;
directions[j++] = 255;

directions[j++] = 0.0;
directions[j++] = 1.0;
directions[j++] = 255;
}

// PERFORMANCE_IDEA: Should we reference count billboard collections, and eventually delete this?
Expand Down Expand Up @@ -685,28 +685,28 @@ define([
}, {
index : attributeLocations.pickColor,
componentsPerAttribute : 4,
//normalize : true,
componentDatatype : ComponentDatatype.FLOAT,
normalize : true,
componentDatatype : ComponentDatatype.UNSIGNED_BYTE,
usage : BufferUsage.STATIC_DRAW,
purpose : pickPassPurpose
}, {
index : attributeLocations.color,
componentsPerAttribute : 4,
//normalize : true,
componentDatatype : ComponentDatatype.FLOAT,
normalize : true,
componentDatatype : ComponentDatatype.UNSIGNED_BYTE,
usage : buffersUsage[COLOR_INDEX],
purpose : colorPassPurpose
}, {
index : attributeLocations.originAndShow,
componentsPerAttribute : 3,
componentDatatype : ComponentDatatype.FLOAT,
componentDatatype : ComponentDatatype.BYTE,
usage : buffersUsage[SHOW_INDEX] // buffersUsage[HORIZONTAL_ORIGIN_INDEX] and buffersUsage[VERTICAL_ORIGIN_INDEX] ignored
}, {
index : attributeLocations.direction,
vertexBuffer : directionVertexBuffer,
componentsPerAttribute : 2,
//normalize : true,
componentDatatype : ComponentDatatype.FLOAT
normalize : true,
componentDatatype : ComponentDatatype.UNSIGNED_BYTE
}, {
index : attributeLocations.rotationAndAlignedAxis,
componentsPerAttribute : 4,
Expand Down Expand Up @@ -820,14 +820,10 @@ define([
var writer = colorWriters[attributeLocations.color];

var color = billboard.getColor();
// var red = Color.floatToByte(color.red);
// var green = Color.floatToByte(color.green);
// var blue = Color.floatToByte(color.blue);
// var alpha = Color.floatToByte(color.alpha);
var red = color.red;
var green = color.green;
var blue = color.blue;
var alpha = color.alpha;
var red = Color.floatToByte(color.red);
var green = Color.floatToByte(color.green);
var blue = Color.floatToByte(color.blue);
var alpha = Color.floatToByte(color.alpha);

writer(i + 0, red, green, blue, alpha);
writer(i + 1, red, green, blue, alpha);
Expand Down
16 changes: 8 additions & 8 deletions Source/Scene/CentralBody.js
Original file line number Diff line number Diff line change
Expand Up @@ -640,11 +640,11 @@ define([
var shaderCache = context.getShaderCache();

if (!defined(this._depthCommand.shaderProgram)) {
/*this._depthCommand.shaderProgram = shaderCache.getShaderProgram(
this._depthCommand.shaderProgram = shaderCache.getShaderProgram(
CentralBodyVSDepth,
CentralBodyFSDepth, {
position : 0
});*/
});
}

if (this._surface._terrainProvider.isReady() &&
Expand Down Expand Up @@ -730,11 +730,11 @@ define([
});
this._surfaceShaderSet.invalidateShaders();

// var poleShaderProgram = shaderCache.replaceShaderProgram(this._northPoleCommand.shaderProgram,
// CentralBodyVSPole, CentralBodyFSPole, TerrainProvider.attributeLocations);
var poleShaderProgram = shaderCache.replaceShaderProgram(this._northPoleCommand.shaderProgram,
CentralBodyVSPole, CentralBodyFSPole, TerrainProvider.attributeLocations);

//this._northPoleCommand.shaderProgram = poleShaderProgram;
//this._southPoleCommand.shaderProgram = poleShaderProgram;
this._northPoleCommand.shaderProgram = poleShaderProgram;
this._southPoleCommand.shaderProgram = poleShaderProgram;

this._showingPrettyOcean = defined(this._oceanNormalMap);
this._hasWaterMask = hasWaterMask;
Expand Down Expand Up @@ -789,7 +789,7 @@ define([
if (!this.depthTestAgainstTerrain) {
commandList.push(this._clearDepthCommand);
if (mode === SceneMode.SCENE3D) {
// commandList.push(this._depthCommand);
commandList.push(this._depthCommand);
}
}
}
Expand All @@ -798,7 +798,7 @@ define([
if (pass.pick) {
// Not actually pickable, but render depth-only so primitives on the backface
// of the globe are not picked.
// commandList.push(this._depthCommand);
commandList.push(this._depthCommand);
}
};

Expand Down
25 changes: 11 additions & 14 deletions Source/Scene/Sun.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ define([
'../Core/defined',
'../Core/defineProperties',
'../Core/destroyObject',
'../Core/IndexDatatype',
'../Core/Math',
'../Core/PrimitiveType',
'../Core/Geometry',
Expand Down Expand Up @@ -36,7 +35,6 @@ define([
defined,
defineProperties,
destroyObject,
IndexDatatype,
CesiumMath,
PrimitiveType,
Geometry,
Expand Down Expand Up @@ -159,7 +157,6 @@ define([
]
})
},
indices : new Uint16Array([0, 1, 2, 0, 2, 3]),
primitiveType : PrimitiveType.TRIANGLES
});

Expand Down Expand Up @@ -227,7 +224,7 @@ define([

var drawCommand = new DrawCommand();
drawCommand.owner = this;
drawCommand.primitiveType = PrimitiveType.TRIANGLES;
drawCommand.primitiveType = PrimitiveType.TRIANGLE_FAN;
drawCommand.vertexArray = getVertexArray(context);
drawCommand.shaderProgram = context.getShaderCache().getShaderProgram(ViewportQuadVS, SunTextureFS, viewportAttributeLocations);
drawCommand.framebuffer = fbo;
Expand Down Expand Up @@ -262,29 +259,29 @@ define([
direction : 0
};

var directions = new Float32Array(4 * 2);
var directions = new Uint8Array(4 * 2);
directions[0] = 0;
directions[1] = 0;

directions[2] = 1.0;
directions[2] = 255;
directions[3] = 0.0;

directions[4] = 1.0;
directions[5] = 1.0;
directions[4] = 255;
directions[5] = 255;

directions[6] = 0.0;
directions[7] = 1.0;
directions[7] = 255;

var vertexBuffer = context.createVertexBuffer(directions, BufferUsage.STATIC_DRAW);
var attributes = [{
index : attributeLocations.direction,
vertexBuffer : vertexBuffer,
componentsPerAttribute : 2,
componentDatatype : ComponentDatatype.FLOAT
normalize : true,
componentDatatype : ComponentDatatype.UNSIGNED_BYTE
}];
var indexBuffer = context.createIndexBuffer(new Uint16Array([0, 1, 2, 0, 2, 3]), BufferUsage.STATIC_DRAW, IndexDatatype.UNSIGNED_SHORT);
command.vertexArray = context.createVertexArray(attributes, indexBuffer);
command.primitiveType = PrimitiveType.TRIANGLES;
command.vertexArray = context.createVertexArray(attributes);
command.primitiveType = PrimitiveType.TRIANGLE_FAN;

command.shaderProgram = context.getShaderCache().getShaderProgram(SunVS, SunFS, attributeLocations);
command.renderState = context.createRenderState({
Expand Down Expand Up @@ -384,4 +381,4 @@ define([
};

return Sun;
});
});
3 changes: 1 addition & 2 deletions Source/Scene/SunPostProcess.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ define([
]
})
},
indices : new Uint16Array([0, 1, 2, 0, 2, 3]),
primitiveType : PrimitiveType.TRIANGLES
});

Expand Down Expand Up @@ -178,7 +177,7 @@ define([
this._clearFBO2Command = new ClearCommand();
this._clearFBO2Command.color = new Color();

var primitiveType = PrimitiveType.TRIANGLES;
var primitiveType = PrimitiveType.TRIANGLE_FAN;
var vertexArray = getVertexArray(context);

var downSampleCommand = this._downSampleCommand = new DrawCommand();
Expand Down
12 changes: 11 additions & 1 deletion Source/Shaders/EllipsoidVS.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,22 @@ void main()
v_positionEC = (czm_modelView * p).xyz; // position in eye coordinates
gl_Position = czm_modelViewProjection * p; // position in clip coordinates

// IE11 doesn't support gl_depthRange.
// No matter, it's currently always 0.0, 1.0.
#ifdef gl_depthRange
float depthRangeNear = gl_depthRange.near;
float depthRangeFar = gl_depthRange.far;
#else
float depthRangeNear = 0.0;
float depthRangeFar = 1.0;
#endif

// With multi-frustum, when the ellipsoid primitive is positioned on the intersection of two frustums
// and close to terrain, the terrain (writes depth) in the closest frustum can overwrite part of the
// ellipsoid (does not write depth) that was rendered in the farther frustum.
//
// Here, we clamp the depth in the vertex shader to avoid being overwritten; however, this creates
// artifacts since some fragments can be alpha blended twice. This is solved by only rendering
// the ellipsoid in the closest frustum to the viewer.
gl_Position.z = clamp(gl_Position.z, gl_DepthRange.near, gl_DepthRange.far);
gl_Position.z = clamp(gl_Position.z, depthRangeNear, depthRangeFar);
}
3 changes: 1 addition & 2 deletions Source/Widgets/CesiumWidget/CesiumWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,8 @@ define([

scene.skyBox = skyBox;
scene.skyAtmosphere = new SkyAtmosphere(ellipsoid);
scene.skyAtmosphere.show = false;
scene.sun = new Sun();
//scene.moon = new Moon();
scene.moon = new Moon();

//Set the base imagery layer
var imageryProvider = options.imageryProvider;
Expand Down

0 comments on commit 215af9f

Please sign in to comment.