Skip to content

Commit

Permalink
Formatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
bagnell committed Jul 10, 2018
1 parent aa655af commit ce49ae9
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 37 deletions.
61 changes: 31 additions & 30 deletions Source/Scene/BillboardCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -1276,40 +1276,41 @@ define([
writer(i + 2, translateX, translateY, 0.0, 0.0);
writer(i + 3, translateX, translateY, 0.0, 0.0);
}
} else {
//write texture coordiante bounds, used by depth testing in fragment shader
var minX = 0;
var minY = 0;
var width = 0;
var height = 0;
var index = billboard._imageIndex;
if (index !== -1) {
var imageRectangle = textureAtlasCoordinates[index];
return;
}

//>>includeStart('debug', pragmas.debug);
if (!defined(imageRectangle)) {
throw new DeveloperError('Invalid billboard image index: ' + index);
}
//>>includeEnd('debug');
//write texture coordinate bounds, used by depth testing in fragment shader
var minX = 0;
var minY = 0;
var width = 0;
var height = 0;
var index = billboard._imageIndex;
if (index !== -1) {
var imageRectangle = textureAtlasCoordinates[index];

minX = imageRectangle.x;
minY = imageRectangle.y;
width = imageRectangle.width;
height = imageRectangle.height;
//>>includeStart('debug', pragmas.debug);
if (!defined(imageRectangle)) {
throw new DeveloperError('Invalid billboard image index: ' + index);
}
var maxX = minX + width;
var maxY = minY + height;
//>>includeEnd('debug');

if (billboardCollection._instanced) {
i = billboard._index;
writer(i, minX, minY, maxX, maxY);
} else {
i = billboard._index * 4;
writer(i + 0, minX, minY, maxX, maxY);
writer(i + 1, minX, minY, maxX, maxY);
writer(i + 2, minX, minY, maxX, maxY);
writer(i + 3, minX, minY, maxX, maxY);
}
minX = imageRectangle.x;
minY = imageRectangle.y;
width = imageRectangle.width;
height = imageRectangle.height;
}
var maxX = minX + width;
var maxY = minY + height;

if (billboardCollection._instanced) {
i = billboard._index;
writer(i, minX, minY, maxX, maxY);
} else {
i = billboard._index * 4;
writer(i + 0, minX, minY, maxX, maxY);
writer(i + 1, minX, minY, maxX, maxY);
writer(i + 2, minX, minY, maxX, maxY);
writer(i + 3, minX, minY, maxX, maxY);
}
}

Expand Down
13 changes: 6 additions & 7 deletions Source/Shaders/BillboardCollectionVS.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ const float SHIFT_RIGHT1 = 1.0 / 2.0;

vec4 addScreenSpaceOffset(vec4 positionEC, vec2 imageSize, float scale, vec2 direction, vec2 origin, vec2 translate, vec2 pixelOffset, vec3 alignedAxis, bool validAlignedAxis, float rotation, bool sizeInMeters, out mat2 rotationMatrix, out float mpp)
{

// Note the halfSize cannot be computed in JavaScript because it is sent via
// compressed vertex attributes that coerce it to an integer.
vec2 halfSize = imageSize * scale * czm_resolutionScale * 0.5;
Expand All @@ -65,8 +64,8 @@ vec4 addScreenSpaceOffset(vec4 positionEC, vec2 imageSize, float scale, vec2 dir
if (validAlignedAxis)
{
vec4 projectedAlignedAxis = czm_modelViewProjection * vec4(alignedAxis, 0.0);
angle += sign(-projectedAlignedAxis.x) * acos( sign(projectedAlignedAxis.y) * (projectedAlignedAxis.y * projectedAlignedAxis.y) /
(projectedAlignedAxis.x * projectedAlignedAxis.x + projectedAlignedAxis.y * projectedAlignedAxis.y) );
angle += sign(-projectedAlignedAxis.x) * acos(sign(projectedAlignedAxis.y) * (projectedAlignedAxis.y * projectedAlignedAxis.y) /
(projectedAlignedAxis.x * projectedAlignedAxis.x + projectedAlignedAxis.y * projectedAlignedAxis.y));
}

float cosTheta = cos(angle);
Expand Down Expand Up @@ -108,7 +107,7 @@ float getGlobeDepth(vec4 positionEC)
{
vec4 posWC = czm_eyeToWindowCoordinates(positionEC);

float globeDepth = czm_unpackDepth(texture2D(czm_globeDepthTexture, posWC.xy/czm_viewport.zw));
float globeDepth = czm_unpackDepth(texture2D(czm_globeDepthTexture, posWC.xy / czm_viewport.zw));

if (globeDepth == 0.0)
{
Expand Down Expand Up @@ -384,11 +383,11 @@ if (lengthSq < disableDepthTestDistance) {
imageSize /= mpp;
}

#if defined(ROTATION) || defined(ALIGNED_AXIS)
#if defined(ROTATION) || defined(ALIGNED_AXIS)
v_rotationMatrix = rotationMatrix;
#else
#else
v_rotationMatrix = mat2(1.0, 0.0, 0.0, 1.0);
#endif
#endif

v_eyeDepthDistanceAndApplyTranslate.x = eyeDepth;
if (lengthSq < disableDepthTestDistance)
Expand Down

0 comments on commit ce49ae9

Please sign in to comment.