Skip to content

Commit

Permalink
Organization
Browse files Browse the repository at this point in the history
  • Loading branch information
lilleyse committed Sep 20, 2016
1 parent 46d00e3 commit 8e98836
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 13 deletions.
7 changes: 7 additions & 0 deletions Source/Scene/Batched3DModel3DTileContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,13 @@ define([
this.batchTable.setAllColor(color);
};

/**
* Part of the {@link Cesium3DTileContent} interface.
*/
Batched3DModel3DTileContent.prototype.applyStyleWithShader = function(frameState, style) {
return false;
};

/**
* Part of the {@link Cesium3DTileContent} interface.
*/
Expand Down
19 changes: 19 additions & 0 deletions Source/Scene/Cesium3DTileContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,25 @@ define([
DeveloperError.throwInstantiationError();
};

/**
* Apply a style to the content using a shader instead of a batch table. Currently this is only
* applicable for {@link PointCloud3DTileContent}.
* <p>
* This is used to implement the <code>Cesium3DTileContent</code> interface, but is
* not part of the public Cesium API.
* </p>
*
* @param {FrameSate} frameState The frame state.
* @param {Cesium3DTileStyle} style The style.
*
* @returns {Boolean} <code>true</code> if this content is styled with a shader; otherwise, <code>false</code>.
*
* @private
*/
Cesium3DTileContent.prototype.applyStyleWithShader = function(frameState, style) {
DeveloperError.throwInstantiationError();
};

/**
* Called by the tile during tileset traversal to get the draw commands needed to render this content.
* When the tile's content is in the PROCESSING state, this creates WebGL resources to ultimately
Expand Down
2 changes: 2 additions & 0 deletions Source/Scene/Cesium3DTileStyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ define([
show = new Expression(String(showExpression));
} else if (typeof(showExpression) === 'string') {
show = new Expression(showExpression);
} else if (defined(showExpression.conditions)) {
show = new ConditionsExpression(showExpression);
}

that._show = show;
Expand Down
5 changes: 2 additions & 3 deletions Source/Scene/Cesium3DTileStyleEngine.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,8 @@ define([

stats.numberOfFeaturesStyled += length;

// Apply style to point cloud. Only apply style if the point cloud is not backed by a batch table.
if ((content instanceof PointCloud3DTileContent) && (length === 0)) {
content.applyStyle(frameState, style);
if (content.applyStyleWithShader(frameState, style)) {
return;
}

if (!defined(style)) {
Expand Down
7 changes: 5 additions & 2 deletions Source/Scene/ConditionsExpression.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,18 @@ define([
var exp = expression._expression;
for (var cond in conditions) {
if (conditions.hasOwnProperty(cond)) {
var colorExpression = conditions[cond];
cond = String(cond);
var condExpression = String(conditions[cond]);
if (defined(exp)) {
cond = cond.replace(expressionPlaceholder, exp);
condExpression = condExpression.replace(expressionPlaceholder, exp);
} else {
cond = cond.replace(expressionPlaceholder, 'undefined');
condExpression = condExpression.replace(expressionPlaceholder, 'undefined');
}
runtimeConditions.push(new Statement(
new Expression(cond),
new Expression(colorExpression)
new Expression(condExpression)
));
}
}
Expand Down
7 changes: 7 additions & 0 deletions Source/Scene/Empty3DTileContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,13 @@ define([
Empty3DTileContent.prototype.applyDebugSettings = function(enabled, color) {
};

/**
* Part of the {@link Cesium3DTileContent} interface.
*/
Empty3DTileContent.prototype.applyStyleWithShader = function(frameState, style) {
return false;
};

/**
* Part of the {@link Cesium3DTileContent} interface.
*/
Expand Down
7 changes: 7 additions & 0 deletions Source/Scene/Instanced3DModel3DTileContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,13 @@ define([
this.batchTable.setAllColor(color);
};

/**
* Part of the {@link Cesium3DTileContent} interface.
*/
Instanced3DModel3DTileContent.prototype.applyStyleWithShader = function(frameState, style) {
return false;
};

/**
* Part of the {@link Cesium3DTileContent} interface.
*/
Expand Down
15 changes: 7 additions & 8 deletions Source/Scene/PointCloud3DTileContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -1026,15 +1026,14 @@ define([
};

/**
* Apply a style to the point cloud.
*
* @param {FrameSate} frameState The frame state.
* @param {Cesium3DTileStyle} style The style.
*
* @private
* Part of the {@link Cesium3DTileContent} interface.
*/
PointCloud3DTileContent.prototype.applyStyle = function(frameState, style) {
createShaders(this, frameState, style);
PointCloud3DTileContent.prototype.applyStyleWithShader = function(frameState, style) {
if (!defined(this.batchTable)) {
createShaders(this, frameState, style);
return true;
}
return false;
};

/**
Expand Down
7 changes: 7 additions & 0 deletions Source/Scene/Tileset3DTileContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,13 @@ define([
Tileset3DTileContent.prototype.applyDebugSettings = function(enabled, color) {
};

/**
* Part of the {@link Cesium3DTileContent} interface.
*/
Tileset3DTileContent.prototype.applyStyleWithShader = function(frameState, style) {
return false;
};

/**
* Part of the {@link Cesium3DTileContent} interface.
*/
Expand Down

0 comments on commit 8e98836

Please sign in to comment.