2021-08-03 02:41:42 +08:00
|
|
|
import Check from "../../Core/Check.js";
|
2025-03-12 05:50:04 +08:00
|
|
|
import Frozen from "../../Core/Frozen.js";
|
2021-08-31 04:20:44 +08:00
|
|
|
import defined from "../../Core/defined.js";
|
2022-01-11 03:35:21 +08:00
|
|
|
import PrimitiveType from "../../Core/PrimitiveType.js";
|
2022-08-03 03:30:01 +08:00
|
|
|
import SceneMode from "../SceneMode.js";
|
2022-01-11 05:04:27 +08:00
|
|
|
import AlphaPipelineStage from "./AlphaPipelineStage.js";
|
|
|
|
|
import BatchTexturePipelineStage from "./BatchTexturePipelineStage.js";
|
2022-08-22 23:07:36 +08:00
|
|
|
import ClassificationPipelineStage from "./ClassificationPipelineStage.js";
|
|
|
|
|
import CPUStylingPipelineStage from "./CPUStylingPipelineStage.js";
|
2022-01-11 05:04:27 +08:00
|
|
|
import CustomShaderMode from "./CustomShaderMode.js";
|
|
|
|
|
import CustomShaderPipelineStage from "./CustomShaderPipelineStage.js";
|
2021-09-09 02:12:40 +08:00
|
|
|
import DequantizationPipelineStage from "./DequantizationPipelineStage.js";
|
2025-08-07 13:26:52 +08:00
|
|
|
import EdgeDetectionPipelineStage from "./EdgeDetectionPipelineStage.js";
|
|
|
|
|
import EdgeVisibilityPipelineStage from "./EdgeVisibilityPipelineStage.js";
|
2022-08-22 23:07:36 +08:00
|
|
|
import FeatureIdPipelineStage from "./FeatureIdPipelineStage.js";
|
2021-07-28 03:39:44 +08:00
|
|
|
import GeometryPipelineStage from "./GeometryPipelineStage.js";
|
2025-03-20 03:33:58 +08:00
|
|
|
import ImageryPipelineStage from "./ImageryPipelineStage.js";
|
2021-07-30 05:10:48 +08:00
|
|
|
import LightingPipelineStage from "./LightingPipelineStage.js";
|
|
|
|
|
import MaterialPipelineStage from "./MaterialPipelineStage.js";
|
2024-07-26 04:41:31 +08:00
|
|
|
import MetadataPickingPipelineStage from "./MetadataPickingPipelineStage.js";
|
2022-03-18 00:33:05 +08:00
|
|
|
import MetadataPipelineStage from "./MetadataPipelineStage.js";
|
2022-08-05 04:22:27 +08:00
|
|
|
import ModelUtility from "./ModelUtility.js";
|
2022-04-06 02:23:54 +08:00
|
|
|
import MorphTargetsPipelineStage from "./MorphTargetsPipelineStage.js";
|
2021-08-25 01:44:28 +08:00
|
|
|
import PickingPipelineStage from "./PickingPipelineStage.js";
|
2022-07-15 22:29:27 +08:00
|
|
|
import PointCloudStylingPipelineStage from "./PointCloudStylingPipelineStage.js";
|
2022-06-29 03:02:01 +08:00
|
|
|
import PrimitiveOutlinePipelineStage from "./PrimitiveOutlinePipelineStage.js";
|
2022-06-09 01:11:10 +08:00
|
|
|
import PrimitiveStatisticsPipelineStage from "./PrimitiveStatisticsPipelineStage.js";
|
2022-05-21 03:18:16 +08:00
|
|
|
import SceneMode2DPipelineStage from "./SceneMode2DPipelineStage.js";
|
2022-01-20 00:44:49 +08:00
|
|
|
import SelectedFeatureIdPipelineStage from "./SelectedFeatureIdPipelineStage.js";
|
2022-04-08 23:04:57 +08:00
|
|
|
import SkinningPipelineStage from "./SkinningPipelineStage.js";
|
2023-09-15 03:36:56 +08:00
|
|
|
import VerticalExaggerationPipelineStage from "./VerticalExaggerationPipelineStage.js";
|
2022-05-18 23:58:53 +08:00
|
|
|
import WireframePipelineStage from "./WireframePipelineStage.js";
|
2025-05-21 01:55:03 +08:00
|
|
|
import oneTimeWarning from "../../Core/oneTimeWarning.js";
|
2021-07-26 21:09:02 +08:00
|
|
|
|
2021-08-03 02:41:42 +08:00
|
|
|
/**
|
2021-08-20 07:40:34 +08:00
|
|
|
* In memory representation of a single primitive, that is, a primitive
|
2021-08-03 02:41:42 +08:00
|
|
|
* and its corresponding mesh.
|
|
|
|
|
*
|
2023-02-10 16:35:41 +08:00
|
|
|
* @param {object} options An object containing the following options:
|
2021-08-19 05:15:22 +08:00
|
|
|
* @param {ModelComponents.Primitive} options.primitive The primitive component.
|
2022-04-21 04:04:11 +08:00
|
|
|
* @param {ModelComponents.Node} options.node The node that this primitive belongs to.
|
2022-08-05 00:57:20 +08:00
|
|
|
* @param {Model} options.model The {@link Model} this primitive belongs to.
|
2021-08-19 05:15:22 +08:00
|
|
|
*
|
2022-07-21 23:35:48 +08:00
|
|
|
* @alias ModelRuntimePrimitive
|
2021-08-19 05:15:22 +08:00
|
|
|
* @constructor
|
2021-08-03 02:41:42 +08:00
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
*/
|
2022-08-11 06:22:27 +08:00
|
|
|
function ModelRuntimePrimitive(options) {
|
2025-03-12 05:50:04 +08:00
|
|
|
options = options ?? Frozen.EMPTY_OBJECT;
|
2022-04-21 04:04:11 +08:00
|
|
|
|
|
|
|
|
const primitive = options.primitive;
|
|
|
|
|
const node = options.node;
|
|
|
|
|
const model = options.model;
|
2021-08-03 02:41:42 +08:00
|
|
|
//>>includeStart('debug', pragmas.debug);
|
2022-04-21 04:04:11 +08:00
|
|
|
Check.typeOf.object("options.primitive", primitive);
|
|
|
|
|
Check.typeOf.object("options.node", node);
|
|
|
|
|
Check.typeOf.object("options.model", model);
|
2021-08-03 02:41:42 +08:00
|
|
|
//>>includeEnd('debug');
|
|
|
|
|
|
2021-07-26 21:09:02 +08:00
|
|
|
/**
|
2021-08-20 07:40:34 +08:00
|
|
|
* The primitive component associated with this primitive.
|
2021-08-03 02:41:42 +08:00
|
|
|
*
|
2021-07-26 21:09:02 +08:00
|
|
|
* @type {ModelComponents.Primitive}
|
2021-08-03 02:41:42 +08:00
|
|
|
*
|
|
|
|
|
* @private
|
2021-07-26 21:09:02 +08:00
|
|
|
*/
|
2022-04-21 04:04:11 +08:00
|
|
|
this.primitive = primitive;
|
2021-07-26 21:09:02 +08:00
|
|
|
|
2021-09-13 23:44:35 +08:00
|
|
|
/**
|
|
|
|
|
* A reference to the node this primitive belongs to.
|
|
|
|
|
*
|
|
|
|
|
* @type {ModelComponents.Node}
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
*/
|
2022-04-21 04:04:11 +08:00
|
|
|
this.node = node;
|
2021-09-13 23:44:35 +08:00
|
|
|
|
2021-08-25 03:38:27 +08:00
|
|
|
/**
|
2021-08-06 04:34:24 +08:00
|
|
|
* A reference to the model
|
2021-08-25 03:38:27 +08:00
|
|
|
*
|
2022-08-05 00:57:20 +08:00
|
|
|
* @type {Model}
|
2021-08-25 03:38:27 +08:00
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
*/
|
2022-04-21 04:04:11 +08:00
|
|
|
this.model = model;
|
2021-08-25 03:38:27 +08:00
|
|
|
|
2021-08-03 02:41:42 +08:00
|
|
|
/**
|
2021-08-20 07:40:34 +08:00
|
|
|
* Pipeline stages to apply to this primitive. This
|
2021-08-03 02:41:42 +08:00
|
|
|
* is an array of classes, each with a static method called
|
|
|
|
|
* <code>process()</code>
|
|
|
|
|
*
|
2025-10-11 00:32:14 +08:00
|
|
|
* @type {object[]}
|
2021-08-03 02:41:42 +08:00
|
|
|
* @readonly
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
*/
|
|
|
|
|
this.pipelineStages = [];
|
2021-07-26 21:09:02 +08:00
|
|
|
|
2022-01-05 04:56:55 +08:00
|
|
|
/**
|
2022-08-20 03:02:13 +08:00
|
|
|
* The generated {@link ModelDrawCommand} or {@link ClassificationModelDrawCommand}
|
|
|
|
|
* associated with this primitive.
|
2022-01-05 04:56:55 +08:00
|
|
|
*
|
2022-08-03 04:53:37 +08:00
|
|
|
* @type {ModelDrawCommand|ClassificationModelDrawCommand}
|
2022-01-05 04:56:55 +08:00
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
*/
|
2022-05-31 21:35:01 +08:00
|
|
|
this.drawCommand = undefined;
|
2022-01-05 04:56:55 +08:00
|
|
|
|
2022-01-06 01:01:16 +08:00
|
|
|
/**
|
2022-05-20 22:29:02 +08:00
|
|
|
* The bounding sphere of this primitive in object-space.
|
2022-01-06 01:01:16 +08:00
|
|
|
*
|
|
|
|
|
* @type {BoundingSphere}
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
*/
|
|
|
|
|
this.boundingSphere = undefined;
|
|
|
|
|
|
2022-05-20 22:29:02 +08:00
|
|
|
/**
|
|
|
|
|
* The bounding sphere of this primitive in 2D world space.
|
|
|
|
|
*
|
|
|
|
|
* @type {BoundingSphere}
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
*/
|
|
|
|
|
this.boundingSphere2D = undefined;
|
|
|
|
|
|
2022-05-21 03:18:16 +08:00
|
|
|
/**
|
2022-08-20 03:02:13 +08:00
|
|
|
* A buffer containing the primitive's positions projected to 2D world
|
2022-08-22 23:07:36 +08:00
|
|
|
* coordinates. This is generated by SceneMode2DPipelineStage and used for
|
|
|
|
|
* rendering in 2D / CV mode. The memory is managed by Model; this is just
|
|
|
|
|
* a reference.
|
2022-05-21 03:18:16 +08:00
|
|
|
*
|
|
|
|
|
* @type {Buffer}
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
*/
|
|
|
|
|
this.positionBuffer2D = undefined;
|
|
|
|
|
|
2022-08-22 23:07:36 +08:00
|
|
|
/**
|
|
|
|
|
* An array containing the lengths of the vertex batches for classification.
|
|
|
|
|
* Vertices with the same feature ID are batched together, and each batch is
|
|
|
|
|
* drawn with a different draw command in order to properly classify other
|
|
|
|
|
* assets.
|
|
|
|
|
* <p>
|
|
|
|
|
* This is generated by ClassificationPipelineStage. The memory is managed by
|
|
|
|
|
* Model; this is just a reference.
|
|
|
|
|
* </p>
|
2022-08-20 03:02:13 +08:00
|
|
|
*
|
2023-02-10 16:35:41 +08:00
|
|
|
* @type {number[]}
|
2022-08-20 03:02:13 +08:00
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
*/
|
|
|
|
|
this.batchLengths = undefined;
|
|
|
|
|
|
2022-08-22 23:07:36 +08:00
|
|
|
/**
|
|
|
|
|
* An array containing the offsets of the vertex batches for classification.
|
|
|
|
|
* Vertices with the same feature ID are batched together, and each batch is
|
|
|
|
|
* drawn with a different draw command in order to properly classify other
|
|
|
|
|
* assets.
|
|
|
|
|
* <p>
|
|
|
|
|
* This is generated by ClassificationPipelineStage. The memory is managed by
|
|
|
|
|
* Model; this is just a reference.
|
|
|
|
|
* </p>
|
2022-08-20 03:02:13 +08:00
|
|
|
*
|
2023-02-10 16:35:41 +08:00
|
|
|
* @type {number[]}
|
2022-08-20 03:02:13 +08:00
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
*/
|
|
|
|
|
this.batchOffsets = undefined;
|
|
|
|
|
|
2022-01-06 01:01:16 +08:00
|
|
|
/**
|
|
|
|
|
* Update stages to apply to this primitive.
|
2022-04-26 23:20:19 +08:00
|
|
|
*
|
2025-10-11 00:32:14 +08:00
|
|
|
* @type {object[]}
|
2022-08-20 03:02:13 +08:00
|
|
|
* @readonly
|
|
|
|
|
*
|
2022-04-26 23:20:19 +08:00
|
|
|
* @private
|
2022-01-06 01:01:16 +08:00
|
|
|
*/
|
|
|
|
|
this.updateStages = [];
|
2021-07-26 21:09:02 +08:00
|
|
|
}
|
|
|
|
|
|
2022-01-11 05:04:27 +08:00
|
|
|
/**
|
2022-05-21 03:18:16 +08:00
|
|
|
* Configure the primitive pipeline stages. If the pipeline needs to be re-run,
|
|
|
|
|
* call this method again to ensure the correct sequence of pipeline stages are
|
2022-01-11 05:04:27 +08:00
|
|
|
* used.
|
|
|
|
|
*
|
2022-05-18 23:58:53 +08:00
|
|
|
* @param {FrameState} frameState The frame state.
|
|
|
|
|
*
|
2022-01-11 05:04:27 +08:00
|
|
|
* @private
|
|
|
|
|
*/
|
2022-07-21 23:35:48 +08:00
|
|
|
ModelRuntimePrimitive.prototype.configurePipeline = function (frameState) {
|
2022-01-11 05:04:27 +08:00
|
|
|
const pipelineStages = this.pipelineStages;
|
|
|
|
|
pipelineStages.length = 0;
|
2021-08-06 04:34:24 +08:00
|
|
|
|
2022-01-11 05:04:27 +08:00
|
|
|
const primitive = this.primitive;
|
|
|
|
|
const node = this.node;
|
|
|
|
|
const model = this.model;
|
2022-08-02 02:49:39 +08:00
|
|
|
|
2021-08-26 01:40:19 +08:00
|
|
|
const customShader = model.customShader;
|
2022-07-15 22:29:27 +08:00
|
|
|
const style = model.style;
|
|
|
|
|
|
2022-05-21 03:18:16 +08:00
|
|
|
const useWebgl2 = frameState.context.webgl2;
|
|
|
|
|
const mode = frameState.mode;
|
2022-05-25 03:43:41 +08:00
|
|
|
const use2D =
|
|
|
|
|
mode !== SceneMode.SCENE3D && !frameState.scene3DOnly && model._projectTo2D;
|
2024-09-03 22:23:18 +08:00
|
|
|
const hasVerticalExaggeration =
|
|
|
|
|
frameState.verticalExaggeration !== 1.0 && model.hasVerticalExaggeration;
|
2022-07-15 22:29:27 +08:00
|
|
|
|
2022-04-06 02:23:54 +08:00
|
|
|
const hasMorphTargets =
|
|
|
|
|
defined(primitive.morphTargets) && primitive.morphTargets.length > 0;
|
2022-04-08 23:04:57 +08:00
|
|
|
const hasSkinning = defined(node.skin);
|
2025-03-20 03:33:58 +08:00
|
|
|
|
|
|
|
|
// Check whether the model is part of a `Model3DTileContent` that
|
|
|
|
|
// belongs to a tileset that has imagery layers. If this is the
|
|
|
|
|
// case, then the `ImageryPipelineStage` will be required.
|
|
|
|
|
const hasImageryLayers = defined(model.imageryLayers);
|
|
|
|
|
|
2021-08-06 04:34:24 +08:00
|
|
|
const hasCustomShader = defined(customShader);
|
2021-08-20 04:08:10 +08:00
|
|
|
const hasCustomFragmentShader =
|
|
|
|
|
hasCustomShader && defined(customShader.fragmentShaderText);
|
2021-08-06 04:34:24 +08:00
|
|
|
const materialsEnabled =
|
2021-08-20 04:08:10 +08:00
|
|
|
!hasCustomFragmentShader ||
|
|
|
|
|
customShader.mode !== CustomShaderMode.REPLACE_MATERIAL;
|
2022-08-05 04:22:27 +08:00
|
|
|
const hasQuantization = ModelUtility.hasQuantizedAttributes(
|
2024-10-22 23:57:31 +08:00
|
|
|
primitive.attributes,
|
2021-09-09 02:12:40 +08:00
|
|
|
);
|
2024-11-05 01:43:28 +08:00
|
|
|
|
2022-05-18 23:58:53 +08:00
|
|
|
const generateWireframeIndices =
|
|
|
|
|
model.debugWireframe &&
|
|
|
|
|
PrimitiveType.isTriangles(primitive.primitiveType) &&
|
|
|
|
|
// Generating index buffers for wireframes is always possible in WebGL2.
|
|
|
|
|
// However, this will only work in WebGL1 if the model was constructed with
|
|
|
|
|
// enableDebugWireframe set to true.
|
|
|
|
|
(model._enableDebugWireframe || useWebgl2);
|
2022-01-11 05:21:57 +08:00
|
|
|
|
2022-01-13 03:26:07 +08:00
|
|
|
const pointCloudShading = model.pointCloudShading;
|
2022-01-11 05:21:57 +08:00
|
|
|
const hasAttenuation =
|
|
|
|
|
defined(pointCloudShading) && pointCloudShading.attenuation;
|
2022-08-19 02:54:53 +08:00
|
|
|
const hasPointCloudBackFaceCulling =
|
|
|
|
|
defined(pointCloudShading) && pointCloudShading.backFaceCulling;
|
2022-07-15 22:29:27 +08:00
|
|
|
const hasPointCloudStyle =
|
|
|
|
|
primitive.primitiveType === PrimitiveType.POINTS &&
|
2022-08-19 02:54:53 +08:00
|
|
|
(defined(style) || hasAttenuation || hasPointCloudBackFaceCulling);
|
2022-07-15 22:29:27 +08:00
|
|
|
|
2022-07-02 02:51:37 +08:00
|
|
|
const hasOutlines =
|
|
|
|
|
model._enableShowOutline && defined(primitive.outlineCoordinates);
|
2021-09-09 02:12:40 +08:00
|
|
|
|
2025-08-07 13:26:52 +08:00
|
|
|
const hasEdgeVisibility = defined(primitive.edgeVisibility);
|
|
|
|
|
|
2022-01-27 05:07:43 +08:00
|
|
|
const featureIdFlags = inspectFeatureIds(model, node, primitive);
|
2022-01-15 05:54:30 +08:00
|
|
|
|
2022-08-03 03:30:01 +08:00
|
|
|
const hasClassification = defined(model.classificationType);
|
|
|
|
|
|
2022-01-15 05:54:30 +08:00
|
|
|
// Start of pipeline -----------------------------------------------------
|
2022-05-24 03:08:44 +08:00
|
|
|
if (use2D) {
|
2022-05-21 03:18:16 +08:00
|
|
|
pipelineStages.push(SceneMode2DPipelineStage);
|
|
|
|
|
}
|
2022-01-15 05:54:30 +08:00
|
|
|
|
2021-09-09 02:12:40 +08:00
|
|
|
pipelineStages.push(GeometryPipelineStage);
|
|
|
|
|
|
2022-05-18 23:58:53 +08:00
|
|
|
if (generateWireframeIndices) {
|
|
|
|
|
pipelineStages.push(WireframePipelineStage);
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-22 23:07:36 +08:00
|
|
|
if (hasClassification) {
|
|
|
|
|
pipelineStages.push(ClassificationPipelineStage);
|
|
|
|
|
}
|
2022-05-18 23:58:53 +08:00
|
|
|
|
2022-08-19 23:22:52 +08:00
|
|
|
if (hasMorphTargets) {
|
2022-04-06 02:23:54 +08:00
|
|
|
pipelineStages.push(MorphTargetsPipelineStage);
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-19 23:22:52 +08:00
|
|
|
if (hasSkinning) {
|
2022-04-08 23:04:57 +08:00
|
|
|
pipelineStages.push(SkinningPipelineStage);
|
|
|
|
|
}
|
|
|
|
|
|
2022-07-15 22:29:27 +08:00
|
|
|
if (hasPointCloudStyle) {
|
|
|
|
|
pipelineStages.push(PointCloudStylingPipelineStage);
|
2021-12-18 03:00:35 +08:00
|
|
|
}
|
|
|
|
|
|
2021-09-09 02:12:40 +08:00
|
|
|
if (hasQuantization) {
|
|
|
|
|
pipelineStages.push(DequantizationPipelineStage);
|
|
|
|
|
}
|
2021-08-06 04:34:24 +08:00
|
|
|
|
2025-03-20 03:33:58 +08:00
|
|
|
if (hasImageryLayers) {
|
2025-05-21 01:55:03 +08:00
|
|
|
if (hasOutlines) {
|
|
|
|
|
oneTimeWarning(
|
|
|
|
|
"outlines-and-draping",
|
|
|
|
|
"Primitive outlines disable imagery draping",
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
pipelineStages.push(ImageryPipelineStage);
|
|
|
|
|
}
|
2025-03-20 03:33:58 +08:00
|
|
|
}
|
|
|
|
|
|
2021-08-06 04:34:24 +08:00
|
|
|
if (materialsEnabled) {
|
|
|
|
|
pipelineStages.push(MaterialPipelineStage);
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-18 00:33:05 +08:00
|
|
|
// These stages are always run to ensure structs
|
|
|
|
|
// are declared to avoid compilation errors.
|
2022-01-20 00:44:49 +08:00
|
|
|
pipelineStages.push(FeatureIdPipelineStage);
|
2022-03-18 00:33:05 +08:00
|
|
|
pipelineStages.push(MetadataPipelineStage);
|
2024-07-26 04:41:31 +08:00
|
|
|
pipelineStages.push(MetadataPickingPipelineStage);
|
2022-01-19 02:12:44 +08:00
|
|
|
|
|
|
|
|
if (featureIdFlags.hasPropertyTable) {
|
2022-01-20 00:44:49 +08:00
|
|
|
pipelineStages.push(SelectedFeatureIdPipelineStage);
|
2022-01-15 05:54:30 +08:00
|
|
|
pipelineStages.push(BatchTexturePipelineStage);
|
|
|
|
|
pipelineStages.push(CPUStylingPipelineStage);
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-03 22:23:18 +08:00
|
|
|
if (hasVerticalExaggeration) {
|
2023-09-15 03:36:56 +08:00
|
|
|
pipelineStages.push(VerticalExaggerationPipelineStage);
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-19 02:12:44 +08:00
|
|
|
if (hasCustomShader) {
|
2022-01-11 05:04:27 +08:00
|
|
|
pipelineStages.push(CustomShaderPipelineStage);
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-30 05:10:48 +08:00
|
|
|
pipelineStages.push(LightingPipelineStage);
|
2021-08-25 03:38:27 +08:00
|
|
|
|
2021-08-26 01:40:19 +08:00
|
|
|
if (model.allowPicking) {
|
2021-08-25 03:38:27 +08:00
|
|
|
pipelineStages.push(PickingPipelineStage);
|
|
|
|
|
}
|
2021-09-15 13:06:07 +08:00
|
|
|
|
2022-06-29 03:02:01 +08:00
|
|
|
if (hasOutlines) {
|
|
|
|
|
pipelineStages.push(PrimitiveOutlinePipelineStage);
|
|
|
|
|
}
|
|
|
|
|
|
2025-08-07 13:26:52 +08:00
|
|
|
if (hasEdgeVisibility) {
|
2025-09-18 09:25:09 +08:00
|
|
|
// Indicate to Scene (after primitive updates) that the edge MRT should be enabled.
|
|
|
|
|
frameState.edgeVisibilityRequested = true;
|
2025-08-07 13:26:52 +08:00
|
|
|
pipelineStages.push(EdgeVisibilityPipelineStage);
|
|
|
|
|
pipelineStages.push(EdgeDetectionPipelineStage);
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-27 00:58:08 +08:00
|
|
|
pipelineStages.push(AlphaPipelineStage);
|
|
|
|
|
|
2022-06-09 01:11:10 +08:00
|
|
|
pipelineStages.push(PrimitiveStatisticsPipelineStage);
|
2022-06-02 02:13:21 +08:00
|
|
|
|
2021-07-26 21:09:02 +08:00
|
|
|
return;
|
2022-01-11 05:04:27 +08:00
|
|
|
};
|
2022-01-19 02:12:44 +08:00
|
|
|
|
|
|
|
|
function inspectFeatureIds(model, node, primitive) {
|
2022-01-27 05:07:43 +08:00
|
|
|
let featureIds;
|
2022-01-19 02:12:44 +08:00
|
|
|
// Check instances first, as this is the most specific type of
|
|
|
|
|
// feature ID
|
|
|
|
|
if (defined(node.instances)) {
|
2022-08-05 04:22:27 +08:00
|
|
|
featureIds = ModelUtility.getFeatureIdsByLabel(
|
2022-03-09 04:37:52 +08:00
|
|
|
node.instances.featureIds,
|
2024-10-22 23:57:31 +08:00
|
|
|
model.instanceFeatureIdLabel,
|
2022-03-09 04:37:52 +08:00
|
|
|
);
|
2022-01-19 02:12:44 +08:00
|
|
|
|
|
|
|
|
if (defined(featureIds)) {
|
|
|
|
|
return {
|
|
|
|
|
hasFeatureIds: true,
|
|
|
|
|
hasPropertyTable: defined(featureIds.propertyTableId),
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-05 04:22:27 +08:00
|
|
|
featureIds = ModelUtility.getFeatureIdsByLabel(
|
2022-03-09 04:37:52 +08:00
|
|
|
primitive.featureIds,
|
2024-10-22 23:57:31 +08:00
|
|
|
model.featureIdLabel,
|
2022-03-09 04:37:52 +08:00
|
|
|
);
|
2022-01-19 02:12:44 +08:00
|
|
|
if (defined(featureIds)) {
|
|
|
|
|
return {
|
|
|
|
|
hasFeatureIds: true,
|
|
|
|
|
hasPropertyTable: defined(featureIds.propertyTableId),
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
hasFeatureIds: false,
|
|
|
|
|
hasPropertyTable: false,
|
|
|
|
|
};
|
|
|
|
|
}
|
2022-08-11 06:22:27 +08:00
|
|
|
|
|
|
|
|
export default ModelRuntimePrimitive;
|