kopia lustrzana https://github.com/robhawkes/vizicities
Tidied up Web Worker feature loading
rodzic
a4fc0857bb
commit
10442e4f70
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
VIZI.BuildingManager.prototype = Object.create( VIZI.ObjectManager.prototype );
|
VIZI.BuildingManager.prototype = Object.create( VIZI.ObjectManager.prototype );
|
||||||
|
|
||||||
|
// TODO: Utilise this when loading via Web Workers (right now it's not being called anywhere)
|
||||||
VIZI.BuildingManager.prototype.processFeature = function(feature) {
|
VIZI.BuildingManager.prototype.processFeature = function(feature) {
|
||||||
switch (feature.type) {
|
switch (feature.type) {
|
||||||
case "Feature":
|
case "Feature":
|
||||||
|
|
|
@ -45,7 +45,6 @@
|
||||||
|
|
||||||
var startTime = Date.now();
|
var startTime = Date.now();
|
||||||
worker.process(features).then(function(data) {
|
worker.process(features).then(function(data) {
|
||||||
//worker.processDebug({}).then(function(data) {
|
|
||||||
var timeToSend = data.startTime - startTime;
|
var timeToSend = data.startTime - startTime;
|
||||||
var timeToArrive = Date.now() - data.timeSent;
|
var timeToArrive = Date.now() - data.timeSent;
|
||||||
deferred.resolve({data: data, timeToArrive: timeToArrive, timeToSend: timeToSend});
|
deferred.resolve({data: data, timeToArrive: timeToArrive, timeToSend: timeToSend});
|
||||||
|
@ -61,6 +60,8 @@
|
||||||
// - Each worker processes features and passes a reference back using transferable objects
|
// - Each worker processes features and passes a reference back using transferable objects
|
||||||
// - Features are added to scene for each completed worker promise
|
// - Features are added to scene for each completed worker promise
|
||||||
|
|
||||||
|
// TODO: Move feature definition and render options into separate class (eg. BuildingManager and Building)
|
||||||
|
// - Right now, the generation of Three.js objects in this file is based on buildings
|
||||||
// TODO: Should be possible if geo functionality can be performed before / after the worker task
|
// TODO: Should be possible if geo functionality can be performed before / after the worker task
|
||||||
// TODO: Try and get rid of lock-up that occurs at beginning and end of worker process (possibly due to size of data being sent back and forth)
|
// TODO: Try and get rid of lock-up that occurs at beginning and end of worker process (possibly due to size of data being sent back and forth)
|
||||||
// TODO: Build objects as BufferGeometry for very easy export and messaging out of worker
|
// TODO: Build objects as BufferGeometry for very easy export and messaging out of worker
|
||||||
|
@ -112,7 +113,9 @@
|
||||||
var combinedGeom = new THREE.Geometry();
|
var combinedGeom = new THREE.Geometry();
|
||||||
|
|
||||||
var count = 0;
|
var count = 0;
|
||||||
|
|
||||||
|
// TODO: Work out how to put feature-specific object generation in here
|
||||||
|
// - eg. Buildings, rivers, roads, etc.
|
||||||
_.each(features, function(feature) {
|
_.each(features, function(feature) {
|
||||||
var properties = feature.properties;
|
var properties = feature.properties;
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue