3dcitydb / 3dcitydb-web-map

Cesium-based 3D viewer and JavaScript API for the 3D City Database
Apache License 2.0
377 stars 125 forks source link

Adding gltf, CZML #21

Closed Abelon38 closed 6 years ago

Abelon38 commented 6 years ago

Hi!

I hope your are doing great! I am trying to add ordinary cesium layers such as GLTF and CZML on same way I use to do on Cesium as soon as I put a code inside skript.js the whole map keep loading.. May be a there is another way? This a working layer on Cesium:

var scene = viewer.scene;

var modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame( Cesium.Cartesian3.fromDegrees(14.55677,61.02010, 187)); var model = scene.primitives.add(Cesium.Model.fromGltf({ url : 'data/mora/mora_bygg.gltf', modelMatrix : modelMatrix, scale : 1.0, castShadows: false, receiveShadows: false, heightReference: Cesium.HeightReference.CLAMP_TO_GROUND, scene: scene }));

Regards? Abel Gonzalez

Son-HNguyen commented 6 years ago

Similar to WMS (see comments https://github.com/3dcitydb/3dcitydb-web-map/issues/22#issuecomment-381623329 and https://github.com/3dcitydb/3dcitydb-web-map/issues/22#issuecomment-383524380), you can manually add your own e.g. building layer using the function addNewLayer() starting from line 881 in the main script file. Note that you have to initialize the variable addLayerViewModel correspondingly.

If the layer keeps loading without showing the results, make sure the web client has access to the visualization files (for example by hosting them on the same domain). See more CORS issues at #9, #26, #31 and #39.