Skip to content

Commit

Permalink
Merge pull request #10494 from CesiumGS/rename-model-experimental-files
Browse files Browse the repository at this point in the history
Rename `ModelExperimental` files that don't conflict with `Model`
  • Loading branch information
ptrgags authored Jul 26, 2022
2 parents 03652e2 + ac43b18 commit 9e84228
Show file tree
Hide file tree
Showing 56 changed files with 548 additions and 649 deletions.
Binary file not shown.
2 changes: 1 addition & 1 deletion Apps/Sandcastle/gallery/Model Experimental 3D Models.html
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@

model.readyPromise.then(function (model) {
viewer.camera.lookAt(
position,
model.boundingSphere.center,
new Cesium.HeadingPitchRange(
Cesium.Math.toRadians(45),
Cesium.Math.toRadians(-15),
Expand Down
29 changes: 7 additions & 22 deletions Source/Scene/Cesium3DTileContentFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import Composite3DTileContent from "./Composite3DTileContent.js";
import Geometry3DTileContent from "./Geometry3DTileContent.js";
import Implicit3DTileContent from "./Implicit3DTileContent.js";
import Instanced3DModel3DTileContent from "./Instanced3DModel3DTileContent.js";
import Model3DTileContent from "./ModelExperimental/Model3DTileContent.js";
import PointCloud3DTileContent from "./PointCloud3DTileContent.js";
import Tileset3DTileContent from "./Tileset3DTileContent.js";
import Vector3DTileContent from "./Vector3DTileContent.js";
import RuntimeError from "../Core/RuntimeError.js";
import ModelExperimental3DTileContent from "./ModelExperimental/ModelExperimental3DTileContent.js";

/**
* Maps a tile's magic field in its header to a new content object for the tile's payload.
Expand All @@ -17,7 +17,7 @@ import ModelExperimental3DTileContent from "./ModelExperimental/ModelExperimenta
const Cesium3DTileContentFactory = {
b3dm: function (tileset, tile, resource, arrayBuffer, byteOffset) {
if (tileset.enableModelExperimental) {
return ModelExperimental3DTileContent.fromB3dm(
return Model3DTileContent.fromB3dm(
tileset,
tile,
resource,
Expand All @@ -35,7 +35,7 @@ const Cesium3DTileContentFactory = {
},
pnts: function (tileset, tile, resource, arrayBuffer, byteOffset) {
if (tileset.enableModelExperimental) {
return ModelExperimental3DTileContent.fromPnts(
return Model3DTileContent.fromPnts(
tileset,
tile,
resource,
Expand All @@ -53,7 +53,7 @@ const Cesium3DTileContentFactory = {
},
i3dm: function (tileset, tile, resource, arrayBuffer, byteOffset) {
if (tileset.enableModelExperimental) {
return ModelExperimental3DTileContent.fromI3dm(
return Model3DTileContent.fromI3dm(
tileset,
tile,
resource,
Expand Down Expand Up @@ -122,28 +122,13 @@ const Cesium3DTileContentFactory = {
const dataView = new DataView(arrayBuffer, byteOffset);
const byteLength = dataView.getUint32(8, true);
const glb = new Uint8Array(arrayBuffer, byteOffset, byteLength);
return ModelExperimental3DTileContent.fromGltf(
tileset,
tile,
resource,
glb
);
return Model3DTileContent.fromGltf(tileset, tile, resource, glb);
},
gltf: function (tileset, tile, resource, json) {
return ModelExperimental3DTileContent.fromGltf(
tileset,
tile,
resource,
json
);
return Model3DTileContent.fromGltf(tileset, tile, resource, json);
},
geoJson: function (tileset, tile, resource, json) {
return ModelExperimental3DTileContent.fromGeoJson(
tileset,
tile,
resource,
json
);
return Model3DTileContent.fromGeoJson(tileset, tile, resource, json);
},
};
export default Cesium3DTileContentFactory;
4 changes: 2 additions & 2 deletions Source/Scene/ModelExperimental/GeometryPipelineStage.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import DeveloperError from "../../Core/DeveloperError.js";
import GeometryStageFS from "../../Shaders/ModelExperimental/GeometryStageFS.js";
import GeometryStageVS from "../../Shaders/ModelExperimental/GeometryStageVS.js";
import ModelExperimentalUtility from "./ModelExperimentalUtility.js";
import ModelExperimentalType from "./ModelExperimentalType.js";
import ModelType from "./ModelType.js";
import PrimitiveType from "../../Core/PrimitiveType.js";
import SceneMode from "../SceneMode.js";
import SelectedFeatureIdPipelineStage from "./SelectedFeatureIdPipelineStage.js";
Expand Down Expand Up @@ -127,7 +127,7 @@ GeometryPipelineStage.process = function (
// .pnts point clouds store sRGB color rather than linear color
const model = renderResources.model;
const modelType = model.type;
if (modelType === ModelExperimentalType.TILE_PNTS) {
if (modelType === ModelType.TILE_PNTS) {
shaderBuilder.addDefine(
"HAS_SRGB_COLOR",
undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,11 @@ import Pass from "../../Renderer/Pass.js";
* <p>
* Implements the {@link Cesium3DTileContent} interface.
* </p>
* @alias ModelExperimental3DTileContent
* @alias Model3DTileContent
* @constructor
* @private
*/
export default function ModelExperimental3DTileContent(
tileset,
tile,
resource
) {
export default function Model3DTileContent(tileset, tile, resource) {
this._tileset = tileset;
this._tile = tile;
this._resource = resource;
Expand All @@ -31,7 +27,7 @@ export default function ModelExperimental3DTileContent(
this._group = undefined;
}

Object.defineProperties(ModelExperimental3DTileContent.prototype, {
Object.defineProperties(Model3DTileContent.prototype, {
featuresLength: {
get: function () {
const model = this._model;
Expand Down Expand Up @@ -142,7 +138,7 @@ Object.defineProperties(ModelExperimental3DTileContent.prototype, {
},
});

ModelExperimental3DTileContent.prototype.getFeature = function (featureId) {
Model3DTileContent.prototype.getFeature = function (featureId) {
const model = this._model;
const featureTableId = model.featureTableId;
if (!defined(featureTableId)) {
Expand All @@ -153,10 +149,7 @@ ModelExperimental3DTileContent.prototype.getFeature = function (featureId) {
return featureTable.getFeature(featureId);
};

ModelExperimental3DTileContent.prototype.hasProperty = function (
featureId,
name
) {
Model3DTileContent.prototype.hasProperty = function (featureId, name) {
const model = this._model;
const featureTableId = model.featureTableId;
if (!defined(featureTableId)) {
Expand All @@ -167,10 +160,7 @@ ModelExperimental3DTileContent.prototype.hasProperty = function (
return featureTable.hasProperty(featureId, name);
};

ModelExperimental3DTileContent.prototype.applyDebugSettings = function (
enabled,
color
) {
Model3DTileContent.prototype.applyDebugSettings = function (enabled, color) {
color = enabled ? color : Color.WHITE;
if (this.featuresLength === 0) {
this._model.color = color;
Expand All @@ -179,15 +169,12 @@ ModelExperimental3DTileContent.prototype.applyDebugSettings = function (
}
};

ModelExperimental3DTileContent.prototype.applyStyle = function (style) {
Model3DTileContent.prototype.applyStyle = function (style) {
// the setter will call model.applyStyle()
this._model.style = style;
};

ModelExperimental3DTileContent.prototype.update = function (
tileset,
frameState
) {
Model3DTileContent.prototype.update = function (tileset, frameState) {
const model = this._model;
const tile = this._tile;

Expand Down Expand Up @@ -232,22 +219,17 @@ ModelExperimental3DTileContent.prototype.update = function (
model.update(frameState);
};

ModelExperimental3DTileContent.prototype.isDestroyed = function () {
Model3DTileContent.prototype.isDestroyed = function () {
return false;
};

ModelExperimental3DTileContent.prototype.destroy = function () {
Model3DTileContent.prototype.destroy = function () {
this._model = this._model && this._model.destroy();
return destroyObject(this);
};

ModelExperimental3DTileContent.fromGltf = function (
tileset,
tile,
resource,
gltf
) {
const content = new ModelExperimental3DTileContent(tileset, tile, resource);
Model3DTileContent.fromGltf = function (tileset, tile, resource, gltf) {
const content = new Model3DTileContent(tileset, tile, resource);

const additionalOptions = {
gltf: gltf,
Expand All @@ -272,14 +254,14 @@ ModelExperimental3DTileContent.fromGltf = function (
return content;
};

ModelExperimental3DTileContent.fromB3dm = function (
Model3DTileContent.fromB3dm = function (
tileset,
tile,
resource,
arrayBuffer,
byteOffset
) {
const content = new ModelExperimental3DTileContent(tileset, tile, resource);
const content = new Model3DTileContent(tileset, tile, resource);

const additionalOptions = {
arrayBuffer: arrayBuffer,
Expand All @@ -305,14 +287,14 @@ ModelExperimental3DTileContent.fromB3dm = function (
return content;
};

ModelExperimental3DTileContent.fromI3dm = function (
Model3DTileContent.fromI3dm = function (
tileset,
tile,
resource,
arrayBuffer,
byteOffset
) {
const content = new ModelExperimental3DTileContent(tileset, tile, resource);
const content = new Model3DTileContent(tileset, tile, resource);

const additionalOptions = {
arrayBuffer: arrayBuffer,
Expand All @@ -338,14 +320,14 @@ ModelExperimental3DTileContent.fromI3dm = function (
return content;
};

ModelExperimental3DTileContent.fromPnts = function (
Model3DTileContent.fromPnts = function (
tileset,
tile,
resource,
arrayBuffer,
byteOffset
) {
const content = new ModelExperimental3DTileContent(tileset, tile, resource);
const content = new Model3DTileContent(tileset, tile, resource);

const additionalOptions = {
arrayBuffer: arrayBuffer,
Expand All @@ -363,13 +345,8 @@ ModelExperimental3DTileContent.fromPnts = function (
return content;
};

ModelExperimental3DTileContent.fromGeoJson = function (
tileset,
tile,
resource,
geoJson
) {
const content = new ModelExperimental3DTileContent(tileset, tile, resource);
Model3DTileContent.fromGeoJson = function (tileset, tile, resource, geoJson) {
const content = new Model3DTileContent(tileset, tile, resource);

const additionalOptions = {
geoJson: geoJson,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ const AnimatedPropertyType = ModelComponents.AnimatedPropertyType;
* @param {Object} options An object containing the following options:
* @param {ModelComponents.AnimationChannel} options.channel The corresponding animation channel components from the 3D model.
* @param {ModelExperimentalAnimation} options.runtimeAnimation The runtime animation containing this channel.
* @param {ModelExperimentalRuntimeNode} options.runtimeNode The runtime node that this channel will animate.
* @param {ModelRuntimeNode} options.runtimeNode The runtime node that this channel will animate.
*
* @alias ModelExperimentalAnimationChannel
* @alias ModelAnimationChannel
* @constructor
*
* @private
*/
function ModelExperimentalAnimationChannel(options) {
function ModelAnimationChannel(options) {
options = defaultValue(options, defaultValue.EMPTY_OBJECT);

const channel = options.channel;
Expand All @@ -52,11 +52,11 @@ function ModelExperimentalAnimationChannel(options) {
initialize(this);
}

Object.defineProperties(ModelExperimentalAnimationChannel.prototype, {
Object.defineProperties(ModelAnimationChannel.prototype, {
/**
* The glTF animation channel.
*
* @memberof ModelExperimentalAnimationChannel.prototype
* @memberof ModelAnimationChannel.prototype
*
* @type {ModelComponents.AnimationChannel}
* @readonly
Expand All @@ -72,7 +72,7 @@ Object.defineProperties(ModelExperimentalAnimationChannel.prototype, {
/**
* The runtime animation that owns this channel.
*
* @memberof ModelExperimentalAnimationChannel.prototype
* @memberof ModelAnimationChannel.prototype
*
* @type {ModelExperimentalAnimation}
* @readonly
Expand All @@ -88,9 +88,9 @@ Object.defineProperties(ModelExperimentalAnimationChannel.prototype, {
/**
* The runtime node that this channel animates.
*
* @memberof ModelExperimentalAnimationChannel.prototype
* @memberof ModelAnimationChannel.prototype
*
* @type {ModelExperimentalRuntimeNode}
* @type {ModelRuntimeNode}
* @readonly
*
* @private
Expand All @@ -104,7 +104,7 @@ Object.defineProperties(ModelExperimentalAnimationChannel.prototype, {
/**
* The splines used to evaluate this animation channel.
*
* @memberof ModelExperimentalAnimationChannel.prototype
* @memberof ModelAnimationChannel.prototype
*
* @type {Spline[]}
* @readonly
Expand Down Expand Up @@ -258,7 +258,7 @@ function initialize(runtimeChannel) {
*
* @private
*/
ModelExperimentalAnimationChannel.prototype.animate = function (time) {
ModelAnimationChannel.prototype.animate = function (time) {
const splines = this._splines;
const path = this._path;
const model = this._runtimeAnimation.model;
Expand Down Expand Up @@ -290,4 +290,4 @@ ModelExperimentalAnimationChannel.prototype.animate = function (time) {
}
};

export default ModelExperimentalAnimationChannel;
export default ModelAnimationChannel;
Loading

0 comments on commit 9e84228

Please sign in to comment.