Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Billboard depth fail #5166

Merged
merged 16 commits into from
Apr 6, 2017
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion Source/DataSources/BillboardGraphics.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ define([
this._sizeInMetersSubscription = undefined;
this._distanceDisplayCondition = undefined;
this._distanceDisplayConditionSubscription = undefined;
this._disableDepthDistance = undefined;
this._disableDepthDistanceSubscription = undefined;
this._alwaysDisableDepth = undefined;
this._alwaysDisableDepthSubscription = undefined;
this._definitionChanged = new Event();

this.merge(defaultValue(options, defaultValue.EMPTY_OBJECT));
Expand Down Expand Up @@ -316,7 +320,11 @@ define([
* @memberof BillboardGraphics.prototype
* @type {Property}
*/
distanceDisplayCondition : createPropertyDescriptor('distanceDisplayCondition')
distanceDisplayCondition : createPropertyDescriptor('distanceDisplayCondition'),

disableDepthDistance : createPropertyDescriptor('disableDepthDistance'),

alwaysDisableDepth : createPropertyDescriptor('alwaysDisableDepth')
});

/**
Expand Down Expand Up @@ -348,6 +356,8 @@ define([
result.pixelOffsetScaleByDistance = this._pixelOffsetScaleByDistance;
result.sizeInMeters = this._sizeInMeters;
result.distanceDisplayCondition = this._distanceDisplayCondition;
result.disableDepthDistance = this._disableDepthDistance;
result.alwaysDisableDepth = this._alwaysDisableDepth;
return result;
};

Expand Down Expand Up @@ -383,6 +393,8 @@ define([
this.pixelOffsetScaleByDistance = defaultValue(this._pixelOffsetScaleByDistance, source.pixelOffsetScaleByDistance);
this.sizeInMeters = defaultValue(this._sizeInMeters, source.sizeInMeters);
this.distanceDisplayCondition = defaultValue(this._distanceDisplayCondition, source.distanceDisplayCondition);
this.disableDepthDistance = defaultValue(this._disableDepthDistance, source.disableDepthDistance);
this.alwaysDisableDepth = defaultValue(this._alwaysDisableDepth, source.alwaysDisableDepth);
};

return BillboardGraphics;
Expand Down
2 changes: 2 additions & 0 deletions Source/DataSources/BillboardVisualizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ define([
billboard.pixelOffsetScaleByDistance = Property.getValueOrUndefined(billboardGraphics._pixelOffsetScaleByDistance, time, pixelOffsetScaleByDistance);
billboard.sizeInMeters = Property.getValueOrDefault(billboardGraphics._sizeInMeters, defaultSizeInMeters);
billboard.distanceDisplayCondition = Property.getValueOrUndefined(billboardGraphics._distanceDisplayCondition, time, distanceDisplayCondition);
billboard.disableDepthDistance = Property.getValueOrUndefined(billboardGraphics._disableDepthDistance, time);
billboard.alwaysDisableDepth = Property.getValueOrUndefined(billboardGraphics._alwaysDisableDepth, time);

var subRegion = Property.getValueOrUndefined(billboardGraphics._imageSubRegion, time, boundingRectangle);
if (defined(subRegion)) {
Expand Down
20 changes: 16 additions & 4 deletions Source/DataSources/LabelGraphics.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ define([
this._scaleByDistanceSubscription = undefined;
this._distanceDisplayCondition = undefined;
this._distanceDisplayConditionSubscription = undefined;
this._disableDepthDistance = undefined;
this._disableDepthDistanceSubscription = undefined;
this._alwaysDisableDepth = undefined;
this._alwaysDisableDepthSubscription = undefined;
this._definitionChanged = new Event();

this.merge(defaultValue(options, defaultValue.EMPTY_OBJECT));
Expand Down Expand Up @@ -309,7 +313,11 @@ define([
* @memberof LabelGraphics.prototype
* @type {Property}
*/
distanceDisplayCondition : createPropertyDescriptor('distanceDisplayCondition')
distanceDisplayCondition : createPropertyDescriptor('distanceDisplayCondition'),

disableDepthDistance : createPropertyDescriptor('disableDepthDistance'),

alwaysDisableDepth : createPropertyDescriptor('alwaysDisableDepth')
});

