@Override
        public ByteBuffer getData() {
            ByteBuffer d = bo.getData();
            if (source == null || d != source || slice == null) {
                source = d;
                int currentPos = source.position();
                int currentLimit = source.limit();
                source.limit(source.capacity());
                source.position(0);
                slice = source.slice();
                source.limit(currentLimit);
                source.position(currentPos);
            }
            slice.limit(end);
            slice.position(start);
            return slice;
        }
An helper class that iterates and merges dirty regions

@author Riccardo Balbo
jme3-core/src/main/java/com/jme3/shader/bufferobject/DirtyRegionsIterator.java