@cesium/engine 20.0.1 → 21.0.0
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/ThirdParty/Workers/zip-web-worker.js +637 -0
- package/Build/Workers/{chunk-7P7R7ERW.js → chunk-2T4WAVWX.js} +6 -6
- package/Build/Workers/{chunk-DNMSVJ4S.js → chunk-3G5XEUPY.js} +1 -1
- package/Build/Workers/{chunk-O7KDJVRH.js → chunk-3MSNTCHW.js} +9 -9
- package/Build/Workers/{chunk-7MCEUVPM.js → chunk-3OPG2FGI.js} +4 -4
- package/Build/Workers/{chunk-M4FSVD3C.js → chunk-3PUG3T2H.js} +12 -12
- package/Build/Workers/{chunk-CTU7LCVZ.js → chunk-4PH27XAL.js} +2 -2
- package/Build/Workers/{chunk-ZBLPNAYB.js → chunk-4VJYMLR6.js} +8 -8
- package/Build/Workers/{chunk-DAZVD3AH.js → chunk-5B3PGBQW.js} +11 -11
- package/Build/Workers/{chunk-UXIZVXIR.js → chunk-5GHCWGC4.js} +1 -1
- package/Build/Workers/{chunk-HZ22ZI3Q.js → chunk-5PEQUMCB.js} +12 -12
- package/Build/Workers/{chunk-HSVZWLJD.js → chunk-64WSG7AT.js} +4 -4
- package/Build/Workers/{chunk-ZJGO7T2S.js → chunk-6J6WGCWP.js} +4 -4
- package/Build/Workers/{chunk-OWV4L2GH.js → chunk-75B34CC6.js} +5 -5
- package/Build/Workers/{chunk-4MCKK5XE.js → chunk-7PLX65MV.js} +5 -5
- package/Build/Workers/{chunk-YVAOKOKX.js → chunk-AR2FUSG6.js} +1 -1
- package/Build/Workers/{chunk-JVNWWKXF.js → chunk-ARYRHDEB.js} +6 -6
- package/Build/Workers/{chunk-DAGWF5MM.js → chunk-B7INTBBB.js} +13 -13
- package/Build/Workers/{chunk-WNEY4A5P.js → chunk-BDPSQXLX.js} +5 -5
- package/Build/Workers/{chunk-LYKXQPGW.js → chunk-BU4CGMHO.js} +6 -6
- package/Build/Workers/{chunk-ECGKCTPM.js → chunk-BUBVUXDO.js} +6 -6
- package/Build/Workers/{chunk-LSYTMSIQ.js → chunk-CF72FAKC.js} +4 -4
- package/Build/Workers/{chunk-LZZA3PAR.js → chunk-DJ4ROETJ.js} +5 -5
- package/Build/Workers/{chunk-YNRRVRHO.js → chunk-E5XCZVIY.js} +1 -1
- package/Build/Workers/{chunk-RP4KKY2E.js → chunk-EAYW4CFP.js} +16 -16
- package/Build/Workers/{chunk-YW2UXIBU.js → chunk-EHFMZFVC.js} +4 -4
- package/Build/Workers/{chunk-HKHD5FDM.js → chunk-FFCKCQPK.js} +5 -5
- package/Build/Workers/{chunk-VQLQAENU.js → chunk-GKCZ2G36.js} +7 -7
- package/Build/Workers/{chunk-DJCPJJSP.js → chunk-HJ7IZBEI.js} +4 -4
- package/Build/Workers/{chunk-7FEVXX5D.js → chunk-JJZWDROM.js} +2 -2
- package/Build/Workers/{chunk-SLPWFCXZ.js → chunk-JUOEBO4F.js} +10 -10
- package/Build/Workers/{chunk-LHZKPI55.js → chunk-K4IDXMIZ.js} +9 -9
- package/Build/Workers/{chunk-D4VFVSGU.js → chunk-LL6HN3W4.js} +10 -10
- package/Build/Workers/{chunk-CZGSJ6ZG.js → chunk-LNTUIO55.js} +2 -2
- package/Build/Workers/{chunk-QFMJIXCL.js → chunk-LWOCFJEH.js} +9 -9
- package/Build/Workers/{chunk-2K5PKWLP.js → chunk-MMUISYW4.js} +16 -16
- package/Build/Workers/{chunk-IQKHPQNT.js → chunk-MXYW4BQ3.js} +2 -2
- package/Build/Workers/{chunk-XMIVNU5H.js → chunk-N6DVKXZD.js} +12 -12
- package/Build/Workers/{chunk-E2533KCN.js → chunk-NP46ZIBY.js} +3 -3
- package/Build/Workers/{chunk-O4DA3KRB.js → chunk-OW6F6CPZ.js} +7 -7
- package/Build/Workers/{chunk-QWHUQ4B7.js → chunk-P6OAOFBU.js} +8 -8
- package/Build/Workers/{chunk-4Z7AGRTU.js → chunk-PXDMWXO5.js} +2 -2
- package/Build/Workers/{chunk-WJ5THCIZ.js → chunk-QS7623NH.js} +6 -6
- package/Build/Workers/{chunk-OYFINQQA.js → chunk-ROH45IXJ.js} +7 -7
- package/Build/Workers/{chunk-2MEON5V4.js → chunk-S2P6LCIB.js} +4 -4
- package/Build/Workers/{chunk-JIXKGUWR.js → chunk-S4NZVXU6.js} +2 -2
- package/Build/Workers/{chunk-JHTZDMN6.js → chunk-SGGO5WVA.js} +5 -5
- package/Build/Workers/{chunk-UUXKGCBU.js → chunk-TG7N7TPY.js} +47 -50
- package/Build/Workers/{chunk-PFUF2QIK.js → chunk-TUZQG4RW.js} +14 -14
- package/Build/Workers/{chunk-LF74EILW.js → chunk-UHVE7V65.js} +12 -12
- package/Build/Workers/{chunk-L7PWWHKM.js → chunk-UY2HVPDL.js} +5 -5
- package/Build/Workers/{chunk-V65LOTF3.js → chunk-YNLPRFUQ.js} +6 -6
- package/Build/Workers/{chunk-RB3XS7EZ.js → chunk-ZYOHBCCE.js} +1 -1
- package/Build/Workers/combineGeometry.js +21 -21
- package/Build/Workers/createBoxGeometry.js +15 -15
- package/Build/Workers/createBoxOutlineGeometry.js +13 -13
- package/Build/Workers/createCircleGeometry.js +23 -23
- package/Build/Workers/createCircleOutlineGeometry.js +16 -16
- package/Build/Workers/createCoplanarPolygonGeometry.js +30 -30
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +28 -28
- package/Build/Workers/createCorridorGeometry.js +26 -26
- package/Build/Workers/createCorridorOutlineGeometry.js +25 -25
- package/Build/Workers/createCylinderGeometry.js +17 -17
- package/Build/Workers/createCylinderOutlineGeometry.js +15 -15
- package/Build/Workers/createEllipseGeometry.js +23 -23
- package/Build/Workers/createEllipseOutlineGeometry.js +16 -16
- package/Build/Workers/createEllipsoidGeometry.js +16 -16
- package/Build/Workers/createEllipsoidOutlineGeometry.js +15 -15
- package/Build/Workers/createFrustumGeometry.js +15 -15
- package/Build/Workers/createFrustumOutlineGeometry.js +15 -15
- package/Build/Workers/createGeometry.js +21 -21
- package/Build/Workers/createGroundPolylineGeometry.js +19 -19
- package/Build/Workers/createPlaneGeometry.js +13 -13
- package/Build/Workers/createPlaneOutlineGeometry.js +12 -12
- package/Build/Workers/createPolygonGeometry.js +29 -29
- package/Build/Workers/createPolygonOutlineGeometry.js +27 -27
- package/Build/Workers/createPolylineGeometry.js +22 -22
- package/Build/Workers/createPolylineVolumeGeometry.js +28 -28
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +24 -24
- package/Build/Workers/createRectangleGeometry.js +24 -24
- package/Build/Workers/createRectangleOutlineGeometry.js +17 -17
- package/Build/Workers/createSimplePolylineGeometry.js +20 -20
- package/Build/Workers/createSphereGeometry.js +16 -16
- package/Build/Workers/createSphereOutlineGeometry.js +15 -15
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +12 -12
- package/Build/Workers/createVectorTileGeometries.js +21 -21
- package/Build/Workers/createVectorTilePoints.js +11 -11
- package/Build/Workers/createVectorTilePolygons.js +19 -19
- package/Build/Workers/createVectorTilePolylines.js +12 -12
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +19 -19
- package/Build/Workers/createVerticesFromHeightmap.js +19 -19
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +16 -16
- package/Build/Workers/createWallGeometry.js +21 -21
- package/Build/Workers/createWallOutlineGeometry.js +20 -20
- package/Build/Workers/decodeDraco.js +10 -10
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
- package/Build/Workers/decodeI3S.js +9 -9
- package/Build/Workers/gaussianSplatSorter.js +4 -4
- package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
- package/Build/Workers/transcodeKTX2.js +6 -6
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +19 -19
- package/Source/Core/Event.js +41 -49
- package/Source/Core/GoogleMaps.js +2 -2
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/IonResource.js +30 -4
- package/Source/Core/Resource.js +5 -1
- package/Source/DataSources/KmlDataSource.js +62 -63
- package/Source/DataSources/exportKml.js +27 -30
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/Azure2DImageryProvider.js +308 -0
- package/Source/Scene/BatchTableHierarchy.js +2 -50
- package/Source/Scene/Billboard.js +4 -0
- package/Source/Scene/BillboardCollection.js +9 -2
- package/Source/Scene/ClippingPlaneCollection.js +3 -3
- package/Source/Scene/ClippingPolygon.js +91 -2
- package/Source/Scene/CreditDisplay.js +1 -1
- package/Source/Scene/GaussianSplat3DTileContent.js +54 -9
- package/Source/Scene/GaussianSplatPrimitive.js +49 -50
- package/Source/Scene/Google2DImageryProvider.js +614 -0
- package/Source/Scene/IonImageryProvider.js +22 -1
- package/Source/Scene/LabelCollection.js +1 -0
- package/Source/Scene/Material.js +248 -80
- package/Source/Scene/PntsParser.js +65 -0
- package/Source/Scene/Primitive.js +6 -0
- package/Source/Scene/PrimitiveState.js +123 -0
- package/Source/Scene/Scene.js +2 -2
- package/Source/Scene/VoxelBoundsCollection.js +494 -0
- package/Source/Scene/VoxelBoxShape.js +236 -101
- package/Source/Scene/VoxelCylinderShape.js +315 -204
- package/Source/Scene/VoxelEllipsoidShape.js +402 -119
- package/Source/Scene/VoxelPrimitive.js +119 -84
- package/Source/Scene/VoxelRenderResources.js +17 -10
- package/Source/Scene/VoxelShape.js +21 -6
- package/Source/Scene/buildVoxelDrawCommands.js +61 -20
- package/Source/Scene/createGooglePhotorealistic3DTileset.js +1 -1
- package/Source/Scene/getClippingFunction.js +79 -88
- package/Source/Shaders/BillboardCollectionVS.glsl +2 -0
- package/Source/Shaders/BillboardCollectionVS.js +2 -0
- package/Source/Shaders/Voxels/IntersectBox.glsl +20 -33
- package/Source/Shaders/Voxels/IntersectBox.js +20 -33
- package/Source/Shaders/Voxels/IntersectCylinder.glsl +28 -32
- package/Source/Shaders/Voxels/IntersectCylinder.js +28 -32
- package/Source/Shaders/Voxels/IntersectDepth.glsl +1 -4
- package/Source/Shaders/Voxels/IntersectDepth.js +1 -4
- package/Source/Shaders/Voxels/IntersectEllipsoid.glsl +12 -20
- package/Source/Shaders/Voxels/IntersectEllipsoid.js +12 -20
- package/Source/Shaders/Voxels/IntersectLongitude.glsl +21 -9
- package/Source/Shaders/Voxels/IntersectLongitude.js +21 -9
- package/Source/Shaders/Voxels/{IntersectClippingPlanes.glsl → IntersectPlane.glsl} +5 -3
- package/Source/Shaders/Voxels/{IntersectClippingPlanes.js → IntersectPlane.js} +5 -3
- package/Source/Shaders/Voxels/Intersection.glsl +3 -3
- package/Source/Shaders/Voxels/Intersection.js +3 -3
- package/Source/Shaders/Voxels/Octree.glsl +46 -51
- package/Source/Shaders/Voxels/Octree.js +46 -51
- package/Source/Shaders/Voxels/VoxelFS.glsl +50 -48
- package/Source/Shaders/Voxels/VoxelFS.js +50 -48
- package/Source/Shaders/Voxels/VoxelUtils.glsl +0 -19
- package/Source/Shaders/Voxels/VoxelUtils.js +0 -19
- package/Source/Shaders/Voxels/convertLocalToBoxUv.glsl +30 -0
- package/Source/Shaders/Voxels/convertLocalToBoxUv.js +32 -0
- package/Source/Shaders/Voxels/convertLocalToCylinderUv.glsl +97 -0
- package/Source/Shaders/Voxels/convertLocalToCylinderUv.js +99 -0
- package/Source/Shaders/Voxels/convertLocalToEllipsoidUv.glsl +193 -0
- package/Source/Shaders/Voxels/convertLocalToEllipsoidUv.js +195 -0
- package/Source/ThirdParty/Workers/zip-web-worker.js +1 -0
- package/Source/ThirdParty/zip-module.wasm +0 -0
- package/index.d.ts +340 -14
- package/index.js +116 -114
- package/package.json +2 -2
- package/Build/ThirdParty/Workers/pako_deflate.min.js +0 -503
- package/Build/ThirdParty/Workers/pako_inflate.min.js +0 -698
- package/Build/ThirdParty/Workers/z-worker-pako.js +0 -601
- package/Source/Core/defaultValue.js +0 -48
- package/Source/Shaders/Voxels/convertUvToBox.glsl +0 -45
- package/Source/Shaders/Voxels/convertUvToBox.js +0 -46
- package/Source/Shaders/Voxels/convertUvToCylinder.glsl +0 -99
- package/Source/Shaders/Voxels/convertUvToCylinder.js +0 -101
- package/Source/Shaders/Voxels/convertUvToEllipsoid.glsl +0 -139
- package/Source/Shaders/Voxels/convertUvToEllipsoid.js +0 -141
- package/Source/ThirdParty/Workers/pako_deflate.min.js +0 -2
- package/Source/ThirdParty/Workers/pako_inflate.min.js +0 -2
- package/Source/ThirdParty/Workers/z-worker-pako.js +0 -1
|
@@ -38,66 +38,61 @@ function getClippingFunction(clippingPlaneCollection, context) {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
function clippingFunctionUnion(clippingPlanesLength) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
`}\n`;
|
|
70
|
-
return functionString;
|
|
41
|
+
return `float clip(vec4 fragCoord, sampler2D clippingPlanes, mat4 clippingPlanesMatrix)
|
|
42
|
+
{
|
|
43
|
+
vec4 position = czm_windowToEyeCoordinates(fragCoord);
|
|
44
|
+
vec3 clipNormal = vec3(0.0);
|
|
45
|
+
vec3 clipPosition = vec3(0.0);
|
|
46
|
+
float clipAmount;
|
|
47
|
+
float pixelWidth = czm_metersPerPixel(position);
|
|
48
|
+
bool breakAndDiscard = false;
|
|
49
|
+
for (int i = 0; i < ${clippingPlanesLength}; ++i)
|
|
50
|
+
{
|
|
51
|
+
vec4 clippingPlane = getClippingPlane(clippingPlanes, i, clippingPlanesMatrix);
|
|
52
|
+
clipNormal = clippingPlane.xyz;
|
|
53
|
+
clipPosition = -clippingPlane.w * clipNormal;
|
|
54
|
+
float amount = dot(clipNormal, (position.xyz - clipPosition)) / pixelWidth;
|
|
55
|
+
clipAmount = czm_branchFreeTernary(i == 0, amount, min(amount, clipAmount));
|
|
56
|
+
if (amount <= 0.0)
|
|
57
|
+
{
|
|
58
|
+
breakAndDiscard = true;
|
|
59
|
+
// HLSL compiler bug if we discard here: https://bugs.chromium.org/p/angleproject/issues/detail?id=1945#c6
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (breakAndDiscard) {
|
|
64
|
+
discard;
|
|
65
|
+
}
|
|
66
|
+
return clipAmount;
|
|
67
|
+
}
|
|
68
|
+
`;
|
|
71
69
|
}
|
|
72
70
|
|
|
73
71
|
function clippingFunctionIntersect(clippingPlanesLength) {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
` return clipAmount;\n` +
|
|
99
|
-
`}\n`;
|
|
100
|
-
return functionString;
|
|
72
|
+
return `float clip(vec4 fragCoord, sampler2D clippingPlanes, mat4 clippingPlanesMatrix)
|
|
73
|
+
{
|
|
74
|
+
bool clipped = true;
|
|
75
|
+
vec4 position = czm_windowToEyeCoordinates(fragCoord);
|
|
76
|
+
vec3 clipNormal = vec3(0.0);
|
|
77
|
+
vec3 clipPosition = vec3(0.0);
|
|
78
|
+
float clipAmount = 0.0;
|
|
79
|
+
float pixelWidth = czm_metersPerPixel(position);
|
|
80
|
+
for (int i = 0; i < ${clippingPlanesLength}; ++i)
|
|
81
|
+
{
|
|
82
|
+
vec4 clippingPlane = getClippingPlane(clippingPlanes, i, clippingPlanesMatrix);
|
|
83
|
+
clipNormal = clippingPlane.xyz;
|
|
84
|
+
clipPosition = -clippingPlane.w * clipNormal;
|
|
85
|
+
float amount = dot(clipNormal, (position.xyz - clipPosition)) / pixelWidth;
|
|
86
|
+
clipAmount = max(amount, clipAmount);
|
|
87
|
+
clipped = clipped && (amount <= 0.0);
|
|
88
|
+
}
|
|
89
|
+
if (clipped)
|
|
90
|
+
{
|
|
91
|
+
discard;
|
|
92
|
+
}
|
|
93
|
+
return clipAmount;
|
|
94
|
+
}
|
|
95
|
+
`;
|
|
101
96
|
}
|
|
102
97
|
|
|
103
98
|
function getClippingPlaneFloat(width, height) {
|
|
@@ -113,19 +108,17 @@ function getClippingPlaneFloat(width, height) {
|
|
|
113
108
|
pixelHeightString += ".0";
|
|
114
109
|
}
|
|
115
110
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
`}\n`;
|
|
128
|
-
return functionString;
|
|
111
|
+
return `vec4 getClippingPlane(highp sampler2D packedClippingPlanes, int clippingPlaneNumber, mat4 transform)
|
|
112
|
+
{
|
|
113
|
+
int pixY = clippingPlaneNumber / ${width};
|
|
114
|
+
int pixX = clippingPlaneNumber - (pixY * ${width});
|
|
115
|
+
// Sample from center of pixel
|
|
116
|
+
float u = (float(pixX) + 0.5) * ${pixelWidthString};
|
|
117
|
+
float v = (float(pixY) + 0.5) * ${pixelHeightString};
|
|
118
|
+
vec4 plane = texture(packedClippingPlanes, vec2(u, v));
|
|
119
|
+
return czm_transformPlane(plane, transform);
|
|
120
|
+
}
|
|
121
|
+
`;
|
|
129
122
|
}
|
|
130
123
|
|
|
131
124
|
function getClippingPlaneUint8(width, height) {
|
|
@@ -141,23 +134,21 @@ function getClippingPlaneUint8(width, height) {
|
|
|
141
134
|
pixelHeightString += ".0";
|
|
142
135
|
}
|
|
143
136
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
`}\n`;
|
|
161
|
-
return functionString;
|
|
137
|
+
return `vec4 getClippingPlane(highp sampler2D packedClippingPlanes, int clippingPlaneNumber, mat4 transform)
|
|
138
|
+
{
|
|
139
|
+
int clippingPlaneStartIndex = clippingPlaneNumber * 2;
|
|
140
|
+
int pixY = clippingPlaneStartIndex / ${width};
|
|
141
|
+
int pixX = clippingPlaneStartIndex - (pixY * ${width});
|
|
142
|
+
// Sample from center of pixel
|
|
143
|
+
float u = (float(pixX) + 0.5) * ${pixelWidthString};
|
|
144
|
+
float v = (float(pixY) + 0.5) * ${pixelHeightString};
|
|
145
|
+
vec4 oct32 = texture(packedClippingPlanes, vec2(u, v)) * 255.0;
|
|
146
|
+
vec2 oct = vec2(oct32.x * 256.0 + oct32.y, oct32.z * 256.0 + oct32.w);
|
|
147
|
+
vec4 plane;
|
|
148
|
+
plane.xyz = czm_octDecode(oct, 65535.0);
|
|
149
|
+
plane.w = czm_unpackFloat(texture(packedClippingPlanes, vec2(u + ${pixelWidthString}, v)));
|
|
150
|
+
return czm_transformPlane(plane, transform);
|
|
151
|
+
}
|
|
152
|
+
`;
|
|
162
153
|
}
|
|
163
154
|
export default getClippingFunction;
|
|
@@ -165,9 +165,11 @@ void main()
|
|
|
165
165
|
|
|
166
166
|
temp = compressedAttribute0.z * SHIFT_RIGHT8;
|
|
167
167
|
translate.x = floor(temp) - UPPER_BOUND;
|
|
168
|
+
translate.x *= SHIFT_RIGHT2; // undo translateX scaling (helps preserve subpixel precision, see BillboardCollection.js attribute writer for more info)
|
|
168
169
|
|
|
169
170
|
translate.y += (temp - floor(temp)) * SHIFT_LEFT8;
|
|
170
171
|
translate.y -= UPPER_BOUND;
|
|
172
|
+
translate.y *= SHIFT_RIGHT2;
|
|
171
173
|
|
|
172
174
|
temp = compressedAttribute1.x * SHIFT_RIGHT8;
|
|
173
175
|
float temp2 = floor(compressedAttribute2.w * SHIFT_RIGHT2);
|
|
@@ -166,9 +166,11 @@ void main()\n\
|
|
|
166
166
|
\n\
|
|
167
167
|
temp = compressedAttribute0.z * SHIFT_RIGHT8;\n\
|
|
168
168
|
translate.x = floor(temp) - UPPER_BOUND;\n\
|
|
169
|
+
translate.x *= SHIFT_RIGHT2; // undo translateX scaling (helps preserve subpixel precision, see BillboardCollection.js attribute writer for more info)\n\
|
|
169
170
|
\n\
|
|
170
171
|
translate.y += (temp - floor(temp)) * SHIFT_LEFT8;\n\
|
|
171
172
|
translate.y -= UPPER_BOUND;\n\
|
|
173
|
+
translate.y *= SHIFT_RIGHT2;\n\
|
|
172
174
|
\n\
|
|
173
175
|
temp = compressedAttribute1.x * SHIFT_RIGHT8;\n\
|
|
174
176
|
float temp2 = floor(compressedAttribute2.w * SHIFT_RIGHT2);\n\
|
|
@@ -5,43 +5,30 @@
|
|
|
5
5
|
#define BOX_INTERSECTION_INDEX ### // always 0
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
uniform
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
vec3 directions = sign(ray.dir);
|
|
23
|
-
|
|
24
|
-
// The actual intersection points are the furthest entry and the closest exit
|
|
25
|
-
float lastEntry = maxComponent(entries);
|
|
26
|
-
bvec3 isLastEntry = equal(entries, vec3(lastEntry));
|
|
27
|
-
vec3 entryNormal = -1.0 * vec3(isLastEntry) * directions;
|
|
28
|
-
vec4 entry = vec4(entryNormal, lastEntry);
|
|
29
|
-
|
|
30
|
-
float firstExit = minComponent(exits);
|
|
31
|
-
bvec3 isFirstExit = equal(exits, vec3(firstExit));
|
|
32
|
-
vec3 exitNormal = vec3(isLastEntry) * directions;
|
|
33
|
-
vec4 exit = vec4(exitNormal, firstExit);
|
|
34
|
-
|
|
35
|
-
if (entry.w > exit.w) {
|
|
36
|
-
entry.w = NO_HIT;
|
|
37
|
-
exit.w = NO_HIT;
|
|
8
|
+
uniform sampler2D u_renderBoundPlanesTexture;
|
|
9
|
+
|
|
10
|
+
RayShapeIntersection intersectBoundPlanes(in Ray ray) {
|
|
11
|
+
vec4 lastEntry = vec4(ray.dir, -INF_HIT);
|
|
12
|
+
vec4 firstExit = vec4(-ray.dir, +INF_HIT);
|
|
13
|
+
for (int i = 0; i < 6; i++) {
|
|
14
|
+
vec4 boundPlane = getBoundPlane(u_renderBoundPlanesTexture, i);
|
|
15
|
+
vec4 intersection = intersectPlane(ray, boundPlane);
|
|
16
|
+
if (dot(ray.dir, boundPlane.xyz) < 0.0) {
|
|
17
|
+
lastEntry = intersection.w > lastEntry.w ? intersection : lastEntry;
|
|
18
|
+
} else {
|
|
19
|
+
firstExit = intersection.w < firstExit.w ? intersection: firstExit;
|
|
20
|
+
}
|
|
38
21
|
}
|
|
39
22
|
|
|
40
|
-
|
|
23
|
+
if (lastEntry.w < firstExit.w) {
|
|
24
|
+
return RayShapeIntersection(lastEntry, firstExit);
|
|
25
|
+
} else {
|
|
26
|
+
return RayShapeIntersection(vec4(-ray.dir, NO_HIT), vec4(ray.dir, NO_HIT));
|
|
27
|
+
}
|
|
41
28
|
}
|
|
42
29
|
|
|
43
|
-
void intersectShape(in Ray
|
|
30
|
+
void intersectShape(in Ray rayUV, in Ray rayEC, inout Intersections ix)
|
|
44
31
|
{
|
|
45
|
-
RayShapeIntersection intersection =
|
|
32
|
+
RayShapeIntersection intersection = intersectBoundPlanes(rayEC);
|
|
46
33
|
setShapeIntersection(ix, BOX_INTERSECTION_INDEX, intersection);
|
|
47
34
|
}
|
|
@@ -6,44 +6,31 @@ export default "// See IntersectionUtils.glsl for the definitions of Ray, RaySha
|
|
|
6
6
|
#define BOX_INTERSECTION_INDEX ### // always 0\n\
|
|
7
7
|
*/\n\
|
|
8
8
|
\n\
|
|
9
|
-
uniform
|
|
10
|
-
|
|
11
|
-
\n\
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
\n\
|
|
23
|
-
vec3 directions = sign(ray.dir);\n\
|
|
24
|
-
\n\
|
|
25
|
-
// The actual intersection points are the furthest entry and the closest exit\n\
|
|
26
|
-
float lastEntry = maxComponent(entries);\n\
|
|
27
|
-
bvec3 isLastEntry = equal(entries, vec3(lastEntry));\n\
|
|
28
|
-
vec3 entryNormal = -1.0 * vec3(isLastEntry) * directions;\n\
|
|
29
|
-
vec4 entry = vec4(entryNormal, lastEntry);\n\
|
|
30
|
-
\n\
|
|
31
|
-
float firstExit = minComponent(exits);\n\
|
|
32
|
-
bvec3 isFirstExit = equal(exits, vec3(firstExit));\n\
|
|
33
|
-
vec3 exitNormal = vec3(isLastEntry) * directions;\n\
|
|
34
|
-
vec4 exit = vec4(exitNormal, firstExit);\n\
|
|
35
|
-
\n\
|
|
36
|
-
if (entry.w > exit.w) {\n\
|
|
37
|
-
entry.w = NO_HIT;\n\
|
|
38
|
-
exit.w = NO_HIT;\n\
|
|
9
|
+
uniform sampler2D u_renderBoundPlanesTexture;\n\
|
|
10
|
+
\n\
|
|
11
|
+
RayShapeIntersection intersectBoundPlanes(in Ray ray) {\n\
|
|
12
|
+
vec4 lastEntry = vec4(ray.dir, -INF_HIT);\n\
|
|
13
|
+
vec4 firstExit = vec4(-ray.dir, +INF_HIT);\n\
|
|
14
|
+
for (int i = 0; i < 6; i++) {\n\
|
|
15
|
+
vec4 boundPlane = getBoundPlane(u_renderBoundPlanesTexture, i);\n\
|
|
16
|
+
vec4 intersection = intersectPlane(ray, boundPlane);\n\
|
|
17
|
+
if (dot(ray.dir, boundPlane.xyz) < 0.0) {\n\
|
|
18
|
+
lastEntry = intersection.w > lastEntry.w ? intersection : lastEntry;\n\
|
|
19
|
+
} else {\n\
|
|
20
|
+
firstExit = intersection.w < firstExit.w ? intersection: firstExit;\n\
|
|
21
|
+
}\n\
|
|
39
22
|
}\n\
|
|
40
23
|
\n\
|
|
41
|
-
|
|
24
|
+
if (lastEntry.w < firstExit.w) {\n\
|
|
25
|
+
return RayShapeIntersection(lastEntry, firstExit);\n\
|
|
26
|
+
} else {\n\
|
|
27
|
+
return RayShapeIntersection(vec4(-ray.dir, NO_HIT), vec4(ray.dir, NO_HIT));\n\
|
|
28
|
+
}\n\
|
|
42
29
|
}\n\
|
|
43
30
|
\n\
|
|
44
|
-
void intersectShape(in Ray
|
|
31
|
+
void intersectShape(in Ray rayUV, in Ray rayEC, inout Intersections ix)\n\
|
|
45
32
|
{\n\
|
|
46
|
-
RayShapeIntersection intersection =
|
|
33
|
+
RayShapeIntersection intersection = intersectBoundPlanes(rayEC);\n\
|
|
47
34
|
setShapeIntersection(ix, BOX_INTERSECTION_INDEX, intersection);\n\
|
|
48
35
|
}\n\
|
|
49
36
|
";
|
|
@@ -19,32 +19,30 @@
|
|
|
19
19
|
|
|
20
20
|
// Cylinder uniforms
|
|
21
21
|
uniform vec2 u_cylinderRenderRadiusMinMax;
|
|
22
|
-
uniform vec2 u_cylinderRenderHeightMinMax;
|
|
23
22
|
#if defined(CYLINDER_HAS_RENDER_BOUNDS_ANGLE)
|
|
24
23
|
uniform vec2 u_cylinderRenderAngleMinMax;
|
|
25
24
|
#endif
|
|
26
25
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
vec4 intersectMax = vec4(0.0, 0.0, 1.0 * signFlip, tmax);
|
|
42
|
-
|
|
43
|
-
bool topEntry = zDirection < 0.0;
|
|
44
|
-
vec4 entry = topEntry ? intersectMax : intersectMin;
|
|
45
|
-
vec4 exit = topEntry ? intersectMin : intersectMax;
|
|
26
|
+
uniform sampler2D u_renderBoundPlanesTexture;
|
|
27
|
+
|
|
28
|
+
RayShapeIntersection intersectBoundPlanes(in Ray ray) {
|
|
29
|
+
vec4 lastEntry = vec4(ray.dir, -INF_HIT);
|
|
30
|
+
vec4 firstExit = vec4(-ray.dir, +INF_HIT);
|
|
31
|
+
for (int i = 0; i < 2; i++) {
|
|
32
|
+
vec4 boundPlane = getBoundPlane(u_renderBoundPlanesTexture, i);
|
|
33
|
+
vec4 intersection = intersectPlane(ray, boundPlane);
|
|
34
|
+
if (dot(ray.dir, boundPlane.xyz) < 0.0) {
|
|
35
|
+
lastEntry = intersection.w > lastEntry.w ? intersection : lastEntry;
|
|
36
|
+
} else {
|
|
37
|
+
firstExit = intersection.w < firstExit.w ? intersection: firstExit;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
46
40
|
|
|
47
|
-
|
|
41
|
+
if (lastEntry.w < firstExit.w) {
|
|
42
|
+
return RayShapeIntersection(lastEntry, firstExit);
|
|
43
|
+
} else {
|
|
44
|
+
return RayShapeIntersection(vec4(-ray.dir, NO_HIT), vec4(ray.dir, NO_HIT));
|
|
45
|
+
}
|
|
48
46
|
}
|
|
49
47
|
|
|
50
48
|
/**
|
|
@@ -70,8 +68,11 @@ RayShapeIntersection intersectCylinder(in Ray ray, in float radius, in bool conv
|
|
|
70
68
|
float t1 = (-b - determinant) / a;
|
|
71
69
|
float t2 = (-b + determinant) / a;
|
|
72
70
|
float signFlip = convex ? 1.0 : -1.0;
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
vec3 normal1 = vec3((position + t1 * direction) * signFlip, 0.0);
|
|
72
|
+
vec3 normal2 = vec3((position + t2 * direction) * signFlip, 0.0);
|
|
73
|
+
// Return normals in eye coordinates
|
|
74
|
+
vec4 intersect1 = vec4(normalize(czm_normal * normal1), t1);
|
|
75
|
+
vec4 intersect2 = vec4(normalize(czm_normal * normal2), t2);
|
|
75
76
|
|
|
76
77
|
return RayShapeIntersection(intersect1, intersect2);
|
|
77
78
|
}
|
|
@@ -80,21 +81,16 @@ RayShapeIntersection intersectCylinder(in Ray ray, in float radius, in bool conv
|
|
|
80
81
|
* Find the intersection of a ray with a right cylindrical solid of given
|
|
81
82
|
* radius and height bounds. NOTE: The shape is assumed to be convex.
|
|
82
83
|
*/
|
|
83
|
-
RayShapeIntersection intersectBoundedCylinder(in Ray ray, in
|
|
84
|
+
RayShapeIntersection intersectBoundedCylinder(in Ray ray, in Ray rayEC, in float radius)
|
|
84
85
|
{
|
|
85
86
|
RayShapeIntersection cylinderIntersection = intersectCylinder(ray, radius, true);
|
|
86
|
-
RayShapeIntersection heightBoundsIntersection =
|
|
87
|
+
RayShapeIntersection heightBoundsIntersection = intersectBoundPlanes(rayEC);
|
|
87
88
|
return intersectIntersections(ray, cylinderIntersection, heightBoundsIntersection);
|
|
88
89
|
}
|
|
89
90
|
|
|
90
|
-
void intersectShape(Ray ray, inout Intersections ix)
|
|
91
|
+
void intersectShape(in Ray ray, in Ray rayEC, inout Intersections ix)
|
|
91
92
|
{
|
|
92
|
-
|
|
93
|
-
// Direction is scaled as well to be in sync with position.
|
|
94
|
-
ray.pos = ray.pos * 2.0 - 1.0;
|
|
95
|
-
ray.dir *= 2.0;
|
|
96
|
-
|
|
97
|
-
RayShapeIntersection outerIntersect = intersectBoundedCylinder(ray, u_cylinderRenderRadiusMinMax.y, u_cylinderRenderHeightMinMax);
|
|
93
|
+
RayShapeIntersection outerIntersect = intersectBoundedCylinder(ray, rayEC, u_cylinderRenderRadiusMinMax.y);
|
|
98
94
|
|
|
99
95
|
setShapeIntersection(ix, CYLINDER_INTERSECTION_INDEX_RADIUS_MAX, outerIntersect);
|
|
100
96
|
|
|
@@ -20,32 +20,30 @@ export default "// See IntersectionUtils.glsl for the definitions of Ray, NO_HIT
|
|
|
20
20
|
\n\
|
|
21
21
|
// Cylinder uniforms\n\
|
|
22
22
|
uniform vec2 u_cylinderRenderRadiusMinMax;\n\
|
|
23
|
-
uniform vec2 u_cylinderRenderHeightMinMax;\n\
|
|
24
23
|
#if defined(CYLINDER_HAS_RENDER_BOUNDS_ANGLE)\n\
|
|
25
24
|
uniform vec2 u_cylinderRenderAngleMinMax;\n\
|
|
26
25
|
#endif\n\
|
|
27
26
|
\n\
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
\n\
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
vec4 intersectMax = vec4(0.0, 0.0, 1.0 * signFlip, tmax);\n\
|
|
43
|
-
\n\
|
|
44
|
-
bool topEntry = zDirection < 0.0;\n\
|
|
45
|
-
vec4 entry = topEntry ? intersectMax : intersectMin;\n\
|
|
46
|
-
vec4 exit = topEntry ? intersectMin : intersectMax;\n\
|
|
27
|
+
uniform sampler2D u_renderBoundPlanesTexture;\n\
|
|
28
|
+
\n\
|
|
29
|
+
RayShapeIntersection intersectBoundPlanes(in Ray ray) {\n\
|
|
30
|
+
vec4 lastEntry = vec4(ray.dir, -INF_HIT);\n\
|
|
31
|
+
vec4 firstExit = vec4(-ray.dir, +INF_HIT);\n\
|
|
32
|
+
for (int i = 0; i < 2; i++) {\n\
|
|
33
|
+
vec4 boundPlane = getBoundPlane(u_renderBoundPlanesTexture, i);\n\
|
|
34
|
+
vec4 intersection = intersectPlane(ray, boundPlane);\n\
|
|
35
|
+
if (dot(ray.dir, boundPlane.xyz) < 0.0) {\n\
|
|
36
|
+
lastEntry = intersection.w > lastEntry.w ? intersection : lastEntry;\n\
|
|
37
|
+
} else {\n\
|
|
38
|
+
firstExit = intersection.w < firstExit.w ? intersection: firstExit;\n\
|
|
39
|
+
}\n\
|
|
40
|
+
}\n\
|
|
47
41
|
\n\
|
|
48
|
-
|
|
42
|
+
if (lastEntry.w < firstExit.w) {\n\
|
|
43
|
+
return RayShapeIntersection(lastEntry, firstExit);\n\
|
|
44
|
+
} else {\n\
|
|
45
|
+
return RayShapeIntersection(vec4(-ray.dir, NO_HIT), vec4(ray.dir, NO_HIT));\n\
|
|
46
|
+
}\n\
|
|
49
47
|
}\n\
|
|
50
48
|
\n\
|
|
51
49
|
/**\n\
|
|
@@ -71,8 +69,11 @@ RayShapeIntersection intersectCylinder(in Ray ray, in float radius, in bool conv
|
|
|
71
69
|
float t1 = (-b - determinant) / a;\n\
|
|
72
70
|
float t2 = (-b + determinant) / a;\n\
|
|
73
71
|
float signFlip = convex ? 1.0 : -1.0;\n\
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
vec3 normal1 = vec3((position + t1 * direction) * signFlip, 0.0);\n\
|
|
73
|
+
vec3 normal2 = vec3((position + t2 * direction) * signFlip, 0.0);\n\
|
|
74
|
+
// Return normals in eye coordinates\n\
|
|
75
|
+
vec4 intersect1 = vec4(normalize(czm_normal * normal1), t1);\n\
|
|
76
|
+
vec4 intersect2 = vec4(normalize(czm_normal * normal2), t2);\n\
|
|
76
77
|
\n\
|
|
77
78
|
return RayShapeIntersection(intersect1, intersect2);\n\
|
|
78
79
|
}\n\
|
|
@@ -81,21 +82,16 @@ RayShapeIntersection intersectCylinder(in Ray ray, in float radius, in bool conv
|
|
|
81
82
|
* Find the intersection of a ray with a right cylindrical solid of given\n\
|
|
82
83
|
* radius and height bounds. NOTE: The shape is assumed to be convex.\n\
|
|
83
84
|
*/\n\
|
|
84
|
-
RayShapeIntersection intersectBoundedCylinder(in Ray ray, in
|
|
85
|
+
RayShapeIntersection intersectBoundedCylinder(in Ray ray, in Ray rayEC, in float radius)\n\
|
|
85
86
|
{\n\
|
|
86
87
|
RayShapeIntersection cylinderIntersection = intersectCylinder(ray, radius, true);\n\
|
|
87
|
-
RayShapeIntersection heightBoundsIntersection =
|
|
88
|
+
RayShapeIntersection heightBoundsIntersection = intersectBoundPlanes(rayEC);\n\
|
|
88
89
|
return intersectIntersections(ray, cylinderIntersection, heightBoundsIntersection);\n\
|
|
89
90
|
}\n\
|
|
90
91
|
\n\
|
|
91
|
-
void intersectShape(Ray ray, inout Intersections ix)\n\
|
|
92
|
+
void intersectShape(in Ray ray, in Ray rayEC, inout Intersections ix)\n\
|
|
92
93
|
{\n\
|
|
93
|
-
|
|
94
|
-
// Direction is scaled as well to be in sync with position.\n\
|
|
95
|
-
ray.pos = ray.pos * 2.0 - 1.0;\n\
|
|
96
|
-
ray.dir *= 2.0;\n\
|
|
97
|
-
\n\
|
|
98
|
-
RayShapeIntersection outerIntersect = intersectBoundedCylinder(ray, u_cylinderRenderRadiusMinMax.y, u_cylinderRenderHeightMinMax);\n\
|
|
94
|
+
RayShapeIntersection outerIntersect = intersectBoundedCylinder(ray, rayEC, u_cylinderRenderRadiusMinMax.y);\n\
|
|
99
95
|
\n\
|
|
100
96
|
setShapeIntersection(ix, CYLINDER_INTERSECTION_INDEX_RADIUS_MAX, outerIntersect);\n\
|
|
101
97
|
\n\
|
|
@@ -5,8 +5,6 @@
|
|
|
5
5
|
#define DEPTH_INTERSECTION_INDEX ###
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
uniform mat4 u_transformPositionViewToUv;
|
|
9
|
-
|
|
10
8
|
void intersectDepth(in vec2 screenCoord, in Ray ray, inout Intersections ix) {
|
|
11
9
|
float logDepthOrDepth = czm_unpackDepth(texture(czm_globeDepthTexture, screenCoord));
|
|
12
10
|
float entry;
|
|
@@ -15,8 +13,7 @@ void intersectDepth(in vec2 screenCoord, in Ray ray, inout Intersections ix) {
|
|
|
15
13
|
// Calculate how far the ray must travel before it hits the depth buffer.
|
|
16
14
|
vec4 eyeCoordinateDepth = czm_screenToEyeCoordinates(screenCoord, logDepthOrDepth);
|
|
17
15
|
eyeCoordinateDepth /= eyeCoordinateDepth.w;
|
|
18
|
-
|
|
19
|
-
entry = dot(depthPositionUv - ray.pos, ray.dir);
|
|
16
|
+
entry = dot(eyeCoordinateDepth.xyz - ray.pos, ray.dir);
|
|
20
17
|
exit = +INF_HIT;
|
|
21
18
|
} else {
|
|
22
19
|
// There's no depth at this location.
|
|
@@ -6,8 +6,6 @@ export default "// See IntersectionUtils.glsl for the definitions of Ray, Inters
|
|
|
6
6
|
#define DEPTH_INTERSECTION_INDEX ###\n\
|
|
7
7
|
*/\n\
|
|
8
8
|
\n\
|
|
9
|
-
uniform mat4 u_transformPositionViewToUv;\n\
|
|
10
|
-
\n\
|
|
11
9
|
void intersectDepth(in vec2 screenCoord, in Ray ray, inout Intersections ix) {\n\
|
|
12
10
|
float logDepthOrDepth = czm_unpackDepth(texture(czm_globeDepthTexture, screenCoord));\n\
|
|
13
11
|
float entry;\n\
|
|
@@ -16,8 +14,7 @@ void intersectDepth(in vec2 screenCoord, in Ray ray, inout Intersections ix) {\n
|
|
|
16
14
|
// Calculate how far the ray must travel before it hits the depth buffer.\n\
|
|
17
15
|
vec4 eyeCoordinateDepth = czm_screenToEyeCoordinates(screenCoord, logDepthOrDepth);\n\
|
|
18
16
|
eyeCoordinateDepth /= eyeCoordinateDepth.w;\n\
|
|
19
|
-
|
|
20
|
-
entry = dot(depthPositionUv - ray.pos, ray.dir);\n\
|
|
17
|
+
entry = dot(eyeCoordinateDepth.xyz - ray.pos, ray.dir);\n\
|
|
21
18
|
exit = +INF_HIT;\n\
|
|
22
19
|
} else {\n\
|
|
23
20
|
// There's no depth at this location.\n\
|