Method to add

I would like to request that the following method be added into TextureState. It would make getting a list of textures much simpler.




    public int NumberOfActiveUnits()
    {
      int number=0;
     for (int x = 0; x < numTexUnits; x++) {
        if (texture[x] != null) {
            number++;
        }
      }
      return number;
    }

Yeah that could be useful but it could be optimized like that :



    public int numberOfActiveUnits()
    {
       int number = 0;

       for(int x = numTexUnits; --x >= 0; )
       {
           if (texture[x] != null)
              number++;
       }

       return number;
    }



That's just a micro-optimisation...

I doubt either is more efificient once the JIT gets ahold of them.

Maybe, but most java performance books tell you to count down to 0 because comparisons to 0 are faster.