@ -121,11 +121,13 @@ public class LodControl extends AbstractControl implements Cloneable, JmeCloneab
@Override
@Override
public void setSpatial ( Spatial spatial ) {
public void setSpatial ( Spatial spatial ) {
if ( ! ( spatial instanceof Geometry ) ) {
if ( spatial ! = null & & ! ( spatial instanceof Geometry ) ) {
throw new IllegalArgumentException ( "LodControl can only be attached to Geometry!" ) ;
throw new IllegalArgumentException ( "LodControl can only be attached to Geometry!" ) ;
}
}
super . setSpatial ( spatial ) ;
super . setSpatial ( spatial ) ;
if ( spatial ! = null ) {
Geometry geom = ( Geometry ) spatial ;
Geometry geom = ( Geometry ) spatial ;
Mesh mesh = geom . getMesh ( ) ;
Mesh mesh = geom . getMesh ( ) ;
numLevels = mesh . getNumLodLevels ( ) ;
numLevels = mesh . getNumLodLevels ( ) ;
@ -133,6 +135,10 @@ public class LodControl extends AbstractControl implements Cloneable, JmeCloneab
for ( int i = numLevels - 1 ; i > = 0 ; i - - ) {
for ( int i = numLevels - 1 ; i > = 0 ; i - - ) {
numTris [ i ] = mesh . getTriangleCount ( i ) ;
numTris [ i ] = mesh . getTriangleCount ( i ) ;
}
}
} else {
numLevels = 0 ;
numTris = null ;
}
}
}
@Override
@Override