@hztxi/cesium-engine 25.0.4 → 25.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-247MLVK2.js +124 -0
- package/Build/Workers/chunk-26I7TIAE.js +58 -0
- package/Build/Workers/chunk-26OYTC24.js +38 -0
- package/Build/Workers/chunk-2GJAWJJT.js +1344 -0
- package/Build/Workers/chunk-2IMOZG7R.js +973 -0
- package/Build/Workers/chunk-2J2VS5RI.js +288 -0
- package/Build/Workers/chunk-2L6JGSYJ.js +57 -0
- package/Build/Workers/chunk-32N2SB76.js +56 -0
- package/Build/Workers/chunk-375SHKGW.js +44 -0
- package/Build/Workers/chunk-37WL527K.js +1287 -0
- package/Build/Workers/chunk-3IGH46TC.js +1054 -0
- package/Build/Workers/chunk-47BSFGJC.js +837 -0
- package/Build/Workers/chunk-4J7PL5AM.js +454 -0
- package/Build/Workers/chunk-4UMO63VY.js +76 -0
- package/Build/Workers/chunk-5FYUSABU.js +945 -0
- package/Build/Workers/chunk-5WU37CUJ.js +630 -0
- package/Build/Workers/chunk-5YI3TQQC.js +778 -0
- package/Build/Workers/chunk-6EBDN5WS.js +97 -0
- package/Build/Workers/chunk-75HIWCEV.js +301 -0
- package/Build/Workers/chunk-7AMVPXZY.js +1992 -0
- package/Build/Workers/chunk-7BMDD6SM.js +124 -0
- package/Build/Workers/chunk-7OME2OKM.js +171 -0
- package/Build/Workers/chunk-A2BROW3D.js +352 -0
- package/Build/Workers/chunk-AEZQ2UWS.js +288 -0
- package/Build/Workers/chunk-AXE2ZIEG.js +219 -0
- package/Build/Workers/chunk-B4XOVZGA.js +476 -0
- package/Build/Workers/chunk-BDR7GL3E.js +1067 -0
- package/Build/Workers/chunk-C342XITR.js +44 -0
- package/Build/Workers/chunk-CDLPLYLV.js +1287 -0
- package/Build/Workers/chunk-CEKCKPFN.js +368 -0
- package/Build/Workers/chunk-CHMDKP5L.js +2342 -0
- package/Build/Workers/chunk-CWAUXQRF.js +754 -0
- package/Build/Workers/chunk-CWGB3D4Z.js +257 -0
- package/Build/Workers/chunk-DQEUGBGA.js +2719 -0
- package/Build/Workers/chunk-DUBE5G2H.js +497 -0
- package/Build/Workers/chunk-E4PBNWWK.js +58 -0
- package/Build/Workers/chunk-E5F7LDEP.js +3201 -0
- package/Build/Workers/chunk-E5MWOMVC.js +57 -0
- package/Build/Workers/chunk-EE3XBOQI.js +1483 -0
- package/Build/Workers/chunk-EHA2ZDPZ.js +415 -0
- package/Build/Workers/chunk-EKEKPAJF.js +454 -0
- package/Build/Workers/chunk-EOHKUXPX.js +198 -0
- package/Build/Workers/chunk-ERENMHG2.js +754 -0
- package/Build/Workers/chunk-ESQGFRLZ.js +163 -0
- package/Build/Workers/chunk-FAKYMBUA.js +1046 -0
- package/Build/Workers/chunk-FSK4OZOO.js +352 -0
- package/Build/Workers/chunk-FSLRYNZ6.js +682 -0
- package/Build/Workers/chunk-FV4OWDV4.js +9230 -0
- package/Build/Workers/chunk-FYRNNQSL.js +280 -0
- package/Build/Workers/chunk-GMDOGAXK.js +2719 -0
- package/Build/Workers/chunk-GRAFCIPA.js +455 -0
- package/Build/Workers/chunk-HEY4IOS3.js +140 -0
- package/Build/Workers/chunk-HRWFO57T.js +301 -0
- package/Build/Workers/chunk-HTCLVUBZ.js +82 -0
- package/Build/Workers/chunk-I2Q7XDRA.js +630 -0
- package/Build/Workers/chunk-ILPH3NF7.js +3794 -0
- package/Build/Workers/chunk-JMF4ATAS.js +3794 -0
- package/Build/Workers/chunk-JZUUODN6.js +97 -0
- package/Build/Workers/chunk-KEJKMITY.js +82 -0
- package/Build/Workers/chunk-KW2QZDUS.js +147 -0
- package/Build/Workers/chunk-KWVB54J6.js +241 -0
- package/Build/Workers/chunk-L6B5XPBL.js +73 -0
- package/Build/Workers/chunk-LGJXN2VP.js +352 -0
- package/Build/Workers/chunk-LY2UG3HV.js +38 -0
- package/Build/Workers/chunk-M3B3ZUU2.js +476 -0
- package/Build/Workers/chunk-MKR6YCMG.js +497 -0
- package/Build/Workers/chunk-MROMS2RL.js +162 -0
- package/Build/Workers/chunk-MUNAUSK7.js +280 -0
- package/Build/Workers/chunk-NCPJBP24.js +140 -0
- package/Build/Workers/chunk-NFY5V6MR.js +102 -0
- package/Build/Workers/chunk-NHU5JEPP.js +1344 -0
- package/Build/Workers/chunk-OODXPB45.js +73 -0
- package/Build/Workers/chunk-OXZ5J3JW.js +368 -0
- package/Build/Workers/chunk-OYPSUED3.js +1067 -0
- package/Build/Workers/chunk-QBSWSTHY.js +257 -0
- package/Build/Workers/chunk-QDJYG7QL.js +352 -0
- package/Build/Workers/chunk-QIOOTLWN.js +56 -0
- package/Build/Workers/chunk-QUPRALOD.js +101 -0
- package/Build/Workers/chunk-RBEVHHXK.js +3201 -0
- package/Build/Workers/chunk-RHO5HV52.js +305 -0
- package/Build/Workers/chunk-RX3U2BBW.js +1483 -0
- package/Build/Workers/chunk-S3XHL7GO.js +1992 -0
- package/Build/Workers/chunk-SBIC4OGS.js +171 -0
- package/Build/Workers/chunk-SVCZUP5R.js +837 -0
- package/Build/Workers/chunk-T4CYNROE.js +102 -0
- package/Build/Workers/chunk-T5VLPB4H.js +414 -0
- package/Build/Workers/chunk-TBHW5UME.js +973 -0
- package/Build/Workers/chunk-TPOX6IOR.js +1054 -0
- package/Build/Workers/chunk-TX763OWB.js +387 -0
- package/Build/Workers/chunk-ULNBTI6R.js +138 -0
- package/Build/Workers/chunk-UMUS2AQQ.js +398 -0
- package/Build/Workers/chunk-UTAWMCSE.js +163 -0
- package/Build/Workers/chunk-UZ7GTP2L.js +162 -0
- package/Build/Workers/chunk-VETQOADR.js +2342 -0
- package/Build/Workers/chunk-VXRWOM3T.js +101 -0
- package/Build/Workers/chunk-W3C7OHXF.js +387 -0
- package/Build/Workers/chunk-WB5GWYDP.js +455 -0
- package/Build/Workers/chunk-WN6MAL25.js +682 -0
- package/Build/Workers/chunk-WTR7KMQA.js +693 -0
- package/Build/Workers/chunk-WTTFMU3P.js +241 -0
- package/Build/Workers/chunk-WULONJZC.js +1800 -0
- package/Build/Workers/chunk-WVVFCMYF.js +147 -0
- package/Build/Workers/chunk-WZPMAVTV.js +511 -0
- package/Build/Workers/chunk-XAVNBZQ6.js +56 -0
- package/Build/Workers/chunk-XDSDR62Y.js +1800 -0
- package/Build/Workers/chunk-XDZCVNIZ.js +198 -0
- package/Build/Workers/chunk-XNLCW2OI.js +138 -0
- package/Build/Workers/chunk-XNQ2BTJD.js +693 -0
- package/Build/Workers/chunk-XZYBDSFP.js +305 -0
- package/Build/Workers/chunk-Y7KVUJEB.js +219 -0
- package/Build/Workers/chunk-YDYN3RPI.js +398 -0
- package/Build/Workers/chunk-YMMEQBEW.js +511 -0
- package/Build/Workers/chunk-YQFOQAXD.js +9230 -0
- package/Build/Workers/chunk-Z6JV4DZG.js +1046 -0
- package/Build/Workers/chunk-ZTK5EBUI.js +76 -0
- package/Build/Workers/chunk-ZZPDORJK.js +56 -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 +95 -31
- 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 +26 -26
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +23 -23
- package/Build/Workers/createVerticesFromHeightmap.js +23 -23
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +21 -21
- 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 +23 -23
- package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +26 -26
- package/Source/Core/GroundPolylineGeometry.js +99 -4
- package/Source/Core/PolylinePipeline.js +9 -2
- package/Source/DataSources/PolylineGeometryUpdater.js +125 -7
- package/Source/Scene/Camera.js +56 -3
- package/Source/Scene/CameraFlightPath.js +14 -0
- package/Source/Scene/ClassificationPrimitive.js +63 -3
- package/Source/Scene/ColumbusWorlds.js +190 -0
- package/Source/Scene/FrameState.js +10 -0
- package/Source/Scene/Globe.js +89 -22
- package/Source/Scene/GlobeDepth.js +216 -5
- package/Source/Scene/GlobeSurfaceTileProvider.js +897 -678
- package/Source/Scene/GroundPolylinePrimitive.js +2 -1
- package/Source/Scene/Polyline.js +32 -5
- package/Source/Scene/PolylineCollection.js +41 -2
- package/Source/Scene/Primitive.js +12 -13
- package/Source/Scene/PrimitivePipeline.js +158 -28
- package/Source/Scene/Scene.js +428 -5
- package/Source/Scene/SceneTransforms.js +17 -0
- package/Source/Scene/ScreenSpaceCameraController.js +12 -3
- package/Source/Shaders/PolylineShadowVolumeFS.glsl +14 -0
- package/Source/Shaders/PolylineShadowVolumeFS.js +14 -0
- package/Source/Shaders/PolylineShadowVolumeMorphVS.glsl +14 -1
- package/Source/Shaders/PolylineShadowVolumeMorphVS.js +14 -1
- package/Source/Shaders/PolylineShadowVolumeVS.glsl +7 -0
- package/Source/Shaders/PolylineShadowVolumeVS.js +7 -0
- package/Source/Shaders/PolylineVS.glsl +16 -6
- package/Source/Shaders/PolylineVS.js +16 -6
- package/Source/Shaders/RestoreDepth.glsl +8 -0
- package/Source/Shaders/RestoreDepth.js +10 -0
- package/Source/ThirdParty/zip-module.wasm +0 -0
- package/index.d.ts +535 -1393
- package/index.js +267 -265
- package/package.json +10 -10
package/Source/Scene/Globe.js
CHANGED
|
@@ -20,6 +20,7 @@ import GlobeFS from "../Shaders/GlobeFS.js";
|
|
|
20
20
|
import GlobeVS from "../Shaders/GlobeVS.js";
|
|
21
21
|
import AtmosphereCommon from "../Shaders/AtmosphereCommon.js";
|
|
22
22
|
import GroundAtmosphere from "../Shaders/GroundAtmosphere.js";
|
|
23
|
+
import ColumbusWorlds from "./ColumbusWorlds.js";
|
|
23
24
|
import GlobeSurfaceShaderSet from "./GlobeSurfaceShaderSet.js";
|
|
24
25
|
import GlobeSurfaceTileProvider from "./GlobeSurfaceTileProvider.js";
|
|
25
26
|
import GlobeTranslucency from "./GlobeTranslucency.js";
|
|
@@ -724,24 +725,28 @@ function makeShadersDirty(globe) {
|
|
|
724
725
|
|
|
725
726
|
function createComparePickTileFunction(rayOrigin) {
|
|
726
727
|
return function (a, b) {
|
|
727
|
-
const aDist = BoundingSphere.distanceSquaredTo(
|
|
728
|
-
|
|
729
|
-
rayOrigin,
|
|
730
|
-
);
|
|
731
|
-
const bDist = BoundingSphere.distanceSquaredTo(
|
|
732
|
-
b.pickBoundingSphere,
|
|
733
|
-
rayOrigin,
|
|
734
|
-
);
|
|
728
|
+
const aDist = BoundingSphere.distanceSquaredTo(a.sphere, rayOrigin);
|
|
729
|
+
const bDist = BoundingSphere.distanceSquaredTo(b.sphere, rayOrigin);
|
|
735
730
|
|
|
736
731
|
return aDist - bDist;
|
|
737
732
|
};
|
|
738
733
|
}
|
|
739
734
|
|
|
735
|
+
// Columbus repeat worlds: how many translated world copies to test on either
|
|
736
|
+
// side of the pick ray's own world when repeat worlds are enabled.
|
|
737
|
+
const GLOBE_COLUMBUS_MAX_EXTRA_WORLDS = 2;
|
|
738
|
+
|
|
739
|
+
function getGlobeColumbusWorldWidth(projection) {
|
|
740
|
+
return ColumbusWorlds.getWorldWidth(projection);
|
|
741
|
+
}
|
|
742
|
+
|
|
740
743
|
const scratchArray = [];
|
|
741
744
|
const scratchSphereIntersectionResult = {
|
|
742
745
|
start: 0.0,
|
|
743
746
|
stop: 0.0,
|
|
744
747
|
};
|
|
748
|
+
const scratchPickOffsetSphere = new BoundingSphere();
|
|
749
|
+
const scratchColumbusPickRay = new Ray();
|
|
745
750
|
|
|
746
751
|
/**
|
|
747
752
|
* Find an intersection between a ray and the globe surface that was rendered. The ray must be given in world coordinates.
|
|
@@ -774,6 +779,12 @@ Globe.prototype.pickWorldCoordinates = function (
|
|
|
774
779
|
const mode = scene.mode;
|
|
775
780
|
const projection = scene.mapProjection;
|
|
776
781
|
|
|
782
|
+
const repeatWorlds =
|
|
783
|
+
scene.columbusRepeatWorlds === true && mode === SceneMode.COLUMBUS_VIEW;
|
|
784
|
+
const worldWidth = repeatWorlds
|
|
785
|
+
? getGlobeColumbusWorldWidth(projection)
|
|
786
|
+
: 0.0;
|
|
787
|
+
|
|
777
788
|
const sphereIntersections = scratchArray;
|
|
778
789
|
sphereIntersections.length = 0;
|
|
779
790
|
|
|
@@ -810,13 +821,48 @@ Globe.prototype.pickWorldCoordinates = function (
|
|
|
810
821
|
continue;
|
|
811
822
|
}
|
|
812
823
|
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
824
|
+
if (!repeatWorlds) {
|
|
825
|
+
const boundingSphereIntersection = IntersectionTests.raySphere(
|
|
826
|
+
ray,
|
|
827
|
+
boundingVolume,
|
|
828
|
+
scratchSphereIntersectionResult,
|
|
829
|
+
);
|
|
830
|
+
if (defined(boundingSphereIntersection)) {
|
|
831
|
+
sphereIntersections.push({
|
|
832
|
+
surfaceTile,
|
|
833
|
+
sphere: boundingVolume,
|
|
834
|
+
offset: 0.0,
|
|
835
|
+
});
|
|
836
|
+
}
|
|
837
|
+
continue;
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
// Columbus repeat worlds: a translated copy of this tile may be hit even
|
|
841
|
+
// when the primary sphere is not. Test the copies around the ray's own
|
|
842
|
+
// world so points beyond the ±180° meridian pick correctly.
|
|
843
|
+
const rayWorld = Math.round(ray.origin.y / worldWidth);
|
|
844
|
+
for (
|
|
845
|
+
let w = rayWorld - GLOBE_COLUMBUS_MAX_EXTRA_WORLDS;
|
|
846
|
+
w <= rayWorld + GLOBE_COLUMBUS_MAX_EXTRA_WORLDS;
|
|
847
|
+
++w
|
|
848
|
+
) {
|
|
849
|
+
const offset = w * worldWidth;
|
|
850
|
+
const offsetSphere = scratchPickOffsetSphere;
|
|
851
|
+
Cartesian3.clone(boundingVolume.center, offsetSphere.center);
|
|
852
|
+
offsetSphere.center.y += offset;
|
|
853
|
+
offsetSphere.radius = boundingVolume.radius;
|
|
854
|
+
const boundingSphereIntersection = IntersectionTests.raySphere(
|
|
855
|
+
ray,
|
|
856
|
+
offsetSphere,
|
|
857
|
+
scratchSphereIntersectionResult,
|
|
858
|
+
);
|
|
859
|
+
if (defined(boundingSphereIntersection)) {
|
|
860
|
+
sphereIntersections.push({
|
|
861
|
+
surfaceTile,
|
|
862
|
+
sphere: BoundingSphere.clone(offsetSphere, new BoundingSphere()),
|
|
863
|
+
offset,
|
|
864
|
+
});
|
|
865
|
+
}
|
|
820
866
|
}
|
|
821
867
|
}
|
|
822
868
|
|
|
@@ -825,13 +871,34 @@ Globe.prototype.pickWorldCoordinates = function (
|
|
|
825
871
|
let intersection;
|
|
826
872
|
const length = sphereIntersections.length;
|
|
827
873
|
for (let i = 0; i < length; ++i) {
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
874
|
+
const candidate = sphereIntersections[i];
|
|
875
|
+
const offset = candidate.offset;
|
|
876
|
+
if (offset === 0.0) {
|
|
877
|
+
intersection = candidate.surfaceTile.pick(
|
|
878
|
+
ray,
|
|
879
|
+
scene.mode,
|
|
880
|
+
scene.mapProjection,
|
|
881
|
+
cullBackFaces,
|
|
882
|
+
result,
|
|
883
|
+
);
|
|
884
|
+
} else {
|
|
885
|
+
// Pick against the copy by shifting the ray into the primary world,
|
|
886
|
+
// then shifting the hit point back onto the copy.
|
|
887
|
+
const pickRay = scratchColumbusPickRay;
|
|
888
|
+
Cartesian3.clone(ray.origin, pickRay.origin);
|
|
889
|
+
pickRay.origin.y -= offset;
|
|
890
|
+
Cartesian3.clone(ray.direction, pickRay.direction);
|
|
891
|
+
intersection = candidate.surfaceTile.pick(
|
|
892
|
+
pickRay,
|
|
893
|
+
scene.mode,
|
|
894
|
+
scene.mapProjection,
|
|
895
|
+
cullBackFaces,
|
|
896
|
+
result,
|
|
897
|
+
);
|
|
898
|
+
if (defined(intersection)) {
|
|
899
|
+
intersection.y += offset;
|
|
900
|
+
}
|
|
901
|
+
}
|
|
835
902
|
if (defined(intersection)) {
|
|
836
903
|
break;
|
|
837
904
|
}
|
|
@@ -8,7 +8,9 @@ import PixelDatatype from "../Renderer/PixelDatatype.js";
|
|
|
8
8
|
import RenderState from "../Renderer/RenderState.js";
|
|
9
9
|
import PassThrough from "../Shaders/PostProcessStages/PassThrough.js";
|
|
10
10
|
import PassThroughDepth from "../Shaders/PostProcessStages/PassThroughDepth.js";
|
|
11
|
+
import RestoreDepth from "../Shaders/RestoreDepth.js";
|
|
11
12
|
import BlendingState from "./BlendingState.js";
|
|
13
|
+
import DepthFunction from "./DepthFunction.js";
|
|
12
14
|
import StencilConstants from "./StencilConstants.js";
|
|
13
15
|
import StencilFunction from "./StencilFunction.js";
|
|
14
16
|
import StencilOperation from "./StencilOperation.js";
|
|
@@ -33,6 +35,12 @@ function GlobeDepth() {
|
|
|
33
35
|
supportsDepthTexture: true,
|
|
34
36
|
});
|
|
35
37
|
this._copyDepthFramebuffer = new FramebufferManager();
|
|
38
|
+
// Extra globe depth copies for frustum 1..n. Each frustum packs depth
|
|
39
|
+
// against its own near/far, so a single shared copy cannot be decoded
|
|
40
|
+
// correctly by the other frustums (e.g. a Columbus world copy pass).
|
|
41
|
+
this._copyDepthFramebuffers = [];
|
|
42
|
+
this._copyDepthCommands = [];
|
|
43
|
+
this._restoreDepthCommands = [];
|
|
36
44
|
this._tempCopyDepthFramebuffer = new FramebufferManager();
|
|
37
45
|
this._updateDepthFramebuffer = new FramebufferManager({
|
|
38
46
|
createColorAttachments: false,
|
|
@@ -50,6 +58,7 @@ function GlobeDepth() {
|
|
|
50
58
|
this._rs = undefined;
|
|
51
59
|
this._rsBlend = undefined;
|
|
52
60
|
this._rsUpdate = undefined;
|
|
61
|
+
this._rsRestoreDepth = undefined;
|
|
53
62
|
|
|
54
63
|
this._useScissorTest = false;
|
|
55
64
|
this._scissorRectangle = undefined;
|
|
@@ -149,6 +158,29 @@ function updateCopyCommands(globeDepth, context, width, height, passState) {
|
|
|
149
158
|
mask: StencilConstants.CESIUM_3D_TILE_MASK,
|
|
150
159
|
},
|
|
151
160
|
});
|
|
161
|
+
|
|
162
|
+
// Writes a depth copy back into the depth buffer. Color writes are off and
|
|
163
|
+
// the quad's fragment depth comes from the sampled texture. The depth test
|
|
164
|
+
// must stay enabled (ALWAYS): a disabled depth test discards the write, so
|
|
165
|
+
// the quad would only paint color and never restore the buffer.
|
|
166
|
+
globeDepth._rsRestoreDepth = RenderState.fromCache({
|
|
167
|
+
viewport: viewport,
|
|
168
|
+
scissorTest: {
|
|
169
|
+
enabled: globeDepth._useScissorTest,
|
|
170
|
+
rectangle: globeDepth._scissorRectangle,
|
|
171
|
+
},
|
|
172
|
+
colorMask: {
|
|
173
|
+
red: false,
|
|
174
|
+
green: false,
|
|
175
|
+
blue: false,
|
|
176
|
+
alpha: false,
|
|
177
|
+
},
|
|
178
|
+
depthTest: {
|
|
179
|
+
enabled: true,
|
|
180
|
+
func: DepthFunction.ALWAYS,
|
|
181
|
+
},
|
|
182
|
+
depthMask: true,
|
|
183
|
+
});
|
|
152
184
|
}
|
|
153
185
|
|
|
154
186
|
if (!defined(globeDepth._copyDepthCommand)) {
|
|
@@ -272,6 +304,12 @@ GlobeDepth.prototype.update = function (
|
|
|
272
304
|
);
|
|
273
305
|
}
|
|
274
306
|
this._copyDepthFramebuffer.update(context, width, height);
|
|
307
|
+
for (let i = 0; i < this._copyDepthFramebuffers.length; i++) {
|
|
308
|
+
const framebuffer = this._copyDepthFramebuffers[i];
|
|
309
|
+
if (defined(framebuffer)) {
|
|
310
|
+
framebuffer.update(context, width, height);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
275
313
|
updateCopyCommands(this, context, width, height, passState);
|
|
276
314
|
context.uniformState.globeDepthTexture = undefined;
|
|
277
315
|
|
|
@@ -292,13 +330,165 @@ GlobeDepth.prototype.prepareColorTextures = function (context, blitStencil) {
|
|
|
292
330
|
}
|
|
293
331
|
};
|
|
294
332
|
|
|
295
|
-
|
|
296
|
-
|
|
333
|
+
/**
|
|
334
|
+
* Returns the copy depth framebuffer for a frustum, creating it on demand.
|
|
335
|
+
*
|
|
336
|
+
* @param {Context} context The context used for rendering.
|
|
337
|
+
* @param {number} frustumIndex The index of the frustum.
|
|
338
|
+
* @returns {FramebufferManager|undefined} The framebuffer manager, or
|
|
339
|
+
* <code>undefined</code> for frustum 0 (the shared copy).
|
|
340
|
+
*
|
|
341
|
+
* @private
|
|
342
|
+
*/
|
|
343
|
+
GlobeDepth.prototype._getFrustumCopyDepthFramebuffer = function (
|
|
344
|
+
context,
|
|
345
|
+
frustumIndex,
|
|
346
|
+
) {
|
|
347
|
+
if (frustumIndex === 0) {
|
|
348
|
+
return this._copyDepthFramebuffer;
|
|
349
|
+
}
|
|
350
|
+
let framebuffer = this._copyDepthFramebuffers[frustumIndex];
|
|
351
|
+
if (!defined(framebuffer)) {
|
|
352
|
+
framebuffer = this._copyDepthFramebuffers[frustumIndex] =
|
|
353
|
+
new FramebufferManager();
|
|
354
|
+
const mainColorTexture = this._copyDepthFramebuffer.getColorTexture();
|
|
355
|
+
if (defined(mainColorTexture)) {
|
|
356
|
+
framebuffer.update(
|
|
357
|
+
context,
|
|
358
|
+
mainColorTexture.width,
|
|
359
|
+
mainColorTexture.height,
|
|
360
|
+
);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
return framebuffer;
|
|
364
|
+
};
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* Returns the copy depth command for a frustum, creating it on demand.
|
|
368
|
+
*
|
|
369
|
+
* @param {Context} context The context used for rendering.
|
|
370
|
+
* @param {number} frustumIndex The index of the frustum.
|
|
371
|
+
* @returns {ViewportQuadCommand|undefined} The command, or <code>undefined</code>.
|
|
372
|
+
*
|
|
373
|
+
* @private
|
|
374
|
+
*/
|
|
375
|
+
GlobeDepth.prototype._getFrustumCopyDepthCommand = function (
|
|
376
|
+
context,
|
|
377
|
+
frustumIndex,
|
|
378
|
+
) {
|
|
379
|
+
if (frustumIndex === 0) {
|
|
380
|
+
return this._copyDepthCommand;
|
|
381
|
+
}
|
|
382
|
+
let command = this._copyDepthCommands[frustumIndex];
|
|
383
|
+
if (!defined(command)) {
|
|
384
|
+
const globeDepth = this;
|
|
385
|
+
command = this._copyDepthCommands[frustumIndex] =
|
|
386
|
+
context.createViewportQuadCommand(PassThroughDepth, {
|
|
387
|
+
uniformMap: {
|
|
388
|
+
u_depthTexture: function () {
|
|
389
|
+
return globeDepth.colorFramebufferManager.getDepthStencilTexture();
|
|
390
|
+
},
|
|
391
|
+
},
|
|
392
|
+
owner: globeDepth,
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
command.renderState = this._rs;
|
|
396
|
+
command.framebuffer = this._getFrustumCopyDepthFramebuffer(
|
|
397
|
+
context,
|
|
398
|
+
frustumIndex,
|
|
399
|
+
).framebuffer;
|
|
400
|
+
return command;
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* Copy the current globe depth into the copy depth texture of a frustum and
|
|
405
|
+
* make it the active <code>czm_globeDepthTexture</code>.
|
|
406
|
+
*
|
|
407
|
+
* @param {Context} context The context used for rendering.
|
|
408
|
+
* @param {PassState} passState Render state for subsequent rendering passes.
|
|
409
|
+
* @param {number} [frustumIndex=0] The index of the frustum being rendered.
|
|
410
|
+
*
|
|
411
|
+
* @private
|
|
412
|
+
*/
|
|
413
|
+
GlobeDepth.prototype.executeCopyDepth = function (
|
|
414
|
+
context,
|
|
415
|
+
passState,
|
|
416
|
+
frustumIndex,
|
|
417
|
+
) {
|
|
418
|
+
const index = defined(frustumIndex) ? frustumIndex : 0;
|
|
419
|
+
const framebuffer = this._getFrustumCopyDepthFramebuffer(context, index);
|
|
420
|
+
const command = this._getFrustumCopyDepthCommand(context, index);
|
|
421
|
+
if (defined(command)) {
|
|
297
422
|
this.prepareColorTextures(context);
|
|
298
|
-
|
|
299
|
-
context.uniformState.globeDepthTexture =
|
|
300
|
-
|
|
423
|
+
command.execute(context, passState);
|
|
424
|
+
context.uniformState.globeDepthTexture = framebuffer.getColorTexture();
|
|
425
|
+
}
|
|
426
|
+
};
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* Make an already copied globe depth texture the active
|
|
430
|
+
* <code>czm_globeDepthTexture</code>. Used by the Columbus world copy pass,
|
|
431
|
+
* which re-executes the classification commands of a primary frustum and must
|
|
432
|
+
* therefore read the depth copy produced for that same frustum.
|
|
433
|
+
*
|
|
434
|
+
* @param {Context} context The context used for rendering.
|
|
435
|
+
* @param {number} [frustumIndex=0] The index of the frustum.
|
|
436
|
+
*
|
|
437
|
+
* @private
|
|
438
|
+
*/
|
|
439
|
+
GlobeDepth.prototype.useCopyDepth = function (context, frustumIndex) {
|
|
440
|
+
const index = defined(frustumIndex) ? frustumIndex : 0;
|
|
441
|
+
let framebuffer = index > 0 ? this._copyDepthFramebuffers[index] : undefined;
|
|
442
|
+
if (!defined(framebuffer) || !defined(framebuffer.framebuffer)) {
|
|
443
|
+
// The requested frustum never produced a copy (e.g. the primary pass was
|
|
444
|
+
// skipped this frame); keep the shared copy so the uniform stays defined.
|
|
445
|
+
framebuffer = this._copyDepthFramebuffer;
|
|
446
|
+
}
|
|
447
|
+
context.uniformState.globeDepthTexture = framebuffer.getColorTexture();
|
|
448
|
+
};
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* Writes an already copied globe depth back into the depth buffer, so terrain
|
|
452
|
+
* classification can be re-executed after the primary pass finished. Ground
|
|
453
|
+
* classification needs the terrain depth in the buffer (its stencil pass depth
|
|
454
|
+
* tests the shadow volume against it), but the scene clears the globe depth
|
|
455
|
+
* after the primary classification pass whenever
|
|
456
|
+
* {@link Globe#depthTestAgainstTerrain} is off - the walkthrough used by the
|
|
457
|
+
* Columbus world copy pass then classifies against an empty buffer and draws
|
|
458
|
+
* nothing.
|
|
459
|
+
*
|
|
460
|
+
* @param {Context} context The context used for rendering.
|
|
461
|
+
* @param {PassState} passState The render pass state, whose framebuffer must be the one that receives the depth.
|
|
462
|
+
* @param {number} [frustumIndex=0] The index of the frustum whose copy should be restored.
|
|
463
|
+
*
|
|
464
|
+
* @private
|
|
465
|
+
*/
|
|
466
|
+
GlobeDepth.prototype.executeRestoreDepth = function (
|
|
467
|
+
context,
|
|
468
|
+
passState,
|
|
469
|
+
frustumIndex,
|
|
470
|
+
) {
|
|
471
|
+
const index = defined(frustumIndex) ? frustumIndex : 0;
|
|
472
|
+
const framebuffer = this._getFrustumCopyDepthFramebuffer(context, index);
|
|
473
|
+
const renderState = this._rsRestoreDepth;
|
|
474
|
+
if (!defined(framebuffer.getColorTexture()) || !defined(renderState)) {
|
|
475
|
+
return;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
let command = this._restoreDepthCommands[index];
|
|
479
|
+
if (!defined(command)) {
|
|
480
|
+
command = this._restoreDepthCommands[index] =
|
|
481
|
+
context.createViewportQuadCommand(RestoreDepth, {
|
|
482
|
+
uniformMap: {
|
|
483
|
+
u_depthTexture: function () {
|
|
484
|
+
return framebuffer.getColorTexture();
|
|
485
|
+
},
|
|
486
|
+
},
|
|
487
|
+
owner: this,
|
|
488
|
+
});
|
|
301
489
|
}
|
|
490
|
+
command.renderState = renderState;
|
|
491
|
+
command.execute(context, passState);
|
|
302
492
|
};
|
|
303
493
|
|
|
304
494
|
/**
|
|
@@ -379,6 +569,27 @@ GlobeDepth.prototype.destroy = function () {
|
|
|
379
569
|
this._pickColorFramebuffer.destroy();
|
|
380
570
|
this._outputFramebuffer.destroy();
|
|
381
571
|
this._copyDepthFramebuffer.destroy();
|
|
572
|
+
for (let i = 0; i < this._copyDepthFramebuffers.length; i++) {
|
|
573
|
+
const framebuffer = this._copyDepthFramebuffers[i];
|
|
574
|
+
if (defined(framebuffer)) {
|
|
575
|
+
framebuffer.destroy();
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
this._copyDepthFramebuffers.length = 0;
|
|
579
|
+
for (let i = 0; i < this._copyDepthCommands.length; i++) {
|
|
580
|
+
const command = this._copyDepthCommands[i];
|
|
581
|
+
if (defined(command) && defined(command.shaderProgram)) {
|
|
582
|
+
command.shaderProgram = command.shaderProgram.destroy();
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
this._copyDepthCommands.length = 0;
|
|
586
|
+
for (let i = 0; i < this._restoreDepthCommands.length; i++) {
|
|
587
|
+
const command = this._restoreDepthCommands[i];
|
|
588
|
+
if (defined(command) && defined(command.shaderProgram)) {
|
|
589
|
+
command.shaderProgram = command.shaderProgram.destroy();
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
this._restoreDepthCommands.length = 0;
|
|
382
593
|
this._tempCopyDepthFramebuffer.destroy();
|
|
383
594
|
this._updateDepthFramebuffer.destroy();
|
|
384
595
|
|