39 lines
1.3 KiB
JavaScript
39 lines
1.3 KiB
JavaScript
// Screen Zone entities by Thoys
|
|
|
|
(function() {
|
|
var zoneWebEntities = [];
|
|
var DEFAULT_DPI = 30;
|
|
this.enterEntity = function(id) {
|
|
Entities.getChildrenIDs(id).forEach(function(entityID) {
|
|
var properties = Entities.getEntityProperties(entityID);
|
|
var userData = JSON.parse(properties.userData);
|
|
zoneWebEntities.push(Overlays.addOverlay("web3d", {
|
|
url: userData.url,
|
|
position: properties.position,
|
|
rotation: properties.rotation,
|
|
dimensions: properties.dimensions,
|
|
resolution: properties.resolution !== undefined ? properties.resolution : { x: 480, y: 640 },
|
|
dpi: userData.dpi !== undefined ? userData.dpi : DEFAULT_DPI,
|
|
color: { red: 255, green: 255, blue: 255 },
|
|
alpha: 1.0,
|
|
parentID: entityID,
|
|
parentJointIndex: -1
|
|
}));
|
|
});
|
|
};
|
|
|
|
function clearWebOverlays() {
|
|
zoneWebEntities.forEach(function(overlay) {
|
|
Overlays.deleteOverlay(overlay);
|
|
});
|
|
zoneWebEntities = [];
|
|
}
|
|
|
|
this.leaveEntity = function(id) {
|
|
clearWebOverlays();
|
|
};
|
|
|
|
this.unload = function() {
|
|
clearWebOverlays();
|
|
};
|
|
});
|