Skip to content

Commit

Permalink
Rename shadowMap to sunShadowMap
Browse files Browse the repository at this point in the history
  • Loading branch information
lilleyse committed Feb 12, 2016
1 parent acad46f commit 417802b
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Apps/Sandcastle/gallery/development/Shadows.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

var scene = viewer.scene;
var camera = scene.camera;
var shadowMap = scene.shadowMap;
var shadowMap = scene.sunShadowMap;
shadowMap.debugShow = true;

var centerLongitude = -1.31968;
Expand Down
8 changes: 4 additions & 4 deletions Source/Renderer/AutomaticUniforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -1459,10 +1459,10 @@ define([
*
* @private
*
* @alias czm_shadowMapTexture
* @alias czm_sunShadowMapTexture
* @glslUniform
*/
czm_shadowMapTexture : new AutomaticUniform({
czm_sunShadowMapTexture : new AutomaticUniform({
size : 1,
datatype : WebGLConstants.SAMPLER_2D,
getValue : function(uniformState) {
Expand All @@ -1475,10 +1475,10 @@ define([
*
* @private
*
* @alias czm_shadowMapMatrix
* @alias czm_sunShadowMapMatrix
* @glslUniform
*/
czm_shadowMapMatrix : new AutomaticUniform({
czm_sunShadowMapMatrix : new AutomaticUniform({
size : 1,
datatype : WebGLConstants.FLOAT_MAT4,
getValue : function(uniformState) {
Expand Down
2 changes: 1 addition & 1 deletion Source/Renderer/UniformState.js
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@ define([
* are set to the right value.
*
* @param {FrameState} frameState The frameState to synchronize with.
* @param {ShadowMap} [shadowMap] The shadow map.
* @param {ShadowMap} [shadowMap] The sun's shadow map.
*/
UniformState.prototype.update = function(frameState, shadowMap) {
this._mode = frameState.mode;
Expand Down
9 changes: 4 additions & 5 deletions Source/Scene/Scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ define([
* Render shadows in the scene.
* @type {ShadowMap}
*/
this.shadowMap = new ShadowMap(context, new Camera(this));
this.sunShadowMap = new ShadowMap(context, new Camera(this));

this._terrainExaggeration = defaultValue(options.terrainExaggeration, 1.0);

Expand Down Expand Up @@ -1083,7 +1083,7 @@ define([
frameState.cullingVolume = camera.frustum.computeCullingVolume(camera.positionWC, camera.directionWC, camera.upWC);
frameState.occluder = getOccluder(scene);
frameState.terrainExaggeration = scene._terrainExaggeration;
frameState.shadowsEnabled = scene.shadowMap.enabled;
frameState.shadowsEnabled = scene.sunShadowMap.enabled;

clearPasses(frameState.passes);
}
Expand Down Expand Up @@ -1644,10 +1644,9 @@ define([
function executeShadowMapCommands(scene) {
var context = scene.context;
var uniformState = context.uniformState;
var shadowMap = scene.shadowMap;
var shadowMap = scene.sunShadowMap;
var renderState = shadowMap.renderState;
var passState = shadowMap.passState;
var cameraScene = scene.camera;

// Clear shadow depth
shadowMap.clearCommand.execute(context);
Expand Down Expand Up @@ -1955,7 +1954,7 @@ define([

scene.fog.update(frameState);

var shadowMap = scene.shadowMap;
var shadowMap = scene.sunShadowMap;
if (shadowMap.enabled) {
shadowMap.update(frameState);
}
Expand Down
6 changes: 3 additions & 3 deletions Source/Scene/ShadowMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ define([
'void main() \n' +
'{ \n' +
' czm_shadow_main(); \n' +
' czm_shadowMapCoordinate = (czm_shadowMapMatrix * gl_Position).xyz; \n' +
' czm_shadowMapCoordinate = (czm_sunShadowMapMatrix * gl_Position).xyz; \n' +
'} \n';
return vs;
};
Expand All @@ -232,7 +232,7 @@ define([
'{ \n' +
' czm_shadow_main(); \n' +
' float depth = czm_shadowMapCoordinate.z; \n' +
' float shadowDepth = texture2D(czm_shadowMapTexture, czm_shadowMapCoordinate.xy).r; \n' +
' float shadowDepth = texture2D(czm_sunShadowMapTexture, czm_shadowMapCoordinate.xy).r; \n' +
' // TODO : remove if \n' +
' if (depth - 0.005 > shadowDepth) { \n' +
' gl_FragColor.rgb *= 0.2; \n' +
Expand Down Expand Up @@ -263,7 +263,7 @@ define([
'varying vec2 v_textureCoordinates; \n' +
'void main() \n' +
'{ \n' +
' float shadow = texture2D(czm_shadowMapTexture, v_textureCoordinates).r; \n' +
' float shadow = texture2D(czm_sunShadowMapTexture, v_textureCoordinates).r; \n' +
' gl_FragColor = vec4(vec3(shadow), 1.0); \n' +
'} \n';

Expand Down

0 comments on commit 417802b

Please sign in to comment.