cesium 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE.md +259 -0
- data/README.rdoc +90 -0
- data/Rakefile +40 -0
- data/app/assets/javascripts/Assets/Assets.profile.js +8 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_0.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_1.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_10.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_11.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_12.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_13.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_14.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_15.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_16.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_17.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_18.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_19.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_2.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_20.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_21.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_22.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_23.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_24.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_25.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_26.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_27.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_3.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_4.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_5.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_6.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_7.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_8.json +1 -0
- data/app/assets/javascripts/Assets/IAU2006_XYS/IAU2006_XYS_9.json +1 -0
- data/app/assets/javascripts/Assets/Textures/NE2_LR_LC_SR_W_DR_2048.jpg +0 -0
- data/app/assets/javascripts/Assets/Textures/SkyBox/tycho2t3_80_mx.jpg +0 -0
- data/app/assets/javascripts/Assets/Textures/SkyBox/tycho2t3_80_my.jpg +0 -0
- data/app/assets/javascripts/Assets/Textures/SkyBox/tycho2t3_80_mz.jpg +0 -0
- data/app/assets/javascripts/Assets/Textures/SkyBox/tycho2t3_80_px.jpg +0 -0
- data/app/assets/javascripts/Assets/Textures/SkyBox/tycho2t3_80_py.jpg +0 -0
- data/app/assets/javascripts/Assets/Textures/SkyBox/tycho2t3_80_pz.jpg +0 -0
- data/app/assets/javascripts/Assets/Textures/waterNormals.jpg +0 -0
- data/app/assets/javascripts/Assets/package.json +6 -0
- data/app/assets/javascripts/Cesium.js +320 -0
- data/app/assets/javascripts/Core/AnimationController.js +148 -0
- data/app/assets/javascripts/Core/AxisAlignedBoundingBox.js +243 -0
- data/app/assets/javascripts/Core/BoundingRectangle.js +364 -0
- data/app/assets/javascripts/Core/BoundingSphere.js +819 -0
- data/app/assets/javascripts/Core/BoxTessellator.js +93 -0
- data/app/assets/javascripts/Core/Cartesian2.js +762 -0
- data/app/assets/javascripts/Core/Cartesian3.js +861 -0
- data/app/assets/javascripts/Core/Cartesian4.js +762 -0
- data/app/assets/javascripts/Core/Cartographic.js +211 -0
- data/app/assets/javascripts/Core/CatmullRomSpline.js +232 -0
- data/app/assets/javascripts/Core/Clock.js +195 -0
- data/app/assets/javascripts/Core/ClockRange.js +37 -0
- data/app/assets/javascripts/Core/ClockStep.js +32 -0
- data/app/assets/javascripts/Core/Color.js +1629 -0
- data/app/assets/javascripts/Core/ComponentDatatype.js +119 -0
- data/app/assets/javascripts/Core/Core.profile.js +8 -0
- data/app/assets/javascripts/Core/CubeMapEllipsoidTessellator.js +198 -0
- data/app/assets/javascripts/Core/CubicRealPolynomial.js +251 -0
- data/app/assets/javascripts/Core/DefaultProxy.js +30 -0
- data/app/assets/javascripts/Core/DeveloperError.js +60 -0
- data/app/assets/javascripts/Core/EarthOrientationParameters.js +383 -0
- data/app/assets/javascripts/Core/EarthOrientationParametersSample.js +50 -0
- data/app/assets/javascripts/Core/Ellipsoid.js +539 -0
- data/app/assets/javascripts/Core/EllipsoidTangentPlane.js +207 -0
- data/app/assets/javascripts/Core/EllipsoidalOccluder.js +151 -0
- data/app/assets/javascripts/Core/EncodedCartesian3.js +197 -0
- data/app/assets/javascripts/Core/Enumeration.js +67 -0
- data/app/assets/javascripts/Core/Event.js +122 -0
- data/app/assets/javascripts/Core/Extent.js +383 -0
- data/app/assets/javascripts/Core/ExtentTessellator.js +384 -0
- data/app/assets/javascripts/Core/FAR.js +13 -0
- data/app/assets/javascripts/Core/FeatureDetection.js +126 -0
- data/app/assets/javascripts/Core/Fullscreen.js +235 -0
- data/app/assets/javascripts/Core/GeographicProjection.js +107 -0
- data/app/assets/javascripts/Core/HermitePolynomialApproximation.js +176 -0
- data/app/assets/javascripts/Core/HermiteSpline.js +234 -0
- data/app/assets/javascripts/Core/Iau2006XysData.js +259 -0
- data/app/assets/javascripts/Core/Iau2006XysSample.js +36 -0
- data/app/assets/javascripts/Core/IndexDatatype.js +28 -0
- data/app/assets/javascripts/Core/Intersect.js +40 -0
- data/app/assets/javascripts/Core/IntersectionTests.js +359 -0
- data/app/assets/javascripts/Core/Interval.js +27 -0
- data/app/assets/javascripts/Core/Iso8601.js +46 -0
- data/app/assets/javascripts/Core/JulianDate.js +1228 -0
- data/app/assets/javascripts/Core/KeyboardEventModifier.js +38 -0
- data/app/assets/javascripts/Core/LagrangePolynomialApproximation.js +96 -0
- data/app/assets/javascripts/Core/LeapSecond.js +158 -0
- data/app/assets/javascripts/Core/LinearApproximation.js +98 -0
- data/app/assets/javascripts/Core/Math.js +532 -0
- data/app/assets/javascripts/Core/Matrix2.js +833 -0
- data/app/assets/javascripts/Core/Matrix3.js +1099 -0
- data/app/assets/javascripts/Core/Matrix4.js +2164 -0
- data/app/assets/javascripts/Core/MeshFilters.js +568 -0
- data/app/assets/javascripts/Core/Occluder.js +474 -0
- data/app/assets/javascripts/Core/OrientationInterpolator.js +109 -0
- data/app/assets/javascripts/Core/PlaneTessellator.js +74 -0
- data/app/assets/javascripts/Core/PolygonPipeline.js +792 -0
- data/app/assets/javascripts/Core/PolylinePipeline.js +90 -0
- data/app/assets/javascripts/Core/PrimitiveType.js +80 -0
- data/app/assets/javascripts/Core/QuadraticRealPolynomial.js +146 -0
- data/app/assets/javascripts/Core/QuarticRealPolynomial.js +339 -0
- data/app/assets/javascripts/Core/Quaternion.js +947 -0
- data/app/assets/javascripts/Core/Queue.js +95 -0
- data/app/assets/javascripts/Core/Ray.js +64 -0
- data/app/assets/javascripts/Core/ReferenceFrame.js +25 -0
- data/app/assets/javascripts/Core/RequestErrorEvent.js +35 -0
- data/app/assets/javascripts/Core/RuntimeError.js +59 -0
- data/app/assets/javascripts/Core/ScreenSpaceEventHandler.js +658 -0
- data/app/assets/javascripts/Core/ScreenSpaceEventType.js +149 -0
- data/app/assets/javascripts/Core/Shapes.js +230 -0
- data/app/assets/javascripts/Core/Spherical.js +192 -0
- data/app/assets/javascripts/Core/TaskProcessor.js +131 -0
- data/app/assets/javascripts/Core/TimeConstants.js +85 -0
- data/app/assets/javascripts/Core/TimeInterval.js +305 -0
- data/app/assets/javascripts/Core/TimeIntervalCollection.js +543 -0
- data/app/assets/javascripts/Core/TimeStandard.js +31 -0
- data/app/assets/javascripts/Core/Tipsify.js +285 -0
- data/app/assets/javascripts/Core/Transforms.js +614 -0
- data/app/assets/javascripts/Core/TridiagonalSystemSolver.js +102 -0
- data/app/assets/javascripts/Core/Visibility.js +38 -0
- data/app/assets/javascripts/Core/WebMercatorProjection.js +154 -0
- data/app/assets/javascripts/Core/WindingOrder.js +40 -0
- data/app/assets/javascripts/Core/binarySearch.js +69 -0
- data/app/assets/javascripts/Core/buildModuleUrl.js +77 -0
- data/app/assets/javascripts/Core/clone.js +21 -0
- data/app/assets/javascripts/Core/combine.js +81 -0
- data/app/assets/javascripts/Core/computeSunPosition.js +116 -0
- data/app/assets/javascripts/Core/createGuid.js +25 -0
- data/app/assets/javascripts/Core/defaultValue.js +22 -0
- data/app/assets/javascripts/Core/destroyObject.js +61 -0
- data/app/assets/javascripts/Core/freezeObject.js +20 -0
- data/app/assets/javascripts/Core/getImagePixels.js +46 -0
- data/app/assets/javascripts/Core/isLeapYear.js +30 -0
- data/app/assets/javascripts/Core/jsonp.js +116 -0
- data/app/assets/javascripts/Core/loadArrayBuffer.js +76 -0
- data/app/assets/javascripts/Core/loadImage.js +85 -0
- data/app/assets/javascripts/Core/loadJson.js +54 -0
- data/app/assets/javascripts/Core/loadText.js +78 -0
- data/app/assets/javascripts/Core/loadXML.js +76 -0
- data/app/assets/javascripts/Core/package.json +6 -0
- data/app/assets/javascripts/Core/pointInsideTriangle2D.js +41 -0
- data/app/assets/javascripts/Core/requestAnimationFrame.js +61 -0
- data/app/assets/javascripts/Core/throttleRequestByServer.js +74 -0
- data/app/assets/javascripts/Core/writeTextToCanvas.js +92 -0
- data/app/assets/javascripts/DynamicScene/CompositeDynamicObjectCollection.js +254 -0
- data/app/assets/javascripts/DynamicScene/CzmlBoolean.js +57 -0
- data/app/assets/javascripts/DynamicScene/CzmlCartesian2.js +96 -0
- data/app/assets/javascripts/DynamicScene/CzmlCartesian3.js +99 -0
- data/app/assets/javascripts/DynamicScene/CzmlCartographic.js +125 -0
- data/app/assets/javascripts/DynamicScene/CzmlColor.js +127 -0
- data/app/assets/javascripts/DynamicScene/CzmlDefaults.js +135 -0
- data/app/assets/javascripts/DynamicScene/CzmlHorizontalOrigin.js +59 -0
- data/app/assets/javascripts/DynamicScene/CzmlImage.js +61 -0
- data/app/assets/javascripts/DynamicScene/CzmlLabelStyle.js +59 -0
- data/app/assets/javascripts/DynamicScene/CzmlNumber.js +82 -0
- data/app/assets/javascripts/DynamicScene/CzmlString.js +56 -0
- data/app/assets/javascripts/DynamicScene/CzmlUnitCartesian3.js +99 -0
- data/app/assets/javascripts/DynamicScene/CzmlUnitQuaternion.js +172 -0
- data/app/assets/javascripts/DynamicScene/CzmlUnitSpherical.js +98 -0
- data/app/assets/javascripts/DynamicScene/CzmlVerticalOrigin.js +59 -0
- data/app/assets/javascripts/DynamicScene/DynamicBillboard.js +245 -0
- data/app/assets/javascripts/DynamicScene/DynamicBillboardVisualizer.js +347 -0
- data/app/assets/javascripts/DynamicScene/DynamicColorMaterial.js +78 -0
- data/app/assets/javascripts/DynamicScene/DynamicCone.js +291 -0
- data/app/assets/javascripts/DynamicScene/DynamicConeVisualizer.js +350 -0
- data/app/assets/javascripts/DynamicScene/DynamicConeVisualizerUsingCustomSensor.js +389 -0
- data/app/assets/javascripts/DynamicScene/DynamicDirectionsProperty.js +163 -0
- data/app/assets/javascripts/DynamicScene/DynamicEllipsoid.js +158 -0
- data/app/assets/javascripts/DynamicScene/DynamicEllipsoidVisualizer.js +277 -0
- data/app/assets/javascripts/DynamicScene/DynamicImageMaterial.js +136 -0
- data/app/assets/javascripts/DynamicScene/DynamicLabel.js +286 -0
- data/app/assets/javascripts/DynamicScene/DynamicLabelVisualizer.js +341 -0
- data/app/assets/javascripts/DynamicScene/DynamicMaterialProperty.js +125 -0
- data/app/assets/javascripts/DynamicScene/DynamicObject.js +364 -0
- data/app/assets/javascripts/DynamicScene/DynamicObjectCollection.js +137 -0
- data/app/assets/javascripts/DynamicScene/DynamicObjectView.js +299 -0
- data/app/assets/javascripts/DynamicScene/DynamicPath.js +214 -0
- data/app/assets/javascripts/DynamicScene/DynamicPathVisualizer.js +402 -0
- data/app/assets/javascripts/DynamicScene/DynamicPoint.js +184 -0
- data/app/assets/javascripts/DynamicScene/DynamicPointVisualizer.js +323 -0
- data/app/assets/javascripts/DynamicScene/DynamicPolygon.js +138 -0
- data/app/assets/javascripts/DynamicScene/DynamicPolygonVisualizer.js +251 -0
- data/app/assets/javascripts/DynamicScene/DynamicPolyline.js +183 -0
- data/app/assets/javascripts/DynamicScene/DynamicPolylineVisualizer.js +268 -0
- data/app/assets/javascripts/DynamicScene/DynamicPositionProperty.js +525 -0
- data/app/assets/javascripts/DynamicScene/DynamicProperty.js +352 -0
- data/app/assets/javascripts/DynamicScene/DynamicPyramid.js +204 -0
- data/app/assets/javascripts/DynamicScene/DynamicPyramidVisualizer.js +302 -0
- data/app/assets/javascripts/DynamicScene/DynamicScene.profile.js +8 -0
- data/app/assets/javascripts/DynamicScene/DynamicVertexPositionsProperty.js +199 -0
- data/app/assets/javascripts/DynamicScene/ReferenceProperty.js +155 -0
- data/app/assets/javascripts/DynamicScene/VisualizerCollection.js +181 -0
- data/app/assets/javascripts/DynamicScene/package.json +6 -0
- data/app/assets/javascripts/DynamicScene/processCzml.js +77 -0
- data/app/assets/javascripts/Renderer/BlendEquation.js +52 -0
- data/app/assets/javascripts/Renderer/BlendFunction.js +158 -0
- data/app/assets/javascripts/Renderer/BlendingState.js +64 -0
- data/app/assets/javascripts/Renderer/Buffer.js +141 -0
- data/app/assets/javascripts/Renderer/BufferUsage.js +48 -0
- data/app/assets/javascripts/Renderer/ClearCommand.js +40 -0
- data/app/assets/javascripts/Renderer/CommandLists.js +42 -0
- data/app/assets/javascripts/Renderer/Context.js +2805 -0
- data/app/assets/javascripts/Renderer/CubeMap.js +358 -0
- data/app/assets/javascripts/Renderer/CubeMapFace.js +202 -0
- data/app/assets/javascripts/Renderer/CullFace.js +50 -0
- data/app/assets/javascripts/Renderer/DepthFunction.js +95 -0
- data/app/assets/javascripts/Renderer/DrawCommand.js +96 -0
- data/app/assets/javascripts/Renderer/Framebuffer.js +435 -0
- data/app/assets/javascripts/Renderer/MipmapHint.js +50 -0
- data/app/assets/javascripts/Renderer/PickFramebuffer.js +178 -0
- data/app/assets/javascripts/Renderer/PixelDatatype.js +86 -0
- data/app/assets/javascripts/Renderer/PixelFormat.js +113 -0
- data/app/assets/javascripts/Renderer/Renderbuffer.js +102 -0
- data/app/assets/javascripts/Renderer/RenderbufferFormat.js +77 -0
- data/app/assets/javascripts/Renderer/Renderer.profile.js +8 -0
- data/app/assets/javascripts/Renderer/ShaderCache.js +121 -0
- data/app/assets/javascripts/Renderer/ShaderProgram.js +2402 -0
- data/app/assets/javascripts/Renderer/StencilFunction.js +95 -0
- data/app/assets/javascripts/Renderer/StencilOperation.js +95 -0
- data/app/assets/javascripts/Renderer/Texture.js +395 -0
- data/app/assets/javascripts/Renderer/TextureAtlas.js +472 -0
- data/app/assets/javascripts/Renderer/TextureAtlasBuilder.js +133 -0
- data/app/assets/javascripts/Renderer/TextureMagnificationFilter.js +41 -0
- data/app/assets/javascripts/Renderer/TextureMinificationFilter.js +77 -0
- data/app/assets/javascripts/Renderer/TextureWrap.js +50 -0
- data/app/assets/javascripts/Renderer/UniformDatatype.js +218 -0
- data/app/assets/javascripts/Renderer/UniformState.js +799 -0
- data/app/assets/javascripts/Renderer/VertexArray.js +365 -0
- data/app/assets/javascripts/Renderer/VertexArrayFacade.js +574 -0
- data/app/assets/javascripts/Renderer/VertexLayout.js +49 -0
- data/app/assets/javascripts/Renderer/loadCubeMap.js +92 -0
- data/app/assets/javascripts/Renderer/package.json +6 -0
- data/app/assets/javascripts/Scene/AnimationCollection.js +249 -0
- data/app/assets/javascripts/Scene/ArcGisMapServerImageryProvider.js +384 -0
- data/app/assets/javascripts/Scene/Billboard.js +680 -0
- data/app/assets/javascripts/Scene/BillboardCollection.js +1209 -0
- data/app/assets/javascripts/Scene/BingMapsImageryProvider.js +460 -0
- data/app/assets/javascripts/Scene/BingMapsStyle.js +55 -0
- data/app/assets/javascripts/Scene/Camera.js +358 -0
- data/app/assets/javascripts/Scene/CameraColumbusViewMode.js +30 -0
- data/app/assets/javascripts/Scene/CameraController.js +1258 -0
- data/app/assets/javascripts/Scene/CameraEventAggregator.js +270 -0
- data/app/assets/javascripts/Scene/CameraEventType.js +53 -0
- data/app/assets/javascripts/Scene/CameraFlightPath.js +495 -0
- data/app/assets/javascripts/Scene/CentralBody.js +817 -0
- data/app/assets/javascripts/Scene/CentralBodySurface.js +1120 -0
- data/app/assets/javascripts/Scene/CentralBodySurfaceShaderSet.js +107 -0
- data/app/assets/javascripts/Scene/ComplexConicSensorVolume.js +511 -0
- data/app/assets/javascripts/Scene/CompositePrimitive.js +454 -0
- data/app/assets/javascripts/Scene/CullingVolume.js +59 -0
- data/app/assets/javascripts/Scene/CustomSensorVolume.js +440 -0
- data/app/assets/javascripts/Scene/DiscardMissingTileImagePolicy.js +134 -0
- data/app/assets/javascripts/Scene/EllipsoidPrimitive.js +412 -0
- data/app/assets/javascripts/Scene/EllipsoidTerrainProvider.js +182 -0
- data/app/assets/javascripts/Scene/FrameState.js +86 -0
- data/app/assets/javascripts/Scene/FrustumCommands.js +32 -0
- data/app/assets/javascripts/Scene/GeographicTilingScheme.js +265 -0
- data/app/assets/javascripts/Scene/HorizontalOrigin.js +39 -0
- data/app/assets/javascripts/Scene/Imagery.js +85 -0
- data/app/assets/javascripts/Scene/ImageryLayer.js +876 -0
- data/app/assets/javascripts/Scene/ImageryLayerCollection.js +403 -0
- data/app/assets/javascripts/Scene/ImageryProvider.js +185 -0
- data/app/assets/javascripts/Scene/ImageryProviderError.js +149 -0
- data/app/assets/javascripts/Scene/ImageryState.js +20 -0
- data/app/assets/javascripts/Scene/Label.js +706 -0
- data/app/assets/javascripts/Scene/LabelCollection.js +697 -0
- data/app/assets/javascripts/Scene/LabelStyle.js +39 -0
- data/app/assets/javascripts/Scene/Material.js +1177 -0
- data/app/assets/javascripts/Scene/NeverTileDiscardPolicy.js +38 -0
- data/app/assets/javascripts/Scene/OpenStreetMapImageryProvider.js +282 -0
- data/app/assets/javascripts/Scene/OrthographicFrustum.js +345 -0
- data/app/assets/javascripts/Scene/PerformanceDisplay.js +183 -0
- data/app/assets/javascripts/Scene/PerspectiveFrustum.js +239 -0
- data/app/assets/javascripts/Scene/PerspectiveOffCenterFrustum.js +394 -0
- data/app/assets/javascripts/Scene/Polygon.js +886 -0
- data/app/assets/javascripts/Scene/Polyline.js +441 -0
- data/app/assets/javascripts/Scene/PolylineCollection.js +1532 -0
- data/app/assets/javascripts/Scene/Projections.js +93 -0
- data/app/assets/javascripts/Scene/RectangularPyramidSensorVolume.js +224 -0
- data/app/assets/javascripts/Scene/Scene.js +632 -0
- data/app/assets/javascripts/Scene/Scene.profile.js +8 -0
- data/app/assets/javascripts/Scene/SceneMode.js +51 -0
- data/app/assets/javascripts/Scene/SceneTransitioner.js +776 -0
- data/app/assets/javascripts/Scene/ScreenSpaceCameraController.js +1063 -0
- data/app/assets/javascripts/Scene/SensorVolumeCollection.js +192 -0
- data/app/assets/javascripts/Scene/SingleTileImageryProvider.js +295 -0
- data/app/assets/javascripts/Scene/SkyAtmosphere.js +239 -0
- data/app/assets/javascripts/Scene/SkyBox.js +231 -0
- data/app/assets/javascripts/Scene/TerrainProvider.js +229 -0
- data/app/assets/javascripts/Scene/TexturePool.js +154 -0
- data/app/assets/javascripts/Scene/Tile.js +322 -0
- data/app/assets/javascripts/Scene/TileDiscardPolicy.js +42 -0
- data/app/assets/javascripts/Scene/TileImagery.js +36 -0
- data/app/assets/javascripts/Scene/TileLoadQueue.js +123 -0
- data/app/assets/javascripts/Scene/TileMapServiceImageryProvider.js +337 -0
- data/app/assets/javascripts/Scene/TileReplacementQueue.js +139 -0
- data/app/assets/javascripts/Scene/TileState.js +19 -0
- data/app/assets/javascripts/Scene/TilingScheme.js +213 -0
- data/app/assets/javascripts/Scene/VerticalOrigin.js +39 -0
- data/app/assets/javascripts/Scene/ViewportQuad.js +256 -0
- data/app/assets/javascripts/Scene/WebMapServiceImageryProvider.js +374 -0
- data/app/assets/javascripts/Scene/WebMercatorTilingScheme.js +291 -0
- data/app/assets/javascripts/Scene/package.json +6 -0
- data/app/assets/javascripts/Shaders/BillboardCollectionFS.glsl +30 -0
- data/app/assets/javascripts/Shaders/BillboardCollectionFS.js +31 -0
- data/app/assets/javascripts/Shaders/BillboardCollectionVS.glsl +68 -0
- data/app/assets/javascripts/Shaders/BillboardCollectionVS.js +54 -0
- data/app/assets/javascripts/Shaders/BuiltinFunctions.glsl +927 -0
- data/app/assets/javascripts/Shaders/BuiltinFunctions.js +322 -0
- data/app/assets/javascripts/Shaders/CentralBodyFS.glsl +106 -0
- data/app/assets/javascripts/Shaders/CentralBodyFS.js +82 -0
- data/app/assets/javascripts/Shaders/CentralBodyFSDepth.glsl +20 -0
- data/app/assets/javascripts/Shaders/CentralBodyFSDepth.js +22 -0
- data/app/assets/javascripts/Shaders/CentralBodyFSPole.glsl +29 -0
- data/app/assets/javascripts/Shaders/CentralBodyFSPole.js +28 -0
- data/app/assets/javascripts/Shaders/CentralBodyVS.glsl +88 -0
- data/app/assets/javascripts/Shaders/CentralBodyVS.js +69 -0
- data/app/assets/javascripts/Shaders/CentralBodyVSDepth.glsl +9 -0
- data/app/assets/javascripts/Shaders/CentralBodyVSDepth.js +13 -0
- data/app/assets/javascripts/Shaders/CentralBodyVSPole.glsl +12 -0
- data/app/assets/javascripts/Shaders/CentralBodyVSPole.js +15 -0
- data/app/assets/javascripts/Shaders/ComplexConicSensorVolumeFS.glsl +448 -0
- data/app/assets/javascripts/Shaders/ComplexConicSensorVolumeFS.js +361 -0
- data/app/assets/javascripts/Shaders/ComplexConicSensorVolumeVS.glsl +19 -0
- data/app/assets/javascripts/Shaders/ComplexConicSensorVolumeVS.js +20 -0
- data/app/assets/javascripts/Shaders/ConstructiveSolidGeometry.glsl +886 -0
- data/app/assets/javascripts/Shaders/ConstructiveSolidGeometry.js +586 -0
- data/app/assets/javascripts/Shaders/CustomSensorVolumeFS.glsl +126 -0
- data/app/assets/javascripts/Shaders/CustomSensorVolumeFS.js +95 -0
- data/app/assets/javascripts/Shaders/CustomSensorVolumeVS.glsl +14 -0
- data/app/assets/javascripts/Shaders/CustomSensorVolumeVS.js +18 -0
- data/app/assets/javascripts/Shaders/EllipsoidFS.glsl +40 -0
- data/app/assets/javascripts/Shaders/EllipsoidFS.js +38 -0
- data/app/assets/javascripts/Shaders/EllipsoidVS.glsl +26 -0
- data/app/assets/javascripts/Shaders/EllipsoidVS.js +16 -0
- data/app/assets/javascripts/Shaders/Materials/AsphaltMaterial.glsl +25 -0
- data/app/assets/javascripts/Shaders/Materials/AsphaltMaterial.js +23 -0
- data/app/assets/javascripts/Shaders/Materials/BlobMaterial.glsl +18 -0
- data/app/assets/javascripts/Shaders/Materials/BlobMaterial.js +19 -0
- data/app/assets/javascripts/Shaders/Materials/BrickMaterial.glsl +42 -0
- data/app/assets/javascripts/Shaders/Materials/BrickMaterial.js +36 -0
- data/app/assets/javascripts/Shaders/Materials/BumpMapMaterial.glsl +29 -0
- data/app/assets/javascripts/Shaders/Materials/BumpMapMaterial.js +27 -0
- data/app/assets/javascripts/Shaders/Materials/CementMaterial.glsl +19 -0
- data/app/assets/javascripts/Shaders/Materials/CementMaterial.js +20 -0
- data/app/assets/javascripts/Shaders/Materials/CheckerboardMaterial.glsl +38 -0
- data/app/assets/javascripts/Shaders/Materials/CheckerboardMaterial.js +32 -0
- data/app/assets/javascripts/Shaders/Materials/DotMaterial.glsl +17 -0
- data/app/assets/javascripts/Shaders/Materials/DotMaterial.js +18 -0
- data/app/assets/javascripts/Shaders/Materials/ErosionMaterial.glsl +23 -0
- data/app/assets/javascripts/Shaders/Materials/ErosionMaterial.js +24 -0
- data/app/assets/javascripts/Shaders/Materials/FacetMaterial.glsl +18 -0
- data/app/assets/javascripts/Shaders/Materials/FacetMaterial.js +19 -0
- data/app/assets/javascripts/Shaders/Materials/FresnelMaterial.glsl +12 -0
- data/app/assets/javascripts/Shaders/Materials/FresnelMaterial.js +15 -0
- data/app/assets/javascripts/Shaders/Materials/GrassMaterial.glsl +28 -0
- data/app/assets/javascripts/Shaders/Materials/GrassMaterial.js +26 -0
- data/app/assets/javascripts/Shaders/Materials/NormalMapMaterial.glsl +19 -0
- data/app/assets/javascripts/Shaders/Materials/NormalMapMaterial.js +21 -0
- data/app/assets/javascripts/Shaders/Materials/ReflectionMaterial.glsl +13 -0
- data/app/assets/javascripts/Shaders/Materials/ReflectionMaterial.js +16 -0
- data/app/assets/javascripts/Shaders/Materials/RefractionMaterial.glsl +14 -0
- data/app/assets/javascripts/Shaders/Materials/RefractionMaterial.js +17 -0
- data/app/assets/javascripts/Shaders/Materials/RimLightingMaterial.glsl +18 -0
- data/app/assets/javascripts/Shaders/Materials/RimLightingMaterial.js +19 -0
- data/app/assets/javascripts/Shaders/Materials/StripeMaterial.glsl +29 -0
- data/app/assets/javascripts/Shaders/Materials/StripeMaterial.js +26 -0
- data/app/assets/javascripts/Shaders/Materials/TieDyeMaterial.glsl +17 -0
- data/app/assets/javascripts/Shaders/Materials/TieDyeMaterial.js +19 -0
- data/app/assets/javascripts/Shaders/Materials/Water.glsl +91 -0
- data/app/assets/javascripts/Shaders/Materials/Water.js +60 -0
- data/app/assets/javascripts/Shaders/Materials/WoodMaterial.glsl +36 -0
- data/app/assets/javascripts/Shaders/Materials/WoodMaterial.js +31 -0
- data/app/assets/javascripts/Shaders/Noise.glsl +453 -0
- data/app/assets/javascripts/Shaders/Noise.js +242 -0
- data/app/assets/javascripts/Shaders/PolygonFS.glsl +27 -0
- data/app/assets/javascripts/Shaders/PolygonFS.js +23 -0
- data/app/assets/javascripts/Shaders/PolygonFSPick.glsl +6 -0
- data/app/assets/javascripts/Shaders/PolygonFSPick.js +11 -0
- data/app/assets/javascripts/Shaders/PolygonVS.glsl +38 -0
- data/app/assets/javascripts/Shaders/PolygonVS.js +39 -0
- data/app/assets/javascripts/Shaders/PolygonVSPick.glsl +30 -0
- data/app/assets/javascripts/Shaders/PolygonVSPick.js +32 -0
- data/app/assets/javascripts/Shaders/PolylineFS.glsl +6 -0
- data/app/assets/javascripts/Shaders/PolylineFS.js +11 -0
- data/app/assets/javascripts/Shaders/PolylineVS.glsl +34 -0
- data/app/assets/javascripts/Shaders/PolylineVS.js +35 -0
- data/app/assets/javascripts/Shaders/Ray.glsl +532 -0
- data/app/assets/javascripts/Shaders/Ray.js +357 -0
- data/app/assets/javascripts/Shaders/ReprojectWebMercatorFS.glsl +26 -0
- data/app/assets/javascripts/Shaders/ReprojectWebMercatorFS.js +22 -0
- data/app/assets/javascripts/Shaders/ReprojectWebMercatorVS.glsl +11 -0
- data/app/assets/javascripts/Shaders/ReprojectWebMercatorVS.js +14 -0
- data/app/assets/javascripts/Shaders/SensorVolume.glsl +43 -0
- data/app/assets/javascripts/Shaders/SensorVolume.js +31 -0
- data/app/assets/javascripts/Shaders/Shaders.profile.js +8 -0
- data/app/assets/javascripts/Shaders/SkyAtmosphereFS.glsl +70 -0
- data/app/assets/javascripts/Shaders/SkyAtmosphereFS.js +62 -0
- data/app/assets/javascripts/Shaders/SkyAtmosphereVS.glsl +131 -0
- data/app/assets/javascripts/Shaders/SkyAtmosphereVS.js +115 -0
- data/app/assets/javascripts/Shaders/SkyBoxFS.glsl +10 -0
- data/app/assets/javascripts/Shaders/SkyBoxFS.js +14 -0
- data/app/assets/javascripts/Shaders/SkyBoxVS.glsl +10 -0
- data/app/assets/javascripts/Shaders/SkyBoxVS.js +14 -0
- data/app/assets/javascripts/Shaders/ViewportQuadFS.glsl +16 -0
- data/app/assets/javascripts/Shaders/ViewportQuadFS.js +17 -0
- data/app/assets/javascripts/Shaders/ViewportQuadVS.glsl +10 -0
- data/app/assets/javascripts/Shaders/ViewportQuadVS.js +14 -0
- data/app/assets/javascripts/Shaders/package.json +6 -0
- data/app/assets/javascripts/ThirdParty/ThirdParty.profile.js +8 -0
- data/app/assets/javascripts/ThirdParty/Tween.js +678 -0
- data/app/assets/javascripts/ThirdParty/Uri.js +277 -0
- data/app/assets/javascripts/ThirdParty/measureText.js +197 -0
- data/app/assets/javascripts/ThirdParty/package.json +6 -0
- data/app/assets/javascripts/ThirdParty/sprintf.js +319 -0
- data/app/assets/javascripts/ThirdParty/when.js +748 -0
- data/app/assets/javascripts/Widgets/Dojo/CesiumViewerWidget.css +175 -0
- data/app/assets/javascripts/Widgets/Dojo/CesiumViewerWidget.html +52 -0
- data/app/assets/javascripts/Widgets/Dojo/CesiumViewerWidget.js +1237 -0
- data/app/assets/javascripts/Widgets/Dojo/CesiumWidget.html +4 -0
- data/app/assets/javascripts/Widgets/Dojo/CesiumWidget.js +349 -0
- data/app/assets/javascripts/Widgets/Dojo/TimelineWidget.css +1 -0
- data/app/assets/javascripts/Widgets/Dojo/TimelineWidget.js +47 -0
- data/app/assets/javascripts/Widgets/Dojo/checkForChromeFrame.js +71 -0
- data/app/assets/javascripts/Widgets/Images/Bing_Logo_51x19_White.png +0 -0
- data/app/assets/javascripts/Widgets/Images/Cesium_Logo_overlay.png +0 -0
- data/app/assets/javascripts/Widgets/Images/TimelineIcons.png +0 -0
- data/app/assets/javascripts/Widgets/Images/ajax-loader.gif +0 -0
- data/app/assets/javascripts/Widgets/Images/animationBar.png +0 -0
- data/app/assets/javascripts/Widgets/Images/viewControlBar.png +0 -0
- data/app/assets/javascripts/Widgets/Timeline.css +113 -0
- data/app/assets/javascripts/Widgets/Timeline.js +629 -0
- data/app/assets/javascripts/Widgets/TimelineHighlightRange.js +51 -0
- data/app/assets/javascripts/Widgets/TimelineTrack.js +54 -0
- data/app/assets/javascripts/Widgets/Widgets.profile.js +8 -0
- data/app/assets/javascripts/Widgets/package.json +6 -0
- data/app/assets/javascripts/Workers/Workers.profile.js +8 -0
- data/app/assets/javascripts/Workers/cesiumWorkerBootstrapper.js +2015 -0
- data/app/assets/javascripts/Workers/createTaskProcessorWorker.js +55 -0
- data/app/assets/javascripts/Workers/createVerticesFromExtent.js +24 -0
- data/app/assets/javascripts/Workers/package.json +6 -0
- data/app/assets/javascripts/copyrightHeader.js +22 -0
- data/app/assets/javascripts/main.js +10 -0
- data/app/assets/stylesheets/cesium.css +4 -0
- data/app/controllers/cesium_controller.rb +4 -0
- data/app/helpers/cesium_helper.rb +2 -0
- data/app/views/cesium/index.html.erb +3 -0
- data/config/routes.rb +3 -0
- data/lib/cesium.rb +4 -0
- data/lib/cesium/engine.rb +4 -0
- data/lib/cesium/version.rb +3 -0
- data/lib/tasks/cesium_tasks.rake +4 -0
- data/test/cesium_test.rb +7 -0
- data/test/dummy/README.rdoc +261 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/javascripts/adapters/jquery-adapter.js.coffee +4 -0
- data/test/dummy/app/assets/javascripts/app.js.coffee +11 -0
- data/test/dummy/app/assets/javascripts/application.js.coffee +73 -0
- data/test/dummy/app/assets/stylesheets/application.css +12 -0
- data/test/dummy/app/controllers/application_controller.rb +4 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +21 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +59 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +37 -0
- data/test/dummy/config/environments/production.rb +67 -0
- data/test/dummy/config/environments/test.rb +37 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +15 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/requirejs.yml +10 -0
- data/test/dummy/config/routes.rb +3 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +25 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/functional/cesium_controller_test.rb +9 -0
- data/test/integration/navigation_test.rb +10 -0
- data/test/test_helper.rb +15 -0
- data/test/unit/helpers/cesium_helper_test.rb +4 -0
- metadata +641 -0
@@ -0,0 +1,30 @@
|
|
1
|
+
uniform sampler2D u_atlas;
|
2
|
+
|
3
|
+
varying vec2 v_textureCoordinates;
|
4
|
+
|
5
|
+
#ifdef RENDER_FOR_PICK
|
6
|
+
varying vec4 v_pickColor;
|
7
|
+
#else
|
8
|
+
varying vec4 v_color;
|
9
|
+
#endif
|
10
|
+
|
11
|
+
void main()
|
12
|
+
{
|
13
|
+
#ifdef RENDER_FOR_PICK
|
14
|
+
vec4 vertexColor = vec4(1.0, 1.0, 1.0, 1.0);
|
15
|
+
#else
|
16
|
+
vec4 vertexColor = v_color;
|
17
|
+
#endif
|
18
|
+
|
19
|
+
vec4 color = texture2D(u_atlas, v_textureCoordinates) * vertexColor;
|
20
|
+
if (color.a == 0.0)
|
21
|
+
{
|
22
|
+
discard;
|
23
|
+
}
|
24
|
+
|
25
|
+
#ifdef RENDER_FOR_PICK
|
26
|
+
gl_FragColor = v_pickColor;
|
27
|
+
#else
|
28
|
+
gl_FragColor = color;
|
29
|
+
#endif
|
30
|
+
}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
// This file is automatically rebuilt by the Cesium build process.
|
2
|
+
/*global define*/
|
3
|
+
define(function() {
|
4
|
+
"use strict";
|
5
|
+
return "uniform sampler2D u_atlas;\n\
|
6
|
+
varying vec2 v_textureCoordinates;\n\
|
7
|
+
#ifdef RENDER_FOR_PICK\n\
|
8
|
+
varying vec4 v_pickColor;\n\
|
9
|
+
#else\n\
|
10
|
+
varying vec4 v_color;\n\
|
11
|
+
#endif\n\
|
12
|
+
void main()\n\
|
13
|
+
{\n\
|
14
|
+
#ifdef RENDER_FOR_PICK\n\
|
15
|
+
vec4 vertexColor = vec4(1.0, 1.0, 1.0, 1.0);\n\
|
16
|
+
#else\n\
|
17
|
+
vec4 vertexColor = v_color;\n\
|
18
|
+
#endif\n\
|
19
|
+
vec4 color = texture2D(u_atlas, v_textureCoordinates) * vertexColor;\n\
|
20
|
+
if (color.a == 0.0)\n\
|
21
|
+
{\n\
|
22
|
+
discard;\n\
|
23
|
+
}\n\
|
24
|
+
#ifdef RENDER_FOR_PICK\n\
|
25
|
+
gl_FragColor = v_pickColor;\n\
|
26
|
+
#else\n\
|
27
|
+
gl_FragColor = color;\n\
|
28
|
+
#endif\n\
|
29
|
+
}\n\
|
30
|
+
";
|
31
|
+
});
|
@@ -0,0 +1,68 @@
|
|
1
|
+
attribute vec3 positionHigh;
|
2
|
+
attribute vec3 positionLow;
|
3
|
+
attribute vec2 direction; // in screen space
|
4
|
+
attribute vec4 textureCoordinatesAndImageSize; // size in normalized texture coordinates
|
5
|
+
attribute vec3 originAndShow; // show is 0.0 (false) or 1.0 (true)
|
6
|
+
attribute vec2 pixelOffset;
|
7
|
+
attribute vec4 eyeOffsetAndScale; // eye offset in meters
|
8
|
+
|
9
|
+
#ifdef RENDER_FOR_PICK
|
10
|
+
attribute vec4 pickColor;
|
11
|
+
#else
|
12
|
+
attribute vec4 color;
|
13
|
+
#endif
|
14
|
+
|
15
|
+
uniform vec2 u_atlasSize;
|
16
|
+
uniform float u_clampToPixel; // clamp is 1.0 (true) or 0.0 (false)
|
17
|
+
|
18
|
+
uniform float u_morphTime;
|
19
|
+
|
20
|
+
const vec2 czm_highResolutionSnapScale = vec2(1.0, 1.0); // TODO
|
21
|
+
|
22
|
+
varying vec2 v_textureCoordinates;
|
23
|
+
|
24
|
+
#ifdef RENDER_FOR_PICK
|
25
|
+
varying vec4 v_pickColor;
|
26
|
+
#else
|
27
|
+
varying vec4 v_color;
|
28
|
+
#endif
|
29
|
+
|
30
|
+
void main()
|
31
|
+
{
|
32
|
+
// Modifying this shader may also require modifications to Billboard.computeScreenSpacePosition
|
33
|
+
|
34
|
+
// unpack attributes
|
35
|
+
vec3 eyeOffset = eyeOffsetAndScale.xyz;
|
36
|
+
float scale = eyeOffsetAndScale.w;
|
37
|
+
vec2 textureCoordinates = textureCoordinatesAndImageSize.xy;
|
38
|
+
vec2 imageSize = textureCoordinatesAndImageSize.zw;
|
39
|
+
vec2 origin = originAndShow.xy;
|
40
|
+
float show = originAndShow.z;
|
41
|
+
|
42
|
+
///////////////////////////////////////////////////////////////////////////
|
43
|
+
|
44
|
+
vec4 p = vec4(czm_translateRelativeToEye(positionHigh, positionLow), 1.0);
|
45
|
+
vec4 positionEC = czm_modelViewRelativeToEye * p;
|
46
|
+
positionEC = czm_eyeOffset(positionEC, eyeOffset);
|
47
|
+
positionEC.xyz *= show;
|
48
|
+
|
49
|
+
///////////////////////////////////////////////////////////////////////////
|
50
|
+
|
51
|
+
vec4 positionWC = czm_eyeToWindowCoordinates(positionEC);
|
52
|
+
|
53
|
+
vec2 halfSize = u_atlasSize * imageSize * 0.5 * scale * czm_highResolutionSnapScale;
|
54
|
+
halfSize *= ((direction * 2.0) - 1.0);
|
55
|
+
|
56
|
+
positionWC.xy += (origin * abs(halfSize)) + halfSize;
|
57
|
+
positionWC.xy += (pixelOffset * czm_highResolutionSnapScale);
|
58
|
+
positionWC.xy = mix(positionWC.xy, floor(positionWC.xy), u_clampToPixel);
|
59
|
+
|
60
|
+
gl_Position = czm_viewportOrthographic * vec4(positionWC.xy, -positionWC.z, 1.0);
|
61
|
+
v_textureCoordinates = textureCoordinates;
|
62
|
+
|
63
|
+
#ifdef RENDER_FOR_PICK
|
64
|
+
v_pickColor = pickColor;
|
65
|
+
#else
|
66
|
+
v_color = color;
|
67
|
+
#endif
|
68
|
+
}
|
@@ -0,0 +1,54 @@
|
|
1
|
+
// This file is automatically rebuilt by the Cesium build process.
|
2
|
+
/*global define*/
|
3
|
+
define(function() {
|
4
|
+
"use strict";
|
5
|
+
return "attribute vec3 positionHigh;\n\
|
6
|
+
attribute vec3 positionLow;\n\
|
7
|
+
attribute vec2 direction;\n\
|
8
|
+
attribute vec4 textureCoordinatesAndImageSize;\n\
|
9
|
+
attribute vec3 originAndShow;\n\
|
10
|
+
attribute vec2 pixelOffset;\n\
|
11
|
+
attribute vec4 eyeOffsetAndScale;\n\
|
12
|
+
#ifdef RENDER_FOR_PICK\n\
|
13
|
+
attribute vec4 pickColor;\n\
|
14
|
+
#else\n\
|
15
|
+
attribute vec4 color;\n\
|
16
|
+
#endif\n\
|
17
|
+
uniform vec2 u_atlasSize;\n\
|
18
|
+
uniform float u_clampToPixel;\n\
|
19
|
+
uniform float u_morphTime;\n\
|
20
|
+
const vec2 czm_highResolutionSnapScale = vec2(1.0, 1.0);\n\
|
21
|
+
varying vec2 v_textureCoordinates;\n\
|
22
|
+
#ifdef RENDER_FOR_PICK\n\
|
23
|
+
varying vec4 v_pickColor;\n\
|
24
|
+
#else\n\
|
25
|
+
varying vec4 v_color;\n\
|
26
|
+
#endif\n\
|
27
|
+
void main()\n\
|
28
|
+
{\n\
|
29
|
+
vec3 eyeOffset = eyeOffsetAndScale.xyz;\n\
|
30
|
+
float scale = eyeOffsetAndScale.w;\n\
|
31
|
+
vec2 textureCoordinates = textureCoordinatesAndImageSize.xy;\n\
|
32
|
+
vec2 imageSize = textureCoordinatesAndImageSize.zw;\n\
|
33
|
+
vec2 origin = originAndShow.xy;\n\
|
34
|
+
float show = originAndShow.z;\n\
|
35
|
+
vec4 p = vec4(czm_translateRelativeToEye(positionHigh, positionLow), 1.0);\n\
|
36
|
+
vec4 positionEC = czm_modelViewRelativeToEye * p;\n\
|
37
|
+
positionEC = czm_eyeOffset(positionEC, eyeOffset);\n\
|
38
|
+
positionEC.xyz *= show;\n\
|
39
|
+
vec4 positionWC = czm_eyeToWindowCoordinates(positionEC);\n\
|
40
|
+
vec2 halfSize = u_atlasSize * imageSize * 0.5 * scale * czm_highResolutionSnapScale;\n\
|
41
|
+
halfSize *= ((direction * 2.0) - 1.0);\n\
|
42
|
+
positionWC.xy += (origin * abs(halfSize)) + halfSize;\n\
|
43
|
+
positionWC.xy += (pixelOffset * czm_highResolutionSnapScale);\n\
|
44
|
+
positionWC.xy = mix(positionWC.xy, floor(positionWC.xy), u_clampToPixel);\n\
|
45
|
+
gl_Position = czm_viewportOrthographic * vec4(positionWC.xy, -positionWC.z, 1.0);\n\
|
46
|
+
v_textureCoordinates = textureCoordinates;\n\
|
47
|
+
#ifdef RENDER_FOR_PICK\n\
|
48
|
+
v_pickColor = pickColor;\n\
|
49
|
+
#else\n\
|
50
|
+
v_color = color;\n\
|
51
|
+
#endif\n\
|
52
|
+
}\n\
|
53
|
+
";
|
54
|
+
});
|
@@ -0,0 +1,927 @@
|
|
1
|
+
/**
|
2
|
+
* DOC_TBA
|
3
|
+
*
|
4
|
+
* @name czm_infinity
|
5
|
+
* @glslConstant
|
6
|
+
*/
|
7
|
+
const float czm_infinity = 5906376272000.0; // Distance from the Sun to Pluto in meters. TODO: What is best given lowp, mediump, and highp?
|
8
|
+
|
9
|
+
/**
|
10
|
+
* DOC_TBA
|
11
|
+
*
|
12
|
+
* @name czm_epsilon1
|
13
|
+
* @glslConstant
|
14
|
+
*/
|
15
|
+
const float czm_epsilon1 = 0.1;
|
16
|
+
|
17
|
+
/**
|
18
|
+
* DOC_TBA
|
19
|
+
*
|
20
|
+
* @name czm_epsilon2
|
21
|
+
* @glslConstant
|
22
|
+
*/
|
23
|
+
const float czm_epsilon2 = 0.01;
|
24
|
+
|
25
|
+
/**
|
26
|
+
* DOC_TBA
|
27
|
+
*
|
28
|
+
* @name czm_epsilon3
|
29
|
+
* @glslConstant
|
30
|
+
*/
|
31
|
+
const float czm_epsilon3 = 0.001;
|
32
|
+
|
33
|
+
/**
|
34
|
+
* DOC_TBA
|
35
|
+
*
|
36
|
+
* @name czm_epsilon4
|
37
|
+
* @glslConstant
|
38
|
+
*/
|
39
|
+
const float czm_epsilon4 = 0.0001;
|
40
|
+
|
41
|
+
/**
|
42
|
+
* DOC_TBA
|
43
|
+
*
|
44
|
+
* @name czm_epsilon5
|
45
|
+
* @glslConstant
|
46
|
+
*/
|
47
|
+
const float czm_epsilon5 = 0.00001;
|
48
|
+
|
49
|
+
/**
|
50
|
+
* DOC_TBA
|
51
|
+
*
|
52
|
+
* @name czm_epsilon6
|
53
|
+
* @glslConstant
|
54
|
+
*/
|
55
|
+
const float czm_epsilon6 = 0.000001;
|
56
|
+
|
57
|
+
/**
|
58
|
+
* DOC_TBA
|
59
|
+
*
|
60
|
+
* @name czm_epsilon7
|
61
|
+
* @glslConstant
|
62
|
+
*/
|
63
|
+
const float czm_epsilon7 = 0.0000001;
|
64
|
+
|
65
|
+
/**
|
66
|
+
* DOC_TBA
|
67
|
+
*
|
68
|
+
* @name czm_equalsEpsilon
|
69
|
+
* @glslFunction
|
70
|
+
*/
|
71
|
+
bool czm_equalsEpsilon(float left, float right, float epsilon) {
|
72
|
+
return (abs(left - right) <= epsilon);
|
73
|
+
}
|
74
|
+
|
75
|
+
bool czm_equalsEpsilon(float left, float right) {
|
76
|
+
// Workaround bug in Opera Next 12. Do not delegate to the other czm_equalsEpsilon.
|
77
|
+
return (abs(left - right) <= czm_epsilon7);
|
78
|
+
}
|
79
|
+
|
80
|
+
///////////////////////////////////////////////////////////////////////////////
|
81
|
+
|
82
|
+
/**
|
83
|
+
* Returns the transpose of the matrix. The input <code>matrix</code> can be
|
84
|
+
* a <code>mat2</code>, <code>mat3</code>, or <code>mat4</code>.
|
85
|
+
*
|
86
|
+
* @name czm_transpose
|
87
|
+
* @glslFunction
|
88
|
+
*
|
89
|
+
* @param {} matrix The matrix to transpose.
|
90
|
+
*
|
91
|
+
* @returns {} The transposed matrix.
|
92
|
+
*
|
93
|
+
* @example
|
94
|
+
* // GLSL declarations
|
95
|
+
* mat2 czm_transpose(mat2 matrix);
|
96
|
+
* mat3 czm_transpose(mat3 matrix);
|
97
|
+
* mat4 czm_transpose(mat4 matrix);
|
98
|
+
*
|
99
|
+
* // Tranpose a 3x3 rotation matrix to find its inverse.
|
100
|
+
* mat3 eastNorthUpToEye = czm_eastNorthUpToEyeCoordinates(
|
101
|
+
* positionMC, normalEC);
|
102
|
+
* mat3 eyeToEastNorthUp = czm_transpose(eastNorthUpToEye);
|
103
|
+
*/
|
104
|
+
mat2 czm_transpose(mat2 matrix)
|
105
|
+
{
|
106
|
+
return mat2(
|
107
|
+
matrix[0][0], matrix[1][0],
|
108
|
+
matrix[0][1], matrix[1][1]);
|
109
|
+
}
|
110
|
+
|
111
|
+
mat3 czm_transpose(mat3 matrix)
|
112
|
+
{
|
113
|
+
return mat3(
|
114
|
+
matrix[0][0], matrix[1][0], matrix[2][0],
|
115
|
+
matrix[0][1], matrix[1][1], matrix[2][1],
|
116
|
+
matrix[0][2], matrix[1][2], matrix[2][2]);
|
117
|
+
}
|
118
|
+
|
119
|
+
mat4 czm_transpose(mat4 matrix)
|
120
|
+
{
|
121
|
+
return mat4(
|
122
|
+
matrix[0][0], matrix[1][0], matrix[2][0], matrix[3][0],
|
123
|
+
matrix[0][1], matrix[1][1], matrix[2][1], matrix[3][1],
|
124
|
+
matrix[0][2], matrix[1][2], matrix[2][2], matrix[3][2],
|
125
|
+
matrix[0][3], matrix[1][3], matrix[2][3], matrix[3][3]);
|
126
|
+
}
|
127
|
+
|
128
|
+
///////////////////////////////////////////////////////////////////////////////
|
129
|
+
|
130
|
+
/**
|
131
|
+
* Transforms a position from model to window coordinates. The transformation
|
132
|
+
* from model to clip coordinates is done using {@link czm_modelViewProjection}.
|
133
|
+
* The transform from normalized device coordinates to window coordinates is
|
134
|
+
* done using {@link czm_viewportTransformation}, which assumes a depth range
|
135
|
+
* of <code>near = 0</code> and <code>far = 1</code>.
|
136
|
+
* <br /><br />
|
137
|
+
* This transform is useful when there is a need to manipulate window coordinates
|
138
|
+
* in a vertex shader as done by {@link BillboardCollection}.
|
139
|
+
* <br /><br />
|
140
|
+
* This function should not be confused with {@link czm_viewportOrthographic},
|
141
|
+
* which is an orthographic projection matrix that transforms from window
|
142
|
+
* coordinates to clip coordinates.
|
143
|
+
*
|
144
|
+
* @name czm_modelToWindowCoordinates
|
145
|
+
* @glslFunction
|
146
|
+
*
|
147
|
+
* @param {vec4} position The position in model coordinates to transform.
|
148
|
+
*
|
149
|
+
* @returns {vec4} The transformed position in window coordinates.
|
150
|
+
*
|
151
|
+
* @see czm_eyeToWindowCoordinates
|
152
|
+
* @see czm_modelViewProjection
|
153
|
+
* @see czm_viewportTransformation
|
154
|
+
* @see czm_viewportOrthographic
|
155
|
+
* @see BillboardCollection
|
156
|
+
*
|
157
|
+
* @example
|
158
|
+
* vec4 positionWC = czm_modelToWindowCoordinates(positionMC);
|
159
|
+
*/
|
160
|
+
vec4 czm_modelToWindowCoordinates(vec4 position)
|
161
|
+
{
|
162
|
+
vec4 q = czm_modelViewProjection * position; // clip coordinates
|
163
|
+
q.xyz /= q.w; // normalized device coordinates
|
164
|
+
q.xyz = (czm_viewportTransformation * vec4(q.xyz, 1.0)).xyz; // window coordinates
|
165
|
+
return q;
|
166
|
+
}
|
167
|
+
|
168
|
+
/**
|
169
|
+
* Transforms a position from eye to window coordinates. The transformation
|
170
|
+
* from eye to clip coordinates is done using {@link czm_projection}.
|
171
|
+
* The transform from normalized device coordinates to window coordinates is
|
172
|
+
* done using {@link czm_viewportTransformation}, which assumes a depth range
|
173
|
+
* of <code>near = 0</code> and <code>far = 1</code>.
|
174
|
+
* <br /><br />
|
175
|
+
* This transform is useful when there is a need to manipulate window coordinates
|
176
|
+
* in a vertex shader as done by {@link BillboardCollection}.
|
177
|
+
*
|
178
|
+
* @name czm_eyeToWindowCoordinates
|
179
|
+
* @glslFunction
|
180
|
+
*
|
181
|
+
* @param {vec4} position The position in eye coordinates to transform.
|
182
|
+
*
|
183
|
+
* @returns {vec4} The transformed position in window coordinates.
|
184
|
+
*
|
185
|
+
* @see czm_modelToWindowCoordinates
|
186
|
+
* @see czm_projection
|
187
|
+
* @see czm_viewportTransformation
|
188
|
+
* @see BillboardCollection
|
189
|
+
*
|
190
|
+
* @example
|
191
|
+
* vec4 positionWC = czm_eyeToWindowCoordinates(positionEC);
|
192
|
+
*/
|
193
|
+
vec4 czm_eyeToWindowCoordinates(vec4 positionEC)
|
194
|
+
{
|
195
|
+
vec4 q = czm_projection * positionEC; // clip coordinates
|
196
|
+
q.xyz /= q.w; // normalized device coordinates
|
197
|
+
q.xyz = (czm_viewportTransformation * vec4(q.xyz, 1.0)).xyz; // window coordinates
|
198
|
+
return q;
|
199
|
+
}
|
200
|
+
|
201
|
+
/**
|
202
|
+
* Transforms a position from window to eye coordinates.
|
203
|
+
* The transform from window to normalized device coordinates is done using components
|
204
|
+
* of (@link czm_viewport} and {@link czm_viewportTransformation} instead of calculating
|
205
|
+
* the inverse of <code>czm_viewportTransformation</code>. The transformation from
|
206
|
+
* normalized device coordinates to clip coordinates is done using <code>positionWC.w</code>,
|
207
|
+
* which is expected to be the scalar used in the perspective divide. The transformation
|
208
|
+
* from clip to eye coordinates is done using {@link czm_inverseProjection}.
|
209
|
+
*
|
210
|
+
* @name czm_windowToEyeCoordinates
|
211
|
+
* @glslFunction
|
212
|
+
*
|
213
|
+
* @param {vec4} fragmentCoordinate The position in window coordinates to transform.
|
214
|
+
*
|
215
|
+
* @returns {vec4} The transformed position in eye coordinates.
|
216
|
+
*
|
217
|
+
* @see czm_modelToWindowCoordinates
|
218
|
+
* @see czm_eyeToWindowCoordinates
|
219
|
+
* @see czm_inverseProjection
|
220
|
+
* @see czm_viewport
|
221
|
+
* @see czm_viewportTransformation
|
222
|
+
*
|
223
|
+
* @example
|
224
|
+
* vec4 positionEC = czm_windowToEyeCoordinates(gl_FragCoord);
|
225
|
+
*/
|
226
|
+
vec4 czm_windowToEyeCoordinates(vec4 fragmentCoordinate)
|
227
|
+
{
|
228
|
+
float x = 2.0 * (fragmentCoordinate.x - czm_viewport.x) / czm_viewport.z - 1.0;
|
229
|
+
float y = 2.0 * (fragmentCoordinate.y - czm_viewport.y) / czm_viewport.w - 1.0;
|
230
|
+
float z = (fragmentCoordinate.z - czm_viewportTransformation[3][2]) / czm_viewportTransformation[2][2];
|
231
|
+
vec4 q = vec4(x, y, z, 1.0);
|
232
|
+
q /= fragmentCoordinate.w;
|
233
|
+
q = czm_inverseProjection * q;
|
234
|
+
return q;
|
235
|
+
}
|
236
|
+
|
237
|
+
///////////////////////////////////////////////////////////////////////////////
|
238
|
+
|
239
|
+
/**
|
240
|
+
* DOC_TBA
|
241
|
+
*
|
242
|
+
* @name czm_eyeOffset
|
243
|
+
* @glslFunction
|
244
|
+
*
|
245
|
+
* @param {vec4} positionEC DOC_TBA.
|
246
|
+
* @param {vec3} eyeOffset DOC_TBA.
|
247
|
+
*
|
248
|
+
* @returns {vec4} DOC_TBA.
|
249
|
+
*/
|
250
|
+
vec4 czm_eyeOffset(vec4 positionEC, vec3 eyeOffset)
|
251
|
+
{
|
252
|
+
// This equation is approximate in x and y.
|
253
|
+
vec4 p = positionEC;
|
254
|
+
vec4 zEyeOffset = normalize(p) * eyeOffset.z;
|
255
|
+
p.xy += eyeOffset.xy + zEyeOffset.xy;
|
256
|
+
p.z += zEyeOffset.z;
|
257
|
+
return p;
|
258
|
+
}
|
259
|
+
|
260
|
+
///////////////////////////////////////////////////////////////////////////////
|
261
|
+
|
262
|
+
/**
|
263
|
+
* DOC_TBA
|
264
|
+
*
|
265
|
+
* @name czm_geodeticSurfaceNormal
|
266
|
+
* @glslFunction
|
267
|
+
*
|
268
|
+
* @param {vec3} positionOnEllipsoid DOC_TBA
|
269
|
+
* @param {vec3} ellipsoidCenter DOC_TBA
|
270
|
+
* @param {vec3} oneOverEllipsoidRadiiSquared DOC_TBA
|
271
|
+
*
|
272
|
+
* @returns {vec3} DOC_TBA.
|
273
|
+
*/
|
274
|
+
vec3 czm_geodeticSurfaceNormal(vec3 positionOnEllipsoid, vec3 ellipsoidCenter, vec3 oneOverEllipsoidRadiiSquared)
|
275
|
+
{
|
276
|
+
return normalize((positionOnEllipsoid - ellipsoidCenter) * oneOverEllipsoidRadiiSquared);
|
277
|
+
}
|
278
|
+
|
279
|
+
/**
|
280
|
+
* DOC_TBA
|
281
|
+
*
|
282
|
+
* @name czm_ellipsoidWgs84TextureCoordinates
|
283
|
+
* @glslFunction
|
284
|
+
*/
|
285
|
+
vec2 czm_ellipsoidWgs84TextureCoordinates(vec3 normal)
|
286
|
+
{
|
287
|
+
return vec2(atan(normal.y, normal.x) * czm_oneOverTwoPi + 0.5, asin(normal.z) * czm_oneOverPi + 0.5);
|
288
|
+
}
|
289
|
+
|
290
|
+
/**
|
291
|
+
* Computes a 3x3 rotation matrix that transforms vectors from an ellipsoid's east-north-up coordinate system
|
292
|
+
* to eye coordinates. In east-north-up coordinates, x points east, y points north, and z points along the
|
293
|
+
* surface normal. East-north-up can be used as an ellipsoid's tangent space for operations such as bump mapping.
|
294
|
+
* <br /><br />
|
295
|
+
* The ellipsoid is assumed to be centered at the model coordinate's origin.
|
296
|
+
*
|
297
|
+
* @name czm_eastNorthUpToEyeCoordinates
|
298
|
+
* @glslFunction
|
299
|
+
*
|
300
|
+
* @param {vec3} positionMC The position on the ellipsoid in model coordinates.
|
301
|
+
* @param {vec3} normalEC The normalized ellipsoid surface normal, at <code>positionMC</code>, in eye coordinates.
|
302
|
+
*
|
303
|
+
* @returns {mat3} A 3x3 rotation matrix that transforms vectors from the east-north-up coordinate system to eye coordinates.
|
304
|
+
*
|
305
|
+
* @example
|
306
|
+
* // Transform a vector defined in the east-north-up coordinate
|
307
|
+
* // system, (0, 0, 1) which is the surface normal, to eye
|
308
|
+
* // coordinates.
|
309
|
+
* mat3 m = czm_eastNorthUpToEyeCoordinates(positionMC, normalEC);
|
310
|
+
* vec3 normalEC = m * vec3(0.0, 0.0, 1.0);
|
311
|
+
*/
|
312
|
+
mat3 czm_eastNorthUpToEyeCoordinates(vec3 positionMC, vec3 normalEC)
|
313
|
+
{
|
314
|
+
vec3 tangentMC = normalize(vec3(-positionMC.y, positionMC.x, 0.0)); // normalized surface tangent in model coordinates
|
315
|
+
vec3 tangentEC = normalize(czm_normal * tangentMC); // normalized surface tangent in eye coordiantes
|
316
|
+
vec3 bitangentEC = normalize(cross(normalEC, tangentEC)); // normalized surface bitangent in eye coordinates
|
317
|
+
|
318
|
+
return mat3(
|
319
|
+
tangentEC.x, tangentEC.y, tangentEC.z,
|
320
|
+
bitangentEC.x, bitangentEC.y, bitangentEC.z,
|
321
|
+
normalEC.x, normalEC.y, normalEC.z);
|
322
|
+
}
|
323
|
+
|
324
|
+
///////////////////////////////////////////////////////////////////////////////
|
325
|
+
|
326
|
+
/**
|
327
|
+
* Used as input to every material's czm_getMaterial function.
|
328
|
+
*
|
329
|
+
* @name czm_materialInput
|
330
|
+
* @glslStruct
|
331
|
+
*
|
332
|
+
* @property {float} s 1D texture coordinates.
|
333
|
+
* @property {vec2} st 2D texture coordinates.
|
334
|
+
* @property {vec3} str 3D texture coordinates.
|
335
|
+
* @property {vec3} normalEC Unperturbed surface normal in eye coordinates.
|
336
|
+
* @property {mat3} tangentToEyeMatrix Matrix for converting a tangent space normal to eye space.
|
337
|
+
* @property {vec3} positionToEyeEC Vector from the fragment to the eye in eye coordinates. The magnitude is the distance in meters from the fragment to the eye.
|
338
|
+
* @property {vec3} positionMC Position in model coordinates.
|
339
|
+
*/
|
340
|
+
struct czm_materialInput
|
341
|
+
{
|
342
|
+
float s;
|
343
|
+
vec2 st;
|
344
|
+
vec3 str;
|
345
|
+
vec3 normalEC;
|
346
|
+
mat3 tangentToEyeMatrix;
|
347
|
+
vec3 positionToEyeEC;
|
348
|
+
vec3 positionMC;
|
349
|
+
};
|
350
|
+
|
351
|
+
/**
|
352
|
+
* Holds material information that can be used for lighting. Returned by all czm_getMaterial functions.
|
353
|
+
*
|
354
|
+
* @name czm_material
|
355
|
+
* @glslStruct
|
356
|
+
*
|
357
|
+
* @property {vec3} diffuse Incoming light that scatters evenly in all directions.
|
358
|
+
* @property {float} specular Intensity of incoming light reflecting in a single direction.
|
359
|
+
* @property {float} shininess The sharpness of the specular reflection. Higher values create a smaller, more focused specular highlight.
|
360
|
+
* @property {vec3} normal Surface's normal in eye coordinates. It is used for effects such as normal mapping. The default is the surface's unmodified normal.
|
361
|
+
* @property {vec3} emission Light emitted by the material equally in all directions. The default is vec3(0.0), which emits no light.
|
362
|
+
* @property {float} alpha Opacity of this material. 0.0 is completely transparent; 1.0 is completely opaque.
|
363
|
+
*/
|
364
|
+
struct czm_material
|
365
|
+
{
|
366
|
+
vec3 diffuse;
|
367
|
+
float specular;
|
368
|
+
float shininess;
|
369
|
+
vec3 normal;
|
370
|
+
vec3 emission;
|
371
|
+
float alpha;
|
372
|
+
};
|
373
|
+
|
374
|
+
/**
|
375
|
+
* An czm_material with default values. Every material's czm_getMaterial
|
376
|
+
* should use this default material as a base for the material it returns.
|
377
|
+
* The default normal value is given by materialInput.normalEC.
|
378
|
+
*
|
379
|
+
* @name czm_getDefaultMaterial
|
380
|
+
* @glslFunction
|
381
|
+
*
|
382
|
+
* @param {czm_materialInput} input The input used to construct the default material.
|
383
|
+
*
|
384
|
+
* @returns {czm_material} The default material.
|
385
|
+
*
|
386
|
+
* @see czm_materialInput
|
387
|
+
* @see czm_material
|
388
|
+
* @see czm_getMaterial
|
389
|
+
*/
|
390
|
+
czm_material czm_getDefaultMaterial(czm_materialInput materialInput)
|
391
|
+
{
|
392
|
+
czm_material material;
|
393
|
+
material.diffuse = vec3(0.0);
|
394
|
+
material.specular = 0.0;
|
395
|
+
material.shininess = 1.0;
|
396
|
+
material.normal = materialInput.normalEC;
|
397
|
+
material.emission = vec3(0.0);
|
398
|
+
material.alpha = 1.0;
|
399
|
+
return material;
|
400
|
+
}
|
401
|
+
|
402
|
+
float getLambertDiffuse(vec3 lightDirection, czm_material material)
|
403
|
+
{
|
404
|
+
return max(dot(lightDirection, material.normal), 0.0);
|
405
|
+
}
|
406
|
+
|
407
|
+
float getSpecular(vec3 lightDirection, vec3 toEye, czm_material material)
|
408
|
+
{
|
409
|
+
vec3 toReflectedLight = reflect(-lightDirection, material.normal);
|
410
|
+
float specular = max(dot(toReflectedLight, toEye), 0.0);
|
411
|
+
|
412
|
+
return pow(specular, material.shininess);
|
413
|
+
}
|
414
|
+
|
415
|
+
/**
|
416
|
+
* Computes a color using the Phong lighting model.
|
417
|
+
*
|
418
|
+
* @name czm_phong
|
419
|
+
* @glslFunction
|
420
|
+
*
|
421
|
+
* @param {vec3} toEye A normalized vector from the fragment to the eye in eye coordinates.
|
422
|
+
* @param {czm_material} material The fragment's material.
|
423
|
+
*
|
424
|
+
* @returns {vec4} The computed color.
|
425
|
+
*
|
426
|
+
* @example
|
427
|
+
* vec3 positionToEyeEC = // ...
|
428
|
+
* czm_material material = // ...
|
429
|
+
* gl_FragColor = czm_phong(normalize(positionToEyeEC), material);
|
430
|
+
*
|
431
|
+
* @see czm_getMaterial
|
432
|
+
*/
|
433
|
+
vec4 czm_phong(vec3 toEye, czm_material material)
|
434
|
+
{
|
435
|
+
// Diffuse from directional light sources at eye (for top-down and horizon views)
|
436
|
+
float diffuse = getLambertDiffuse(vec3(0.0, 0.0, 1.0), material) + getLambertDiffuse(vec3(0.0, 1.0, 0.0), material);
|
437
|
+
|
438
|
+
// Specular from sun and pseudo-moon
|
439
|
+
float specular = getSpecular(czm_sunDirectionEC, toEye, material) + getSpecular(czm_moonDirectionEC, toEye, material);
|
440
|
+
|
441
|
+
vec3 ambient = vec3(0.0);
|
442
|
+
vec3 color = ambient + material.emission;
|
443
|
+
color += material.diffuse * diffuse;
|
444
|
+
color += material.specular * specular;
|
445
|
+
|
446
|
+
return vec4(color, material.alpha);
|
447
|
+
}
|
448
|
+
|
449
|
+
/**
|
450
|
+
* Computes the luminance of a color.
|
451
|
+
*
|
452
|
+
* @name czm_luminance
|
453
|
+
* @glslFunction
|
454
|
+
*
|
455
|
+
* @param {vec3} rgb The color.
|
456
|
+
*
|
457
|
+
* @returns {float} The luminance.
|
458
|
+
*
|
459
|
+
* @example
|
460
|
+
* float light = czm_luminance(vec3(0.0)); // 0.0
|
461
|
+
* float dark = czm_luminance(vec3(1.0)); // ~1.0
|
462
|
+
*/
|
463
|
+
float czm_luminance(vec3 rgb)
|
464
|
+
{
|
465
|
+
// Algorithm from Chapter 10 of Graphics Shaders.
|
466
|
+
const vec3 W = vec3(0.2125, 0.7154, 0.0721);
|
467
|
+
return dot(rgb, W);
|
468
|
+
}
|
469
|
+
|
470
|
+
/**
|
471
|
+
* Adjusts the hue of a color.
|
472
|
+
*
|
473
|
+
* @name czm_hue
|
474
|
+
* @glslFunction
|
475
|
+
*
|
476
|
+
* @param {vec3} rgb The color.
|
477
|
+
* @param {float} adjustment The amount to adjust the hue of the color in radians.
|
478
|
+
*
|
479
|
+
* @returns {float} The color with the hue adjusted.
|
480
|
+
*
|
481
|
+
* @example
|
482
|
+
* vec3 adjustHue = czm_hue(color, czm_pi); // The same as czm_hue(color, -czm_pi)
|
483
|
+
*/
|
484
|
+
vec3 czm_hue(vec3 rgb, float adjustment)
|
485
|
+
{
|
486
|
+
const mat3 toYIQ = mat3(0.299, 0.587, 0.114,
|
487
|
+
0.595716, -0.274453, -0.321263,
|
488
|
+
0.211456, -0.522591, 0.311135);
|
489
|
+
const mat3 toRGB = mat3(1.0, 0.9563, 0.6210,
|
490
|
+
1.0, -0.2721, -0.6474,
|
491
|
+
1.0, -1.107, 1.7046);
|
492
|
+
|
493
|
+
vec3 yiq = toYIQ * rgb;
|
494
|
+
float hue = atan(yiq.z, yiq.y) + adjustment;
|
495
|
+
float chroma = sqrt(yiq.z * yiq.z + yiq.y * yiq.y);
|
496
|
+
|
497
|
+
vec3 color = vec3(yiq.x, chroma * cos(hue), chroma * sin(hue));
|
498
|
+
return toRGB * color;
|
499
|
+
}
|
500
|
+
|
501
|
+
/**
|
502
|
+
* Adjusts the saturation of a color.
|
503
|
+
*
|
504
|
+
* @name czm_saturation
|
505
|
+
* @glslFunction
|
506
|
+
*
|
507
|
+
* @param {vec3} rgb The color.
|
508
|
+
* @param {float} adjustment The amount to adjust the saturation of the color.
|
509
|
+
*
|
510
|
+
* @returns {float} The color with the saturation adjusted.
|
511
|
+
*
|
512
|
+
* @example
|
513
|
+
* vec3 greyScale = czm_saturation(color, 0.0);
|
514
|
+
* vec3 doubleSaturation = czm_saturation(color, 2.0);
|
515
|
+
*/
|
516
|
+
vec3 czm_saturation(vec3 rgb, float adjustment)
|
517
|
+
{
|
518
|
+
// Algorithm from Chapter 16 of OpenGL Shading Language
|
519
|
+
vec3 intensity = vec3(czm_luminance(rgb));
|
520
|
+
return mix(intensity, rgb, adjustment);
|
521
|
+
}
|
522
|
+
|
523
|
+
/**
|
524
|
+
* DOC_TBA
|
525
|
+
*
|
526
|
+
* @name czm_multiplyWithColorBalance
|
527
|
+
* @glslFunction
|
528
|
+
*/
|
529
|
+
vec3 czm_multiplyWithColorBalance(vec3 left, vec3 right)
|
530
|
+
{
|
531
|
+
// Algorithm from Chapter 10 of Graphics Shaders.
|
532
|
+
const vec3 W = vec3(0.2125, 0.7154, 0.0721);
|
533
|
+
|
534
|
+
vec3 target = left * right;
|
535
|
+
float leftLuminance = dot(left, W);
|
536
|
+
float rightLuminance = dot(right, W);
|
537
|
+
float targetLuminance = dot(target, W);
|
538
|
+
|
539
|
+
return ((leftLuminance + rightLuminance) / (2.0 * targetLuminance)) * target;
|
540
|
+
}
|
541
|
+
|
542
|
+
///////////////////////////////////////////////////////////////////////////////
|
543
|
+
|
544
|
+
/**
|
545
|
+
* The maximum latitude, in radians, both North and South, supported by a Web Mercator
|
546
|
+
* (EPSG:3857) projection. Technically, the Mercator projection is defined
|
547
|
+
* for any latitude up to (but not including) 90 degrees, but it makes sense
|
548
|
+
* to cut it off sooner because it grows exponentially with increasing latitude.
|
549
|
+
* The logic behind this particular cutoff value, which is the one used by
|
550
|
+
* Google Maps, Bing Maps, and Esri, is that it makes the projection
|
551
|
+
* square. That is, the extent is equal in the X and Y directions.
|
552
|
+
*
|
553
|
+
* The constant value is computed as follows:
|
554
|
+
* czm_pi * 0.5 - (2.0 * atan(exp(-czm_pi)))
|
555
|
+
*
|
556
|
+
* @name czm_webMercatorMaxLatitude
|
557
|
+
* @glslConstant
|
558
|
+
*/
|
559
|
+
const float czm_webMercatorMaxLatitude = 1.4844222297453323669610967939;
|
560
|
+
|
561
|
+
/**
|
562
|
+
* Specifies a flat, 2D map.
|
563
|
+
*
|
564
|
+
* @name czm_scene2D
|
565
|
+
* @glslConstant
|
566
|
+
*/
|
567
|
+
const int czm_scene2D = 0;
|
568
|
+
|
569
|
+
/**
|
570
|
+
* Specifies 2.D Columbus View.
|
571
|
+
*
|
572
|
+
* @name czm_columbusView
|
573
|
+
* @glslConstant
|
574
|
+
*/
|
575
|
+
const int czm_columbusView = 1;
|
576
|
+
|
577
|
+
/**
|
578
|
+
* Specifies a 3D globe.
|
579
|
+
*
|
580
|
+
* @name czm_scene3D
|
581
|
+
* @glslConstant
|
582
|
+
*/
|
583
|
+
const int czm_scene3D = 2;
|
584
|
+
|
585
|
+
/**
|
586
|
+
* Specifies that the scene is morphing between modes.
|
587
|
+
*
|
588
|
+
* @name czm_morphing
|
589
|
+
* @glslConstant
|
590
|
+
*/
|
591
|
+
const int czm_morphing = 3;
|
592
|
+
|
593
|
+
/**
|
594
|
+
* DOC_TBA
|
595
|
+
*
|
596
|
+
* @name czm_columbusViewMorph
|
597
|
+
* @glslFunction
|
598
|
+
*/
|
599
|
+
vec4 czm_columbusViewMorph(vec3 position2D, vec3 position3D, float time)
|
600
|
+
{
|
601
|
+
// Just linear for now.
|
602
|
+
vec3 p = mix(position2D, position3D, time);
|
603
|
+
return vec4(p, 1.0);
|
604
|
+
}
|
605
|
+
|
606
|
+
///////////////////////////////////////////////////////////////////////////////
|
607
|
+
|
608
|
+
/**
|
609
|
+
* DOC_TBA
|
610
|
+
*
|
611
|
+
* @name czm_ray
|
612
|
+
* @glslStruct
|
613
|
+
*/
|
614
|
+
struct czm_ray
|
615
|
+
{
|
616
|
+
vec3 origin;
|
617
|
+
vec3 direction;
|
618
|
+
};
|
619
|
+
|
620
|
+
/**
|
621
|
+
* Computes the point along a ray at the given time. <code>time</code> can be positive, negative, or zero.
|
622
|
+
*
|
623
|
+
* @name czm_pointAlongRay
|
624
|
+
* @glslFunction
|
625
|
+
*
|
626
|
+
* @param {czm_ray} ray The ray to compute the point along.
|
627
|
+
* @param {float} time The time along the ray.
|
628
|
+
*
|
629
|
+
* @returns {vec3} The point along the ray at the given time.
|
630
|
+
*
|
631
|
+
* @example
|
632
|
+
* czm_ray ray = czm_ray(vec3(0.0), vec3(1.0, 0.0, 0.0)); // origin, direction
|
633
|
+
* vec3 v = czm_pointAlongRay(ray, 2.0); // (2.0, 0.0, 0.0)
|
634
|
+
*/
|
635
|
+
vec3 czm_pointAlongRay(czm_ray ray, float time)
|
636
|
+
{
|
637
|
+
return ray.origin + (time * ray.direction);
|
638
|
+
}
|
639
|
+
|
640
|
+
///////////////////////////////////////////////////////////////////////////////
|
641
|
+
|
642
|
+
/**
|
643
|
+
* DOC_TBA
|
644
|
+
*
|
645
|
+
* @name czm_raySegment
|
646
|
+
* @glslStruct
|
647
|
+
*/
|
648
|
+
struct czm_raySegment
|
649
|
+
{
|
650
|
+
float start;
|
651
|
+
float stop;
|
652
|
+
};
|
653
|
+
|
654
|
+
/**
|
655
|
+
* DOC_TBA
|
656
|
+
*
|
657
|
+
* @name czm_emptyRaySegment
|
658
|
+
* @glslConstant
|
659
|
+
*/
|
660
|
+
const czm_raySegment czm_emptyRaySegment = czm_raySegment(-czm_infinity, -czm_infinity);
|
661
|
+
|
662
|
+
/**
|
663
|
+
* DOC_TBA
|
664
|
+
*
|
665
|
+
* @name czm_fullRaySegment
|
666
|
+
* @glslConstant
|
667
|
+
*/
|
668
|
+
const czm_raySegment czm_fullRaySegment = czm_raySegment(0.0, czm_infinity);
|
669
|
+
|
670
|
+
/**
|
671
|
+
* Determines if a time interval is empty.
|
672
|
+
*
|
673
|
+
* @name czm_isEmpty
|
674
|
+
* @glslFunction
|
675
|
+
*
|
676
|
+
* @param {czm_raySegment} interval The interval to test.
|
677
|
+
*
|
678
|
+
* @returns {bool} <code>true</code> if the time interval is empty; otherwise, <code>false</code>.
|
679
|
+
*
|
680
|
+
* @example
|
681
|
+
* bool b0 = czm_isEmpty(czm_emptyRaySegment); // true
|
682
|
+
* bool b1 = czm_isEmpty(czm_raySegment(0.0, 1.0)); // false
|
683
|
+
* bool b2 = czm_isEmpty(czm_raySegment(1.0, 1.0)); // false, contains 1.0.
|
684
|
+
*/
|
685
|
+
bool czm_isEmpty(czm_raySegment interval)
|
686
|
+
{
|
687
|
+
return (interval.stop < 0.0);
|
688
|
+
}
|
689
|
+
|
690
|
+
/**
|
691
|
+
* Determines if a time interval is empty.
|
692
|
+
*
|
693
|
+
* @name czm_isFull
|
694
|
+
* @glslFunction
|
695
|
+
*
|
696
|
+
* @param {czm_raySegment} interval The interval to test.
|
697
|
+
*
|
698
|
+
* @returns {bool} <code>true</code> if the time interval is empty; otherwise, <code>false</code>.
|
699
|
+
*
|
700
|
+
* @example
|
701
|
+
* bool b0 = czm_isEmpty(czm_emptyRaySegment); // true
|
702
|
+
* bool b1 = czm_isEmpty(czm_raySegment(0.0, 1.0)); // false
|
703
|
+
* bool b2 = czm_isEmpty(czm_raySegment(1.0, 1.0)); // false, contains 1.0.
|
704
|
+
*/
|
705
|
+
bool czm_isFull(czm_raySegment interval)
|
706
|
+
{
|
707
|
+
return (interval.start == 0.0 && interval.stop == czm_infinity);
|
708
|
+
}
|
709
|
+
|
710
|
+
///////////////////////////////////////////////////////////////////////////////
|
711
|
+
|
712
|
+
/**
|
713
|
+
* DOC_TBA
|
714
|
+
*
|
715
|
+
* @name czm_ellipsoid
|
716
|
+
* @glslStruct
|
717
|
+
*/
|
718
|
+
struct czm_ellipsoid
|
719
|
+
{
|
720
|
+
vec3 center;
|
721
|
+
vec3 radii;
|
722
|
+
vec3 inverseRadii;
|
723
|
+
vec3 inverseRadiiSquared;
|
724
|
+
};
|
725
|
+
|
726
|
+
/**
|
727
|
+
* DOC_TBA
|
728
|
+
*
|
729
|
+
* @name czm_ellipsoidNew
|
730
|
+
* @glslFunction
|
731
|
+
*
|
732
|
+
*/
|
733
|
+
czm_ellipsoid czm_ellipsoidNew(vec3 center, vec3 radii)
|
734
|
+
{
|
735
|
+
vec3 inverseRadii = vec3(1.0 / radii.x, 1.0 / radii.y, 1.0 / radii.z);
|
736
|
+
vec3 inverseRadiiSquared = inverseRadii * inverseRadii;
|
737
|
+
czm_ellipsoid temp = czm_ellipsoid(center, radii, inverseRadii, inverseRadiiSquared);
|
738
|
+
return temp;
|
739
|
+
}
|
740
|
+
|
741
|
+
/**
|
742
|
+
* DOC_TBA
|
743
|
+
*
|
744
|
+
* @name czm_ellipsoidContainsPoint
|
745
|
+
* @glslFunction
|
746
|
+
*
|
747
|
+
*/
|
748
|
+
bool czm_ellipsoidContainsPoint(czm_ellipsoid ellipsoid, vec3 point)
|
749
|
+
{
|
750
|
+
vec3 scaled = ellipsoid.inverseRadii * (czm_inverseModelView * vec4(point, 1.0)).xyz;
|
751
|
+
return (dot(scaled, scaled) <= 1.0);
|
752
|
+
}
|
753
|
+
|
754
|
+
/**
|
755
|
+
* DOC_TBA
|
756
|
+
*
|
757
|
+
*
|
758
|
+
* @name czm_rayEllipsoidIntersectionInterval
|
759
|
+
* @glslFunction
|
760
|
+
*/
|
761
|
+
czm_raySegment czm_rayEllipsoidIntersectionInterval(czm_ray ray, czm_ellipsoid ellipsoid)
|
762
|
+
{
|
763
|
+
// ray and ellipsoid center in eye coordinates. radii in model coordinates.
|
764
|
+
vec3 q = ellipsoid.inverseRadii * (czm_inverseModelView * vec4(ray.origin, 1.0)).xyz;
|
765
|
+
vec3 w = ellipsoid.inverseRadii * (czm_inverseModelView * vec4(ray.direction, 0.0)).xyz;
|
766
|
+
|
767
|
+
q = q - ellipsoid.inverseRadii * (czm_inverseModelView * vec4(ellipsoid.center, 1.0)).xyz;
|
768
|
+
|
769
|
+
float q2 = dot(q, q);
|
770
|
+
float qw = dot(q, w);
|
771
|
+
|
772
|
+
if (q2 > 1.0) // Outside ellipsoid.
|
773
|
+
{
|
774
|
+
if (qw >= 0.0) // Looking outward or tangent (0 intersections).
|
775
|
+
{
|
776
|
+
return czm_emptyRaySegment;
|
777
|
+
}
|
778
|
+
else // qw < 0.0.
|
779
|
+
{
|
780
|
+
float qw2 = qw * qw;
|
781
|
+
float difference = q2 - 1.0; // Positively valued.
|
782
|
+
float w2 = dot(w, w);
|
783
|
+
float product = w2 * difference;
|
784
|
+
|
785
|
+
if (qw2 < product) // Imaginary roots (0 intersections).
|
786
|
+
{
|
787
|
+
return czm_emptyRaySegment;
|
788
|
+
}
|
789
|
+
else if (qw2 > product) // Distinct roots (2 intersections).
|
790
|
+
{
|
791
|
+
float discriminant = qw * qw - product;
|
792
|
+
float temp = -qw + sqrt(discriminant); // Avoid cancellation.
|
793
|
+
float root0 = temp / w2;
|
794
|
+
float root1 = difference / temp;
|
795
|
+
if (root0 < root1)
|
796
|
+
{
|
797
|
+
czm_raySegment i = czm_raySegment(root0, root1);
|
798
|
+
return i;
|
799
|
+
}
|
800
|
+
else
|
801
|
+
{
|
802
|
+
czm_raySegment i = czm_raySegment(root1, root0);
|
803
|
+
return i;
|
804
|
+
}
|
805
|
+
}
|
806
|
+
else // qw2 == product. Repeated roots (2 intersections).
|
807
|
+
{
|
808
|
+
float root = sqrt(difference / w2);
|
809
|
+
czm_raySegment i = czm_raySegment(root, root);
|
810
|
+
return i;
|
811
|
+
}
|
812
|
+
}
|
813
|
+
}
|
814
|
+
else if (q2 < 1.0) // Inside ellipsoid (2 intersections).
|
815
|
+
{
|
816
|
+
float difference = q2 - 1.0; // Negatively valued.
|
817
|
+
float w2 = dot(w, w);
|
818
|
+
float product = w2 * difference; // Negatively valued.
|
819
|
+
float discriminant = qw * qw - product;
|
820
|
+
float temp = -qw + sqrt(discriminant); // Positively valued.
|
821
|
+
czm_raySegment i = czm_raySegment(0.0, temp / w2);
|
822
|
+
return i;
|
823
|
+
}
|
824
|
+
else // q2 == 1.0. On ellipsoid.
|
825
|
+
{
|
826
|
+
if (qw < 0.0) // Looking inward.
|
827
|
+
{
|
828
|
+
float w2 = dot(w, w);
|
829
|
+
czm_raySegment i = czm_raySegment(0.0, -qw / w2);
|
830
|
+
return i;
|
831
|
+
}
|
832
|
+
else // qw >= 0.0. Looking outward or tangent.
|
833
|
+
{
|
834
|
+
return czm_emptyRaySegment;
|
835
|
+
}
|
836
|
+
}
|
837
|
+
}
|
838
|
+
|
839
|
+
/**
|
840
|
+
* Returns the WGS84 ellipsoid, with its center at the origin of world coordinates, in eye coordinates.
|
841
|
+
*
|
842
|
+
* @name czm_getWgs84EllipsoidEC
|
843
|
+
* @glslFunction
|
844
|
+
*
|
845
|
+
* @returns {czm_ellipsoid} The WGS84 ellipsoid, with its center at the origin of world coordinates, in eye coordinates.
|
846
|
+
*
|
847
|
+
* @see Ellipsoid.getWgs84
|
848
|
+
*
|
849
|
+
* @example
|
850
|
+
* czm_ellipsoid ellipsoid = czm_getWgs84EllipsoidEC();
|
851
|
+
*/
|
852
|
+
czm_ellipsoid czm_getWgs84EllipsoidEC()
|
853
|
+
{
|
854
|
+
return czm_ellipsoidNew(
|
855
|
+
czm_view[3].xyz, // center
|
856
|
+
vec3(6378137.0, 6378137.0, 6356752.314245)); // radii
|
857
|
+
}
|
858
|
+
|
859
|
+
/**
|
860
|
+
* Computes the fraction of a Web Wercator extent at which a given geodetic latitude is located.
|
861
|
+
*
|
862
|
+
* @name czm_latitudeToWebMercatorFraction
|
863
|
+
* @glslFunction
|
864
|
+
*
|
865
|
+
* @param {float} The geodetic latitude, in radians.
|
866
|
+
* @param {float} The low portion of the Web Mercator coordinate of the southern boundary of the extent.
|
867
|
+
* @param {float} The high portion of the Web Mercator coordinate of the southern boundary of the extent.
|
868
|
+
* @param {float} The total height of the extent in Web Mercator coordinates.
|
869
|
+
*
|
870
|
+
* @returns {float} The fraction of the extent at which the latitude occurs. If the latitude is the southern
|
871
|
+
* boundary of the extent, the return value will be zero. If it is the northern boundary, the return
|
872
|
+
* value will be 1.0. Latitudes in between are mapped according to the Web Mercator projection.
|
873
|
+
*/
|
874
|
+
float czm_latitudeToWebMercatorFraction(float latitude, float southMercatorYLow, float southMercatorYHigh, float oneOverMercatorHeight)
|
875
|
+
{
|
876
|
+
float sinLatitude = sin(latitude);
|
877
|
+
float mercatorY = 0.5 * log((1.0 + sinLatitude) / (1.0 - sinLatitude));
|
878
|
+
|
879
|
+
// mercatorY - southMercatorY in simulated double precision.
|
880
|
+
float t1 = 0.0 - southMercatorYLow;
|
881
|
+
float e = t1 - 0.0;
|
882
|
+
float t2 = ((-southMercatorYLow - e) + (0.0 - (t1 - e))) + mercatorY - southMercatorYHigh;
|
883
|
+
float highDifference = t1 + t2;
|
884
|
+
float lowDifference = t2 - (highDifference - t1);
|
885
|
+
|
886
|
+
return highDifference * oneOverMercatorHeight + lowDifference * oneOverMercatorHeight;
|
887
|
+
}
|
888
|
+
|
889
|
+
/**
|
890
|
+
* Translates a position (or any <code>vec3</code>) that was encoded with {@link EncodedCartesian3},
|
891
|
+
* and then provided to the shader as separate <code>high</code> and <code>low</code> bits to
|
892
|
+
* be relative to the eye. As shown in the example, the position can then be transformed in eye
|
893
|
+
* or clip coordinates using {@link czm_modelViewRelativeToEye} or {@link czm_modelViewProjectionRelativeToEye},
|
894
|
+
* respectively.
|
895
|
+
* <p>
|
896
|
+
* This technique, called GPU RTE, eliminates jittering artifacts when using large coordinates as
|
897
|
+
* described in <a href="http://blogs.agi.com/insight3d/index.php/2008/09/03/precisions-precisions/">Precisions, Precisions</a>.
|
898
|
+
* </p>
|
899
|
+
*
|
900
|
+
* @name czm_translateRelativeToEye
|
901
|
+
* @glslFunction
|
902
|
+
*
|
903
|
+
* @param {vec3} high The position's high bits.
|
904
|
+
* @param {vec3} low The position's low bits.
|
905
|
+
* @returns {vec3} The position translated to be relative to the camera's position.
|
906
|
+
*
|
907
|
+
* @example
|
908
|
+
* attribute vec3 positionHigh;
|
909
|
+
* attribute vec3 positionLow;
|
910
|
+
*
|
911
|
+
* void main()
|
912
|
+
* {
|
913
|
+
* vec3 p = czm_translateRelativeToEye(positionHigh, positionLow);
|
914
|
+
* gl_Position = czm_modelViewProjectionRelativeToEye * vec4(p, 1.0);
|
915
|
+
* }
|
916
|
+
*
|
917
|
+
* @see czm_modelViewRelativeToEye
|
918
|
+
* @see czm_modelViewProjectionRelativeToEye
|
919
|
+
* @see EncodedCartesian3
|
920
|
+
*/
|
921
|
+
vec3 czm_translateRelativeToEye(vec3 high, vec3 low)
|
922
|
+
{
|
923
|
+
vec3 highDifference = high - czm_encodedCameraPositionMCHigh;
|
924
|
+
vec3 lowDifference = low - czm_encodedCameraPositionMCLow;
|
925
|
+
|
926
|
+
return highDifference + lowDifference;
|
927
|
+
}
|