diff --git a/index.html b/index.html
index 094b014f..2195b27e 100644
--- a/index.html
+++ b/index.html
@@ -102,6 +102,7 @@
+
{
+ if (obj.type === 'Mesh') {
+ if (Array.isArray(obj.material)) {
+ obj.material.forEach((material) => {
+ material.clippingPlanes = this.clipPlanes;
+ material.clipIntersection = true;
+ });
+ } else {
+ obj.material.clippingPlanes = this.clipPlanes;
+ obj.material.clipIntersection = true;
+ }
+ }
+ });
+ }
+});
diff --git a/src/components/street-geo.js b/src/components/street-geo.js
index ee181d25..3bedf12f 100644
--- a/src/components/street-geo.js
+++ b/src/components/street-geo.js
@@ -7,17 +7,19 @@ const MAPBOX_ACCESS_TOKEN_VALUE =
AFRAME.registerComponent('street-geo', {
schema: {
+ maps: {
+ type: 'string',
+ default: 'google3d',
+ oneOf: ['google3d', 'mapbox2d', 'osm3d']
+ },
longitude: { type: 'number', default: 0 },
latitude: { type: 'number', default: 0 },
elevation: { type: 'number', default: null }, // deprecated
orthometricHeight: { type: 'number', default: null },
geoidHeight: { type: 'number', default: null },
ellipsoidalHeight: { type: 'number', default: null },
- maps: {
- type: 'string',
- default: 'google3d',
- oneOf: ['google3d', 'mapbox2d', 'osm3d']
- }
+ clippingEnabled: { type: 'boolean', default: true },
+ clippingSource: { type: 'string', default: '#clip-box' }
},
init: function () {
/*
@@ -140,6 +142,14 @@ AFRAME.registerComponent('street-geo', {
);
}
google3dElement.setAttribute('data-ignore-raycaster', '');
+
+ if (data.clippingEnabled) {
+ google3dElement.setAttribute(
+ 'clipping-box',
+ 'sourceBoxSelector: ' + data.clippingSource
+ );
+ }
+
el.appendChild(google3dElement);
self['google3d'] = google3dElement;
};
diff --git a/src/index.js b/src/index.js
index 0b3960b8..f7f7bf7c 100644
--- a/src/index.js
+++ b/src/index.js
@@ -19,6 +19,7 @@ require('./components/streetplan-loader');
require('./components/street-geo.js');
require('./components/street-environment.js');
require('./components/intersection.js');
+require('./components/clipping-box.js');
if (typeof VERSION !== 'undefined') {
console.log(`3DStreet Version: ${VERSION}`);