Merge branch 'updateGeometricStateOptimization' of https://github.com/Bebul/jmonkeyengine
This commit is contained in:
commit
10ee96d839
@ -114,6 +114,16 @@ public class Node extends Spatial implements Savable {
|
||||
|
||||
child.setLightListRefresh();
|
||||
}
|
||||
|
||||
Spatial p = parent;
|
||||
while (p != null) {
|
||||
if (p.refreshFlags != 0) {
|
||||
return; //any refresh flag is sufficient, as each propagates to the root Node
|
||||
}
|
||||
p.refreshFlags |= RF_CHILD_LIGHTLIST;
|
||||
p = p.parent;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -154,6 +164,9 @@ public class Node extends Spatial implements Savable {
|
||||
|
||||
@Override
|
||||
public void updateGeometricState(){
|
||||
boolean somethingToRefresh = (refreshFlags != 0);
|
||||
if (!somethingToRefresh) return;
|
||||
|
||||
if ((refreshFlags & RF_LIGHTLIST) != 0){
|
||||
updateWorldLightList();
|
||||
}
|
||||
@ -164,6 +177,7 @@ public class Node extends Spatial implements Savable {
|
||||
updateWorldTransforms();
|
||||
}
|
||||
|
||||
refreshFlags &= ~RF_CHILD_LIGHTLIST;
|
||||
if (!children.isEmpty()) {
|
||||
// the important part- make sure child geometric state is refreshed
|
||||
// first before updating own world bound. This saves
|
||||
@ -638,5 +652,4 @@ public class Node extends Spatial implements Savable {
|
||||
protected void breadthFirstTraversal(SceneGraphVisitor visitor, Queue<Spatial> queue) {
|
||||
queue.addAll(children);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -118,7 +118,8 @@ public abstract class Spatial implements Savable, Cloneable, Collidable, Cloneab
|
||||
*/
|
||||
protected static final int RF_TRANSFORM = 0x01, // need light resort + combine transforms
|
||||
RF_BOUND = 0x02,
|
||||
RF_LIGHTLIST = 0x04; // changes in light lists
|
||||
RF_LIGHTLIST = 0x04, // changes in light lists
|
||||
RF_CHILD_LIGHTLIST = 0x08; // some child need geometry update
|
||||
|
||||
protected CullHint cullHint = CullHint.Inherit;
|
||||
protected BatchHint batchHint = BatchHint.Inherit;
|
||||
|
Loading…
x
Reference in New Issue
Block a user