Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <!-- Use correct character set. -->
- <meta charset="utf-8">
- <!-- Tell IE to use the latest, best version (or Chrome Frame if pre-IE11). -->
- <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
- <!-- Make the application on mobile take up the full browser screen and disable user scaling. -->
- <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
- <title>Hello World!</title>
- <script src="Cesium/Cesium.js"></script>
- <style>
- @import url(Cesium/Widgets/widgets.css);
- #cesiumContainer {
- position: absolute;
- top: 0;
- left: 0;
- height: 100%;
- width: 100%;
- margin: 0;
- overflow: hidden;
- padding: 0;
- font-family: sans-serif;
- }
- body {
- padding: 0;
- margin: 0;
- overflow: hidden;
- }
- </style>
- </head>
- <body>
- <div id="cesiumContainer"></div>
- <script>
- var viewer = new Cesium.Viewer('cesiumContainer');
- var primitives = viewer.scene.primitives;
- // Create box and position with a model matrix
- var dimensions = new Cesium.Cartesian3(400000.0, 300000.0, 9000000.0);
- var positionOnEllipsoid = Cesium.Cartesian3.fromDegrees(-105.0, 45.0);
- var boxModelMatrix = Cesium.Matrix4.multiplyByTranslation(
- Cesium.Transforms.eastNorthUpToFixedFrame(positionOnEllipsoid),
- new Cesium.Cartesian3(0.0, 0.0, dimensions.z * 0.5));
- var boxGeometry = Cesium.BoxGeometry.fromDimensions({
- vertexFormat : Cesium.PerInstanceColorAppearance.VERTEX_FORMAT,
- dimensions : dimensions
- });
- var boxGeometryInstance = new Cesium.GeometryInstance({
- geometry : boxGeometry,
- modelMatrix : boxModelMatrix,
- attributes : {
- color : Cesium.ColorGeometryInstanceAttribute.fromColor(new Cesium.Color(1.0, 0.0, 0.0, 0.5))
- }
- });
- primitives.add(new Cesium.Primitive({
- geometryInstances : boxGeometryInstance,
- appearance : new Cesium.PerInstanceColorAppearance({
- closed: true
- })
- }));
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement