public void updateInstances(Camera cam) {
        FloatBuffer fb = (FloatBuffer) transformInstanceData.getData();
        fb.limit(fb.capacity());
        fb.position(0);

        int numCulledGeometries = 0;
        TempVars vars = TempVars.get();
        {
            float[] temp = vars.matrixWrite;

            for (int i = 0; i < firstUnusedIndex; i++) {
                Geometry geom = geometries[i];

                if (geom == null) {
                    geom = geometries[firstUnusedIndex - 1];

                    if (geom == null) {
                        throw new AssertionError();
                    }

                    swap(i, firstUnusedIndex - 1);

                    while (geometries[firstUnusedIndex -1] == null) {
                        firstUnusedIndex--;
                    }
                }

                if (cam != null && instanceCullingFunction != null) {
                    boolean culled = instanceCullingFunction.apply(cam, geom);
                    if (culled) {
                        numCulledGeometries++;
                        continue;
                    }
                }

                Matrix4f worldMatrix = geom.getWorldMatrix();
                updateInstance(worldMatrix, temp, 0, vars.tempMat3, vars.quat1);
                fb.put(temp);
            }
        }
        vars.release();

        fb.flip();

        numVisibleInstances = firstUnusedIndex - numCulledGeometries;
        if (fb.limit() / INSTANCE_SIZE != numVisibleInstances) {
            throw new AssertionError();
        }

        transformInstanceData.updateData(fb);
    }
@deprecated use {@link #updateInstances(com.jme3.renderer.Camera)}
jme3-core/src/main/java/com/jme3/scene/instancing/InstancedGeometry.java