* Fixed issue where attaching scene to viewport does not force it to update
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9568 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
c02b24da12
commit
5497fcc7e6
@ -290,6 +290,7 @@ public class ViewPort {
|
|||||||
throw new IllegalArgumentException( "Scene cannot be null." );
|
throw new IllegalArgumentException( "Scene cannot be null." );
|
||||||
}
|
}
|
||||||
sceneList.add(scene);
|
sceneList.add(scene);
|
||||||
|
scene.forceRefresh(true, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -304,6 +305,7 @@ public class ViewPort {
|
|||||||
throw new IllegalArgumentException( "Scene cannot be null." );
|
throw new IllegalArgumentException( "Scene cannot be null." );
|
||||||
}
|
}
|
||||||
sceneList.remove(scene);
|
sceneList.remove(scene);
|
||||||
|
scene.forceRefresh(true, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -117,8 +117,9 @@ public abstract class Spatial implements Savable, Cloneable, Collidable, Cloneab
|
|||||||
* Refresh flag types
|
* Refresh flag types
|
||||||
*/
|
*/
|
||||||
protected static final int RF_TRANSFORM = 0x01, // need light resort + combine transforms
|
protected static final int RF_TRANSFORM = 0x01, // need light resort + combine transforms
|
||||||
RF_BOUND = 0x02,
|
RF_BOUND = 0x02,
|
||||||
RF_LIGHTLIST = 0x04; // changes in light lists
|
RF_LIGHTLIST = 0x04; // changes in light lists
|
||||||
|
|
||||||
protected CullHint cullHint = CullHint.Inherit;
|
protected CullHint cullHint = CullHint.Inherit;
|
||||||
protected BatchHint batchHint = BatchHint.Inherit;
|
protected BatchHint batchHint = BatchHint.Inherit;
|
||||||
/**
|
/**
|
||||||
@ -213,7 +214,6 @@ public abstract class Spatial implements Savable, Cloneable, Collidable, Cloneab
|
|||||||
protected void setBoundRefresh() {
|
protected void setBoundRefresh() {
|
||||||
refreshFlags |= RF_BOUND;
|
refreshFlags |= RF_BOUND;
|
||||||
|
|
||||||
// XXX: Replace with a recursive call?
|
|
||||||
Spatial p = parent;
|
Spatial p = parent;
|
||||||
while (p != null) {
|
while (p != null) {
|
||||||
if ((p.refreshFlags & RF_BOUND) != 0) {
|
if ((p.refreshFlags & RF_BOUND) != 0) {
|
||||||
@ -225,6 +225,25 @@ public abstract class Spatial implements Savable, Cloneable, Collidable, Cloneab
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (Internal use only) Forces a refresh of the given types of data.
|
||||||
|
*
|
||||||
|
* @param transforms Refresh world transform based on parents'
|
||||||
|
* @param bounds Refresh bounding volume data based on child nodes
|
||||||
|
* @param lights Refresh light list based on parents'
|
||||||
|
*/
|
||||||
|
public void forceRefresh(boolean transforms, boolean bounds, boolean lights) {
|
||||||
|
if (transforms) {
|
||||||
|
setTransformRefresh();
|
||||||
|
}
|
||||||
|
if (bounds) {
|
||||||
|
setBoundRefresh();
|
||||||
|
}
|
||||||
|
if (lights) {
|
||||||
|
setLightListRefresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <code>checkCulling</code> checks the spatial with the camera to see if it
|
* <code>checkCulling</code> checks the spatial with the camera to see if it
|
||||||
* should be culled.
|
* should be culled.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user