RenderState.controllers idea

Renderstate currently uses an Controller[10] Controllers for every single render state, and always loops through 10 times for every render state every frame checking for controllers. Most RenderStates don’t use controllers, and never 10. So instead of Controller[] I’ve put int ArrayList. The arraylist starts off null and is only made if a controller is attached to the render state. Each frame, the render state gets its controller ArrayList and if that list is null it skips checking for controllers. Something like the following:


  public void addController(int index, Controller c) {
//    controllers[index] = c;
      if (controllers==null)
        controllers=new ArrayList(10);
      controllers.set(index,c);
  }



and inside Spatial.updateWorldData(float time)

    RenderState rs;
    for (int i = renderStateList.length; --i >= 0; ) {
      rs = renderStateList[i];
      if (rs != null) {
        ArrayList controls = rs.getControllers();
          if (controls==null) continue;
        for (int j = controls.size(); --j >=0 ;) {
            Controller tempC=(Controller) controls.get(j);
          if (tempC != null) {
            tempC.update(time);
          }
        }
      }
    }