Skip to content

Commit ebca09f

Browse files
committed
Apply shadow property to OL-Cesium and add short documentation about properties
1 parent 5b43f7b commit ebca09f

File tree

5 files changed

+50
-633
lines changed

5 files changed

+50
-633
lines changed

PROPERTIES.md

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# OLCEsium Properties
2+
3+
## olcs_extruded_height
4+
Value: number
5+
The distance in meters between the polygon's extruded face and the ellipsoid surface.
6+
Check buildings example for usage in context.
7+
8+
## olcs_shadows
9+
Value: boolean
10+
Enables shadow casting in 3D. Can be either applied to the entire feature set or by feature individually.
11+
In order for it to work, [shadowMap](https://cesium.com/learn/cesiumjs/ref-doc/Scene.html?classFilter=scene#shadowMap) needs to be enabled in the Cesium scene. To use the sun as light source, enable [enableLighting](https://cesium.com/learn/cesiumjs/ref-doc/Globe.html#enableLighting) on the Globe.
12+
Check buildings example for usage in context.
13+
14+
## olcs_model
15+
Value: object({cesiumOptions: options})
16+
Is used to define the 3D model representation of an OpenLayers vector feature in the Cesium scene. This property allows you to customize how the feature is visualized and positioned in the 3D world.
17+
18+
To use the olcs_model property, set it as a property on your OpenLayers vector feature. It should be an object that specifies the properties of the 3D model. The olcs_model object can have the following key-value pairs:
19+
20+
- url: The URL of the 3D model's data source (required).
21+
- scale: A numeric value representing the scale of the model (optional).
22+
- minimumPixelSize: The minimum pixel size at which the model will be visible (optional).
23+
- heightReference: Specifies how the model's height is interpreted in the scene (optional).
24+
25+
Check vectors example for usage in context.
26+
27+
## olcs_skip
28+
Value: boolean
29+
Allows you to exclude specific layers from being rendered in the Cesium 3D view. This can be useful when you want to control which layers are displayed in the 2D map view and which are displayed in the 3D Cesium view.
30+
31+
## olcs_minimumLevel
32+
Value: number
33+
Allows you to set a minimum zoom level for rendering 3D tiles in the Cesium view. This property helps to control the level of detail displayed in the 3D view based on the current zoom level.
34+
Check mvt example for usage in context.
35+
36+
37+

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ Going further
9696

9797
See the [examples](https://openlayers.org/ol-cesium/examples/).
9898

99+
Use properties to control specific aspects of OL-Cesium integration, see the [PROPERTIES.MD](https://github.com/openlayers/ol-cesium/blob/master/PROPERTIES.md).
100+
99101
If you are new to Cesium, you should also check the [Cesium tutorials](https://cesiumjs.org/tutorials).
100102

101103

examples/buildings.js

+11
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,22 @@ const map = new olMap({
4545
zoom: 2,
4646
}),
4747
});
48+
// Enable the property 'olcs_shadows' for the entire set of features
49+
// Alternatively, you can enable 'olcs_shadows' for each feature individually
4850
vector.set('olcs_shadows', true);
4951

52+
5053
const ol3d = new OLCesium({map, target: 'map3d'});
5154
ol3d.setEnabled(true);
5255

56+
// Be aware that enabling the following properties can impact performance
57+
// Enable shadow map to allow Cesium to cast scene's shadows
58+
const scene = ol3d.getCesiumScene();
59+
scene.shadowMap.enabled = true;
60+
// Enable lighting the globe with the sun as a light source to have dynamic lighting conditions according to the position of the sun
61+
scene.globe.enableLighting = true;
62+
63+
5364
const vectorSource = vector.getSource();
5465
vectorSource.once('featuresloadend', () => {
5566
if (vectorSource.getState() === 'ready') {

0 commit comments

Comments
 (0)