@rtzh/engine 0.0.5 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Build/Workers/chunk-243UEBJF.js +1045 -0
- package/Build/Workers/chunk-2UNHFFAZ.js +352 -0
- package/Build/Workers/chunk-2Y2KA6PM.js +387 -0
- package/Build/Workers/chunk-2ZXYLPPT.js +163 -0
- package/Build/Workers/chunk-32ZGDYJY.js +3514 -0
- package/Build/Workers/chunk-3NSMZ3XW.js +1067 -0
- package/Build/Workers/chunk-3WT5VKYM.js +101 -0
- package/Build/Workers/chunk-4DIL24GG.js +1460 -0
- package/Build/Workers/chunk-4FEDW3WT.js +299 -0
- package/Build/Workers/chunk-4IXXMXPJ.js +682 -0
- package/Build/Workers/chunk-4SC4KVID.js +692 -0
- package/Build/Workers/chunk-52UUGJQ6.js +288 -0
- package/Build/Workers/chunk-53AFSDGM.js +37 -0
- package/Build/Workers/chunk-54LZ6OUD.js +1067 -0
- package/Build/Workers/chunk-54SSO7NS.js +352 -0
- package/Build/Workers/chunk-565HBO3F.js +352 -0
- package/Build/Workers/chunk-5L3PEFKO.js +629 -0
- package/Build/Workers/chunk-5RMI6LFO.js +692 -0
- package/Build/Workers/chunk-5SVTAJRH.js +837 -0
- package/Build/Workers/chunk-5VDZEVQX.js +788 -0
- package/Build/Workers/chunk-5VWFNSLF.js +44 -0
- package/Build/Workers/chunk-5W4ISZGQ.js +1483 -0
- package/Build/Workers/chunk-5ZMMQ7HE.js +37 -0
- package/Build/Workers/chunk-64VDO4BW.js +114 -0
- package/Build/Workers/chunk-6AUSOZOL.js +476 -0
- package/Build/Workers/chunk-6BIU5AL4.js +692 -0
- package/Build/Workers/chunk-6KA3AJM6.js +455 -0
- package/Build/Workers/chunk-6MYDYE24.js +280 -0
- package/Build/Workers/chunk-6RUDXAFC.js +2719 -0
- package/Build/Workers/chunk-6YSUD2OH.js +219 -0
- package/Build/Workers/chunk-6YT2LZ3Z.js +1443 -0
- package/Build/Workers/chunk-73EGVDOC.js +398 -0
- package/Build/Workers/chunk-7BOVULMD.js +44 -0
- package/Build/Workers/chunk-7KOMCIWI.js +8366 -0
- package/Build/Workers/chunk-7MMYV5PM.js +288 -0
- package/Build/Workers/chunk-7QPQGSS3.js +57 -0
- package/Build/Workers/chunk-AEURJQ3B.js +73 -0
- package/Build/Workers/chunk-AMJRLIO3.js +414 -0
- package/Build/Workers/chunk-APOATHFZ.js +138 -0
- package/Build/Workers/chunk-AVNHAFMV.js +114 -0
- package/Build/Workers/chunk-AWMYTHW4.js +101 -0
- package/Build/Workers/chunk-BCYABDWF.js +3514 -0
- package/Build/Workers/chunk-BJHSYHOQ.js +97 -0
- package/Build/Workers/chunk-BM6ZG63T.js +171 -0
- package/Build/Workers/chunk-C3G2NDXM.js +162 -0
- package/Build/Workers/chunk-CTARL7CY.js +511 -0
- package/Build/Workers/chunk-DIA4J2DB.js +497 -0
- package/Build/Workers/chunk-E3NHG3TR.js +1460 -0
- package/Build/Workers/chunk-E5BSDIGY.js +139 -0
- package/Build/Workers/chunk-EDVAQGDJ.js +2719 -0
- package/Build/Workers/chunk-EFHDO3L2.js +102 -0
- package/Build/Workers/chunk-EJVGOIOW.js +1317 -0
- package/Build/Workers/chunk-EPVJ5OOH.js +8366 -0
- package/Build/Workers/chunk-ERYOZBVC.js +171 -0
- package/Build/Workers/chunk-ET7LWDHA.js +58 -0
- package/Build/Workers/chunk-EWDHM5NC.js +37 -0
- package/Build/Workers/chunk-F4Q3VOCC.js +1317 -0
- package/Build/Workers/chunk-FCSN7XOU.js +55 -0
- package/Build/Workers/chunk-FD62YGTB.js +219 -0
- package/Build/Workers/chunk-FHM3HFYM.js +1045 -0
- package/Build/Workers/chunk-FNI64UKI.js +57 -0
- package/Build/Workers/chunk-FRUZKVBP.js +352 -0
- package/Build/Workers/chunk-FSYQE5XE.js +55 -0
- package/Build/Workers/chunk-FYW5UQ24.js +837 -0
- package/Build/Workers/chunk-FYZVCB32.js +75 -0
- package/Build/Workers/chunk-G7PGTG3P.js +387 -0
- package/Build/Workers/chunk-GAQXLBFJ.js +1483 -0
- package/Build/Workers/chunk-GEH53ULL.js +299 -0
- package/Build/Workers/chunk-GLA2PT5T.js +476 -0
- package/Build/Workers/chunk-GWLEBUVI.js +2058 -0
- package/Build/Workers/chunk-GYIGOBV2.js +439 -0
- package/Build/Workers/chunk-GZMTBQM2.js +1443 -0
- package/Build/Workers/chunk-H2MM7FMU.js +1054 -0
- package/Build/Workers/chunk-H33FCT5U.js +940 -0
- package/Build/Workers/chunk-HAR6Y2HP.js +1800 -0
- package/Build/Workers/chunk-HBL3QZ2L.js +642 -0
- package/Build/Workers/chunk-HEKLTOOR.js +1443 -0
- package/Build/Workers/chunk-HM4MH5IG.js +138 -0
- package/Build/Workers/chunk-I5JHYEIE.js +241 -0
- package/Build/Workers/chunk-IB2XQV6U.js +101 -0
- package/Build/Workers/chunk-IC2JHDCI.js +114 -0
- package/Build/Workers/chunk-IEEHNZ36.js +241 -0
- package/Build/Workers/chunk-IRG63TBY.js +55 -0
- package/Build/Workers/chunk-IXM65GBF.js +256 -0
- package/Build/Workers/chunk-IY53MZW2.js +58 -0
- package/Build/Workers/chunk-IYAZCFAC.js +642 -0
- package/Build/Workers/chunk-J2CUNLQP.js +940 -0
- package/Build/Workers/chunk-J766O3PA.js +256 -0
- package/Build/Workers/chunk-JRPAFYGJ.js +1054 -0
- package/Build/Workers/chunk-JWEZXKBE.js +73 -0
- package/Build/Workers/chunk-KFOT2YV5.js +138 -0
- package/Build/Workers/chunk-KGQGZ7PF.js +778 -0
- package/Build/Workers/chunk-KMZXZUA7.js +1460 -0
- package/Build/Workers/chunk-KOVKY3HB.js +198 -0
- package/Build/Workers/chunk-KQ4ET526.js +163 -0
- package/Build/Workers/chunk-L2QIVAZV.js +3514 -0
- package/Build/Workers/chunk-LGMONS4O.js +1317 -0
- package/Build/Workers/chunk-LJHG4PJQ.js +305 -0
- package/Build/Workers/chunk-LNS36LUZ.js +2058 -0
- package/Build/Workers/chunk-LPJHTJDQ.js +305 -0
- package/Build/Workers/chunk-LRW2QXMW.js +352 -0
- package/Build/Workers/chunk-LUUEGFLT.js +305 -0
- package/Build/Workers/chunk-LW2VGHDM.js +1800 -0
- package/Build/Workers/chunk-LXM2ZC4V.js +288 -0
- package/Build/Workers/chunk-LXMLERGC.js +1067 -0
- package/Build/Workers/chunk-MEFWVMG6.js +788 -0
- package/Build/Workers/chunk-MJVNNURF.js +368 -0
- package/Build/Workers/chunk-MWN26ZEM.js +280 -0
- package/Build/Workers/chunk-NIWB6UMY.js +198 -0
- package/Build/Workers/chunk-NJEG7WRW.js +387 -0
- package/Build/Workers/chunk-O224ZEA5.js +58 -0
- package/Build/Workers/chunk-O5ICO3AS.js +682 -0
- package/Build/Workers/chunk-O5QH7XD5.js +629 -0
- package/Build/Workers/chunk-O6T3T3V3.js +97 -0
- package/Build/Workers/chunk-OBM2JYMG.js +75 -0
- package/Build/Workers/chunk-ODZZZGXK.js +219 -0
- package/Build/Workers/chunk-OFTWEOW2.js +1483 -0
- package/Build/Workers/chunk-OIJH6LAY.js +497 -0
- package/Build/Workers/chunk-OJFVD5ZS.js +778 -0
- package/Build/Workers/chunk-OJNPKCEL.js +73 -0
- package/Build/Workers/chunk-PQLZOYZE.js +642 -0
- package/Build/Workers/chunk-PU44PXY2.js +75 -0
- package/Build/Workers/chunk-Q36VXWGP.js +57 -0
- package/Build/Workers/chunk-Q4XPVYXJ.js +476 -0
- package/Build/Workers/chunk-QGXE4VZ3.js +55 -0
- package/Build/Workers/chunk-QIEHP7O4.js +280 -0
- package/Build/Workers/chunk-QY55DT53.js +97 -0
- package/Build/Workers/chunk-R3PTQZ6H.js +44 -0
- package/Build/Workers/chunk-RJVB3K2X.js +511 -0
- package/Build/Workers/chunk-RORZNBGJ.js +299 -0
- package/Build/Workers/chunk-RRBGLANL.js +55 -0
- package/Build/Workers/chunk-RT7PY6BH.js +2719 -0
- package/Build/Workers/chunk-SAD42JSM.js +102 -0
- package/Build/Workers/chunk-SBR7MW44.js +139 -0
- package/Build/Workers/chunk-SFM3GNS2.js +682 -0
- package/Build/Workers/chunk-SKXE77AM.js +139 -0
- package/Build/Workers/chunk-SLYUIIFB.js +455 -0
- package/Build/Workers/chunk-SQSWONTJ.js +241 -0
- package/Build/Workers/chunk-SRLJWNU2.js +368 -0
- package/Build/Workers/chunk-SZELHE7Q.js +163 -0
- package/Build/Workers/chunk-T4LDJBKR.js +124 -0
- package/Build/Workers/chunk-TBASKFFL.js +124 -0
- package/Build/Workers/chunk-TDGGEIZE.js +398 -0
- package/Build/Workers/chunk-TQ63SH2Z.js +352 -0
- package/Build/Workers/chunk-U3VI26GL.js +162 -0
- package/Build/Workers/chunk-U77FLUQF.js +368 -0
- package/Build/Workers/chunk-UIYQEJ5H.js +1054 -0
- package/Build/Workers/chunk-UJ72JOGF.js +511 -0
- package/Build/Workers/chunk-UY7I27VQ.js +1800 -0
- package/Build/Workers/chunk-VLB25GGE.js +439 -0
- package/Build/Workers/chunk-VVKDT4J7.js +837 -0
- package/Build/Workers/chunk-VXDOONLH.js +162 -0
- package/Build/Workers/chunk-W4DV7TAL.js +8366 -0
- package/Build/Workers/chunk-WFTPZ3ZX.js +788 -0
- package/Build/Workers/chunk-WLIQ26XU.js +455 -0
- package/Build/Workers/chunk-WOEPS2UA.js +171 -0
- package/Build/Workers/chunk-WWLWTSMV.js +55 -0
- package/Build/Workers/chunk-WX2ZANQC.js +940 -0
- package/Build/Workers/chunk-XEB4GEXW.js +629 -0
- package/Build/Workers/chunk-XFKTM6GN.js +2058 -0
- package/Build/Workers/chunk-XKBR7TJB.js +398 -0
- package/Build/Workers/chunk-XYRT4RDI.js +1045 -0
- package/Build/Workers/chunk-XZINQPR6.js +124 -0
- package/Build/Workers/chunk-YLKTSY65.js +414 -0
- package/Build/Workers/chunk-YLSZYTTO.js +102 -0
- package/Build/Workers/chunk-YQXKIGXX.js +414 -0
- package/Build/Workers/chunk-YR3LX3PR.js +497 -0
- package/Build/Workers/chunk-Z5MHVJGN.js +778 -0
- package/Build/Workers/chunk-ZBRVFEGF.js +256 -0
- package/Build/Workers/chunk-ZCPCQJBX.js +198 -0
- package/Build/Workers/chunk-ZS7KQSEM.js +439 -0
- package/Build/Workers/combineGeometry.js +24 -24
- package/Build/Workers/createBoxGeometry.js +18 -18
- package/Build/Workers/createBoxOutlineGeometry.js +16 -16
- package/Build/Workers/createCircleGeometry.js +26 -26
- package/Build/Workers/createCircleOutlineGeometry.js +19 -19
- package/Build/Workers/createCoplanarPolygonGeometry.js +33 -33
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -31
- package/Build/Workers/createCorridorGeometry.js +29 -29
- package/Build/Workers/createCorridorOutlineGeometry.js +28 -28
- package/Build/Workers/createCylinderGeometry.js +20 -20
- package/Build/Workers/createCylinderOutlineGeometry.js +18 -18
- package/Build/Workers/createEllipseGeometry.js +26 -26
- package/Build/Workers/createEllipseOutlineGeometry.js +19 -19
- package/Build/Workers/createEllipsoidGeometry.js +19 -19
- package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -18
- package/Build/Workers/createFrustumGeometry.js +18 -18
- package/Build/Workers/createFrustumOutlineGeometry.js +18 -18
- package/Build/Workers/createGeometry.js +24 -24
- package/Build/Workers/createGroundPolylineGeometry.js +22 -22
- package/Build/Workers/createPlaneGeometry.js +16 -16
- package/Build/Workers/createPlaneOutlineGeometry.js +15 -15
- package/Build/Workers/createPolygonGeometry.js +32 -32
- package/Build/Workers/createPolygonOutlineGeometry.js +30 -30
- package/Build/Workers/createPolylineGeometry.js +25 -25
- package/Build/Workers/createPolylineVolumeGeometry.js +31 -31
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -27
- package/Build/Workers/createRectangleGeometry.js +27 -27
- package/Build/Workers/createRectangleOutlineGeometry.js +20 -20
- package/Build/Workers/createSimplePolylineGeometry.js +23 -23
- package/Build/Workers/createSphereGeometry.js +19 -19
- package/Build/Workers/createSphereOutlineGeometry.js +18 -18
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
- package/Build/Workers/createVectorTileGeometries.js +24 -24
- package/Build/Workers/createVectorTilePoints.js +13 -13
- package/Build/Workers/createVectorTilePolygons.js +22 -22
- package/Build/Workers/createVectorTilePolylines.js +14 -14
- package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +25 -25
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -22
- package/Build/Workers/createVerticesFromHeightmap.js +22 -22
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +20 -20
- package/Build/Workers/createWallGeometry.js +24 -24
- package/Build/Workers/createWallOutlineGeometry.js +23 -23
- package/Build/Workers/decodeDraco.js +10 -10
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
- package/Build/Workers/decodeI3S.js +10 -10
- package/Build/Workers/gaussianSplatSorter.js +4 -4
- package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
- package/Build/Workers/incrementallyBuildTerrainPicker.js +10 -10
- package/Build/Workers/transcodeKTX2.js +6 -6
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -22
- package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +25 -25
- package/Source/Scene/Cesium3DTileset.js +4163 -4105
- package/Source/Scene/Model/BarycentricWireframePipelineStage.js +327 -73
- package/Source/Scene/Model/Model.js +3631 -3512
- package/Source/Scene/Model/Model3DTileContent.js +585 -568
- package/Source/Scene/Model/ModelRuntimePrimitive.js +391 -391
- package/Source/Scene/Model/WireframePipelineStage.js +122 -122
- package/Source/Shaders/Model/ModelFS.glsl +38 -2
- package/Source/Shaders/Model/ModelFS.js +38 -2
- package/Source/Shaders/Model/ModelVS.glsl +3 -0
- package/Source/Shaders/Model/ModelVS.js +3 -0
- package/index.d.ts +801 -773
- package/index.js +145 -145
- package/package.json +1 -1
|
@@ -1,391 +1,391 @@
|
|
|
1
|
-
import Check from "../../Core/Check.js";
|
|
2
|
-
import Frozen from "../../Core/Frozen.js";
|
|
3
|
-
import defined from "../../Core/defined.js";
|
|
4
|
-
import PrimitiveType from "../../Core/PrimitiveType.js";
|
|
5
|
-
import SceneMode from "../SceneMode.js";
|
|
6
|
-
import AlphaPipelineStage from "./AlphaPipelineStage.js";
|
|
7
|
-
import BatchTexturePipelineStage from "./BatchTexturePipelineStage.js";
|
|
8
|
-
import ClassificationPipelineStage from "./ClassificationPipelineStage.js";
|
|
9
|
-
import CPUStylingPipelineStage from "./CPUStylingPipelineStage.js";
|
|
10
|
-
import CustomShaderMode from "./CustomShaderMode.js";
|
|
11
|
-
import CustomShaderPipelineStage from "./CustomShaderPipelineStage.js";
|
|
12
|
-
import DequantizationPipelineStage from "./DequantizationPipelineStage.js";
|
|
13
|
-
import EdgeDetectionPipelineStage from "./EdgeDetectionPipelineStage.js";
|
|
14
|
-
import EdgeVisibilityPipelineStage from "./EdgeVisibilityPipelineStage.js";
|
|
15
|
-
import FeatureIdPipelineStage from "./FeatureIdPipelineStage.js";
|
|
16
|
-
import GeometryPipelineStage from "./GeometryPipelineStage.js";
|
|
17
|
-
import ImageryPipelineStage from "./ImageryPipelineStage.js";
|
|
18
|
-
import LightingPipelineStage from "./LightingPipelineStage.js";
|
|
19
|
-
import MaterialPipelineStage from "./MaterialPipelineStage.js";
|
|
20
|
-
import MetadataPickingPipelineStage from "./MetadataPickingPipelineStage.js";
|
|
21
|
-
import MetadataPipelineStage from "./MetadataPipelineStage.js";
|
|
22
|
-
import ModelUtility from "./ModelUtility.js";
|
|
23
|
-
import MorphTargetsPipelineStage from "./MorphTargetsPipelineStage.js";
|
|
24
|
-
import PickingPipelineStage from "./PickingPipelineStage.js";
|
|
25
|
-
import PointCloudStylingPipelineStage from "./PointCloudStylingPipelineStage.js";
|
|
26
|
-
import PrimitiveOutlinePipelineStage from "./PrimitiveOutlinePipelineStage.js";
|
|
27
|
-
import PrimitiveStatisticsPipelineStage from "./PrimitiveStatisticsPipelineStage.js";
|
|
28
|
-
import SceneMode2DPipelineStage from "./SceneMode2DPipelineStage.js";
|
|
29
|
-
import SelectedFeatureIdPipelineStage from "./SelectedFeatureIdPipelineStage.js";
|
|
30
|
-
import SkinningPipelineStage from "./SkinningPipelineStage.js";
|
|
31
|
-
import VerticalExaggerationPipelineStage from "./VerticalExaggerationPipelineStage.js";
|
|
32
|
-
import WireframePipelineStage from "./WireframePipelineStage.js";
|
|
33
|
-
import BarycentricWireframePipelineStage from "./BarycentricWireframePipelineStage.js";
|
|
34
|
-
import oneTimeWarning from "../../Core/oneTimeWarning.js";
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* In memory representation of a single primitive, that is, a primitive
|
|
38
|
-
* and its corresponding mesh.
|
|
39
|
-
*
|
|
40
|
-
* @param {object} options An object containing the following options:
|
|
41
|
-
* @param {ModelComponents.Primitive} options.primitive The primitive component.
|
|
42
|
-
* @param {ModelComponents.Node} options.node The node that this primitive belongs to.
|
|
43
|
-
* @param {Model} options.model The {@link Model} this primitive belongs to.
|
|
44
|
-
*
|
|
45
|
-
* @alias ModelRuntimePrimitive
|
|
46
|
-
* @constructor
|
|
47
|
-
*
|
|
48
|
-
* @private
|
|
49
|
-
*/
|
|
50
|
-
function ModelRuntimePrimitive(options) {
|
|
51
|
-
options = options ?? Frozen.EMPTY_OBJECT;
|
|
52
|
-
|
|
53
|
-
const primitive = options.primitive;
|
|
54
|
-
const node = options.node;
|
|
55
|
-
const model = options.model;
|
|
56
|
-
//>>includeStart('debug', pragmas.debug);
|
|
57
|
-
Check.typeOf.object("options.primitive", primitive);
|
|
58
|
-
Check.typeOf.object("options.node", node);
|
|
59
|
-
Check.typeOf.object("options.model", model);
|
|
60
|
-
//>>includeEnd('debug');
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* The primitive component associated with this primitive.
|
|
64
|
-
*
|
|
65
|
-
* @type {ModelComponents.Primitive}
|
|
66
|
-
*
|
|
67
|
-
* @private
|
|
68
|
-
*/
|
|
69
|
-
this.primitive = primitive;
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* A reference to the node this primitive belongs to.
|
|
73
|
-
*
|
|
74
|
-
* @type {ModelComponents.Node}
|
|
75
|
-
*
|
|
76
|
-
* @private
|
|
77
|
-
*/
|
|
78
|
-
this.node = node;
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* A reference to the model
|
|
82
|
-
*
|
|
83
|
-
* @type {Model}
|
|
84
|
-
*
|
|
85
|
-
* @private
|
|
86
|
-
*/
|
|
87
|
-
this.model = model;
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Pipeline stages to apply to this primitive. This
|
|
91
|
-
* is an array of classes, each with a static method called
|
|
92
|
-
* <code>process()</code>
|
|
93
|
-
*
|
|
94
|
-
* @type {object[]}
|
|
95
|
-
* @readonly
|
|
96
|
-
*
|
|
97
|
-
* @private
|
|
98
|
-
*/
|
|
99
|
-
this.pipelineStages = [];
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* The generated {@link ModelDrawCommand} or {@link ClassificationModelDrawCommand}
|
|
103
|
-
* associated with this primitive.
|
|
104
|
-
*
|
|
105
|
-
* @type {ModelDrawCommand|ClassificationModelDrawCommand}
|
|
106
|
-
*
|
|
107
|
-
* @private
|
|
108
|
-
*/
|
|
109
|
-
this.drawCommand = undefined;
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* The bounding sphere of this primitive in object-space.
|
|
113
|
-
*
|
|
114
|
-
* @type {BoundingSphere}
|
|
115
|
-
*
|
|
116
|
-
* @private
|
|
117
|
-
*/
|
|
118
|
-
this.boundingSphere = undefined;
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* The bounding sphere of this primitive in 2D world space.
|
|
122
|
-
*
|
|
123
|
-
* @type {BoundingSphere}
|
|
124
|
-
*
|
|
125
|
-
* @private
|
|
126
|
-
*/
|
|
127
|
-
this.boundingSphere2D = undefined;
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* A buffer containing the primitive's positions projected to 2D world
|
|
131
|
-
* coordinates. This is generated by SceneMode2DPipelineStage and used for
|
|
132
|
-
* rendering in 2D / CV mode. The memory is managed by Model; this is just
|
|
133
|
-
* a reference.
|
|
134
|
-
*
|
|
135
|
-
* @type {Buffer}
|
|
136
|
-
*
|
|
137
|
-
* @private
|
|
138
|
-
*/
|
|
139
|
-
this.positionBuffer2D = undefined;
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* An array containing the lengths of the vertex batches for classification.
|
|
143
|
-
* Vertices with the same feature ID are batched together, and each batch is
|
|
144
|
-
* drawn with a different draw command in order to properly classify other
|
|
145
|
-
* assets.
|
|
146
|
-
* <p>
|
|
147
|
-
* This is generated by ClassificationPipelineStage. The memory is managed by
|
|
148
|
-
* Model; this is just a reference.
|
|
149
|
-
* </p>
|
|
150
|
-
*
|
|
151
|
-
* @type {number[]}
|
|
152
|
-
*
|
|
153
|
-
* @private
|
|
154
|
-
*/
|
|
155
|
-
this.batchLengths = undefined;
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* An array containing the offsets of the vertex batches for classification.
|
|
159
|
-
* Vertices with the same feature ID are batched together, and each batch is
|
|
160
|
-
* drawn with a different draw command in order to properly classify other
|
|
161
|
-
* assets.
|
|
162
|
-
* <p>
|
|
163
|
-
* This is generated by ClassificationPipelineStage. The memory is managed by
|
|
164
|
-
* Model; this is just a reference.
|
|
165
|
-
* </p>
|
|
166
|
-
*
|
|
167
|
-
* @type {number[]}
|
|
168
|
-
*
|
|
169
|
-
* @private
|
|
170
|
-
*/
|
|
171
|
-
this.batchOffsets = undefined;
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Update stages to apply to this primitive.
|
|
175
|
-
*
|
|
176
|
-
* @type {object[]}
|
|
177
|
-
* @readonly
|
|
178
|
-
*
|
|
179
|
-
* @private
|
|
180
|
-
*/
|
|
181
|
-
this.updateStages = [];
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* Configure the primitive pipeline stages. If the pipeline needs to be re-run,
|
|
186
|
-
* call this method again to ensure the correct sequence of pipeline stages are
|
|
187
|
-
* used.
|
|
188
|
-
*
|
|
189
|
-
* @param {FrameState} frameState The frame state.
|
|
190
|
-
*
|
|
191
|
-
* @private
|
|
192
|
-
*/
|
|
193
|
-
ModelRuntimePrimitive.prototype.configurePipeline = function (frameState) {
|
|
194
|
-
const pipelineStages = this.pipelineStages;
|
|
195
|
-
pipelineStages.length = 0;
|
|
196
|
-
|
|
197
|
-
const primitive = this.primitive;
|
|
198
|
-
const node = this.node;
|
|
199
|
-
const model = this.model;
|
|
200
|
-
|
|
201
|
-
const customShader = model.customShader;
|
|
202
|
-
const style = model.style;
|
|
203
|
-
|
|
204
|
-
const useWebgl2 = frameState.context.webgl2;
|
|
205
|
-
const mode = frameState.mode;
|
|
206
|
-
const use2D =
|
|
207
|
-
mode !== SceneMode.SCENE3D && !frameState.scene3DOnly && model._projectTo2D;
|
|
208
|
-
const hasVerticalExaggeration =
|
|
209
|
-
frameState.verticalExaggeration !== 1.0 && model.hasVerticalExaggeration;
|
|
210
|
-
|
|
211
|
-
const hasMorphTargets =
|
|
212
|
-
defined(primitive.morphTargets) && primitive.morphTargets.length > 0;
|
|
213
|
-
const hasSkinning = defined(node.skin);
|
|
214
|
-
|
|
215
|
-
// Check whether the model is part of a `Model3DTileContent` that
|
|
216
|
-
// belongs to a tileset that has imagery layers. If this is the
|
|
217
|
-
// case, then the `ImageryPipelineStage` will be required.
|
|
218
|
-
const hasImageryLayers = defined(model.imageryLayers);
|
|
219
|
-
|
|
220
|
-
const hasCustomShader = defined(customShader);
|
|
221
|
-
const hasCustomFragmentShader =
|
|
222
|
-
hasCustomShader && defined(customShader.fragmentShaderText);
|
|
223
|
-
const materialsEnabled =
|
|
224
|
-
!hasCustomFragmentShader ||
|
|
225
|
-
customShader.mode !== CustomShaderMode.REPLACE_MATERIAL;
|
|
226
|
-
const hasQuantization = ModelUtility.hasQuantizedAttributes(
|
|
227
|
-
primitive.attributes,
|
|
228
|
-
);
|
|
229
|
-
|
|
230
|
-
const generateWireframeIndices =
|
|
231
|
-
model.debugWireframe &&
|
|
232
|
-
PrimitiveType.isTriangles(primitive.primitiveType) &&
|
|
233
|
-
model.debugWireframeMode === "lines" &&
|
|
234
|
-
// Generating index buffers for wireframes is always possible in WebGL2.
|
|
235
|
-
// However, this will only work in WebGL1 if the model was constructed with
|
|
236
|
-
// enableDebugWireframe set to true.
|
|
237
|
-
(model._enableDebugWireframe || useWebgl2);
|
|
238
|
-
|
|
239
|
-
const generateBarycentricWireframe =
|
|
240
|
-
model.debugWireframe &&
|
|
241
|
-
PrimitiveType.isTriangles(primitive.primitiveType) &&
|
|
242
|
-
model.debugWireframeMode === "barycentric";
|
|
243
|
-
|
|
244
|
-
const pointCloudShading = model.pointCloudShading;
|
|
245
|
-
const hasAttenuation =
|
|
246
|
-
defined(pointCloudShading) && pointCloudShading.attenuation;
|
|
247
|
-
const hasPointCloudBackFaceCulling =
|
|
248
|
-
defined(pointCloudShading) && pointCloudShading.backFaceCulling;
|
|
249
|
-
const hasPointCloudStyle =
|
|
250
|
-
primitive.primitiveType === PrimitiveType.POINTS &&
|
|
251
|
-
(defined(style) || hasAttenuation || hasPointCloudBackFaceCulling);
|
|
252
|
-
|
|
253
|
-
const hasOutlines =
|
|
254
|
-
model._enableShowOutline && defined(primitive.outlineCoordinates);
|
|
255
|
-
|
|
256
|
-
const hasEdgeVisibility = defined(primitive.edgeVisibility);
|
|
257
|
-
|
|
258
|
-
const featureIdFlags = inspectFeatureIds(model, node, primitive);
|
|
259
|
-
|
|
260
|
-
const hasClassification = defined(model.classificationType);
|
|
261
|
-
|
|
262
|
-
// Start of pipeline -----------------------------------------------------
|
|
263
|
-
if (use2D) {
|
|
264
|
-
pipelineStages.push(SceneMode2DPipelineStage);
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
pipelineStages.push(GeometryPipelineStage);
|
|
268
|
-
|
|
269
|
-
if (generateWireframeIndices) {
|
|
270
|
-
pipelineStages.push(WireframePipelineStage);
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
if (generateBarycentricWireframe) {
|
|
274
|
-
pipelineStages.push(BarycentricWireframePipelineStage);
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
if (hasClassification) {
|
|
278
|
-
pipelineStages.push(ClassificationPipelineStage);
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
if (hasMorphTargets) {
|
|
282
|
-
pipelineStages.push(MorphTargetsPipelineStage);
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
if (hasSkinning) {
|
|
286
|
-
pipelineStages.push(SkinningPipelineStage);
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
if (hasPointCloudStyle) {
|
|
290
|
-
pipelineStages.push(PointCloudStylingPipelineStage);
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
if (hasQuantization) {
|
|
294
|
-
pipelineStages.push(DequantizationPipelineStage);
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
if (hasImageryLayers) {
|
|
298
|
-
if (hasOutlines) {
|
|
299
|
-
oneTimeWarning(
|
|
300
|
-
"outlines-and-draping",
|
|
301
|
-
"Primitive outlines disable imagery draping",
|
|
302
|
-
);
|
|
303
|
-
} else {
|
|
304
|
-
pipelineStages.push(ImageryPipelineStage);
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
if (materialsEnabled) {
|
|
309
|
-
pipelineStages.push(MaterialPipelineStage);
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
// These stages are always run to ensure structs
|
|
313
|
-
// are declared to avoid compilation errors.
|
|
314
|
-
pipelineStages.push(FeatureIdPipelineStage);
|
|
315
|
-
pipelineStages.push(MetadataPipelineStage);
|
|
316
|
-
pipelineStages.push(MetadataPickingPipelineStage);
|
|
317
|
-
|
|
318
|
-
if (featureIdFlags.hasPropertyTable && model.featureTables.length > 0) {
|
|
319
|
-
pipelineStages.push(SelectedFeatureIdPipelineStage);
|
|
320
|
-
pipelineStages.push(BatchTexturePipelineStage);
|
|
321
|
-
pipelineStages.push(CPUStylingPipelineStage);
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
if (hasVerticalExaggeration) {
|
|
325
|
-
pipelineStages.push(VerticalExaggerationPipelineStage);
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
if (hasCustomShader) {
|
|
329
|
-
pipelineStages.push(CustomShaderPipelineStage);
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
pipelineStages.push(LightingPipelineStage);
|
|
333
|
-
|
|
334
|
-
if (model.allowPicking) {
|
|
335
|
-
pipelineStages.push(PickingPipelineStage);
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
if (hasOutlines) {
|
|
339
|
-
pipelineStages.push(PrimitiveOutlinePipelineStage);
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
if (hasEdgeVisibility) {
|
|
343
|
-
// Indicate to Scene (after primitive updates) that the edge MRT should be enabled.
|
|
344
|
-
frameState.edgeVisibilityRequested = true;
|
|
345
|
-
pipelineStages.push(EdgeVisibilityPipelineStage);
|
|
346
|
-
pipelineStages.push(EdgeDetectionPipelineStage);
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
pipelineStages.push(AlphaPipelineStage);
|
|
350
|
-
|
|
351
|
-
pipelineStages.push(PrimitiveStatisticsPipelineStage);
|
|
352
|
-
|
|
353
|
-
return;
|
|
354
|
-
};
|
|
355
|
-
|
|
356
|
-
function inspectFeatureIds(model, node, primitive) {
|
|
357
|
-
let featureIds;
|
|
358
|
-
// Check instances first, as this is the most specific type of
|
|
359
|
-
// feature ID
|
|
360
|
-
if (defined(node.instances)) {
|
|
361
|
-
featureIds = ModelUtility.getFeatureIdsByLabel(
|
|
362
|
-
node.instances.featureIds,
|
|
363
|
-
model.instanceFeatureIdLabel,
|
|
364
|
-
);
|
|
365
|
-
|
|
366
|
-
if (defined(featureIds)) {
|
|
367
|
-
return {
|
|
368
|
-
hasFeatureIds: true,
|
|
369
|
-
hasPropertyTable: defined(featureIds.propertyTableId),
|
|
370
|
-
};
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
featureIds = ModelUtility.getFeatureIdsByLabel(
|
|
375
|
-
primitive.featureIds,
|
|
376
|
-
model.featureIdLabel,
|
|
377
|
-
);
|
|
378
|
-
if (defined(featureIds)) {
|
|
379
|
-
return {
|
|
380
|
-
hasFeatureIds: true,
|
|
381
|
-
hasPropertyTable: defined(featureIds.propertyTableId),
|
|
382
|
-
};
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
return {
|
|
386
|
-
hasFeatureIds: false,
|
|
387
|
-
hasPropertyTable: false,
|
|
388
|
-
};
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
export default ModelRuntimePrimitive;
|
|
1
|
+
import Check from "../../Core/Check.js";
|
|
2
|
+
import Frozen from "../../Core/Frozen.js";
|
|
3
|
+
import defined from "../../Core/defined.js";
|
|
4
|
+
import PrimitiveType from "../../Core/PrimitiveType.js";
|
|
5
|
+
import SceneMode from "../SceneMode.js";
|
|
6
|
+
import AlphaPipelineStage from "./AlphaPipelineStage.js";
|
|
7
|
+
import BatchTexturePipelineStage from "./BatchTexturePipelineStage.js";
|
|
8
|
+
import ClassificationPipelineStage from "./ClassificationPipelineStage.js";
|
|
9
|
+
import CPUStylingPipelineStage from "./CPUStylingPipelineStage.js";
|
|
10
|
+
import CustomShaderMode from "./CustomShaderMode.js";
|
|
11
|
+
import CustomShaderPipelineStage from "./CustomShaderPipelineStage.js";
|
|
12
|
+
import DequantizationPipelineStage from "./DequantizationPipelineStage.js";
|
|
13
|
+
import EdgeDetectionPipelineStage from "./EdgeDetectionPipelineStage.js";
|
|
14
|
+
import EdgeVisibilityPipelineStage from "./EdgeVisibilityPipelineStage.js";
|
|
15
|
+
import FeatureIdPipelineStage from "./FeatureIdPipelineStage.js";
|
|
16
|
+
import GeometryPipelineStage from "./GeometryPipelineStage.js";
|
|
17
|
+
import ImageryPipelineStage from "./ImageryPipelineStage.js";
|
|
18
|
+
import LightingPipelineStage from "./LightingPipelineStage.js";
|
|
19
|
+
import MaterialPipelineStage from "./MaterialPipelineStage.js";
|
|
20
|
+
import MetadataPickingPipelineStage from "./MetadataPickingPipelineStage.js";
|
|
21
|
+
import MetadataPipelineStage from "./MetadataPipelineStage.js";
|
|
22
|
+
import ModelUtility from "./ModelUtility.js";
|
|
23
|
+
import MorphTargetsPipelineStage from "./MorphTargetsPipelineStage.js";
|
|
24
|
+
import PickingPipelineStage from "./PickingPipelineStage.js";
|
|
25
|
+
import PointCloudStylingPipelineStage from "./PointCloudStylingPipelineStage.js";
|
|
26
|
+
import PrimitiveOutlinePipelineStage from "./PrimitiveOutlinePipelineStage.js";
|
|
27
|
+
import PrimitiveStatisticsPipelineStage from "./PrimitiveStatisticsPipelineStage.js";
|
|
28
|
+
import SceneMode2DPipelineStage from "./SceneMode2DPipelineStage.js";
|
|
29
|
+
import SelectedFeatureIdPipelineStage from "./SelectedFeatureIdPipelineStage.js";
|
|
30
|
+
import SkinningPipelineStage from "./SkinningPipelineStage.js";
|
|
31
|
+
import VerticalExaggerationPipelineStage from "./VerticalExaggerationPipelineStage.js";
|
|
32
|
+
import WireframePipelineStage from "./WireframePipelineStage.js";
|
|
33
|
+
import BarycentricWireframePipelineStage from "./BarycentricWireframePipelineStage.js";
|
|
34
|
+
import oneTimeWarning from "../../Core/oneTimeWarning.js";
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* In memory representation of a single primitive, that is, a primitive
|
|
38
|
+
* and its corresponding mesh.
|
|
39
|
+
*
|
|
40
|
+
* @param {object} options An object containing the following options:
|
|
41
|
+
* @param {ModelComponents.Primitive} options.primitive The primitive component.
|
|
42
|
+
* @param {ModelComponents.Node} options.node The node that this primitive belongs to.
|
|
43
|
+
* @param {Model} options.model The {@link Model} this primitive belongs to.
|
|
44
|
+
*
|
|
45
|
+
* @alias ModelRuntimePrimitive
|
|
46
|
+
* @constructor
|
|
47
|
+
*
|
|
48
|
+
* @private
|
|
49
|
+
*/
|
|
50
|
+
function ModelRuntimePrimitive(options) {
|
|
51
|
+
options = options ?? Frozen.EMPTY_OBJECT;
|
|
52
|
+
|
|
53
|
+
const primitive = options.primitive;
|
|
54
|
+
const node = options.node;
|
|
55
|
+
const model = options.model;
|
|
56
|
+
//>>includeStart('debug', pragmas.debug);
|
|
57
|
+
Check.typeOf.object("options.primitive", primitive);
|
|
58
|
+
Check.typeOf.object("options.node", node);
|
|
59
|
+
Check.typeOf.object("options.model", model);
|
|
60
|
+
//>>includeEnd('debug');
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* The primitive component associated with this primitive.
|
|
64
|
+
*
|
|
65
|
+
* @type {ModelComponents.Primitive}
|
|
66
|
+
*
|
|
67
|
+
* @private
|
|
68
|
+
*/
|
|
69
|
+
this.primitive = primitive;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* A reference to the node this primitive belongs to.
|
|
73
|
+
*
|
|
74
|
+
* @type {ModelComponents.Node}
|
|
75
|
+
*
|
|
76
|
+
* @private
|
|
77
|
+
*/
|
|
78
|
+
this.node = node;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* A reference to the model
|
|
82
|
+
*
|
|
83
|
+
* @type {Model}
|
|
84
|
+
*
|
|
85
|
+
* @private
|
|
86
|
+
*/
|
|
87
|
+
this.model = model;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Pipeline stages to apply to this primitive. This
|
|
91
|
+
* is an array of classes, each with a static method called
|
|
92
|
+
* <code>process()</code>
|
|
93
|
+
*
|
|
94
|
+
* @type {object[]}
|
|
95
|
+
* @readonly
|
|
96
|
+
*
|
|
97
|
+
* @private
|
|
98
|
+
*/
|
|
99
|
+
this.pipelineStages = [];
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* The generated {@link ModelDrawCommand} or {@link ClassificationModelDrawCommand}
|
|
103
|
+
* associated with this primitive.
|
|
104
|
+
*
|
|
105
|
+
* @type {ModelDrawCommand|ClassificationModelDrawCommand}
|
|
106
|
+
*
|
|
107
|
+
* @private
|
|
108
|
+
*/
|
|
109
|
+
this.drawCommand = undefined;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* The bounding sphere of this primitive in object-space.
|
|
113
|
+
*
|
|
114
|
+
* @type {BoundingSphere}
|
|
115
|
+
*
|
|
116
|
+
* @private
|
|
117
|
+
*/
|
|
118
|
+
this.boundingSphere = undefined;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* The bounding sphere of this primitive in 2D world space.
|
|
122
|
+
*
|
|
123
|
+
* @type {BoundingSphere}
|
|
124
|
+
*
|
|
125
|
+
* @private
|
|
126
|
+
*/
|
|
127
|
+
this.boundingSphere2D = undefined;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* A buffer containing the primitive's positions projected to 2D world
|
|
131
|
+
* coordinates. This is generated by SceneMode2DPipelineStage and used for
|
|
132
|
+
* rendering in 2D / CV mode. The memory is managed by Model; this is just
|
|
133
|
+
* a reference.
|
|
134
|
+
*
|
|
135
|
+
* @type {Buffer}
|
|
136
|
+
*
|
|
137
|
+
* @private
|
|
138
|
+
*/
|
|
139
|
+
this.positionBuffer2D = undefined;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* An array containing the lengths of the vertex batches for classification.
|
|
143
|
+
* Vertices with the same feature ID are batched together, and each batch is
|
|
144
|
+
* drawn with a different draw command in order to properly classify other
|
|
145
|
+
* assets.
|
|
146
|
+
* <p>
|
|
147
|
+
* This is generated by ClassificationPipelineStage. The memory is managed by
|
|
148
|
+
* Model; this is just a reference.
|
|
149
|
+
* </p>
|
|
150
|
+
*
|
|
151
|
+
* @type {number[]}
|
|
152
|
+
*
|
|
153
|
+
* @private
|
|
154
|
+
*/
|
|
155
|
+
this.batchLengths = undefined;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* An array containing the offsets of the vertex batches for classification.
|
|
159
|
+
* Vertices with the same feature ID are batched together, and each batch is
|
|
160
|
+
* drawn with a different draw command in order to properly classify other
|
|
161
|
+
* assets.
|
|
162
|
+
* <p>
|
|
163
|
+
* This is generated by ClassificationPipelineStage. The memory is managed by
|
|
164
|
+
* Model; this is just a reference.
|
|
165
|
+
* </p>
|
|
166
|
+
*
|
|
167
|
+
* @type {number[]}
|
|
168
|
+
*
|
|
169
|
+
* @private
|
|
170
|
+
*/
|
|
171
|
+
this.batchOffsets = undefined;
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Update stages to apply to this primitive.
|
|
175
|
+
*
|
|
176
|
+
* @type {object[]}
|
|
177
|
+
* @readonly
|
|
178
|
+
*
|
|
179
|
+
* @private
|
|
180
|
+
*/
|
|
181
|
+
this.updateStages = [];
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Configure the primitive pipeline stages. If the pipeline needs to be re-run,
|
|
186
|
+
* call this method again to ensure the correct sequence of pipeline stages are
|
|
187
|
+
* used.
|
|
188
|
+
*
|
|
189
|
+
* @param {FrameState} frameState The frame state.
|
|
190
|
+
*
|
|
191
|
+
* @private
|
|
192
|
+
*/
|
|
193
|
+
ModelRuntimePrimitive.prototype.configurePipeline = function (frameState) {
|
|
194
|
+
const pipelineStages = this.pipelineStages;
|
|
195
|
+
pipelineStages.length = 0;
|
|
196
|
+
|
|
197
|
+
const primitive = this.primitive;
|
|
198
|
+
const node = this.node;
|
|
199
|
+
const model = this.model;
|
|
200
|
+
|
|
201
|
+
const customShader = model.customShader;
|
|
202
|
+
const style = model.style;
|
|
203
|
+
|
|
204
|
+
const useWebgl2 = frameState.context.webgl2;
|
|
205
|
+
const mode = frameState.mode;
|
|
206
|
+
const use2D =
|
|
207
|
+
mode !== SceneMode.SCENE3D && !frameState.scene3DOnly && model._projectTo2D;
|
|
208
|
+
const hasVerticalExaggeration =
|
|
209
|
+
frameState.verticalExaggeration !== 1.0 && model.hasVerticalExaggeration;
|
|
210
|
+
|
|
211
|
+
const hasMorphTargets =
|
|
212
|
+
defined(primitive.morphTargets) && primitive.morphTargets.length > 0;
|
|
213
|
+
const hasSkinning = defined(node.skin);
|
|
214
|
+
|
|
215
|
+
// Check whether the model is part of a `Model3DTileContent` that
|
|
216
|
+
// belongs to a tileset that has imagery layers. If this is the
|
|
217
|
+
// case, then the `ImageryPipelineStage` will be required.
|
|
218
|
+
const hasImageryLayers = defined(model.imageryLayers);
|
|
219
|
+
|
|
220
|
+
const hasCustomShader = defined(customShader);
|
|
221
|
+
const hasCustomFragmentShader =
|
|
222
|
+
hasCustomShader && defined(customShader.fragmentShaderText);
|
|
223
|
+
const materialsEnabled =
|
|
224
|
+
!hasCustomFragmentShader ||
|
|
225
|
+
customShader.mode !== CustomShaderMode.REPLACE_MATERIAL;
|
|
226
|
+
const hasQuantization = ModelUtility.hasQuantizedAttributes(
|
|
227
|
+
primitive.attributes,
|
|
228
|
+
);
|
|
229
|
+
|
|
230
|
+
const generateWireframeIndices =
|
|
231
|
+
model.debugWireframe &&
|
|
232
|
+
PrimitiveType.isTriangles(primitive.primitiveType) &&
|
|
233
|
+
model.debugWireframeMode === "lines" &&
|
|
234
|
+
// Generating index buffers for wireframes is always possible in WebGL2.
|
|
235
|
+
// However, this will only work in WebGL1 if the model was constructed with
|
|
236
|
+
// enableDebugWireframe set to true.
|
|
237
|
+
(model._enableDebugWireframe || useWebgl2);
|
|
238
|
+
|
|
239
|
+
const generateBarycentricWireframe =
|
|
240
|
+
model.debugWireframe &&
|
|
241
|
+
PrimitiveType.isTriangles(primitive.primitiveType) &&
|
|
242
|
+
model.debugWireframeMode === "barycentric";
|
|
243
|
+
|
|
244
|
+
const pointCloudShading = model.pointCloudShading;
|
|
245
|
+
const hasAttenuation =
|
|
246
|
+
defined(pointCloudShading) && pointCloudShading.attenuation;
|
|
247
|
+
const hasPointCloudBackFaceCulling =
|
|
248
|
+
defined(pointCloudShading) && pointCloudShading.backFaceCulling;
|
|
249
|
+
const hasPointCloudStyle =
|
|
250
|
+
primitive.primitiveType === PrimitiveType.POINTS &&
|
|
251
|
+
(defined(style) || hasAttenuation || hasPointCloudBackFaceCulling);
|
|
252
|
+
|
|
253
|
+
const hasOutlines =
|
|
254
|
+
model._enableShowOutline && defined(primitive.outlineCoordinates);
|
|
255
|
+
|
|
256
|
+
const hasEdgeVisibility = defined(primitive.edgeVisibility);
|
|
257
|
+
|
|
258
|
+
const featureIdFlags = inspectFeatureIds(model, node, primitive);
|
|
259
|
+
|
|
260
|
+
const hasClassification = defined(model.classificationType);
|
|
261
|
+
|
|
262
|
+
// Start of pipeline -----------------------------------------------------
|
|
263
|
+
if (use2D) {
|
|
264
|
+
pipelineStages.push(SceneMode2DPipelineStage);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
pipelineStages.push(GeometryPipelineStage);
|
|
268
|
+
|
|
269
|
+
if (generateWireframeIndices) {
|
|
270
|
+
pipelineStages.push(WireframePipelineStage);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
if (generateBarycentricWireframe) {
|
|
274
|
+
pipelineStages.push(BarycentricWireframePipelineStage);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
if (hasClassification) {
|
|
278
|
+
pipelineStages.push(ClassificationPipelineStage);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
if (hasMorphTargets) {
|
|
282
|
+
pipelineStages.push(MorphTargetsPipelineStage);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
if (hasSkinning) {
|
|
286
|
+
pipelineStages.push(SkinningPipelineStage);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
if (hasPointCloudStyle) {
|
|
290
|
+
pipelineStages.push(PointCloudStylingPipelineStage);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
if (hasQuantization) {
|
|
294
|
+
pipelineStages.push(DequantizationPipelineStage);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
if (hasImageryLayers) {
|
|
298
|
+
if (hasOutlines) {
|
|
299
|
+
oneTimeWarning(
|
|
300
|
+
"outlines-and-draping",
|
|
301
|
+
"Primitive outlines disable imagery draping",
|
|
302
|
+
);
|
|
303
|
+
} else {
|
|
304
|
+
pipelineStages.push(ImageryPipelineStage);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
if (materialsEnabled) {
|
|
309
|
+
pipelineStages.push(MaterialPipelineStage);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
// These stages are always run to ensure structs
|
|
313
|
+
// are declared to avoid compilation errors.
|
|
314
|
+
pipelineStages.push(FeatureIdPipelineStage);
|
|
315
|
+
pipelineStages.push(MetadataPipelineStage);
|
|
316
|
+
pipelineStages.push(MetadataPickingPipelineStage);
|
|
317
|
+
|
|
318
|
+
if (featureIdFlags.hasPropertyTable && model.featureTables.length > 0) {
|
|
319
|
+
pipelineStages.push(SelectedFeatureIdPipelineStage);
|
|
320
|
+
pipelineStages.push(BatchTexturePipelineStage);
|
|
321
|
+
pipelineStages.push(CPUStylingPipelineStage);
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
if (hasVerticalExaggeration) {
|
|
325
|
+
pipelineStages.push(VerticalExaggerationPipelineStage);
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
if (hasCustomShader) {
|
|
329
|
+
pipelineStages.push(CustomShaderPipelineStage);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
pipelineStages.push(LightingPipelineStage);
|
|
333
|
+
|
|
334
|
+
if (model.allowPicking) {
|
|
335
|
+
pipelineStages.push(PickingPipelineStage);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
if (hasOutlines) {
|
|
339
|
+
pipelineStages.push(PrimitiveOutlinePipelineStage);
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
if (hasEdgeVisibility) {
|
|
343
|
+
// Indicate to Scene (after primitive updates) that the edge MRT should be enabled.
|
|
344
|
+
frameState.edgeVisibilityRequested = true;
|
|
345
|
+
pipelineStages.push(EdgeVisibilityPipelineStage);
|
|
346
|
+
pipelineStages.push(EdgeDetectionPipelineStage);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
pipelineStages.push(AlphaPipelineStage);
|
|
350
|
+
|
|
351
|
+
pipelineStages.push(PrimitiveStatisticsPipelineStage);
|
|
352
|
+
|
|
353
|
+
return;
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
function inspectFeatureIds(model, node, primitive) {
|
|
357
|
+
let featureIds;
|
|
358
|
+
// Check instances first, as this is the most specific type of
|
|
359
|
+
// feature ID
|
|
360
|
+
if (defined(node.instances)) {
|
|
361
|
+
featureIds = ModelUtility.getFeatureIdsByLabel(
|
|
362
|
+
node.instances.featureIds,
|
|
363
|
+
model.instanceFeatureIdLabel,
|
|
364
|
+
);
|
|
365
|
+
|
|
366
|
+
if (defined(featureIds)) {
|
|
367
|
+
return {
|
|
368
|
+
hasFeatureIds: true,
|
|
369
|
+
hasPropertyTable: defined(featureIds.propertyTableId),
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
featureIds = ModelUtility.getFeatureIdsByLabel(
|
|
375
|
+
primitive.featureIds,
|
|
376
|
+
model.featureIdLabel,
|
|
377
|
+
);
|
|
378
|
+
if (defined(featureIds)) {
|
|
379
|
+
return {
|
|
380
|
+
hasFeatureIds: true,
|
|
381
|
+
hasPropertyTable: defined(featureIds.propertyTableId),
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
return {
|
|
386
|
+
hasFeatureIds: false,
|
|
387
|
+
hasPropertyTable: false,
|
|
388
|
+
};
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
export default ModelRuntimePrimitive;
|