@cesium/engine 1.0.0 → 1.1.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/Workers/{AttributeCompression-4589338a.js → AttributeCompression-b646d393.js} +1 -1
- package/Build/Workers/{AxisAlignedBoundingBox-bfb1234f.js → AxisAlignedBoundingBox-a4321399.js} +1 -1
- package/Build/Workers/{BoundingRectangle-7ffc2153.js → BoundingRectangle-80d8801f.js} +1 -1
- package/Build/Workers/{BoxGeometry-93f344a3.js → BoxGeometry-33c10a4f.js} +1 -1
- package/Build/Workers/{Color-0c5aaf47.js → Color-1bf9a6e0.js} +1 -1
- package/Build/Workers/{CoplanarPolygonGeometryLibrary-6597982a.js → CoplanarPolygonGeometryLibrary-5c5b981b.js} +1 -1
- package/Build/Workers/{CorridorGeometryLibrary-2119580e.js → CorridorGeometryLibrary-7cbae7a0.js} +1 -1
- package/Build/Workers/{CylinderGeometry-f9503c6d.js → CylinderGeometry-42740df0.js} +1 -1
- package/Build/Workers/{EllipseGeometry-fedf72d5.js → EllipseGeometry-49a3ac21.js} +1 -1
- package/Build/Workers/{EllipseGeometryLibrary-4ea68687.js → EllipseGeometryLibrary-b891b2f8.js} +1 -1
- package/Build/Workers/{EllipseOutlineGeometry-e2ae6a35.js → EllipseOutlineGeometry-fbd72e07.js} +1 -1
- package/Build/Workers/{EllipsoidGeodesic-16de63ea.js → EllipsoidGeodesic-98c62a56.js} +1 -1
- package/Build/Workers/{EllipsoidGeometry-95c0330e.js → EllipsoidGeometry-a351dba8.js} +1 -1
- package/Build/Workers/{EllipsoidOutlineGeometry-d6d2ceec.js → EllipsoidOutlineGeometry-3e8779bf.js} +1 -1
- package/Build/Workers/{EllipsoidRhumbLine-ae5e65e0.js → EllipsoidRhumbLine-19756602.js} +1 -1
- package/Build/Workers/{EllipsoidTangentPlane-bfc674bf.js → EllipsoidTangentPlane-cfb50678.js} +1 -1
- package/Build/Workers/{EncodedCartesian3-f473ea18.js → EncodedCartesian3-81f70735.js} +1 -1
- package/Build/Workers/{FrustumGeometry-3bf2e4eb.js → FrustumGeometry-c5754412.js} +1 -1
- package/Build/Workers/{GeometryAttribute-df5f473e.js → GeometryAttribute-0bfd05e8.js} +1 -1
- package/Build/Workers/{GeometryInstance-aa75b4cf.js → GeometryInstance-451dc1cd.js} +1 -1
- package/Build/Workers/{GeometryPipeline-f0e46c42.js → GeometryPipeline-0166905d.js} +1 -1
- package/Build/Workers/{IntersectionTests-9de29d51.js → IntersectionTests-a93d3de9.js} +1 -1
- package/Build/Workers/{Matrix2-ce637455.js → Matrix2-13178034.js} +4 -2
- package/Build/Workers/{Matrix3-4f4df527.js → Matrix3-315394f6.js} +2 -1
- package/Build/Workers/{OrientedBoundingBox-d3ff3d4d.js → OrientedBoundingBox-b450cb61.js} +5 -5
- package/Build/Workers/{Plane-b81241c2.js → Plane-900aa728.js} +1 -1
- package/Build/Workers/{PolygonGeometryLibrary-6f4937bb.js → PolygonGeometryLibrary-f918ac26.js} +1 -1
- package/Build/Workers/PolygonPipeline-f59a8f0a.js +1345 -0
- package/Build/Workers/{PolylinePipeline-2e2b015c.js → PolylinePipeline-d8e6bd9b.js} +1 -1
- package/Build/Workers/{PolylineVolumeGeometryLibrary-7ee1d449.js → PolylineVolumeGeometryLibrary-125d2edf.js} +1 -1
- package/Build/Workers/{PrimitivePipeline-a9b7aae0.js → PrimitivePipeline-0d7b5ed4.js} +1 -1
- package/Build/Workers/{RectangleGeometryLibrary-9aa6c8f6.js → RectangleGeometryLibrary-0768db63.js} +1 -1
- package/Build/Workers/{TerrainEncoding-b52dcfc5.js → TerrainEncoding-06470d7f.js} +1 -1
- package/Build/Workers/{Transforms-2f755df8.js → Transforms-26539bce.js} +97 -83
- package/Build/Workers/{WallGeometryLibrary-ab19a93d.js → WallGeometryLibrary-6167b0fc.js} +1 -1
- package/Build/Workers/{WebMercatorProjection-9f25de49.js → WebMercatorProjection-13a90d41.js} +1 -1
- package/Build/Workers/cesiumWorkerBootstrapper.js +25 -1
- package/Build/Workers/combineGeometry.js +1 -1
- package/Build/Workers/createBoxGeometry.js +1 -1
- package/Build/Workers/createBoxOutlineGeometry.js +1 -1
- package/Build/Workers/createCircleGeometry.js +1 -1
- package/Build/Workers/createCircleOutlineGeometry.js +1 -1
- package/Build/Workers/createCoplanarPolygonGeometry.js +1 -1
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +1 -1
- package/Build/Workers/createCorridorGeometry.js +1 -1
- package/Build/Workers/createCorridorOutlineGeometry.js +1 -1
- package/Build/Workers/createCylinderGeometry.js +1 -1
- package/Build/Workers/createCylinderOutlineGeometry.js +1 -1
- package/Build/Workers/createEllipseGeometry.js +1 -1
- package/Build/Workers/createEllipseOutlineGeometry.js +1 -1
- package/Build/Workers/createEllipsoidGeometry.js +1 -1
- package/Build/Workers/createEllipsoidOutlineGeometry.js +1 -1
- package/Build/Workers/createFrustumGeometry.js +1 -1
- package/Build/Workers/createFrustumOutlineGeometry.js +1 -1
- package/Build/Workers/createGeometry.js +1 -1
- package/Build/Workers/createGroundPolylineGeometry.js +1 -1
- package/Build/Workers/createPlaneGeometry.js +1 -1
- package/Build/Workers/createPlaneOutlineGeometry.js +1 -1
- package/Build/Workers/createPolygonGeometry.js +1 -1
- package/Build/Workers/createPolygonOutlineGeometry.js +1 -1
- package/Build/Workers/createPolylineGeometry.js +1 -1
- package/Build/Workers/createPolylineVolumeGeometry.js +1 -1
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +1 -1
- package/Build/Workers/createRectangleGeometry.js +1 -1
- package/Build/Workers/createRectangleOutlineGeometry.js +1 -1
- package/Build/Workers/createSimplePolylineGeometry.js +1 -1
- package/Build/Workers/createSphereGeometry.js +1 -1
- package/Build/Workers/createSphereOutlineGeometry.js +1 -1
- package/Build/Workers/createVectorTileClampedPolylines.js +1 -1
- package/Build/Workers/createVectorTileGeometries.js +1 -1
- package/Build/Workers/createVectorTilePoints.js +1 -1
- package/Build/Workers/createVectorTilePolygons.js +1 -1
- package/Build/Workers/createVectorTilePolylines.js +1 -1
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +1 -1
- package/Build/Workers/createVerticesFromHeightmap.js +7 -3
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +1 -1
- package/Build/Workers/createWallGeometry.js +1 -1
- package/Build/Workers/createWallOutlineGeometry.js +1 -1
- package/Build/Workers/decodeI3S.js +1 -1
- package/Build/Workers/package.js +25 -1
- package/Build/Workers/transferTypedArrayTest.js +25 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +1 -1
- package/Source/Core/EarthOrientationParameters.js +67 -63
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/Matrix2.js +2 -1
- package/Source/Core/Matrix3.js +2 -1
- package/Source/Core/Matrix4.js +1 -0
- package/Source/Core/OrientedBoundingBox.js +4 -4
- package/Source/Core/S2Cell.js +3 -3
- package/Source/Core/Transforms.js +3 -7
- package/Source/DataSources/GpxDataSource.js +4 -6
- package/Source/DataSources/KmlDataSource.js +3 -5
- package/Source/Renderer/Context.js +27 -9
- package/Source/Renderer/Pass.js +3 -2
- package/Source/Scene/Cesium3DTileContentType.js +19 -0
- package/Source/Scene/Cesium3DTilesVoxelProvider.js +482 -0
- package/Source/Scene/Cesium3DTilesetMetadata.js +2 -2
- package/Source/Scene/ContentMetadata.js +2 -2
- package/Source/Scene/DerivedCommand.js +7 -0
- package/Source/Scene/Expression.js +1 -1
- package/Source/Scene/Globe.js +10 -0
- package/Source/Scene/GlobeSurfaceTileProvider.js +7 -0
- package/Source/Scene/GltfImageLoader.js +1 -1
- package/Source/Scene/GltfVertexBufferLoader.js +10 -2
- package/Source/Scene/GroupMetadata.js +2 -2
- package/Source/Scene/ImplicitMetadataView.js +2 -2
- package/Source/Scene/ImplicitSubtreeCache.js +127 -0
- package/Source/Scene/ImplicitSubtreeMetadata.js +2 -2
- package/Source/Scene/ImplicitTileset.js +3 -2
- package/Source/Scene/KeyframeNode.js +47 -0
- package/Source/Scene/Megatexture.js +490 -0
- package/Source/Scene/MetadataClass.js +60 -25
- package/Source/Scene/MetadataClassProperty.js +132 -68
- package/Source/Scene/MetadataComponentType.js +78 -57
- package/Source/Scene/MetadataEnum.js +59 -23
- package/Source/Scene/MetadataEnumValue.js +49 -15
- package/Source/Scene/MetadataSchema.js +53 -24
- package/Source/Scene/MetadataSchemaLoader.js +2 -2
- package/Source/Scene/MetadataTableProperty.js +2 -2
- package/Source/Scene/MetadataType.js +6 -14
- package/Source/Scene/Model/GeoJsonLoader.js +1 -1
- package/Source/Scene/Model/Model.js +2 -3
- package/Source/Scene/Model/buildDrawCommand.js +19 -11
- package/Source/Scene/PointCloud.js +1 -1
- package/Source/Scene/PropertyAttribute.js +2 -2
- package/Source/Scene/PropertyAttributeProperty.js +2 -2
- package/Source/Scene/PropertyTable.js +2 -2
- package/Source/Scene/PropertyTexture.js +2 -2
- package/Source/Scene/PropertyTextureProperty.js +2 -2
- package/Source/Scene/ResourceCache.js +9 -1
- package/Source/Scene/ResourceCacheKey.js +9 -1
- package/Source/Scene/Scene.js +17 -0
- package/Source/Scene/SpatialNode.js +375 -0
- package/Source/Scene/StructuralMetadata.js +2 -2
- package/Source/Scene/TileMetadata.js +2 -2
- package/Source/Scene/TilesetMetadata.js +2 -2
- package/Source/Scene/VoxelBoxShape.js +527 -0
- package/Source/Scene/VoxelContent.js +169 -0
- package/Source/Scene/VoxelCylinderShape.js +937 -0
- package/Source/Scene/VoxelEllipsoidShape.js +937 -0
- package/Source/Scene/VoxelPrimitive.js +1919 -0
- package/Source/Scene/VoxelProvider.js +255 -0
- package/Source/Scene/VoxelRenderResources.js +224 -0
- package/Source/Scene/VoxelShape.js +152 -0
- package/Source/Scene/VoxelShapeType.js +105 -0
- package/Source/Scene/VoxelTraversal.js +1144 -0
- package/Source/Scene/buildVoxelDrawCommands.js +116 -0
- package/Source/Scene/parseBatchTable.js +18 -2
- package/Source/Scene/preprocess3DTileContent.js +8 -0
- package/Source/Scene/processVoxelProperties.js +455 -0
- package/Source/Shaders/BillboardCollectionVS.glsl +1 -1
- package/Source/Shaders/BillboardCollectionVS.js +1 -1
- package/Source/Shaders/Builtin/Constants/passOverlay.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passOverlay.js +1 -1
- package/Source/Shaders/Builtin/Constants/passVoxels.glsl +9 -0
- package/Source/Shaders/Builtin/Constants/passVoxels.js +11 -0
- package/Source/Shaders/Builtin/CzmBuiltins.js +17 -15
- package/Source/Shaders/Builtin/Functions/windowToEyeCoordinates.glsl +55 -43
- package/Source/Shaders/Builtin/Functions/windowToEyeCoordinates.js +55 -43
- package/Source/Shaders/GlobeFS.glsl +2 -1
- package/Source/Shaders/GlobeFS.js +2 -1
- package/Source/Shaders/PointPrimitiveCollectionVS.glsl +5 -2
- package/Source/Shaders/PointPrimitiveCollectionVS.js +5 -2
- package/Source/Shaders/Voxels/IntersectBox.glsl +79 -0
- package/Source/Shaders/Voxels/IntersectBox.js +81 -0
- package/Source/Shaders/Voxels/IntersectClippingPlanes.glsl +70 -0
- package/Source/Shaders/Voxels/IntersectClippingPlanes.js +72 -0
- package/Source/Shaders/Voxels/IntersectCylinder.glsl +273 -0
- package/Source/Shaders/Voxels/IntersectCylinder.js +275 -0
- package/Source/Shaders/Voxels/IntersectDepth.glsl +23 -0
- package/Source/Shaders/Voxels/IntersectDepth.js +25 -0
- package/Source/Shaders/Voxels/IntersectEllipsoid.glsl +337 -0
- package/Source/Shaders/Voxels/IntersectEllipsoid.js +339 -0
- package/Source/Shaders/Voxels/Intersection.glsl +54 -0
- package/Source/Shaders/Voxels/Intersection.js +56 -0
- package/Source/Shaders/Voxels/IntersectionUtils.glsl +151 -0
- package/Source/Shaders/Voxels/IntersectionUtils.js +153 -0
- package/Source/Shaders/Voxels/Megatexture.glsl +136 -0
- package/Source/Shaders/Voxels/Megatexture.js +138 -0
- package/Source/Shaders/Voxels/Octree.glsl +221 -0
- package/Source/Shaders/Voxels/Octree.js +223 -0
- package/Source/Shaders/Voxels/VoxelFS.glsl +150 -0
- package/Source/Shaders/Voxels/VoxelFS.js +152 -0
- package/Source/Shaders/Voxels/VoxelVS.glsl +11 -0
- package/Source/Shaders/Voxels/VoxelVS.js +13 -0
- package/Source/Shaders/Voxels/convertUvToBox.glsl +16 -0
- package/Source/Shaders/Voxels/convertUvToBox.js +18 -0
- package/Source/Shaders/Voxels/convertUvToCylinder.glsl +79 -0
- package/Source/Shaders/Voxels/convertUvToCylinder.js +81 -0
- package/Source/Shaders/Voxels/convertUvToEllipsoid.glsl +133 -0
- package/Source/Shaders/Voxels/convertUvToEllipsoid.js +135 -0
- package/Source/ThirdParty/Workers/z-worker-pako.js +0 -0
- package/index.d.ts +3124 -2287
- package/index.js +1117 -1085
- package/package.json +3 -4
- package/Build/Workers/PolygonPipeline-774a8aaf.js +0 -1341
|
@@ -22,6 +22,7 @@ import czm_passOpaque from './Constants/passOpaque.js'
|
|
|
22
22
|
import czm_passOverlay from './Constants/passOverlay.js'
|
|
23
23
|
import czm_passTerrainClassification from './Constants/passTerrainClassification.js'
|
|
24
24
|
import czm_passTranslucent from './Constants/passTranslucent.js'
|
|
25
|
+
import czm_passVoxels from './Constants/passVoxels.js'
|
|
25
26
|
import czm_pi from './Constants/pi.js'
|
|
26
27
|
import czm_piOverFour from './Constants/piOverFour.js'
|
|
27
28
|
import czm_piOverSix from './Constants/piOverSix.js'
|
|
@@ -45,6 +46,12 @@ import czm_pbrParameters from './Structs/pbrParameters.js'
|
|
|
45
46
|
import czm_ray from './Structs/ray.js'
|
|
46
47
|
import czm_raySegment from './Structs/raySegment.js'
|
|
47
48
|
import czm_shadowParameters from './Structs/shadowParameters.js'
|
|
49
|
+
import czm_HSBToRGB from './Functions/HSBToRGB.js'
|
|
50
|
+
import czm_HSLToRGB from './Functions/HSLToRGB.js'
|
|
51
|
+
import czm_RGBToHSB from './Functions/RGBToHSB.js'
|
|
52
|
+
import czm_RGBToHSL from './Functions/RGBToHSL.js'
|
|
53
|
+
import czm_RGBToXYZ from './Functions/RGBToXYZ.js'
|
|
54
|
+
import czm_XYZToRGB from './Functions/XYZToRGB.js'
|
|
48
55
|
import czm_acesTonemapping from './Functions/acesTonemapping.js'
|
|
49
56
|
import czm_alphaWeight from './Functions/alphaWeight.js'
|
|
50
57
|
import czm_antialias from './Functions/antialias.js'
|
|
@@ -75,15 +82,13 @@ import czm_getDefaultMaterial from './Functions/getDefaultMaterial.js'
|
|
|
75
82
|
import czm_getLambertDiffuse from './Functions/getLambertDiffuse.js'
|
|
76
83
|
import czm_getSpecular from './Functions/getSpecular.js'
|
|
77
84
|
import czm_getWaterNoise from './Functions/getWaterNoise.js'
|
|
78
|
-
import czm_HSBToRGB from './Functions/HSBToRGB.js'
|
|
79
|
-
import czm_HSLToRGB from './Functions/HSLToRGB.js'
|
|
80
85
|
import czm_hue from './Functions/hue.js'
|
|
81
86
|
import czm_inverseGamma from './Functions/inverseGamma.js'
|
|
82
87
|
import czm_isEmpty from './Functions/isEmpty.js'
|
|
83
88
|
import czm_isFull from './Functions/isFull.js'
|
|
84
89
|
import czm_latitudeToWebMercatorFraction from './Functions/latitudeToWebMercatorFraction.js'
|
|
85
|
-
import czm_linearToSrgb from './Functions/linearToSrgb.js'
|
|
86
90
|
import czm_lineDistance from './Functions/lineDistance.js'
|
|
91
|
+
import czm_linearToSrgb from './Functions/linearToSrgb.js'
|
|
87
92
|
import czm_luminance from './Functions/luminance.js'
|
|
88
93
|
import czm_metersPerPixel from './Functions/metersPerPixel.js'
|
|
89
94
|
import czm_modelToWindowCoordinates from './Functions/modelToWindowCoordinates.js'
|
|
@@ -102,9 +107,6 @@ import czm_raySphereIntersectionInterval from './Functions/raySphereIntersection
|
|
|
102
107
|
import czm_readDepth from './Functions/readDepth.js'
|
|
103
108
|
import czm_readNonPerspective from './Functions/readNonPerspective.js'
|
|
104
109
|
import czm_reverseLogDepth from './Functions/reverseLogDepth.js'
|
|
105
|
-
import czm_RGBToHSB from './Functions/RGBToHSB.js'
|
|
106
|
-
import czm_RGBToHSL from './Functions/RGBToHSL.js'
|
|
107
|
-
import czm_RGBToXYZ from './Functions/RGBToXYZ.js'
|
|
108
110
|
import czm_round from './Functions/round.js'
|
|
109
111
|
import czm_sampleOctahedralProjection from './Functions/sampleOctahedralProjection.js'
|
|
110
112
|
import czm_saturation from './Functions/saturation.js'
|
|
@@ -127,7 +129,6 @@ import czm_windowToEyeCoordinates from './Functions/windowToEyeCoordinates.js'
|
|
|
127
129
|
import czm_writeDepthClamp from './Functions/writeDepthClamp.js'
|
|
128
130
|
import czm_writeLogDepth from './Functions/writeLogDepth.js'
|
|
129
131
|
import czm_writeNonPerspective from './Functions/writeNonPerspective.js'
|
|
130
|
-
import czm_XYZToRGB from './Functions/XYZToRGB.js'
|
|
131
132
|
|
|
132
133
|
export default {
|
|
133
134
|
czm_degreesPerRadian : czm_degreesPerRadian,
|
|
@@ -153,6 +154,7 @@ export default {
|
|
|
153
154
|
czm_passOverlay : czm_passOverlay,
|
|
154
155
|
czm_passTerrainClassification : czm_passTerrainClassification,
|
|
155
156
|
czm_passTranslucent : czm_passTranslucent,
|
|
157
|
+
czm_passVoxels : czm_passVoxels,
|
|
156
158
|
czm_pi : czm_pi,
|
|
157
159
|
czm_piOverFour : czm_piOverFour,
|
|
158
160
|
czm_piOverSix : czm_piOverSix,
|
|
@@ -176,6 +178,12 @@ export default {
|
|
|
176
178
|
czm_ray : czm_ray,
|
|
177
179
|
czm_raySegment : czm_raySegment,
|
|
178
180
|
czm_shadowParameters : czm_shadowParameters,
|
|
181
|
+
czm_HSBToRGB : czm_HSBToRGB,
|
|
182
|
+
czm_HSLToRGB : czm_HSLToRGB,
|
|
183
|
+
czm_RGBToHSB : czm_RGBToHSB,
|
|
184
|
+
czm_RGBToHSL : czm_RGBToHSL,
|
|
185
|
+
czm_RGBToXYZ : czm_RGBToXYZ,
|
|
186
|
+
czm_XYZToRGB : czm_XYZToRGB,
|
|
179
187
|
czm_acesTonemapping : czm_acesTonemapping,
|
|
180
188
|
czm_alphaWeight : czm_alphaWeight,
|
|
181
189
|
czm_antialias : czm_antialias,
|
|
@@ -206,15 +214,13 @@ export default {
|
|
|
206
214
|
czm_getLambertDiffuse : czm_getLambertDiffuse,
|
|
207
215
|
czm_getSpecular : czm_getSpecular,
|
|
208
216
|
czm_getWaterNoise : czm_getWaterNoise,
|
|
209
|
-
czm_HSBToRGB : czm_HSBToRGB,
|
|
210
|
-
czm_HSLToRGB : czm_HSLToRGB,
|
|
211
217
|
czm_hue : czm_hue,
|
|
212
218
|
czm_inverseGamma : czm_inverseGamma,
|
|
213
219
|
czm_isEmpty : czm_isEmpty,
|
|
214
220
|
czm_isFull : czm_isFull,
|
|
215
221
|
czm_latitudeToWebMercatorFraction : czm_latitudeToWebMercatorFraction,
|
|
216
|
-
czm_linearToSrgb : czm_linearToSrgb,
|
|
217
222
|
czm_lineDistance : czm_lineDistance,
|
|
223
|
+
czm_linearToSrgb : czm_linearToSrgb,
|
|
218
224
|
czm_luminance : czm_luminance,
|
|
219
225
|
czm_metersPerPixel : czm_metersPerPixel,
|
|
220
226
|
czm_modelToWindowCoordinates : czm_modelToWindowCoordinates,
|
|
@@ -233,9 +239,6 @@ export default {
|
|
|
233
239
|
czm_readDepth : czm_readDepth,
|
|
234
240
|
czm_readNonPerspective : czm_readNonPerspective,
|
|
235
241
|
czm_reverseLogDepth : czm_reverseLogDepth,
|
|
236
|
-
czm_RGBToHSB : czm_RGBToHSB,
|
|
237
|
-
czm_RGBToHSL : czm_RGBToHSL,
|
|
238
|
-
czm_RGBToXYZ : czm_RGBToXYZ,
|
|
239
242
|
czm_round : czm_round,
|
|
240
243
|
czm_sampleOctahedralProjection : czm_sampleOctahedralProjection,
|
|
241
244
|
czm_saturation : czm_saturation,
|
|
@@ -257,6 +260,5 @@ export default {
|
|
|
257
260
|
czm_windowToEyeCoordinates : czm_windowToEyeCoordinates,
|
|
258
261
|
czm_writeDepthClamp : czm_writeDepthClamp,
|
|
259
262
|
czm_writeLogDepth : czm_writeLogDepth,
|
|
260
|
-
czm_writeNonPerspective : czm_writeNonPerspective
|
|
261
|
-
czm_XYZToRGB : czm_XYZToRGB
|
|
263
|
+
czm_writeNonPerspective : czm_writeNonPerspective
|
|
262
264
|
};
|
|
@@ -1,38 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
* Transforms a position from window to eye coordinates.
|
|
3
|
-
* The transform from window to normalized device coordinates is done using components
|
|
4
|
-
* of (@link czm_viewport} and {@link czm_viewportTransformation} instead of calculating
|
|
5
|
-
* the inverse of <code>czm_viewportTransformation</code>. The transformation from
|
|
6
|
-
* normalized device coordinates to clip coordinates is done using <code>fragmentCoordinate.w</code>,
|
|
7
|
-
* which is expected to be the scalar used in the perspective divide. The transformation
|
|
8
|
-
* from clip to eye coordinates is done using {@link czm_inverseProjection}.
|
|
9
|
-
*
|
|
10
|
-
* @name czm_windowToEyeCoordinates
|
|
11
|
-
* @glslFunction
|
|
12
|
-
*
|
|
13
|
-
* @param {vec4} fragmentCoordinate The position in window coordinates to transform.
|
|
14
|
-
*
|
|
15
|
-
* @returns {vec4} The transformed position in eye coordinates.
|
|
16
|
-
*
|
|
17
|
-
* @see czm_modelToWindowCoordinates
|
|
18
|
-
* @see czm_eyeToWindowCoordinates
|
|
19
|
-
* @see czm_inverseProjection
|
|
20
|
-
* @see czm_viewport
|
|
21
|
-
* @see czm_viewportTransformation
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* vec4 positionEC = czm_windowToEyeCoordinates(gl_FragCoord);
|
|
25
|
-
*/
|
|
26
|
-
vec4 czm_windowToEyeCoordinates(vec4 fragmentCoordinate)
|
|
1
|
+
vec4 czm_screenToEyeCoordinates(vec4 screenCoordinate)
|
|
27
2
|
{
|
|
28
3
|
// Reconstruct NDC coordinates
|
|
29
|
-
float x = 2.0 *
|
|
30
|
-
float y = 2.0 *
|
|
31
|
-
float z = (
|
|
4
|
+
float x = 2.0 * screenCoordinate.x - 1.0;
|
|
5
|
+
float y = 2.0 * screenCoordinate.y - 1.0;
|
|
6
|
+
float z = (screenCoordinate.z - czm_viewportTransformation[3][2]) / czm_viewportTransformation[2][2];
|
|
32
7
|
vec4 q = vec4(x, y, z, 1.0);
|
|
33
8
|
|
|
34
9
|
// Reverse the perspective division to obtain clip coordinates.
|
|
35
|
-
q /=
|
|
10
|
+
q /= screenCoordinate.w;
|
|
36
11
|
|
|
37
12
|
// Reverse the projection transformation to obtain eye coordinates.
|
|
38
13
|
if (!(czm_inverseProjection == mat4(0.0))) // IE and Edge sometimes do something weird with != between mat4s
|
|
@@ -59,16 +34,20 @@ vec4 czm_windowToEyeCoordinates(vec4 fragmentCoordinate)
|
|
|
59
34
|
}
|
|
60
35
|
|
|
61
36
|
/**
|
|
62
|
-
* Transforms a position
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
* of
|
|
37
|
+
* Transforms a position from window to eye coordinates.
|
|
38
|
+
* The transform from window to normalized device coordinates is done using components
|
|
39
|
+
* of (@link czm_viewport} and {@link czm_viewportTransformation} instead of calculating
|
|
40
|
+
* the inverse of <code>czm_viewportTransformation</code>. The transformation from
|
|
41
|
+
* normalized device coordinates to clip coordinates is done using <code>fragmentCoordinate.w</code>,
|
|
42
|
+
* which is expected to be the scalar used in the perspective divide. The transformation
|
|
43
|
+
* from clip to eye coordinates is done using {@link czm_inverseProjection}.
|
|
66
44
|
*
|
|
67
45
|
* @name czm_windowToEyeCoordinates
|
|
68
46
|
* @glslFunction
|
|
69
47
|
*
|
|
70
|
-
* @param {
|
|
71
|
-
*
|
|
48
|
+
* @param {vec4} fragmentCoordinate The position in window coordinates to transform.
|
|
49
|
+
*
|
|
50
|
+
* @returns {vec4} The transformed position in eye coordinates.
|
|
72
51
|
*
|
|
73
52
|
* @see czm_modelToWindowCoordinates
|
|
74
53
|
* @see czm_eyeToWindowCoordinates
|
|
@@ -76,24 +55,57 @@ vec4 czm_windowToEyeCoordinates(vec4 fragmentCoordinate)
|
|
|
76
55
|
* @see czm_viewport
|
|
77
56
|
* @see czm_viewportTransformation
|
|
78
57
|
*
|
|
79
|
-
* @
|
|
58
|
+
* @example
|
|
59
|
+
* vec4 positionEC = czm_windowToEyeCoordinates(gl_FragCoord);
|
|
80
60
|
*/
|
|
81
|
-
vec4 czm_windowToEyeCoordinates(
|
|
61
|
+
vec4 czm_windowToEyeCoordinates(vec4 fragmentCoordinate)
|
|
62
|
+
{
|
|
63
|
+
vec2 screenCoordXY = (fragmentCoordinate.xy - czm_viewport.xy) / czm_viewport.zw;
|
|
64
|
+
return czm_screenToEyeCoordinates(vec4(screenCoordXY, fragmentCoordinate.zw));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
vec4 czm_screenToEyeCoordinates(vec2 screenCoordinateXY, float depthOrLogDepth)
|
|
82
68
|
{
|
|
83
69
|
// See reverseLogDepth.glsl. This is separate to re-use the pow.
|
|
84
|
-
#
|
|
70
|
+
#if defined(LOG_DEPTH) || defined(LOG_DEPTH_READ_ONLY)
|
|
85
71
|
float near = czm_currentFrustum.x;
|
|
86
72
|
float far = czm_currentFrustum.y;
|
|
87
73
|
float log2Depth = depthOrLogDepth * czm_log2FarDepthFromNearPlusOne;
|
|
88
74
|
float depthFromNear = pow(2.0, log2Depth) - 1.0;
|
|
89
75
|
float depthFromCamera = depthFromNear + near;
|
|
90
|
-
vec4
|
|
91
|
-
vec4 eyeCoordinate =
|
|
76
|
+
vec4 screenCoord = vec4(screenCoordinateXY, far * (1.0 - near / depthFromCamera) / (far - near), 1.0);
|
|
77
|
+
vec4 eyeCoordinate = czm_screenToEyeCoordinates(screenCoord);
|
|
92
78
|
eyeCoordinate.w = 1.0 / depthFromCamera; // Better precision
|
|
93
79
|
return eyeCoordinate;
|
|
94
80
|
#else
|
|
95
|
-
vec4
|
|
96
|
-
vec4 eyeCoordinate =
|
|
81
|
+
vec4 screenCoord = vec4(screenCoordinateXY, depthOrLogDepth, 1.0);
|
|
82
|
+
vec4 eyeCoordinate = czm_screenToEyeCoordinates(screenCoord);
|
|
97
83
|
#endif
|
|
98
84
|
return eyeCoordinate;
|
|
99
85
|
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Transforms a position given as window x/y and a depth or a log depth from window to eye coordinates.
|
|
89
|
+
* This function produces more accurate results for window positions with log depth than
|
|
90
|
+
* conventionally unpacking the log depth using czm_reverseLogDepth and using the standard version
|
|
91
|
+
* of czm_windowToEyeCoordinates.
|
|
92
|
+
*
|
|
93
|
+
* @name czm_windowToEyeCoordinates
|
|
94
|
+
* @glslFunction
|
|
95
|
+
*
|
|
96
|
+
* @param {vec2} fragmentCoordinateXY The XY position in window coordinates to transform.
|
|
97
|
+
* @param {float} depthOrLogDepth A depth or log depth for the fragment.
|
|
98
|
+
*
|
|
99
|
+
* @see czm_modelToWindowCoordinates
|
|
100
|
+
* @see czm_eyeToWindowCoordinates
|
|
101
|
+
* @see czm_inverseProjection
|
|
102
|
+
* @see czm_viewport
|
|
103
|
+
* @see czm_viewportTransformation
|
|
104
|
+
*
|
|
105
|
+
* @returns {vec4} The transformed position in eye coordinates.
|
|
106
|
+
*/
|
|
107
|
+
vec4 czm_windowToEyeCoordinates(vec2 fragmentCoordinateXY, float depthOrLogDepth)
|
|
108
|
+
{
|
|
109
|
+
vec2 screenCoordXY = (fragmentCoordinateXY.xy - czm_viewport.xy) / czm_viewport.zw;
|
|
110
|
+
return czm_screenToEyeCoordinates(screenCoordXY, depthOrLogDepth);
|
|
111
|
+
}
|
|
@@ -1,39 +1,14 @@
|
|
|
1
1
|
//This file is automatically rebuilt by the Cesium build process.
|
|
2
|
-
export default "
|
|
3
|
-
* Transforms a position from window to eye coordinates.\n\
|
|
4
|
-
* The transform from window to normalized device coordinates is done using components\n\
|
|
5
|
-
* of (@link czm_viewport} and {@link czm_viewportTransformation} instead of calculating\n\
|
|
6
|
-
* the inverse of <code>czm_viewportTransformation</code>. The transformation from\n\
|
|
7
|
-
* normalized device coordinates to clip coordinates is done using <code>fragmentCoordinate.w</code>,\n\
|
|
8
|
-
* which is expected to be the scalar used in the perspective divide. The transformation\n\
|
|
9
|
-
* from clip to eye coordinates is done using {@link czm_inverseProjection}.\n\
|
|
10
|
-
*\n\
|
|
11
|
-
* @name czm_windowToEyeCoordinates\n\
|
|
12
|
-
* @glslFunction\n\
|
|
13
|
-
*\n\
|
|
14
|
-
* @param {vec4} fragmentCoordinate The position in window coordinates to transform.\n\
|
|
15
|
-
*\n\
|
|
16
|
-
* @returns {vec4} The transformed position in eye coordinates.\n\
|
|
17
|
-
*\n\
|
|
18
|
-
* @see czm_modelToWindowCoordinates\n\
|
|
19
|
-
* @see czm_eyeToWindowCoordinates\n\
|
|
20
|
-
* @see czm_inverseProjection\n\
|
|
21
|
-
* @see czm_viewport\n\
|
|
22
|
-
* @see czm_viewportTransformation\n\
|
|
23
|
-
*\n\
|
|
24
|
-
* @example\n\
|
|
25
|
-
* vec4 positionEC = czm_windowToEyeCoordinates(gl_FragCoord);\n\
|
|
26
|
-
*/\n\
|
|
27
|
-
vec4 czm_windowToEyeCoordinates(vec4 fragmentCoordinate)\n\
|
|
2
|
+
export default "vec4 czm_screenToEyeCoordinates(vec4 screenCoordinate)\n\
|
|
28
3
|
{\n\
|
|
29
4
|
// Reconstruct NDC coordinates\n\
|
|
30
|
-
float x = 2.0 *
|
|
31
|
-
float y = 2.0 *
|
|
32
|
-
float z = (
|
|
5
|
+
float x = 2.0 * screenCoordinate.x - 1.0;\n\
|
|
6
|
+
float y = 2.0 * screenCoordinate.y - 1.0;\n\
|
|
7
|
+
float z = (screenCoordinate.z - czm_viewportTransformation[3][2]) / czm_viewportTransformation[2][2];\n\
|
|
33
8
|
vec4 q = vec4(x, y, z, 1.0);\n\
|
|
34
9
|
\n\
|
|
35
10
|
// Reverse the perspective division to obtain clip coordinates.\n\
|
|
36
|
-
q /=
|
|
11
|
+
q /= screenCoordinate.w;\n\
|
|
37
12
|
\n\
|
|
38
13
|
// Reverse the projection transformation to obtain eye coordinates.\n\
|
|
39
14
|
if (!(czm_inverseProjection == mat4(0.0))) // IE and Edge sometimes do something weird with != between mat4s\n\
|
|
@@ -60,16 +35,20 @@ vec4 czm_windowToEyeCoordinates(vec4 fragmentCoordinate)\n\
|
|
|
60
35
|
}\n\
|
|
61
36
|
\n\
|
|
62
37
|
/**\n\
|
|
63
|
-
* Transforms a position
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
* of
|
|
38
|
+
* Transforms a position from window to eye coordinates.\n\
|
|
39
|
+
* The transform from window to normalized device coordinates is done using components\n\
|
|
40
|
+
* of (@link czm_viewport} and {@link czm_viewportTransformation} instead of calculating\n\
|
|
41
|
+
* the inverse of <code>czm_viewportTransformation</code>. The transformation from\n\
|
|
42
|
+
* normalized device coordinates to clip coordinates is done using <code>fragmentCoordinate.w</code>,\n\
|
|
43
|
+
* which is expected to be the scalar used in the perspective divide. The transformation\n\
|
|
44
|
+
* from clip to eye coordinates is done using {@link czm_inverseProjection}.\n\
|
|
67
45
|
*\n\
|
|
68
46
|
* @name czm_windowToEyeCoordinates\n\
|
|
69
47
|
* @glslFunction\n\
|
|
70
48
|
*\n\
|
|
71
|
-
* @param {
|
|
72
|
-
|
|
49
|
+
* @param {vec4} fragmentCoordinate The position in window coordinates to transform.\n\
|
|
50
|
+
*\n\
|
|
51
|
+
* @returns {vec4} The transformed position in eye coordinates.\n\
|
|
73
52
|
*\n\
|
|
74
53
|
* @see czm_modelToWindowCoordinates\n\
|
|
75
54
|
* @see czm_eyeToWindowCoordinates\n\
|
|
@@ -77,25 +56,58 @@ vec4 czm_windowToEyeCoordinates(vec4 fragmentCoordinate)\n\
|
|
|
77
56
|
* @see czm_viewport\n\
|
|
78
57
|
* @see czm_viewportTransformation\n\
|
|
79
58
|
*\n\
|
|
80
|
-
* @
|
|
59
|
+
* @example\n\
|
|
60
|
+
* vec4 positionEC = czm_windowToEyeCoordinates(gl_FragCoord);\n\
|
|
81
61
|
*/\n\
|
|
82
|
-
vec4 czm_windowToEyeCoordinates(
|
|
62
|
+
vec4 czm_windowToEyeCoordinates(vec4 fragmentCoordinate)\n\
|
|
63
|
+
{\n\
|
|
64
|
+
vec2 screenCoordXY = (fragmentCoordinate.xy - czm_viewport.xy) / czm_viewport.zw;\n\
|
|
65
|
+
return czm_screenToEyeCoordinates(vec4(screenCoordXY, fragmentCoordinate.zw));\n\
|
|
66
|
+
}\n\
|
|
67
|
+
\n\
|
|
68
|
+
vec4 czm_screenToEyeCoordinates(vec2 screenCoordinateXY, float depthOrLogDepth)\n\
|
|
83
69
|
{\n\
|
|
84
70
|
// See reverseLogDepth.glsl. This is separate to re-use the pow.\n\
|
|
85
|
-
#
|
|
71
|
+
#if defined(LOG_DEPTH) || defined(LOG_DEPTH_READ_ONLY)\n\
|
|
86
72
|
float near = czm_currentFrustum.x;\n\
|
|
87
73
|
float far = czm_currentFrustum.y;\n\
|
|
88
74
|
float log2Depth = depthOrLogDepth * czm_log2FarDepthFromNearPlusOne;\n\
|
|
89
75
|
float depthFromNear = pow(2.0, log2Depth) - 1.0;\n\
|
|
90
76
|
float depthFromCamera = depthFromNear + near;\n\
|
|
91
|
-
vec4
|
|
92
|
-
vec4 eyeCoordinate =
|
|
77
|
+
vec4 screenCoord = vec4(screenCoordinateXY, far * (1.0 - near / depthFromCamera) / (far - near), 1.0);\n\
|
|
78
|
+
vec4 eyeCoordinate = czm_screenToEyeCoordinates(screenCoord);\n\
|
|
93
79
|
eyeCoordinate.w = 1.0 / depthFromCamera; // Better precision\n\
|
|
94
80
|
return eyeCoordinate;\n\
|
|
95
81
|
#else\n\
|
|
96
|
-
vec4
|
|
97
|
-
vec4 eyeCoordinate =
|
|
82
|
+
vec4 screenCoord = vec4(screenCoordinateXY, depthOrLogDepth, 1.0);\n\
|
|
83
|
+
vec4 eyeCoordinate = czm_screenToEyeCoordinates(screenCoord);\n\
|
|
98
84
|
#endif\n\
|
|
99
85
|
return eyeCoordinate;\n\
|
|
100
86
|
}\n\
|
|
87
|
+
\n\
|
|
88
|
+
/**\n\
|
|
89
|
+
* Transforms a position given as window x/y and a depth or a log depth from window to eye coordinates.\n\
|
|
90
|
+
* This function produces more accurate results for window positions with log depth than\n\
|
|
91
|
+
* conventionally unpacking the log depth using czm_reverseLogDepth and using the standard version\n\
|
|
92
|
+
* of czm_windowToEyeCoordinates.\n\
|
|
93
|
+
*\n\
|
|
94
|
+
* @name czm_windowToEyeCoordinates\n\
|
|
95
|
+
* @glslFunction\n\
|
|
96
|
+
*\n\
|
|
97
|
+
* @param {vec2} fragmentCoordinateXY The XY position in window coordinates to transform.\n\
|
|
98
|
+
* @param {float} depthOrLogDepth A depth or log depth for the fragment.\n\
|
|
99
|
+
*\n\
|
|
100
|
+
* @see czm_modelToWindowCoordinates\n\
|
|
101
|
+
* @see czm_eyeToWindowCoordinates\n\
|
|
102
|
+
* @see czm_inverseProjection\n\
|
|
103
|
+
* @see czm_viewport\n\
|
|
104
|
+
* @see czm_viewportTransformation\n\
|
|
105
|
+
*\n\
|
|
106
|
+
* @returns {vec4} The transformed position in eye coordinates.\n\
|
|
107
|
+
*/\n\
|
|
108
|
+
vec4 czm_windowToEyeCoordinates(vec2 fragmentCoordinateXY, float depthOrLogDepth)\n\
|
|
109
|
+
{\n\
|
|
110
|
+
vec2 screenCoordXY = (fragmentCoordinateXY.xy - czm_viewport.xy) / czm_viewport.zw;\n\
|
|
111
|
+
return czm_screenToEyeCoordinates(screenCoordXY, depthOrLogDepth);\n\
|
|
112
|
+
}\n\
|
|
101
113
|
";
|
|
@@ -102,6 +102,7 @@ uniform vec4 u_undergroundColorAlphaByDistance;
|
|
|
102
102
|
|
|
103
103
|
#ifdef ENABLE_VERTEX_LIGHTING
|
|
104
104
|
uniform float u_lambertDiffuseMultiplier;
|
|
105
|
+
uniform float u_vertexShadowDarkness;
|
|
105
106
|
#endif
|
|
106
107
|
|
|
107
108
|
varying vec3 v_positionMC;
|
|
@@ -405,7 +406,7 @@ void main()
|
|
|
405
406
|
#endif
|
|
406
407
|
|
|
407
408
|
#ifdef ENABLE_VERTEX_LIGHTING
|
|
408
|
-
float diffuseIntensity = clamp(czm_getLambertDiffuse(czm_lightDirectionEC, normalize(v_normalEC)) * u_lambertDiffuseMultiplier +
|
|
409
|
+
float diffuseIntensity = clamp(czm_getLambertDiffuse(czm_lightDirectionEC, normalize(v_normalEC)) * u_lambertDiffuseMultiplier + u_vertexShadowDarkness, 0.0, 1.0);
|
|
409
410
|
vec4 finalColor = vec4(color.rgb * czm_lightColor * diffuseIntensity, color.a);
|
|
410
411
|
#elif defined(ENABLE_DAYNIGHT_SHADING)
|
|
411
412
|
float diffuseIntensity = clamp(czm_getLambertDiffuse(czm_lightDirectionEC, normalEC) * 5.0 + 0.3, 0.0, 1.0);
|
|
@@ -103,6 +103,7 @@ uniform vec4 u_undergroundColorAlphaByDistance;\n\
|
|
|
103
103
|
\n\
|
|
104
104
|
#ifdef ENABLE_VERTEX_LIGHTING\n\
|
|
105
105
|
uniform float u_lambertDiffuseMultiplier;\n\
|
|
106
|
+
uniform float u_vertexShadowDarkness;\n\
|
|
106
107
|
#endif\n\
|
|
107
108
|
\n\
|
|
108
109
|
varying vec3 v_positionMC;\n\
|
|
@@ -406,7 +407,7 @@ void main()\n\
|
|
|
406
407
|
#endif\n\
|
|
407
408
|
\n\
|
|
408
409
|
#ifdef ENABLE_VERTEX_LIGHTING\n\
|
|
409
|
-
float diffuseIntensity = clamp(czm_getLambertDiffuse(czm_lightDirectionEC, normalize(v_normalEC)) * u_lambertDiffuseMultiplier +
|
|
410
|
+
float diffuseIntensity = clamp(czm_getLambertDiffuse(czm_lightDirectionEC, normalize(v_normalEC)) * u_lambertDiffuseMultiplier + u_vertexShadowDarkness, 0.0, 1.0);\n\
|
|
410
411
|
vec4 finalColor = vec4(color.rgb * czm_lightColor * diffuseIntensity, color.a);\n\
|
|
411
412
|
#elif defined(ENABLE_DAYNIGHT_SHADING)\n\
|
|
412
413
|
float diffuseIntensity = clamp(czm_getLambertDiffuse(czm_lightDirectionEC, normalEC) * 5.0 + 0.3, 0.0, 1.0);\n\
|
|
@@ -28,8 +28,6 @@ void main()
|
|
|
28
28
|
float outlinePercent = outlineWidthBothSides / totalSize;
|
|
29
29
|
// Scale in response to browser-zoom.
|
|
30
30
|
totalSize *= czm_pixelRatio;
|
|
31
|
-
// Add padding for anti-aliasing on both sides.
|
|
32
|
-
totalSize += 3.0;
|
|
33
31
|
|
|
34
32
|
float temp = compressedAttribute1.x * SHIFT_RIGHT8;
|
|
35
33
|
float show = floor(temp);
|
|
@@ -111,6 +109,11 @@ void main()
|
|
|
111
109
|
#ifdef EYE_DISTANCE_SCALING
|
|
112
110
|
totalSize *= czm_nearFarScalar(scaleByDistance, lengthSq);
|
|
113
111
|
#endif
|
|
112
|
+
if (totalSize > 0.0) {
|
|
113
|
+
// Add padding for anti-aliasing on both sides.
|
|
114
|
+
totalSize += 3.0;
|
|
115
|
+
}
|
|
116
|
+
|
|
114
117
|
// Clamp to max point size.
|
|
115
118
|
totalSize = min(totalSize, u_maxTotalPointSize);
|
|
116
119
|
// If size is too small, push vertex behind near plane for clipping.
|
|
@@ -29,8 +29,6 @@ void main()\n\
|
|
|
29
29
|
float outlinePercent = outlineWidthBothSides / totalSize;\n\
|
|
30
30
|
// Scale in response to browser-zoom.\n\
|
|
31
31
|
totalSize *= czm_pixelRatio;\n\
|
|
32
|
-
// Add padding for anti-aliasing on both sides.\n\
|
|
33
|
-
totalSize += 3.0;\n\
|
|
34
32
|
\n\
|
|
35
33
|
float temp = compressedAttribute1.x * SHIFT_RIGHT8;\n\
|
|
36
34
|
float show = floor(temp);\n\
|
|
@@ -112,6 +110,11 @@ void main()\n\
|
|
|
112
110
|
#ifdef EYE_DISTANCE_SCALING\n\
|
|
113
111
|
totalSize *= czm_nearFarScalar(scaleByDistance, lengthSq);\n\
|
|
114
112
|
#endif\n\
|
|
113
|
+
if (totalSize > 0.0) {\n\
|
|
114
|
+
// Add padding for anti-aliasing on both sides.\n\
|
|
115
|
+
totalSize += 3.0;\n\
|
|
116
|
+
}\n\
|
|
117
|
+
\n\
|
|
115
118
|
// Clamp to max point size.\n\
|
|
116
119
|
totalSize = min(totalSize, u_maxTotalPointSize);\n\
|
|
117
120
|
// If size is too small, push vertex behind near plane for clipping.\n\
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// See IntersectionUtils.glsl for the definitions of Ray and NO_HIT
|
|
2
|
+
|
|
3
|
+
/* Box defines (set in Scene/VoxelBoxShape.js)
|
|
4
|
+
#define BOX_INTERSECTION_INDEX ### // always 0
|
|
5
|
+
#define BOX_HAS_RENDER_BOUNDS
|
|
6
|
+
#define BOX_IS_2D
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
#if defined(BOX_HAS_RENDER_BOUNDS)
|
|
10
|
+
#if defined(BOX_IS_2D)
|
|
11
|
+
// This matrix bakes in an axis conversion so that the math works for XY plane.
|
|
12
|
+
uniform mat4 u_boxUvToRenderBoundsTransform;
|
|
13
|
+
#else
|
|
14
|
+
// Similar to u_boxTransformUvToBounds but fewer instructions needed.
|
|
15
|
+
uniform vec3 u_boxUvToRenderBoundsScale;
|
|
16
|
+
uniform vec3 u_boxUvToRenderBoundsTranslate;
|
|
17
|
+
#endif
|
|
18
|
+
#endif
|
|
19
|
+
|
|
20
|
+
vec2 intersectUnitCube(Ray ray) // Unit cube from [-1, +1]
|
|
21
|
+
{
|
|
22
|
+
vec3 o = ray.pos;
|
|
23
|
+
vec3 d = ray.dir;
|
|
24
|
+
|
|
25
|
+
vec3 dInv = 1.0 / d;
|
|
26
|
+
vec3 od = -o * dInv;
|
|
27
|
+
vec3 t0 = od - dInv;
|
|
28
|
+
vec3 t1 = od + dInv;
|
|
29
|
+
vec3 m0 = min(t0, t1);
|
|
30
|
+
vec3 m1 = max(t0, t1);
|
|
31
|
+
float tMin = max(max(m0.x, m0.y), m0.z);
|
|
32
|
+
float tMax = min(min(m1.x, m1.y), m1.z);
|
|
33
|
+
|
|
34
|
+
if (tMin >= tMax) {
|
|
35
|
+
return vec2(NO_HIT);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return vec2(tMin, tMax);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
vec2 intersectUnitSquare(Ray ray) // Unit square from [-1, +1]
|
|
42
|
+
{
|
|
43
|
+
vec3 o = ray.pos;
|
|
44
|
+
vec3 d = ray.dir;
|
|
45
|
+
|
|
46
|
+
float t = -o.z / d.z;
|
|
47
|
+
vec2 planePos = o.xy + d.xy * t;
|
|
48
|
+
if (any(greaterThan(abs(planePos), vec2(1.0)))) {
|
|
49
|
+
return vec2(NO_HIT);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return vec2(t, t);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
void intersectShape(Ray ray, inout Intersections ix)
|
|
56
|
+
{
|
|
57
|
+
#if defined(BOX_HAS_RENDER_BOUNDS)
|
|
58
|
+
#if defined(BOX_IS_2D)
|
|
59
|
+
// Transform the ray into unit square space on Z plane
|
|
60
|
+
// This matrix bakes in an axis conversion so that the math works for XY plane.
|
|
61
|
+
ray.pos = vec3(u_boxUvToRenderBoundsTransform * vec4(ray.pos, 1.0));
|
|
62
|
+
ray.dir = vec3(u_boxUvToRenderBoundsTransform * vec4(ray.dir, 0.0));
|
|
63
|
+
vec2 entryExit = intersectUnitSquare(ray);
|
|
64
|
+
#else
|
|
65
|
+
// Transform the ray into unit cube space
|
|
66
|
+
ray.pos = ray.pos * u_boxUvToRenderBoundsScale + u_boxUvToRenderBoundsTranslate;
|
|
67
|
+
ray.dir *= u_boxUvToRenderBoundsScale;
|
|
68
|
+
vec2 entryExit = intersectUnitCube(ray);
|
|
69
|
+
#endif
|
|
70
|
+
#else
|
|
71
|
+
// Position is converted from [0,1] to [-1,+1] because shape intersections assume unit space is [-1,+1].
|
|
72
|
+
// Direction is scaled as well to be in sync with position.
|
|
73
|
+
ray.pos = ray.pos * 2.0 - 1.0;
|
|
74
|
+
ray.dir = ray.dir * 2.0;
|
|
75
|
+
vec2 entryExit = intersectUnitCube(ray);
|
|
76
|
+
#endif
|
|
77
|
+
|
|
78
|
+
setIntersectionPair(ix, BOX_INTERSECTION_INDEX, entryExit);
|
|
79
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
//This file is automatically rebuilt by the Cesium build process.
|
|
2
|
+
export default "// See IntersectionUtils.glsl for the definitions of Ray and NO_HIT\n\
|
|
3
|
+
\n\
|
|
4
|
+
/* Box defines (set in Scene/VoxelBoxShape.js)\n\
|
|
5
|
+
#define BOX_INTERSECTION_INDEX ### // always 0\n\
|
|
6
|
+
#define BOX_HAS_RENDER_BOUNDS\n\
|
|
7
|
+
#define BOX_IS_2D\n\
|
|
8
|
+
*/\n\
|
|
9
|
+
\n\
|
|
10
|
+
#if defined(BOX_HAS_RENDER_BOUNDS)\n\
|
|
11
|
+
#if defined(BOX_IS_2D)\n\
|
|
12
|
+
// This matrix bakes in an axis conversion so that the math works for XY plane.\n\
|
|
13
|
+
uniform mat4 u_boxUvToRenderBoundsTransform;\n\
|
|
14
|
+
#else\n\
|
|
15
|
+
// Similar to u_boxTransformUvToBounds but fewer instructions needed.\n\
|
|
16
|
+
uniform vec3 u_boxUvToRenderBoundsScale;\n\
|
|
17
|
+
uniform vec3 u_boxUvToRenderBoundsTranslate;\n\
|
|
18
|
+
#endif\n\
|
|
19
|
+
#endif\n\
|
|
20
|
+
\n\
|
|
21
|
+
vec2 intersectUnitCube(Ray ray) // Unit cube from [-1, +1]\n\
|
|
22
|
+
{\n\
|
|
23
|
+
vec3 o = ray.pos;\n\
|
|
24
|
+
vec3 d = ray.dir;\n\
|
|
25
|
+
\n\
|
|
26
|
+
vec3 dInv = 1.0 / d;\n\
|
|
27
|
+
vec3 od = -o * dInv;\n\
|
|
28
|
+
vec3 t0 = od - dInv;\n\
|
|
29
|
+
vec3 t1 = od + dInv;\n\
|
|
30
|
+
vec3 m0 = min(t0, t1);\n\
|
|
31
|
+
vec3 m1 = max(t0, t1);\n\
|
|
32
|
+
float tMin = max(max(m0.x, m0.y), m0.z);\n\
|
|
33
|
+
float tMax = min(min(m1.x, m1.y), m1.z);\n\
|
|
34
|
+
\n\
|
|
35
|
+
if (tMin >= tMax) {\n\
|
|
36
|
+
return vec2(NO_HIT);\n\
|
|
37
|
+
}\n\
|
|
38
|
+
\n\
|
|
39
|
+
return vec2(tMin, tMax);\n\
|
|
40
|
+
}\n\
|
|
41
|
+
\n\
|
|
42
|
+
vec2 intersectUnitSquare(Ray ray) // Unit square from [-1, +1]\n\
|
|
43
|
+
{\n\
|
|
44
|
+
vec3 o = ray.pos;\n\
|
|
45
|
+
vec3 d = ray.dir;\n\
|
|
46
|
+
\n\
|
|
47
|
+
float t = -o.z / d.z;\n\
|
|
48
|
+
vec2 planePos = o.xy + d.xy * t;\n\
|
|
49
|
+
if (any(greaterThan(abs(planePos), vec2(1.0)))) {\n\
|
|
50
|
+
return vec2(NO_HIT);\n\
|
|
51
|
+
}\n\
|
|
52
|
+
\n\
|
|
53
|
+
return vec2(t, t);\n\
|
|
54
|
+
}\n\
|
|
55
|
+
\n\
|
|
56
|
+
void intersectShape(Ray ray, inout Intersections ix)\n\
|
|
57
|
+
{\n\
|
|
58
|
+
#if defined(BOX_HAS_RENDER_BOUNDS)\n\
|
|
59
|
+
#if defined(BOX_IS_2D)\n\
|
|
60
|
+
// Transform the ray into unit square space on Z plane\n\
|
|
61
|
+
// This matrix bakes in an axis conversion so that the math works for XY plane.\n\
|
|
62
|
+
ray.pos = vec3(u_boxUvToRenderBoundsTransform * vec4(ray.pos, 1.0));\n\
|
|
63
|
+
ray.dir = vec3(u_boxUvToRenderBoundsTransform * vec4(ray.dir, 0.0));\n\
|
|
64
|
+
vec2 entryExit = intersectUnitSquare(ray);\n\
|
|
65
|
+
#else\n\
|
|
66
|
+
// Transform the ray into unit cube space\n\
|
|
67
|
+
ray.pos = ray.pos * u_boxUvToRenderBoundsScale + u_boxUvToRenderBoundsTranslate;\n\
|
|
68
|
+
ray.dir *= u_boxUvToRenderBoundsScale;\n\
|
|
69
|
+
vec2 entryExit = intersectUnitCube(ray);\n\
|
|
70
|
+
#endif\n\
|
|
71
|
+
#else\n\
|
|
72
|
+
// Position is converted from [0,1] to [-1,+1] because shape intersections assume unit space is [-1,+1].\n\
|
|
73
|
+
// Direction is scaled as well to be in sync with position.\n\
|
|
74
|
+
ray.pos = ray.pos * 2.0 - 1.0;\n\
|
|
75
|
+
ray.dir = ray.dir * 2.0;\n\
|
|
76
|
+
vec2 entryExit = intersectUnitCube(ray);\n\
|
|
77
|
+
#endif\n\
|
|
78
|
+
\n\
|
|
79
|
+
setIntersectionPair(ix, BOX_INTERSECTION_INDEX, entryExit);\n\
|
|
80
|
+
}\n\
|
|
81
|
+
";
|