cesium 0.13.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.
- 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,39 @@
|
|
|
1
|
+
/*global define*/
|
|
2
|
+
define(['../Core/Enumeration'], function(Enumeration) {
|
|
3
|
+
"use strict";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* An enumeration describing how to draw a label.
|
|
7
|
+
*
|
|
8
|
+
* @exports LabelStyle
|
|
9
|
+
*
|
|
10
|
+
* @see Label#setStyle
|
|
11
|
+
*/
|
|
12
|
+
var LabelStyle = {
|
|
13
|
+
/**
|
|
14
|
+
* Fill the text of the label, but do not outline.
|
|
15
|
+
*
|
|
16
|
+
* @constant
|
|
17
|
+
* @type {Enumeration}
|
|
18
|
+
*/
|
|
19
|
+
FILL : new Enumeration(0, 'FILL'),
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Outline the text of the label, but do not fill.
|
|
23
|
+
*
|
|
24
|
+
* @constant
|
|
25
|
+
* @type {Enumeration}
|
|
26
|
+
*/
|
|
27
|
+
OUTLINE : new Enumeration(1, 'OUTLINE'),
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Fill and outline the text of the label.
|
|
31
|
+
*
|
|
32
|
+
* @constant
|
|
33
|
+
* @type {Enumeration}
|
|
34
|
+
*/
|
|
35
|
+
FILL_AND_OUTLINE : new Enumeration(2, 'FILL_AND_OUTLINE')
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
return LabelStyle;
|
|
39
|
+
});
|
|
@@ -0,0 +1,1177 @@
|
|
|
1
|
+
/*global define*/
|
|
2
|
+
define([
|
|
3
|
+
'../ThirdParty/when',
|
|
4
|
+
'../Core/loadImage',
|
|
5
|
+
'../Core/DeveloperError',
|
|
6
|
+
'../Core/createGuid',
|
|
7
|
+
'../Core/clone',
|
|
8
|
+
'../Core/Color',
|
|
9
|
+
'../Core/combine',
|
|
10
|
+
'../Core/defaultValue',
|
|
11
|
+
'../Core/destroyObject',
|
|
12
|
+
'../Core/Cartesian2',
|
|
13
|
+
'../Core/Matrix2',
|
|
14
|
+
'../Core/Matrix3',
|
|
15
|
+
'../Core/Matrix4',
|
|
16
|
+
'../Renderer/Texture',
|
|
17
|
+
'../Renderer/CubeMap',
|
|
18
|
+
'../Shaders/Materials/AsphaltMaterial',
|
|
19
|
+
'../Shaders/Materials/BlobMaterial',
|
|
20
|
+
'../Shaders/Materials/BrickMaterial',
|
|
21
|
+
'../Shaders/Materials/BumpMapMaterial',
|
|
22
|
+
'../Shaders/Materials/CementMaterial',
|
|
23
|
+
'../Shaders/Materials/CheckerboardMaterial',
|
|
24
|
+
'../Shaders/Materials/DotMaterial',
|
|
25
|
+
'../Shaders/Materials/FacetMaterial',
|
|
26
|
+
'../Shaders/Materials/FresnelMaterial',
|
|
27
|
+
'../Shaders/Materials/GrassMaterial',
|
|
28
|
+
'../Shaders/Materials/NormalMapMaterial',
|
|
29
|
+
'../Shaders/Materials/ReflectionMaterial',
|
|
30
|
+
'../Shaders/Materials/RefractionMaterial',
|
|
31
|
+
'../Shaders/Materials/StripeMaterial',
|
|
32
|
+
'../Shaders/Materials/TieDyeMaterial',
|
|
33
|
+
'../Shaders/Materials/Water',
|
|
34
|
+
'../Shaders/Materials/WoodMaterial',
|
|
35
|
+
'../Shaders/Materials/RimLightingMaterial',
|
|
36
|
+
'../Shaders/Materials/ErosionMaterial'
|
|
37
|
+
], function(
|
|
38
|
+
when,
|
|
39
|
+
loadImage,
|
|
40
|
+
DeveloperError,
|
|
41
|
+
createGuid,
|
|
42
|
+
clone,
|
|
43
|
+
Color,
|
|
44
|
+
combine,
|
|
45
|
+
defaultValue,
|
|
46
|
+
destroyObject,
|
|
47
|
+
Cartesian2,
|
|
48
|
+
Matrix2,
|
|
49
|
+
Matrix3,
|
|
50
|
+
Matrix4,
|
|
51
|
+
Texture,
|
|
52
|
+
CubeMap,
|
|
53
|
+
AsphaltMaterial,
|
|
54
|
+
BlobMaterial,
|
|
55
|
+
BrickMaterial,
|
|
56
|
+
BumpMapMaterial,
|
|
57
|
+
CementMaterial,
|
|
58
|
+
CheckerboardMaterial,
|
|
59
|
+
DotMaterial,
|
|
60
|
+
FacetMaterial,
|
|
61
|
+
FresnelMaterial,
|
|
62
|
+
GrassMaterial,
|
|
63
|
+
NormalMapMaterial,
|
|
64
|
+
ReflectionMaterial,
|
|
65
|
+
RefractionMaterial,
|
|
66
|
+
StripeMaterial,
|
|
67
|
+
TieDyeMaterial,
|
|
68
|
+
WaterMaterial,
|
|
69
|
+
WoodMaterial,
|
|
70
|
+
RimLightingMaterial,
|
|
71
|
+
ErosionMaterial) {
|
|
72
|
+
"use strict";
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* A Material defines surface appearance through a combination of diffuse, specular,
|
|
76
|
+
* normal, emission, and alpha components. These values are specified using a
|
|
77
|
+
* JSON schema called Fabric which gets parsed and assembled into glsl shader code
|
|
78
|
+
* behind-the-scenes. Check out the <a href='https://github.com/AnalyticalGraphicsInc/cesium/wiki/Fabric'>wiki page</a>
|
|
79
|
+
* for more details on Fabric.
|
|
80
|
+
* <br /><br />
|
|
81
|
+
* <style type="text/css">
|
|
82
|
+
* #materialDescriptions code {
|
|
83
|
+
* font-weight: normal;
|
|
84
|
+
* font-family: Consolas, 'Lucida Console', Monaco, monospace;
|
|
85
|
+
* color: #A35A00;
|
|
86
|
+
* }
|
|
87
|
+
* #materialDescriptions ul, #materialDescriptions ul ul {
|
|
88
|
+
* list-style-type: none;
|
|
89
|
+
* }
|
|
90
|
+
* #materialDescriptions ul ul {
|
|
91
|
+
* margin-bottom: 10px;
|
|
92
|
+
* }
|
|
93
|
+
* #materialDescriptions ul ul li {
|
|
94
|
+
* font-weight: normal;
|
|
95
|
+
* color: #000000;
|
|
96
|
+
* text-indent: -2em;
|
|
97
|
+
* margin-left: 2em;
|
|
98
|
+
* }
|
|
99
|
+
* #materialDescriptions ul li {
|
|
100
|
+
* font-weight: bold;
|
|
101
|
+
* color: #0053CF;
|
|
102
|
+
* }
|
|
103
|
+
* </style>
|
|
104
|
+
*
|
|
105
|
+
* Base material types and their uniforms:
|
|
106
|
+
* <div id='materialDescriptions'>
|
|
107
|
+
* <ul>
|
|
108
|
+
* <li>Color</li>
|
|
109
|
+
* <ul>
|
|
110
|
+
* <li><code>color</code>: rgba color object.</li>
|
|
111
|
+
* </ul>
|
|
112
|
+
* <li>Image</li>
|
|
113
|
+
* <ul>
|
|
114
|
+
* <li><code>image</code>: path to image.</li>
|
|
115
|
+
* <li><code>repeat</code>: Object with x and y values specifying the number of times to repeat the image.</li>
|
|
116
|
+
* </ul>
|
|
117
|
+
* <li>DiffuseMap</li>
|
|
118
|
+
* <ul>
|
|
119
|
+
* <li><code>image</code>: path to image.</li>
|
|
120
|
+
* <li><code>channels</code>: Three character string containing any combination of r, g, b, and a for selecting the desired image channels.</li>
|
|
121
|
+
* <li><code>repeat</code>: Object with x and y values specifying the number of times to repeat the image.</li>
|
|
122
|
+
* </ul>
|
|
123
|
+
* <li>AlphaMap</li>
|
|
124
|
+
* <ul>
|
|
125
|
+
* <li><code>image</code>: path to image.</li>
|
|
126
|
+
* <li><code>channel</code>: One character string containing r, g, b, or a for selecting the desired image channel. </li>
|
|
127
|
+
* <li><code>repeat</code>: Object with x and y values specifying the number of times to repeat the image.</li>
|
|
128
|
+
* </ul>
|
|
129
|
+
* <li>SpecularMap</li>
|
|
130
|
+
* <ul>
|
|
131
|
+
* <li><code>image</code>: path to image.</li>
|
|
132
|
+
* <li><code>channel</code>: One character string containing r, g, b, or a for selecting the desired image channel. </li>
|
|
133
|
+
* <li><code>repeat</code>: Object with x and y values specifying the number of times to repeat the image.</li>
|
|
134
|
+
* </ul>
|
|
135
|
+
* <li>EmissionMap</li>
|
|
136
|
+
* <ul>
|
|
137
|
+
* <li><code>image</code>: path to image.</li>
|
|
138
|
+
* <li><code>channels</code>: Three character string containing any combination of r, g, b, and a for selecting the desired image channels. </li>
|
|
139
|
+
* <li><code>repeat</code>: Object with x and y values specifying the number of times to repeat the image.</li>
|
|
140
|
+
* </ul>
|
|
141
|
+
* <li>BumpMap</li>
|
|
142
|
+
* <ul>
|
|
143
|
+
* <li><code>image</code>: path to image.</li>
|
|
144
|
+
* <li><code>channel</code>: One character string containing r, g, b, or a for selecting the desired image channel. </li>
|
|
145
|
+
* <li><code>repeat</code>: Object with x and y values specifying the number of times to repeat the image.</li>
|
|
146
|
+
* <li><code>strength</code>: Bump strength value between 0.0 and 1.0 where 0.0 is small bumps and 1.0 is large bumps.</li>
|
|
147
|
+
* </ul>
|
|
148
|
+
* <li>NormalMap</li>
|
|
149
|
+
* <ul>
|
|
150
|
+
* <li><code>image</code>: path to image.</li>
|
|
151
|
+
* <li><code>channels</code>: Three character string containing any combination of r, g, b, and a for selecting the desired image channels. </li>
|
|
152
|
+
* <li><code>repeat</code>: Object with x and y values specifying the number of times to repeat the image.</li>
|
|
153
|
+
* <li><code>strength</code>: Bump strength value between 0.0 and 1.0 where 0.0 is small bumps and 1.0 is large bumps.</li>
|
|
154
|
+
* </ul>
|
|
155
|
+
* <li>Reflection</li>
|
|
156
|
+
* <ul>
|
|
157
|
+
* <li><code>cubeMap</code>: Object with positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ image paths. </li>
|
|
158
|
+
* <li><code>channels</code>: Three character string containing any combination of r, g, b, and a for selecting the desired image channels.</li>
|
|
159
|
+
* </ul>
|
|
160
|
+
* <li>Refraction</li>
|
|
161
|
+
* <ul>
|
|
162
|
+
* <li><code>cubeMap</code>: Object with positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ image paths. </li>
|
|
163
|
+
* <li><code>channels</code>: Three character string containing any combination of r, g, b, and a for selecting the desired image channels.</li>
|
|
164
|
+
* <li><code>indexOfRefractionRatio</code>: Number representing the refraction strength where 1.0 is the lowest and 0.0 is the highest.</li>
|
|
165
|
+
* </ul>
|
|
166
|
+
* <li>Fresnel</li>
|
|
167
|
+
* <ul>
|
|
168
|
+
* <li><code>reflection</code>: Reflection Material.</li>
|
|
169
|
+
* <li><code>refraction</code>: Refraction Material.</li>
|
|
170
|
+
* </ul>
|
|
171
|
+
* <li>Brick</li>
|
|
172
|
+
* <ul>
|
|
173
|
+
* <li><code>brickColor</code>: rgba color object for the brick color.</li>
|
|
174
|
+
* <li><code>mortarColor</code>: rgba color object for the mortar color.</li>
|
|
175
|
+
* <li><code>brickSize</code>: Number between 0.0 and 1.0 where 0.0 is many small bricks and 1.0 is one large brick.</li>
|
|
176
|
+
* <li><code>brickPct</code>: Number for the ratio of brick to mortar where 0.0 is all mortar and 1.0 is all brick.</li>
|
|
177
|
+
* <li><code>brickRoughness</code>: Number between 0.0 and 1.0 representing how rough the brick looks.</li>
|
|
178
|
+
* <li><code>mortarRoughness</code>: Number between 0.0 and 1.0 representing how rough the mortar looks.</li>
|
|
179
|
+
* </ul>
|
|
180
|
+
* <li>Wood</li>
|
|
181
|
+
* <ul>
|
|
182
|
+
* <li><code>lightWoodColor</code>: rgba color object for the wood's base color.</li>
|
|
183
|
+
* <li><code>darkWoodColor</code>: rgba color object for the color of rings in the wood.</li>
|
|
184
|
+
* <li><code>ringFrequency</code>: Number for the frequency of rings in the wood.</li>
|
|
185
|
+
* <li><code>noiseScale</code>: Object with x and y values specifying the noisiness of the ring patterns in both directions.</li>
|
|
186
|
+
* </ul>
|
|
187
|
+
* <li>Asphalt</li>
|
|
188
|
+
* <ul>
|
|
189
|
+
* <li><code>asphaltColor</code>: rgba color object for the asphalt's color.</li>
|
|
190
|
+
* <li><code>bumpSize</code>: Number for the size of the asphalt's bumps.</li>
|
|
191
|
+
* <li><code>roughness</code>: Number that controls how rough the asphalt looks.</li>
|
|
192
|
+
* </ul>
|
|
193
|
+
* <li>Cement</li>
|
|
194
|
+
* <ul>
|
|
195
|
+
* <li><code>cementColor</code>: rgba color object for the cement's color. </li>
|
|
196
|
+
* <li><code>grainScale</code>: Number for the size of rock grains in the cement. </li>
|
|
197
|
+
* <li><code>roughness</code>: Number that controls how rough the cement looks.</li>
|
|
198
|
+
* </ul>
|
|
199
|
+
* <li>Grass</li>
|
|
200
|
+
* <ul>
|
|
201
|
+
* <li><code>grassColor</code>: rgba color object for the grass' color. </li>
|
|
202
|
+
* <li><code>dirtColor</code>: rgba color object for the dirt's color. </li>
|
|
203
|
+
* <li><code>patchiness</code>: Number that controls the size of the color patches in the grass.</li>
|
|
204
|
+
* </ul>
|
|
205
|
+
* <li>Stripe</li>
|
|
206
|
+
* <ul>
|
|
207
|
+
* <li><code>horizontal</code>: Boolean that determines if the stripes are horizontal or vertical.</li>
|
|
208
|
+
* <li><code>lightColor</code>: rgba color object for the stripe's light alternating color.</li>
|
|
209
|
+
* <li><code>darkColor</code>: rgba color object for the stripe's dark alternating color.</li>
|
|
210
|
+
* <li><code>offset</code>: Number that controls the stripe offset from the edge.</li>
|
|
211
|
+
* <li><code>repeat</code>: Number that controls the total number of stripes, half light and half dark.</li>
|
|
212
|
+
* </ul>
|
|
213
|
+
* <li>Checkerboard</li>
|
|
214
|
+
* <ul>
|
|
215
|
+
* <li><code>lightColor</code>: rgba color object for the checkerboard's light alternating color.</li>
|
|
216
|
+
* <li><code>darkColor</code>: rgba color object for the checkerboard's dark alternating color.</li>
|
|
217
|
+
* <li><code>repeat</code>: Object with x and y values specifying the number of columns and rows respectively.</li>
|
|
218
|
+
* </ul>
|
|
219
|
+
* <li>Dot</li>
|
|
220
|
+
* <ul>
|
|
221
|
+
* <li><code>lightColor</code>: rgba color object for the dot color.</li>
|
|
222
|
+
* <li><code>darkColor</code>: rgba color object for the background color.</li>
|
|
223
|
+
* <li><code>repeat</code>: Object with x and y values specifying the number of columns and rows of dots respectively.</li>
|
|
224
|
+
* </ul>
|
|
225
|
+
* <li>TieDye</li>
|
|
226
|
+
* <ul>
|
|
227
|
+
* <li><code>lightColor</code>: rgba color object for the light color.</li>
|
|
228
|
+
* <li><code>darkColor</code>: rgba color object for the dark color.</li>
|
|
229
|
+
* <li><code>frequency</code>: Number that controls the frequency of the pattern.</li>
|
|
230
|
+
* </ul>
|
|
231
|
+
* <li>Facet</li>
|
|
232
|
+
* <ul>
|
|
233
|
+
* <li><code>lightColor</code>: rgba color object for the light color.</li>
|
|
234
|
+
* <li><code>darkColor</code>: rgba color object for the dark color.</li>
|
|
235
|
+
* <li><code>frequency</code>: Number that controls the frequency of the pattern.</li>
|
|
236
|
+
* </ul>
|
|
237
|
+
* <li>Blob</li>
|
|
238
|
+
* <ul>
|
|
239
|
+
* <li><code>lightColor</code>: rgba color object for the light color.</li>
|
|
240
|
+
* <li><code>darkColor</code>: rgba color object for the dark color.</li>
|
|
241
|
+
* <li><code>frequency</code>: Number that controls the frequency of the pattern.</li>
|
|
242
|
+
* </ul>
|
|
243
|
+
* <li>Water</li>
|
|
244
|
+
* <ul>
|
|
245
|
+
* <li><code>baseWaterColor</code>: rgba color object base color of the water.</li>
|
|
246
|
+
* <li><code>blendColor</code>: rgba color object used when blending from water to non-water areas.</li>
|
|
247
|
+
* <li><code>specularMap</code>: Single channel texture used to indicate areas of water.</li>
|
|
248
|
+
* <li><code>normalMap</code>: Normal map for water normal perturbation.</li>
|
|
249
|
+
* <li><code>frequency</code>: Number that controls the number of waves.</li>
|
|
250
|
+
* <li><code>normalMap</code>: Normal map for water normal perturbation.</li>
|
|
251
|
+
* <li><code>animationSpeed</code>: Number that controls the animations speed of the water.</li>
|
|
252
|
+
* <li><code>amplitude</code>: Number that controls the amplitude of water waves.</li>
|
|
253
|
+
* <li><code>specularIntensity</code>: Number that controls the intensity of specular reflections.</li>
|
|
254
|
+
* </ul>
|
|
255
|
+
* <li>RimLighting</li>
|
|
256
|
+
* <ul>
|
|
257
|
+
* <li><code>color</code>: diffuse color and alpha.</li>
|
|
258
|
+
* <li><code>rimColor</code>: diffuse color and alpha of the rim.</li>
|
|
259
|
+
* <li><code>width</code>: Number that determines the rim's width.</li>
|
|
260
|
+
* </ul>
|
|
261
|
+
* <li>Erosion</li>
|
|
262
|
+
* <ul>
|
|
263
|
+
* <li><code>color</code>: diffuse color and alpha.</li>
|
|
264
|
+
* <li><code>time</code>: Time of erosion. 1.0 is no erosion; 0.0 is fully eroded.</li>
|
|
265
|
+
* </ul>
|
|
266
|
+
* </ul>
|
|
267
|
+
* </div>
|
|
268
|
+
*
|
|
269
|
+
* @alias Material
|
|
270
|
+
*
|
|
271
|
+
* @param {Context} description.context The context used to create textures if the material uses them.
|
|
272
|
+
* @param {Boolean} [description.strict = false] Throws errors for issues that would normally be ignored, including unused uniforms or materials.
|
|
273
|
+
* @param {Object} description.fabric The fabric JSON used to generate the material.
|
|
274
|
+
*
|
|
275
|
+
* @constructor
|
|
276
|
+
*
|
|
277
|
+
* @exception {DeveloperError} fabric: uniform has invalid type.
|
|
278
|
+
* @exception {DeveloperError} fabric: uniforms and materials cannot share the same property.
|
|
279
|
+
* @exception {DeveloperError} fabric: cannot have source and components in the same section.
|
|
280
|
+
* @exception {DeveloperError} fabric: property name is not valid. It should be 'type', 'materials', 'uniforms', 'components', or 'source'.
|
|
281
|
+
* @exception {DeveloperError} fabric: property name is not valid. It should be 'diffuse', 'specular', 'shininess', 'normal', 'emission', or 'alpha'.
|
|
282
|
+
* @exception {DeveloperError} image: context is not defined.
|
|
283
|
+
* @exception {DeveloperError} strict: shader source does not use string.
|
|
284
|
+
* @exception {DeveloperError} strict: shader source does not use uniform.
|
|
285
|
+
* @exception {DeveloperError} strict: shader source does not use material.
|
|
286
|
+
*
|
|
287
|
+
* @example
|
|
288
|
+
* // Create a color material with fromType:
|
|
289
|
+
* polygon.material = Material.fromType(context, 'Color');
|
|
290
|
+
* polygon.material.uniforms.color = {
|
|
291
|
+
* red : 1.0,
|
|
292
|
+
* green : 1.0,
|
|
293
|
+
* blue : 0.0
|
|
294
|
+
* alpha : 1.0
|
|
295
|
+
* };
|
|
296
|
+
*
|
|
297
|
+
* // Create the default material:
|
|
298
|
+
* polygon.material = new Material();
|
|
299
|
+
*
|
|
300
|
+
* // Create a color material with full Fabric notation:
|
|
301
|
+
* polygon.material = new Material({
|
|
302
|
+
* context : context,
|
|
303
|
+
* fabric : {
|
|
304
|
+
* type : 'Color',
|
|
305
|
+
* uniforms : {
|
|
306
|
+
* color : {
|
|
307
|
+
* red : 1.0,
|
|
308
|
+
* green : 1.0,
|
|
309
|
+
* blue : 0.0,
|
|
310
|
+
* alpha : 1.0
|
|
311
|
+
* }
|
|
312
|
+
* }
|
|
313
|
+
* }
|
|
314
|
+
* });
|
|
315
|
+
*
|
|
316
|
+
* @see <a href='https://github.com/AnalyticalGraphicsInc/cesium/wiki/Fabric'>Fabric wiki page</a> for a more detailed description of Fabric.
|
|
317
|
+
*/
|
|
318
|
+
var Material = function(description) {
|
|
319
|
+
/**
|
|
320
|
+
* The material type. Can be an existing type or a new type. If no type is specified in fabric, type is a GUID.
|
|
321
|
+
* @type String
|
|
322
|
+
*/
|
|
323
|
+
this.type = undefined;
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* The glsl shader source for this material.
|
|
327
|
+
* @type String
|
|
328
|
+
*/
|
|
329
|
+
this.shaderSource = undefined;
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Maps sub-material names to Material objects.
|
|
333
|
+
* @type Object
|
|
334
|
+
*/
|
|
335
|
+
this.materials = undefined;
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* Maps uniform names to their values.
|
|
339
|
+
* @type Object
|
|
340
|
+
*/
|
|
341
|
+
this.uniforms = undefined;
|
|
342
|
+
this._uniforms = undefined;
|
|
343
|
+
|
|
344
|
+
this._context = undefined;
|
|
345
|
+
this._strict = undefined;
|
|
346
|
+
this._template = undefined;
|
|
347
|
+
|
|
348
|
+
initializeMaterial(description, 0, this);
|
|
349
|
+
Object.defineProperty(this, 'type', {
|
|
350
|
+
value : this.type,
|
|
351
|
+
writable : false
|
|
352
|
+
});
|
|
353
|
+
};
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* Creates a new material using an existing material type.
|
|
357
|
+
* <br /><br />
|
|
358
|
+
* Shorthand for: new Material({context : context, fabric : {type : type}});
|
|
359
|
+
*
|
|
360
|
+
* @param {Context} context The context used to create textures if the material uses them.
|
|
361
|
+
* @param {String} type The base material type.
|
|
362
|
+
*
|
|
363
|
+
* @returns {Material} New material object.
|
|
364
|
+
*
|
|
365
|
+
* @exception {DeveloperError} material with that type does not exist.
|
|
366
|
+
*
|
|
367
|
+
* @example
|
|
368
|
+
* var material = Material.fromType(context, 'Color');
|
|
369
|
+
* material.uniforms.color = vec4(1.0, 0.0, 0.0, 1.0);
|
|
370
|
+
*/
|
|
371
|
+
Material.fromType = function(context, type) {
|
|
372
|
+
if (typeof Material._materialCache.getMaterial(type) === 'undefined') {
|
|
373
|
+
throw new DeveloperError('material with type \'' + type + '\' does not exist.');
|
|
374
|
+
}
|
|
375
|
+
return new Material({
|
|
376
|
+
context : context,
|
|
377
|
+
fabric : {
|
|
378
|
+
type : type
|
|
379
|
+
}
|
|
380
|
+
});
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* Returns true if this object was destroyed; otherwise, false.
|
|
385
|
+
* <br /><br />
|
|
386
|
+
* If this object was destroyed, it should not be used; calling any function other than
|
|
387
|
+
* <code>isDestroyed</code> will result in a {@link DeveloperError} exception.
|
|
388
|
+
*
|
|
389
|
+
* @memberof Material
|
|
390
|
+
*
|
|
391
|
+
* @returns {Boolean} True if this object was destroyed; otherwise, false.
|
|
392
|
+
*
|
|
393
|
+
* @see Material#destroy
|
|
394
|
+
*/
|
|
395
|
+
Material.prototype.isDestroyed = function() {
|
|
396
|
+
return false;
|
|
397
|
+
};
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* Destroys the WebGL resources held by this object. Destroying an object allows for deterministic
|
|
401
|
+
* release of WebGL resources, instead of relying on the garbage collector to destroy this object.
|
|
402
|
+
* <br /><br />
|
|
403
|
+
* Once an object is destroyed, it should not be used; calling any function other than
|
|
404
|
+
* <code>isDestroyed</code> will result in a {@link DeveloperError} exception. Therefore,
|
|
405
|
+
* assign the return value (<code>undefined</code>) to the object as done in the example.
|
|
406
|
+
*
|
|
407
|
+
* @memberof Material
|
|
408
|
+
*
|
|
409
|
+
* @returns {undefined}
|
|
410
|
+
*
|
|
411
|
+
* @exception {DeveloperError} This object was destroyed, i.e., destroy() was called.
|
|
412
|
+
*
|
|
413
|
+
* @see Material#isDestroyed
|
|
414
|
+
*
|
|
415
|
+
* @example
|
|
416
|
+
* material = material && material.destroy();
|
|
417
|
+
*/
|
|
418
|
+
Material.prototype.destroy = function() {
|
|
419
|
+
var materials = this.materials;
|
|
420
|
+
var uniforms = this.uniforms;
|
|
421
|
+
for ( var uniformId in uniforms) {
|
|
422
|
+
if (uniforms.hasOwnProperty(uniformId)) {
|
|
423
|
+
var uniformValue = uniforms[uniformId];
|
|
424
|
+
if (uniformValue instanceof Texture || uniformValue instanceof CubeMap) {
|
|
425
|
+
Material._textureCache.releaseTexture(this, uniformValue);
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
for ( var material in materials) {
|
|
430
|
+
if (materials.hasOwnProperty(material)) {
|
|
431
|
+
material.destroy();
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
return destroyObject(this);
|
|
435
|
+
};
|
|
436
|
+
|
|
437
|
+
function initializeMaterial(description, count, result) {
|
|
438
|
+
description = defaultValue(description, {});
|
|
439
|
+
result._context = description.context;
|
|
440
|
+
result._strict = defaultValue(description.strict, false);
|
|
441
|
+
result._template = defaultValue(description.fabric, {});
|
|
442
|
+
result._template.uniforms = defaultValue(result._template.uniforms, {});
|
|
443
|
+
result._template.materials = defaultValue(result._template.materials, {});
|
|
444
|
+
|
|
445
|
+
result.type = (typeof result._template.type !== 'undefined') ? result._template.type : createGuid();
|
|
446
|
+
|
|
447
|
+
result.shaderSource = '';
|
|
448
|
+
result.materials = {};
|
|
449
|
+
result.uniforms = {};
|
|
450
|
+
result._uniforms = {};
|
|
451
|
+
|
|
452
|
+
// If the cache contains this material type, build the material template off of the stored template.
|
|
453
|
+
var cachedTemplate = Material._materialCache.getMaterial(result.type);
|
|
454
|
+
if (typeof cachedTemplate !== 'undefined') {
|
|
455
|
+
var template = clone(cachedTemplate);
|
|
456
|
+
result._template = combine([result._template, template]);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
// Make sure the template has no obvious errors. More error checking happens later.
|
|
460
|
+
checkForTemplateErrors(result);
|
|
461
|
+
|
|
462
|
+
// If the material has a new type, add it to the cache.
|
|
463
|
+
if (typeof cachedTemplate === 'undefined') {
|
|
464
|
+
Material._materialCache.addMaterial(result.type, result._template);
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
createMethodDefinition(result);
|
|
468
|
+
count = createUniforms(result, count);
|
|
469
|
+
count = createSubMaterials(result, count);
|
|
470
|
+
return count;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
function checkForValidProperties(object, properties, result, throwNotFound) {
|
|
474
|
+
if (typeof object !== 'undefined') {
|
|
475
|
+
for ( var property in object) {
|
|
476
|
+
if (object.hasOwnProperty(property)) {
|
|
477
|
+
var hasProperty = properties.indexOf(property) !== -1;
|
|
478
|
+
if ((throwNotFound && !hasProperty) || (!throwNotFound && hasProperty)) {
|
|
479
|
+
result(property, properties);
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
function invalidNameError(property, properties) {
|
|
487
|
+
var errorString = 'fabric: property name \'' + property + '\' is not valid. It should be ';
|
|
488
|
+
for ( var i = 0; i < properties.length; i++) {
|
|
489
|
+
var propertyName = '\'' + properties[i] + '\'';
|
|
490
|
+
errorString += (i === properties.length - 1) ? ('or ' + propertyName + '.') : (propertyName + ', ');
|
|
491
|
+
}
|
|
492
|
+
throw new DeveloperError(errorString);
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
function duplicateNameError(property, properties) {
|
|
496
|
+
var errorString = 'fabric: uniforms and materials cannot share the same property \'' + property + '\'';
|
|
497
|
+
throw new DeveloperError(errorString);
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
var templateProperties = ['type', 'materials', 'uniforms', 'components', 'source'];
|
|
501
|
+
var componentProperties = ['diffuse', 'specular', 'shininess', 'normal', 'emission', 'alpha'];
|
|
502
|
+
|
|
503
|
+
function checkForTemplateErrors(material) {
|
|
504
|
+
var template = material._template;
|
|
505
|
+
var uniforms = template.uniforms;
|
|
506
|
+
var materials = template.materials;
|
|
507
|
+
var components = template.components;
|
|
508
|
+
|
|
509
|
+
// Make sure source and components do not exist in the same template.
|
|
510
|
+
if ((typeof components !== 'undefined') && (typeof template.source !== 'undefined')) {
|
|
511
|
+
throw new DeveloperError('fabric: cannot have source and components in the same template.');
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
// Make sure all template and components properties are valid.
|
|
515
|
+
checkForValidProperties(template, templateProperties, invalidNameError, true);
|
|
516
|
+
checkForValidProperties(components, componentProperties, invalidNameError, true);
|
|
517
|
+
|
|
518
|
+
// Make sure uniforms and materials do not share any of the same names.
|
|
519
|
+
var materialNames = [];
|
|
520
|
+
for ( var property in materials) {
|
|
521
|
+
if (materials.hasOwnProperty(property)) {
|
|
522
|
+
materialNames.push(property);
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
checkForValidProperties(uniforms, materialNames, duplicateNameError, false);
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
// Create the czm_getMaterial method body using source or components.
|
|
529
|
+
function createMethodDefinition(material) {
|
|
530
|
+
var components = material._template.components;
|
|
531
|
+
var source = material._template.source;
|
|
532
|
+
if (typeof source !== 'undefined') {
|
|
533
|
+
material.shaderSource += source + '\n';
|
|
534
|
+
} else {
|
|
535
|
+
material.shaderSource += 'czm_material czm_getMaterial(czm_materialInput materialInput)\n{\n';
|
|
536
|
+
material.shaderSource += 'czm_material material = czm_getDefaultMaterial(materialInput);\n';
|
|
537
|
+
if (typeof components !== 'undefined') {
|
|
538
|
+
for ( var component in components) {
|
|
539
|
+
if (components.hasOwnProperty(component)) {
|
|
540
|
+
material.shaderSource += 'material.' + component + ' = ' + components[component] + ';\n';
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
material.shaderSource += 'return material;\n}\n';
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
function createUniforms(material, count) {
|
|
549
|
+
var uniforms = material._template.uniforms;
|
|
550
|
+
for ( var uniformId in uniforms) {
|
|
551
|
+
if (uniforms.hasOwnProperty(uniformId)) {
|
|
552
|
+
count = createUniform(material, uniformId, count);
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
return count;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
// Writes uniform declarations to the shader file and connects uniform values with
|
|
559
|
+
// corresponding material properties through the returnUniforms function.
|
|
560
|
+
function createUniform(material, uniformId, count) {
|
|
561
|
+
var strict = material._strict;
|
|
562
|
+
var materialUniforms = material._template.uniforms;
|
|
563
|
+
var uniformValue = materialUniforms[uniformId];
|
|
564
|
+
var uniformType = getUniformType(uniformValue);
|
|
565
|
+
if (typeof uniformType === 'undefined') {
|
|
566
|
+
throw new DeveloperError('fabric: uniform \'' + uniformId + '\' has invalid type.');
|
|
567
|
+
} else if (uniformType === 'channels') {
|
|
568
|
+
if (replaceToken(material, uniformId, uniformValue, false) === 0 && strict) {
|
|
569
|
+
throw new DeveloperError('strict: shader source does not use channels \'' + uniformId + '\'.');
|
|
570
|
+
}
|
|
571
|
+
} else {
|
|
572
|
+
// If uniform type is an image, add image dimension uniforms.
|
|
573
|
+
if (uniformType.indexOf('sampler') !== -1) {
|
|
574
|
+
if (typeof material._context === 'undefined') {
|
|
575
|
+
throw new DeveloperError('image: context is not defined');
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
// Since webgl doesn't allow texture dimension queries in glsl, create a uniform to do it.
|
|
579
|
+
// Check if the shader source actually uses texture dimensions before creating the uniform.
|
|
580
|
+
if (uniformType === 'sampler2D') {
|
|
581
|
+
var imageDimensionsUniformName = uniformId + 'Dimensions';
|
|
582
|
+
if (getNumberOfTokens(material, imageDimensionsUniformName) > 0) {
|
|
583
|
+
materialUniforms[imageDimensionsUniformName] = {
|
|
584
|
+
type : 'ivec3',
|
|
585
|
+
x : 1,
|
|
586
|
+
y : 1
|
|
587
|
+
};
|
|
588
|
+
createUniform(material, imageDimensionsUniformName);
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
// Add uniform declaration to source code.
|
|
592
|
+
var uniformPhrase = 'uniform ' + uniformType + ' ' + uniformId + ';\n';
|
|
593
|
+
if (material.shaderSource.indexOf(uniformPhrase) === -1) {
|
|
594
|
+
material.shaderSource = uniformPhrase + material.shaderSource;
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
var newUniformId = uniformId + '_' + count++;
|
|
598
|
+
if (replaceToken(material, uniformId, newUniformId) === 1 && strict) {
|
|
599
|
+
throw new DeveloperError('strict: shader source does not use uniform \'' + uniformId + '\'.');
|
|
600
|
+
}
|
|
601
|
+
// Set uniform value
|
|
602
|
+
material.uniforms[uniformId] = uniformValue;
|
|
603
|
+
material._uniforms[newUniformId] = returnUniform(material, uniformId, uniformType);
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
return count;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
// Checks for updates to material values to refresh the uniforms.
|
|
610
|
+
var matrixMap = {
|
|
611
|
+
'mat2' : Matrix2,
|
|
612
|
+
'mat3' : Matrix3,
|
|
613
|
+
'mat4' : Matrix4
|
|
614
|
+
};
|
|
615
|
+
function returnUniform(material, uniformId, originalUniformType) {
|
|
616
|
+
return function() {
|
|
617
|
+
var uniforms = material.uniforms;
|
|
618
|
+
var uniformValue = uniforms[uniformId];
|
|
619
|
+
var uniformType = getUniformType(uniformValue);
|
|
620
|
+
|
|
621
|
+
if (originalUniformType === 'sampler2D' && (uniformType === originalUniformType || uniformValue instanceof Texture)) {
|
|
622
|
+
if (uniformType === originalUniformType) {
|
|
623
|
+
uniformValue = Material._textureCache.registerTexture2DToMaterial(material, uniformId, uniformValue);
|
|
624
|
+
}
|
|
625
|
+
// Since texture dimensions can't be updated manually, update them when the texture is updated.
|
|
626
|
+
var uniformDimensionsName = uniformId + 'Dimensions';
|
|
627
|
+
if (uniforms.hasOwnProperty(uniformDimensionsName)) {
|
|
628
|
+
var uniformDimensions = uniforms[uniformDimensionsName];
|
|
629
|
+
uniformDimensions.x = uniformValue._width;
|
|
630
|
+
uniformDimensions.y = uniformValue._height;
|
|
631
|
+
}
|
|
632
|
+
} else if (originalUniformType === 'samplerCube' && (uniformType === originalUniformType || uniformValue instanceof CubeMap)) {
|
|
633
|
+
if (uniformType === originalUniformType) {
|
|
634
|
+
uniformValue = Material._textureCache.registerCubeMapToMaterial(material, uniformId, uniformValue);
|
|
635
|
+
}
|
|
636
|
+
} else if (originalUniformType.indexOf('mat') !== -1 && (uniformType === originalUniformType || uniformValue instanceof matrixMap[originalUniformType])) {
|
|
637
|
+
if (uniformType === originalUniformType) {
|
|
638
|
+
uniformValue = matrixMap[originalUniformType].fromColumnMajorArray(uniformValue);
|
|
639
|
+
}
|
|
640
|
+
} else if (typeof uniformType === 'undefined' || originalUniformType !== uniformType) {
|
|
641
|
+
throw new DeveloperError('fabric: uniform \'' + uniformId + '\' has invalid value.');
|
|
642
|
+
}
|
|
643
|
+
uniforms[uniformId] = uniformValue;
|
|
644
|
+
return uniforms[uniformId];
|
|
645
|
+
};
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
// Determines the uniform type based on the uniform in the template.
|
|
649
|
+
function getUniformType(uniformValue) {
|
|
650
|
+
var uniformType = uniformValue.type;
|
|
651
|
+
if (typeof uniformType === 'undefined') {
|
|
652
|
+
var type = typeof uniformValue;
|
|
653
|
+
if (type === 'number') {
|
|
654
|
+
uniformType = 'float';
|
|
655
|
+
} else if (type === 'boolean') {
|
|
656
|
+
uniformType = 'bool';
|
|
657
|
+
} else if (type === 'string') {
|
|
658
|
+
if (/^([rgba]){1,4}$/i.test(uniformValue)) {
|
|
659
|
+
uniformType = 'channels';
|
|
660
|
+
} else if (uniformValue === Material.DefaultCubeMapId) {
|
|
661
|
+
uniformType = 'samplerCube';
|
|
662
|
+
} else {
|
|
663
|
+
uniformType = 'sampler2D';
|
|
664
|
+
}
|
|
665
|
+
} else if (type === 'object') {
|
|
666
|
+
if (Array.isArray(uniformValue)) {
|
|
667
|
+
if (uniformValue.length === 4 || uniformValue.length === 9 || uniformValue.length === 16) {
|
|
668
|
+
uniformType = 'mat' + Math.sqrt(uniformValue.length);
|
|
669
|
+
}
|
|
670
|
+
} else {
|
|
671
|
+
var numAttributes = 0;
|
|
672
|
+
for ( var attribute in uniformValue) {
|
|
673
|
+
if (uniformValue.hasOwnProperty(attribute)) {
|
|
674
|
+
numAttributes += 1;
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
if (numAttributes >= 2 && numAttributes <= 4) {
|
|
678
|
+
uniformType = 'vec' + numAttributes;
|
|
679
|
+
} else if (numAttributes === 6) {
|
|
680
|
+
uniformType = 'samplerCube';
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
return uniformType;
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
// Create all sub-materials by combining source and uniforms together.
|
|
689
|
+
function createSubMaterials(material, count) {
|
|
690
|
+
var context = material._context;
|
|
691
|
+
var strict = material._strict;
|
|
692
|
+
var subMaterialTemplates = material._template.materials;
|
|
693
|
+
for ( var subMaterialId in subMaterialTemplates) {
|
|
694
|
+
if (subMaterialTemplates.hasOwnProperty(subMaterialId)) {
|
|
695
|
+
// Construct the sub-material.
|
|
696
|
+
var subMaterial = {};
|
|
697
|
+
count = initializeMaterial({
|
|
698
|
+
context : context,
|
|
699
|
+
strict : strict,
|
|
700
|
+
fabric : subMaterialTemplates[subMaterialId]
|
|
701
|
+
}, count, subMaterial);
|
|
702
|
+
|
|
703
|
+
material._uniforms = combine([material._uniforms, subMaterial._uniforms]);
|
|
704
|
+
material.materials[subMaterialId] = subMaterial;
|
|
705
|
+
|
|
706
|
+
// Make the material's czm_getMaterial unique by appending the sub-material type.
|
|
707
|
+
var originalMethodName = 'czm_getMaterial';
|
|
708
|
+
var newMethodName = originalMethodName + '_' + count++;
|
|
709
|
+
replaceToken(subMaterial, originalMethodName, newMethodName);
|
|
710
|
+
material.shaderSource = subMaterial.shaderSource + material.shaderSource;
|
|
711
|
+
|
|
712
|
+
// Replace each material id with an czm_getMaterial method call.
|
|
713
|
+
var materialMethodCall = newMethodName + '(materialInput)';
|
|
714
|
+
if (replaceToken(material, subMaterialId, materialMethodCall) === 0 && strict) {
|
|
715
|
+
throw new DeveloperError('strict: shader source does not use material \'' + subMaterialId + '\'.');
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
return count;
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
// Used for searching or replacing a token in a material's shader source with something else.
|
|
723
|
+
// If excludePeriod is true, do not accept tokens that are preceded by periods.
|
|
724
|
+
// http://stackoverflow.com/questions/641407/javascript-negative-lookbehind-equivalent
|
|
725
|
+
function replaceToken(material, token, newToken, excludePeriod) {
|
|
726
|
+
excludePeriod = defaultValue(excludePeriod, true);
|
|
727
|
+
var count = 0;
|
|
728
|
+
var invalidCharacters = 'a-zA-Z0-9_';
|
|
729
|
+
var suffixChars = '([' + invalidCharacters + '])?';
|
|
730
|
+
var prefixChars = '([' + invalidCharacters + (excludePeriod ? '.' : '') + '])?';
|
|
731
|
+
var regExp = new RegExp(prefixChars + token + suffixChars, 'g');
|
|
732
|
+
material.shaderSource = material.shaderSource.replace(regExp, function($0, $1, $2) {
|
|
733
|
+
if ($1 || $2) {
|
|
734
|
+
return $0;
|
|
735
|
+
}
|
|
736
|
+
count += 1;
|
|
737
|
+
return newToken;
|
|
738
|
+
});
|
|
739
|
+
return count;
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
function getNumberOfTokens(material, token, excludePeriod) {
|
|
743
|
+
return replaceToken(material, token, token, excludePeriod);
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
Material._textureCache = {
|
|
747
|
+
_pathsToMaterials : {},
|
|
748
|
+
|
|
749
|
+
_pathsToTextures : {},
|
|
750
|
+
|
|
751
|
+
_updateMaterialsOnLoad : function(texture, path) {
|
|
752
|
+
this._pathsToTextures[path] = texture;
|
|
753
|
+
var materialContainers = this._pathsToMaterials[path];
|
|
754
|
+
for ( var i = 0; i < materialContainers.length; i++) {
|
|
755
|
+
var materialContainer = materialContainers[i];
|
|
756
|
+
var material = materialContainer.material;
|
|
757
|
+
var property = materialContainer.property;
|
|
758
|
+
this.releaseTexture(material, material.uniforms[property]);
|
|
759
|
+
material.uniforms[property] = texture;
|
|
760
|
+
}
|
|
761
|
+
},
|
|
762
|
+
|
|
763
|
+
releaseTexture : function(material, texture) {
|
|
764
|
+
var pathsToTexture = this._pathsToTextures;
|
|
765
|
+
for ( var path in pathsToTexture) {
|
|
766
|
+
if (pathsToTexture[path] === texture) {
|
|
767
|
+
var materialsWithTexture = this._pathsToMaterials[path];
|
|
768
|
+
for ( var i = 0; i < materialsWithTexture.length; i++) {
|
|
769
|
+
if (materialsWithTexture[i].material === material) {
|
|
770
|
+
materialsWithTexture.splice(i, 1);
|
|
771
|
+
var numMaterialsWithTexture = materialsWithTexture.length;
|
|
772
|
+
if (numMaterialsWithTexture === 0) {
|
|
773
|
+
texture.destroy();
|
|
774
|
+
delete pathsToTexture.path;
|
|
775
|
+
delete materialsWithTexture.path;
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
},
|
|
782
|
+
|
|
783
|
+
registerCubeMapToMaterial : function(material, property, info) {
|
|
784
|
+
var that = this;
|
|
785
|
+
var texture;
|
|
786
|
+
if (info === Material.DefaultCubeMapId) {
|
|
787
|
+
texture = material._context.getDefaultCubeMap();
|
|
788
|
+
} else {
|
|
789
|
+
var path = info.positiveX + info.negativeX + info.positiveY + info.negativeY + info.positiveZ + info.negativeZ;
|
|
790
|
+
this._pathsToMaterials[path] = defaultValue(this._pathsToMaterials[path], []);
|
|
791
|
+
this._pathsToMaterials[path].push({
|
|
792
|
+
'material' : material,
|
|
793
|
+
'property' : property
|
|
794
|
+
});
|
|
795
|
+
texture = this._pathsToTextures[path];
|
|
796
|
+
if (typeof texture === 'undefined') {
|
|
797
|
+
var oldTexture = material.uniforms[property];
|
|
798
|
+
var hasOldTexture = oldTexture instanceof CubeMap;
|
|
799
|
+
texture = hasOldTexture ? oldTexture : material._context.getDefaultCubeMap();
|
|
800
|
+
if (this._pathsToMaterials[path].length === 1) {
|
|
801
|
+
when.all([loadImage(info.positiveX), loadImage(info.negativeX), loadImage(info.positiveY), loadImage(info.negativeY), loadImage(info.positiveZ), loadImage(info.negativeZ)]).then(function(images) {
|
|
802
|
+
texture = material._context.createCubeMap({
|
|
803
|
+
source : {
|
|
804
|
+
positiveX : images[0],
|
|
805
|
+
negativeX : images[1],
|
|
806
|
+
positiveY : images[2],
|
|
807
|
+
negativeY : images[3],
|
|
808
|
+
positiveZ : images[4],
|
|
809
|
+
negativeZ : images[5]
|
|
810
|
+
}
|
|
811
|
+
});
|
|
812
|
+
that._updateMaterialsOnLoad(texture, path);
|
|
813
|
+
});
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
return texture;
|
|
818
|
+
},
|
|
819
|
+
|
|
820
|
+
registerTexture2DToMaterial : function(material, property, info) {
|
|
821
|
+
var that = this;
|
|
822
|
+
var texture;
|
|
823
|
+
if (info === Material.DefaultImageId) {
|
|
824
|
+
texture = material._context.getDefaultTexture();
|
|
825
|
+
} else {
|
|
826
|
+
var path = info;
|
|
827
|
+
this._pathsToMaterials[path] = defaultValue(this._pathsToMaterials[path], []);
|
|
828
|
+
this._pathsToMaterials[path].push({
|
|
829
|
+
'material' : material,
|
|
830
|
+
'property' : property
|
|
831
|
+
});
|
|
832
|
+
texture = this._pathsToTextures[path];
|
|
833
|
+
if (typeof texture === 'undefined') {
|
|
834
|
+
var oldTexture = material.uniforms[property];
|
|
835
|
+
var hasOldTexture = oldTexture instanceof Texture;
|
|
836
|
+
texture = hasOldTexture ? oldTexture : material._context.getDefaultTexture();
|
|
837
|
+
if (this._pathsToMaterials[path].length === 1) {
|
|
838
|
+
when(loadImage(path), function(image) {
|
|
839
|
+
texture = material._context.createTexture2D({
|
|
840
|
+
source : image
|
|
841
|
+
});
|
|
842
|
+
that._updateMaterialsOnLoad(texture, path);
|
|
843
|
+
});
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
return texture;
|
|
848
|
+
}
|
|
849
|
+
};
|
|
850
|
+
|
|
851
|
+
Material._materialCache = {
|
|
852
|
+
_materials : {},
|
|
853
|
+
addMaterial : function(type, materialTemplate) {
|
|
854
|
+
this._materials[type] = materialTemplate;
|
|
855
|
+
},
|
|
856
|
+
getMaterial : function(type) {
|
|
857
|
+
return this._materials[type];
|
|
858
|
+
}
|
|
859
|
+
};
|
|
860
|
+
|
|
861
|
+
Material.DefaultImageId = 'czm_defaultImage';
|
|
862
|
+
Material.DefaultCubeMapId = 'czm_defaultCubeMap';
|
|
863
|
+
|
|
864
|
+
Material.ColorType = 'Color';
|
|
865
|
+
Material._materialCache.addMaterial(Material.ColorType, {
|
|
866
|
+
type : Material.ColorType,
|
|
867
|
+
uniforms : {
|
|
868
|
+
color : new Color(1.0, 0.0, 0.0, 0.5)
|
|
869
|
+
},
|
|
870
|
+
components : {
|
|
871
|
+
diffuse : 'color.rgb',
|
|
872
|
+
alpha : 'color.a'
|
|
873
|
+
}
|
|
874
|
+
});
|
|
875
|
+
|
|
876
|
+
Material.ImageType = 'Image';
|
|
877
|
+
Material._materialCache.addMaterial(Material.ImageType, {
|
|
878
|
+
type : Material.ImageType,
|
|
879
|
+
uniforms : {
|
|
880
|
+
image : Material.DefaultImageId,
|
|
881
|
+
repeat : new Cartesian2(1.0, 1.0)
|
|
882
|
+
},
|
|
883
|
+
components : {
|
|
884
|
+
diffuse : 'texture2D(image, fract(repeat * materialInput.st)).rgb',
|
|
885
|
+
alpha : 'texture2D(image, fract(repeat * materialInput.st)).a'
|
|
886
|
+
}
|
|
887
|
+
});
|
|
888
|
+
|
|
889
|
+
Material.DiffuseMapType = 'DiffuseMap';
|
|
890
|
+
Material._materialCache.addMaterial(Material.DiffuseMapType, {
|
|
891
|
+
type : Material.DiffuseMapType,
|
|
892
|
+
uniforms : {
|
|
893
|
+
image : Material.DefaultImageId,
|
|
894
|
+
channels : 'rgb',
|
|
895
|
+
repeat : new Cartesian2(1.0, 1.0)
|
|
896
|
+
},
|
|
897
|
+
components : {
|
|
898
|
+
diffuse : 'texture2D(image, fract(repeat * materialInput.st)).channels'
|
|
899
|
+
}
|
|
900
|
+
});
|
|
901
|
+
|
|
902
|
+
Material.AlphaMapType = 'AlphaMap';
|
|
903
|
+
Material._materialCache.addMaterial(Material.AlphaMapType, {
|
|
904
|
+
type : Material.AlphaMapType,
|
|
905
|
+
uniforms : {
|
|
906
|
+
image : Material.DefaultImageId,
|
|
907
|
+
channel : 'a',
|
|
908
|
+
repeat : new Cartesian2(1.0, 1.0)
|
|
909
|
+
},
|
|
910
|
+
components : {
|
|
911
|
+
alpha : 'texture2D(image, fract(repeat * materialInput.st)).channel'
|
|
912
|
+
}
|
|
913
|
+
});
|
|
914
|
+
|
|
915
|
+
Material.SpecularMapType = 'SpecularMap';
|
|
916
|
+
Material._materialCache.addMaterial(Material.SpecularMapType, {
|
|
917
|
+
type : Material.SpecularMapType,
|
|
918
|
+
uniforms : {
|
|
919
|
+
image : Material.DefaultImageId,
|
|
920
|
+
channel : 'r',
|
|
921
|
+
repeat : new Cartesian2(1.0, 1.0)
|
|
922
|
+
},
|
|
923
|
+
components : {
|
|
924
|
+
specular : 'texture2D(image, fract(repeat * materialInput.st)).channel'
|
|
925
|
+
}
|
|
926
|
+
});
|
|
927
|
+
|
|
928
|
+
Material.EmissionMapType = 'EmissionMap';
|
|
929
|
+
Material._materialCache.addMaterial(Material.EmissionMapType, {
|
|
930
|
+
type : Material.EmissionMapType,
|
|
931
|
+
uniforms : {
|
|
932
|
+
image : Material.DefaultImageId,
|
|
933
|
+
channels : 'rgb',
|
|
934
|
+
repeat : new Cartesian2(1.0, 1.0)
|
|
935
|
+
},
|
|
936
|
+
components : {
|
|
937
|
+
emission : 'texture2D(image, fract(repeat * materialInput.st)).channels'
|
|
938
|
+
}
|
|
939
|
+
});
|
|
940
|
+
|
|
941
|
+
Material.BumpMapType = 'BumpMap';
|
|
942
|
+
Material._materialCache.addMaterial(Material.BumpMapType, {
|
|
943
|
+
type : Material.BumpMapType,
|
|
944
|
+
uniforms : {
|
|
945
|
+
image : Material.DefaultImageId,
|
|
946
|
+
channel : 'r',
|
|
947
|
+
strength : 0.8,
|
|
948
|
+
repeat : new Cartesian2(1.0, 1.0)
|
|
949
|
+
},
|
|
950
|
+
source : BumpMapMaterial
|
|
951
|
+
});
|
|
952
|
+
|
|
953
|
+
Material.NormalMapType = 'NormalMap';
|
|
954
|
+
Material._materialCache.addMaterial(Material.NormalMapType, {
|
|
955
|
+
type : Material.NormalMapType,
|
|
956
|
+
uniforms : {
|
|
957
|
+
image : Material.DefaultImageId,
|
|
958
|
+
channels : 'rgb',
|
|
959
|
+
strength : 0.8,
|
|
960
|
+
repeat : new Cartesian2(1.0, 1.0)
|
|
961
|
+
},
|
|
962
|
+
source : NormalMapMaterial
|
|
963
|
+
});
|
|
964
|
+
|
|
965
|
+
Material.ReflectionType = 'Reflection';
|
|
966
|
+
Material._materialCache.addMaterial(Material.ReflectionType, {
|
|
967
|
+
type : Material.ReflectionType,
|
|
968
|
+
uniforms : {
|
|
969
|
+
cubeMap : Material.DefaultCubeMapId,
|
|
970
|
+
channels : 'rgb'
|
|
971
|
+
},
|
|
972
|
+
source : ReflectionMaterial
|
|
973
|
+
});
|
|
974
|
+
|
|
975
|
+
Material.RefractionType = 'Refraction';
|
|
976
|
+
Material._materialCache.addMaterial(Material.RefractionType, {
|
|
977
|
+
type : Material.RefractionType,
|
|
978
|
+
uniforms : {
|
|
979
|
+
cubeMap : Material.DefaultCubeMapId,
|
|
980
|
+
channels : 'rgb',
|
|
981
|
+
indexOfRefractionRatio : 0.9
|
|
982
|
+
},
|
|
983
|
+
source : RefractionMaterial
|
|
984
|
+
});
|
|
985
|
+
|
|
986
|
+
Material.FresnelType = 'Fresnel';
|
|
987
|
+
Material._materialCache.addMaterial(Material.FresnelType, {
|
|
988
|
+
type : Material.FresnelType,
|
|
989
|
+
materials : {
|
|
990
|
+
reflection : {
|
|
991
|
+
type : Material.ReflectionType
|
|
992
|
+
},
|
|
993
|
+
refraction : {
|
|
994
|
+
type : Material.RefractionType
|
|
995
|
+
}
|
|
996
|
+
},
|
|
997
|
+
source : FresnelMaterial
|
|
998
|
+
});
|
|
999
|
+
|
|
1000
|
+
Material.BrickType = 'Brick';
|
|
1001
|
+
Material._materialCache.addMaterial(Material.BrickType, {
|
|
1002
|
+
type : Material.BrickType,
|
|
1003
|
+
uniforms : {
|
|
1004
|
+
brickColor : new Color(0.6, 0.3, 0.1, 1.0),
|
|
1005
|
+
mortarColor : new Color(0.8, 0.8, 0.7, 1.0),
|
|
1006
|
+
brickSize : new Cartesian2(0.3, 0.15),
|
|
1007
|
+
brickPct : new Cartesian2(0.9, 0.85),
|
|
1008
|
+
brickRoughness : 0.2,
|
|
1009
|
+
mortarRoughness : 0.1
|
|
1010
|
+
},
|
|
1011
|
+
source : BrickMaterial
|
|
1012
|
+
});
|
|
1013
|
+
|
|
1014
|
+
Material.WoodType = 'Wood';
|
|
1015
|
+
Material._materialCache.addMaterial(Material.WoodType, {
|
|
1016
|
+
type : Material.WoodType,
|
|
1017
|
+
uniforms : {
|
|
1018
|
+
lightWoodColor : new Color(0.6, 0.3, 0.1, 1.0),
|
|
1019
|
+
darkWoodColor : new Color(0.4, 0.2, 0.07, 1.0),
|
|
1020
|
+
ringFrequency : 3.0,
|
|
1021
|
+
noiseScale : new Cartesian2(0.7, 0.5),
|
|
1022
|
+
grainFrequency : 27.0
|
|
1023
|
+
},
|
|
1024
|
+
source : WoodMaterial
|
|
1025
|
+
});
|
|
1026
|
+
|
|
1027
|
+
Material.AsphaltType = 'Asphalt';
|
|
1028
|
+
Material._materialCache.addMaterial(Material.AsphaltType, {
|
|
1029
|
+
type : Material.AsphaltType,
|
|
1030
|
+
uniforms : {
|
|
1031
|
+
asphaltColor : new Color(0.15, 0.15, 0.15, 1.0),
|
|
1032
|
+
bumpSize : 0.02,
|
|
1033
|
+
roughness : 0.2
|
|
1034
|
+
},
|
|
1035
|
+
source : AsphaltMaterial
|
|
1036
|
+
});
|
|
1037
|
+
|
|
1038
|
+
Material.CementType = 'Cement';
|
|
1039
|
+
Material._materialCache.addMaterial(Material.CementType, {
|
|
1040
|
+
type : Material.CementType,
|
|
1041
|
+
uniforms : {
|
|
1042
|
+
cementColor : new Color(0.95, 0.95, 0.85, 1.0),
|
|
1043
|
+
grainScale : 0.01,
|
|
1044
|
+
roughness : 0.3
|
|
1045
|
+
},
|
|
1046
|
+
source : CementMaterial
|
|
1047
|
+
});
|
|
1048
|
+
|
|
1049
|
+
Material.GrassType = 'Grass';
|
|
1050
|
+
Material._materialCache.addMaterial(Material.GrassType, {
|
|
1051
|
+
type : Material.GrassType,
|
|
1052
|
+
uniforms : {
|
|
1053
|
+
grassColor : new Color(0.25, 0.4, 0.1, 1.0),
|
|
1054
|
+
dirtColor : new Color(0.1, 0.1, 0.1, 1.0),
|
|
1055
|
+
patchiness : 1.5
|
|
1056
|
+
},
|
|
1057
|
+
source : GrassMaterial
|
|
1058
|
+
});
|
|
1059
|
+
|
|
1060
|
+
Material.StripeType = 'Stripe';
|
|
1061
|
+
Material._materialCache.addMaterial(Material.StripeType, {
|
|
1062
|
+
type : Material.StripeType,
|
|
1063
|
+
uniforms : {
|
|
1064
|
+
horizontal : true,
|
|
1065
|
+
lightColor : new Color(1.0, 1.0, 1.0, 0.5),
|
|
1066
|
+
darkColor : new Color(0.0, 0.0, 1.0, 0.5),
|
|
1067
|
+
offset : 0.0,
|
|
1068
|
+
repeat : 5.0
|
|
1069
|
+
},
|
|
1070
|
+
source : StripeMaterial
|
|
1071
|
+
});
|
|
1072
|
+
|
|
1073
|
+
Material.CheckerboardType = 'Checkerboard';
|
|
1074
|
+
Material._materialCache.addMaterial(Material.CheckerboardType, {
|
|
1075
|
+
type : Material.CheckerboardType,
|
|
1076
|
+
uniforms : {
|
|
1077
|
+
lightColor : new Color(1.0, 1.0, 1.0, 0.5),
|
|
1078
|
+
darkColor : new Color(0.0, 0.0, 0.0, 0.5),
|
|
1079
|
+
repeat : new Cartesian2(5.0, 5.0)
|
|
1080
|
+
},
|
|
1081
|
+
source : CheckerboardMaterial
|
|
1082
|
+
});
|
|
1083
|
+
|
|
1084
|
+
Material.DotType = 'Dot';
|
|
1085
|
+
Material._materialCache.addMaterial(Material.DotType, {
|
|
1086
|
+
type : Material.DotType,
|
|
1087
|
+
uniforms : {
|
|
1088
|
+
lightColor : new Color(1.0, 1.0, 0.0, 0.75),
|
|
1089
|
+
darkColor : new Color(0.0, 1.0, 1.0, 0.75),
|
|
1090
|
+
repeat : new Cartesian2(5.0, 5.0)
|
|
1091
|
+
},
|
|
1092
|
+
source : DotMaterial
|
|
1093
|
+
});
|
|
1094
|
+
|
|
1095
|
+
Material.TyeDyeType = 'TieDye';
|
|
1096
|
+
Material._materialCache.addMaterial(Material.TyeDyeType, {
|
|
1097
|
+
type : Material.TyeDyeType,
|
|
1098
|
+
uniforms : {
|
|
1099
|
+
lightColor : new Color(1.0, 1.0, 0.0, 0.75),
|
|
1100
|
+
darkColor : new Color(1.0, 0.0, 0.0, 0.75),
|
|
1101
|
+
frequency : 5.0
|
|
1102
|
+
},
|
|
1103
|
+
source : TieDyeMaterial
|
|
1104
|
+
});
|
|
1105
|
+
|
|
1106
|
+
Material.FacetType = 'Facet';
|
|
1107
|
+
Material._materialCache.addMaterial(Material.FacetType, {
|
|
1108
|
+
type : Material.FacetType,
|
|
1109
|
+
uniforms : {
|
|
1110
|
+
lightColor : new Color(0.25, 0.25, 0.25, 0.75),
|
|
1111
|
+
darkColor : new Color(0.75, 0.75, 0.75, 0.75),
|
|
1112
|
+
frequency : 10.0
|
|
1113
|
+
},
|
|
1114
|
+
source : FacetMaterial
|
|
1115
|
+
});
|
|
1116
|
+
|
|
1117
|
+
Material.BlobType = 'Blob';
|
|
1118
|
+
Material._materialCache.addMaterial(Material.BlobType, {
|
|
1119
|
+
type : Material.BlobType,
|
|
1120
|
+
uniforms : {
|
|
1121
|
+
lightColor : new Color(1.0, 1.0, 1.0, 0.5),
|
|
1122
|
+
darkColor : new Color(0.0, 0.0, 1.0, 0.5),
|
|
1123
|
+
frequency : 10.0
|
|
1124
|
+
},
|
|
1125
|
+
source : BlobMaterial
|
|
1126
|
+
});
|
|
1127
|
+
|
|
1128
|
+
Material.WaterType = 'Water';
|
|
1129
|
+
Material._materialCache.addMaterial(Material.WaterType, {
|
|
1130
|
+
type : Material.WaterType,
|
|
1131
|
+
uniforms : {
|
|
1132
|
+
baseWaterColor : {
|
|
1133
|
+
red : 0.2,
|
|
1134
|
+
green : 0.3,
|
|
1135
|
+
blue : 0.6,
|
|
1136
|
+
alpha : 1.0
|
|
1137
|
+
},
|
|
1138
|
+
blendColor : {
|
|
1139
|
+
red : 0.0,
|
|
1140
|
+
green : 1.0,
|
|
1141
|
+
blue : 0.699,
|
|
1142
|
+
alpha : 1.0
|
|
1143
|
+
},
|
|
1144
|
+
specularMap : Material.DefaultImageId,
|
|
1145
|
+
normalMap : Material.DefaultImageId,
|
|
1146
|
+
frequency : 10.0,
|
|
1147
|
+
animationSpeed : 0.01,
|
|
1148
|
+
amplitude : 1.0,
|
|
1149
|
+
specularIntensity : 0.5,
|
|
1150
|
+
fadeFactor : 1.0
|
|
1151
|
+
},
|
|
1152
|
+
source : WaterMaterial
|
|
1153
|
+
});
|
|
1154
|
+
|
|
1155
|
+
Material.RimLightingType = 'RimLighting';
|
|
1156
|
+
Material._materialCache.addMaterial(Material.RimLightingType, {
|
|
1157
|
+
type : Material.RimLightingType,
|
|
1158
|
+
uniforms : {
|
|
1159
|
+
color : new Color(1.0, 0.0, 0.0, 0.7),
|
|
1160
|
+
rimColor : new Color(1.0, 1.0, 1.0, 0.4),
|
|
1161
|
+
width : 0.3
|
|
1162
|
+
},
|
|
1163
|
+
source : RimLightingMaterial
|
|
1164
|
+
});
|
|
1165
|
+
|
|
1166
|
+
Material.ErosionType = 'Erosion';
|
|
1167
|
+
Material._materialCache.addMaterial(Material.ErosionType, {
|
|
1168
|
+
type : Material.ErosionType,
|
|
1169
|
+
uniforms : {
|
|
1170
|
+
color : new Color(1.0, 0.0, 0.0, 0.5),
|
|
1171
|
+
time : 1.0
|
|
1172
|
+
},
|
|
1173
|
+
source : ErosionMaterial
|
|
1174
|
+
});
|
|
1175
|
+
|
|
1176
|
+
return Material;
|
|
1177
|
+
});
|