|
@@ -80,9 +80,8 @@ class HierarchicalWorld extends Object {
|
|
bounds.addPoint(new h3d.col.Point(halfSize,halfSize, pseudoInfinity));
|
|
bounds.addPoint(new h3d.col.Point(halfSize,halfSize, pseudoInfinity));
|
|
bounds.transform(absPos);
|
|
bounds.transform(absPos);
|
|
|
|
|
|
- if ( data.depth != 0 && data.onCreate != null ) {
|
|
|
|
|
|
+ if ( data.depth != 0 && data.onCreate != null )
|
|
data.onCreate(this);
|
|
data.onCreate(this);
|
|
- }
|
|
|
|
}
|
|
}
|
|
|
|
|
|
function init() {
|
|
function init() {
|
|
@@ -103,13 +102,13 @@ class HierarchicalWorld extends Object {
|
|
}
|
|
}
|
|
|
|
|
|
function subdivide() {
|
|
function subdivide() {
|
|
- if ( subdivided )
|
|
|
|
|
|
+ if ( subdivided || getScene() == null ) // parent has been removed during dequeuing.
|
|
|
|
+ return;
|
|
|
|
+ if ( !loading && data.depth > 0 ) {
|
|
|
|
+ loading = true;
|
|
|
|
+ loadingQueue.insert(0, subdivide);
|
|
return;
|
|
return;
|
|
- // if ( !loading ) {
|
|
|
|
- // loading = true;
|
|
|
|
- // loadingQueue.insert(0, subdivide);
|
|
|
|
- // return;
|
|
|
|
- // }
|
|
|
|
|
|
+ }
|
|
loading = false;
|
|
loading = false;
|
|
subdivided = true;
|
|
subdivided = true;
|
|
var childSize = data.size >> 1;
|
|
var childSize = data.size >> 1;
|
|
@@ -148,11 +147,6 @@ class HierarchicalWorld extends Object {
|
|
}
|
|
}
|
|
|
|
|
|
override function syncRec(ctx : h3d.scene.RenderContext) {
|
|
override function syncRec(ctx : h3d.scene.RenderContext) {
|
|
- if ( data.depth == 0 && loadingQueue.length > 0 ) {
|
|
|
|
- var load = loadingQueue.pop();
|
|
|
|
- load();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
if ( debugGraphics == null && DEBUG ) {
|
|
if ( debugGraphics == null && DEBUG ) {
|
|
createGraphics();
|
|
createGraphics();
|
|
} else if ( debugGraphics != null && !DEBUG ) {
|
|
} else if ( debugGraphics != null && !DEBUG ) {
|
|
@@ -164,13 +158,18 @@ class HierarchicalWorld extends Object {
|
|
if ( !isLeaf() ) {
|
|
if ( !isLeaf() ) {
|
|
var isClose = calcDist(ctx) < data.size * data.subdivPow;
|
|
var isClose = calcDist(ctx) < data.size * data.subdivPow;
|
|
if ( FULL || isClose ) {
|
|
if ( FULL || isClose ) {
|
|
- if ( canSubdivide() )
|
|
|
|
|
|
+ if ( canSubdivide() && !loading )
|
|
subdivide();
|
|
subdivide();
|
|
} else if ( !locked && !isClose ) {
|
|
} else if ( !locked && !isClose ) {
|
|
removeSubdivisions();
|
|
removeSubdivisions();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
super.syncRec(ctx);
|
|
super.syncRec(ctx);
|
|
|
|
+
|
|
|
|
+ if ( data.depth == 0 && loadingQueue.length > 0 ) {
|
|
|
|
+ var load = loadingQueue.pop();
|
|
|
|
+ load();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
override function emitRec(ctx : h3d.scene.RenderContext) {
|
|
override function emitRec(ctx : h3d.scene.RenderContext) {
|