Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #527 from gbeatty/ViewportQuad

Added show property to ViewportQuad
  • Loading branch information...
commit 884fadc418c1487b48e12e23146cb079641be8c1 2 parents 4a64a99 + edec440
Patrick Cozzi pjcozzi authored
Showing with 23 additions and 0 deletions.
  1. +14 −0 Source/Scene/ViewportQuad.js
  2. +9 −0 Specs/Scene/ViewportQuadSpec.js
14 Source/Scene/ViewportQuad.js
View
@@ -56,6 +56,15 @@ define([
this._commandLists = new CommandLists();
this._commandLists.overlayList.push(this._overlayCommand);
+ /**
+ * Determines if the viewport quad primitive will be shown.
+ * <p>
+ * The default is <code>true</code>.
+ * </p>
+ *
+ * @type Boolean
+ */
+ this.show = true;
/**
* The BoundingRectangle defining the quad's position within the viewport.
@@ -170,6 +179,11 @@ define([
* @exception {DeveloperError} this.rectangle must be defined.
*/
ViewportQuad.prototype.update = function(context, frameState, commandList) {
+ if (!this.show)
+ {
+ return;
+ }
+
if (typeof this.material === 'undefined') {
throw new DeveloperError('this.material must be defined.');
}
9 Specs/Scene/ViewportQuadSpec.js
View
@@ -78,6 +78,15 @@ defineSuite([
}).toThrow();
});
+ it('does not render when show is false', function() {
+ context.clear();
+ expect(context.readPixels()).toEqual([0, 0, 0, 0]);
+
+ viewportQuad.show = false;
+ render(context, frameState, viewportQuad);
+ expect(context.readPixels()).toEqual([0, 0, 0, 0]);
+ });
+
it('renders material', function() {
context.clear();
expect(context.readPixels()).toEqual([0, 0, 0, 0]);
Please sign in to comment.
Something went wrong with that request. Please try again.