/**
Expand Down Expand Up @@ -342,6 +350,8 @@ define([
result.pixelOffsetScaleByDistance = this.pixelOffsetScaleByDistance;
result.scaleByDistance = this.scaleByDistance;
result.distanceDisplayCondition = this.distanceDisplayCondition;
result.disableDepthDistance = this.disableDepthDistance;
result.alwaysDisableDepth = this.alwaysDisableDepth;
return result;
};

Expand Down Expand Up @@ -374,10 +384,12 @@ define([
this.eyeOffset = defaultValue(this.eyeOffset, source.eyeOffset);
this.heightReference = defaultValue(this.heightReference, source.heightReference);
this.pixelOffset = defaultValue(this.pixelOffset, source.pixelOffset);
this.translucencyByDistance = defaultValue(this._translucencyByDistance, source.translucencyByDistance);
this.pixelOffsetScaleByDistance = defaultValue(this._pixelOffsetScaleByDistance, source.pixelOffsetScaleByDistance);
this.scaleByDistance = defaultValue(this._scaleByDistance, source.scaleByDistance);
this.translucencyByDistance = defaultValue(this.translucencyByDistance, source.translucencyByDistance);
this.pixelOffsetScaleByDistance = defaultValue(this.pixelOffsetScaleByDistance, source.pixelOffsetScaleByDistance);
this.scaleByDistance = defaultValue(this.scaleByDistance, source.scaleByDistance);
this.distanceDisplayCondition = defaultValue(this.distanceDisplayCondition, source.distanceDisplayCondition);
this.disableDepthDistance = defaultValue(this.disableDepthDistance, source.disableDepthDistance);
this.alwaysDisableDepth = defaultValue(this.alwaysDisableDepth, source.alwaysDisableDepth);
};

return LabelGraphics;
Expand Down
2 changes: 2 additions & 0 deletions Source/DataSources/LabelVisualizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ define([
label.pixelOffsetScaleByDistance = Property.getValueOrUndefined(labelGraphics._pixelOffsetScaleByDistance, time, pixelOffsetScaleByDistance);
label.scaleByDistance = Property.getValueOrUndefined(labelGraphics._scaleByDistance, time, scaleByDistance);
label.distanceDisplayCondition = Property.getValueOrUndefined(labelGraphics._distanceDisplayCondition, time, distanceDisplayCondition);
label.disableDepthDistance = Property.getValueOrUndefined(labelGraphics._disableDepthDistance, time);
label.alwaysDisableDepth = Property.getValueOrUndefined(labelGraphics._alwaysDisableDepth, time);
}
return true;
};
Expand Down
14 changes: 13 additions & 1 deletion Source/DataSources/PointGraphics.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ define([
this._heightReferenceSubscription = undefined;
this._distanceDisplayCondition = undefined;
this._distanceDisplayConditionSubscription = undefined;
this._disableDepthDistance = undefined;
this._disableDepthDistanceSubscription = undefined;
this._alwaysDisableDepth = undefined;
this._alwaysDisableDepthSubscription = undefined;
this._definitionChanged = new Event();

this.merge(defaultValue(options, defaultValue.EMPTY_OBJECT));
Expand Down Expand Up @@ -142,7 +146,11 @@ define([
* @memberof PointGraphics.prototype
* @type {Property}
*/
distanceDisplayCondition : createPropertyDescriptor('distanceDisplayCondition')
distanceDisplayCondition : createPropertyDescriptor('distanceDisplayCondition'),

disableDepthDistance : createPropertyDescriptor('disableDepthDistance'),

alwaysDisableDepth : createPropertyDescriptor('alwaysDisableDepth')
});

/**
Expand All @@ -164,6 +172,8 @@ define([
result.translucencyByDistance = this._translucencyByDistance;
result.heightReference = this.heightReference;
result.distanceDisplayCondition = this.distanceDisplayCondition;
result.disableDepthDistance = this.disableDepthDistance;
result.alwaysDisableDepth = this.alwaysDisableDepth;
return result;
};

Expand All @@ -189,6 +199,8 @@ define([
this.translucencyByDistance = defaultValue(this._translucencyByDistance, source.translucencyByDistance);
this.heightReference = defaultValue(this.heightReference, source.heightReference);
this.distanceDisplayCondition = defaultValue(this.distanceDisplayCondition, source.distanceDisplayCondition);
this.disableDepthDistance = defaultValue(this.disableDepthDistance, source.disableDepthDistance);
this.alwaysDisableDepth = defaultValue(this.alwaysDisableDepth, source.alwaysDisableDepth);
};

return PointGraphics;
Expand Down
4 changes: 4 additions & 0 deletions Source/DataSources/PointVisualizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,16 @@ define([
pointPrimitive.outlineWidth = Property.getValueOrDefault(pointGraphics._outlineWidth, time, defaultOutlineWidth);
pointPrimitive.pixelSize = Property.getValueOrDefault(pointGraphics._pixelSize, time, defaultPixelSize);
pointPrimitive.distanceDisplayCondition = Property.getValueOrUndefined(pointGraphics._distanceDisplayCondition, time, distanceDisplayCondition);
pointPrimitive.disableDepthDistance = Property.getValueOrUndefined(pointGraphics._disableDepthDistance, time);
pointPrimitive.alwaysDisableDepth = Property.getValueOrUndefined(pointGraphics._alwaysDisableDepth, time);
} else { // billboard
billboard.show = true;
billboard.position = position;
billboard.scaleByDistance = Property.getValueOrUndefined(pointGraphics._scaleByDistance, time, scaleByDistance);
billboard.translucencyByDistance = Property.getValueOrUndefined(pointGraphics._translucencyByDistance, time, translucencyByDistance);
billboard.distanceDisplayCondition = Property.getValueOrUndefined(pointGraphics._distanceDisplayCondition, time, distanceDisplayCondition);
billboard.disableDepthDistance = Property.getValueOrUndefined(pointGraphics._disableDepthDistance, time);
billboard.alwaysDisableDepth = Property.getValueOrUndefined(pointGraphics._alwaysDisableDepth, time);
billboard.heightReference = heightReference;

var newColor = Property.getValueOrDefault(pointGraphics._color, time, defaultColor, color);
Expand Down
39 changes: 37 additions & 2 deletions Source/Scene/Billboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ define([
this._pixelOffsetScaleByDistance = options.pixelOffsetScaleByDistance;
this._sizeInMeters = defaultValue(options.sizeInMeters, false);
this._distanceDisplayCondition = options.distanceDisplayCondition;
this._disableDepthDistance = options.disableDepthDistance;
this._alwaysDisableDepth = options.alwaysDisableDepth;
this._id = options.id;
this._collection = defaultValue(options.collection, billboardCollection);

Expand Down Expand Up @@ -178,7 +180,9 @@ define([
var TRANSLUCENCY_BY_DISTANCE_INDEX = Billboard.TRANSLUCENCY_BY_DISTANCE_INDEX = 12;
var PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX = Billboard.PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX = 13;
var DISTANCE_DISPLAY_CONDITION = Billboard.DISTANCE_DISPLAY_CONDITION = 14;
Billboard.NUMBER_OF_PROPERTIES = 15;
var DISABLE_DEPTH_DISTANCE = Billboard.DISABLE_DEPTH_DISTANCE = 15;
var ALWAYS_DISABLE_DEPTH = Billboard.ALWAYS_DISABLE_DEPTH = 16;
Billboard.NUMBER_OF_PROPERTIES = 17;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have ideas for avoiding going above 16 attributes?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nevermind, I see that we are good.


function makeDirty(billboard, propertyChanged) {
var billboardCollection = billboard._billboardCollection;
Expand Down Expand Up @@ -748,6 +752,35 @@ define([
}
},

disableDepthDistance : {
get : function() {
return this._disableDepthDistance;
},
set : function(value) {
if (this._disableDepthDistance !== value) {
//>>includeStart('debug', pragmas.debug);
if (defined(value) && value <= 0.0) {
throw new DeveloperError('disableDepthDistance must be greater than 0.0.');
}
//>>includeEnd('debug');
this._disableDepthDistance = value;
makeDirty(this, DISABLE_DEPTH_DISTANCE);
}
}
},

alwaysDisableDepth : {
get : function() {
return this._alwaysDisableDepth;
},
set : function(value) {
if (this._alwaysDisableDepth !== value) {
this._alwaysDisableDepth = value;
makeDirty(this, ALWAYS_DISABLE_DEPTH);
}
}
},

/**
* Gets or sets the user-defined object returned when the billboard is picked.
* @memberof Billboard.prototype
Expand Down Expand Up @@ -1278,7 +1311,9 @@ define([
NearFarScalar.equals(this._scaleByDistance, other._scaleByDistance) &&
NearFarScalar.equals(this._translucencyByDistance, other._translucencyByDistance) &&
NearFarScalar.equals(this._pixelOffsetScaleByDistance, other._pixelOffsetScaleByDistance) &&
DistanceDisplayCondition.equals(this._distanceDisplayCondition, other._distanceDisplayCondition);
DistanceDisplayCondition.equals(this._distanceDisplayCondition, other._distanceDisplayCondition) &&
this._disableDepthDistance === other._disableDepthDistance &&
this._alwaysDisableDepth === other._alwaysDisableDepth;
};

Billboard.prototype._destroy = function() {
Expand Down
Loading