Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BrowseTree #54

Closed
Jeremy-Gaillard opened this issue Feb 26, 2016 · 9 comments
Closed

BrowseTree #54

Jeremy-Gaillard opened this issue Feb 26, 2016 · 9 comments
Assignees
Labels
enhancement 🚀 wip 🚧 Still being worked on

Comments

@Jeremy-Gaillard
Copy link
Contributor

@mbredif and I designed a more elegant way to manage the browseTree an loading mechanisms.

The most important issue in the current implementation is the need to modify the browseTree class each time we need to add a new layer type, so we think a redesign is required.

First off, a clarification of the roles of each class:

  • BrowseTree decides when a node needs to be displayed, loaded or subdivided
  • NodeProcess does various processing in order to determine if a node is occluded/culled
  • Providers loads data from a data source and passes this data to an unbuilt node
  • Quadtree/Octree/etc. (hierarchical structures) instantiate new nodes during subdivisions

A node that can be part of a hierarchical structures (let's call them tiles) must have a constructor which creates an empty tile composed only of metadata (tile id, bounding box...). This metadata will be used by the provider to download the relevant data. A tile should also have a load function, which adds the actual data to it.

The instantiation of the tiles is no longer done by the providers. The quadtree does it during the subdivision. When a quadtree is created, the root node is also instantiated (which solves the problem raised in my comment in issue #40).

NodeProcess has a unique entry point, a function that returns a boolean indicating if a node is culled or not. It doesn't change the state of a node.

New browseTree algorithm (replacing the processNode function):

if(nodeProcess.isCulled(node) {
  node.setVisible(false);
  if(node.loaded) {
    node.setVisible(true);
    if(!node.divided) {
      this.tree.subdivide(node);  // creates empty children tiles
    }
  }
  else {
    if(!node.pending) {
       this.interfaceCommand(new Command...);  // tile download
    }
  }
}

This is just a draft and may need to be changed.
Tiles have three states: loaded, divided and pending.

Lastly, when adding a layer, you have to specify a NodeProcess. So the Scene function addLayer(layer,provider) becomes addLayer(layer,provider,nodeProcess). I think the NodeProcess will only change when you change between a globe or a planar representation.

@qdnguyen
Copy link
Contributor

I think a following architecture is more clear?

BrowseTree : (updateView, etc)
-------------- BrowseQuatree (getNodesToRender,updateView etc)
-------------- BrowseOctree/kdTree (getNodesToRender, updateView etc)
NodeProcess
--------------- QuadtreeNodeProcess (checkVisibility, culling, etc)
--------------- OctreeNodeProcesss (checkVisibility, culling, etc)

Class inherit from BrowseTree and NodeProcess must have same name. Then we can initiate a BrowseTree with a specific tree corresponding to type of data we want to process?

@gchoqueux
Copy link
Contributor

attention this part will change this week

@qdnguyen
Copy link
Contributor

FYI, here is a Chunk class i did in my ChunkedLoD version, may be it helps:
atttribute without underscore belong to Object3D's THREEJS

var Chunk = function(options){
THREE.Mesh.call(this);

    //quadtree structure
    this._x      = options.x;
    this._y      = options.y;
    this._level  = options.level;
    this._parent = options.parent;
    //distance from camera's position to manage LOD
    this._distance = undefined;
    //to know what is state for loading
    this._loadingState    = LoadingState.NONE;
    this._visibleState         = CullingState.NON_VISIBLE;
    this._renderState     = RenderState.NOT_RENDERED;

    //pageID to know where is chunk in cache
    this._name      = PageID.createPageID(this.x,this.y, this.level);
    this._priority = 0;
    //rendu  
   /this.userData = new ChunkData();

};
Chunk.prototype = Object.create(THREE.Mesh.prototype);
Chunk.prototype.constructor = Chunk;

p/s: you can add an extent to store bbox if you want

@qdnguyen
Copy link
Contributor

qdnguyen commented Feb 29, 2016

Create empty child chunks, data has not been filled yet.

Chunk.prototype.createChildChunks = function() {
        if ((this.children.length === 0)) {
                        var level = this.level + 1;
                        var x = this.x * 2;
                        var y = this.y * 2;
                        this.children.push( new Chunk({
                                                                    x : x,
                                                                    y : y,
                                                                    level : level,
                                                                    parent : this
                                                    })); 
                        this.children.push( new Chunk({
                                                                    x : x + 1,
                                                                    y : y,
                                                                    level : level,
                                                                    parent : this
                                                    }));
                       this.children.push( new Chunk({
                                                                    x : x,
                                                                    y : y + 1,
                                                                    level : level,
                                                                    parent : this
                                                    }));
                       this.children.push( new Chunk({
                                                                    x : x + 1,
                                                                    y : y + 1,
                                                                    level : level,
                                                                    parent : this
                                          }));
        }

        return this.children;
    };

@gchoqueux
Copy link
Contributor

I add in browseTree :

  • load specific level for multi-quatrees (multi layers) and skip intermediate levels.
  • generic browser for all layer. It will be built dynamically with chuncks (node process)

@gchoqueux gchoqueux added enhancement 🚀 wip 🚧 Still being worked on labels Mar 1, 2016
@gchoqueux gchoqueux self-assigned this Mar 1, 2016
@gchoqueux gchoqueux changed the title BrowseTree rework BrowseTree Mar 1, 2016
@gchoqueux gchoqueux mentioned this issue Mar 2, 2016
@gchoqueux
Copy link
Contributor

I start the new browse tree

@Jeremy-Gaillard
Copy link
Contributor Author

I am assigning myself to this issue to speed up the implementation of some functionalities required for #41.
Edit : only one person can be assigned at once it seems, no harm meant

@gchoqueux
Copy link
Contributor

@Jeremy-Gaillard any news on this issue?

@Jeremy-Gaillard
Copy link
Contributor Author

I think this issue is no longer relevant. I'm closing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement 🚀 wip 🚧 Still being worked on
Projects
None yet
Development

No branches or pull requests

3 participants