break; case COMBINE_FIRST: for (int iIndex = 0, max = states.length; iIndex < max; iIndex++) { TextureState pkTState = (TextureState) states[iIndex]; if (!pkTState.isEnabled()) continue; else foundEnabled = true; for (int i = 0, maxT = pkTState.getNumberOfUnits(); i < maxT; i++) { Texture pkText = pkTState.getTexture(i); if (newTState.getTexture(i) == null) { newTState.setTexture(pkText, i); }
} break; case COMBINE_FIRST: for (int iIndex = 0, max = states.length; iIndex < max; iIndex++) { TextureState pkTState = (TextureState) states[iIndex]; if (!pkTState.isEnabled())continue; else foundEnabled = true; for (int i = 0, maxT = pkTState.getNumberOfUnits(); i < maxT; i++) { Texture pkText = pkTState.getTexture(i); if (newTState.getTexture(i) == null) { newTState.setTexture(pkText, i);
    public RenderState extract(Stack stack, Spatial spat) {      int mode = spat.getTextureCombineMode();      if (mode == REPLACE) return (LWJGLLightState) stack.peek();      // accumulate the lights in the stack into a single LightState object      LWJGLTextureState newTState = new LWJGLTextureState();      boolean foundEnabled = false;      Object states[] = stack.toArray();      switch (mode) {        case COMBINE_CLOSEST:        case COMBINE_RECENT_ENABLED:          for (int iIndex = states.length-1; iIndex >= 0; iIndex--) {            TextureState pkTState = (TextureState) states[iIndex];            if (!pkTState.isEnabled()) {              if (mode == COMBINE_RECENT_ENABLED) break;              else continue;            } else foundEnabled = true;            for (int i = 0, maxT = pkTState.getNumberOfUnits(); i < maxT; i++) {              Texture pkText = pkTState.getTexture(i);              if (newTState.getTexture(i) == null) {                newTState.setTexture(pkText, i);              }            }          }          break;        case COMBINE_FIRST:          for (int iIndex = 0, max = states.length; iIndex < max; iIndex++) {            TextureState pkTState = (TextureState) states[iIndex];            if (!pkTState.isEnabled()) continue;            else foundEnabled = true;            for (int i = 0, maxT = pkTState.getNumberOfUnits(); i < maxT; i++) {              Texture pkText = pkTState.getTexture(i);              if (newTState.getTexture(i) == null) {                newTState.setTexture(pkText, i);              }            }          }          break;      }      newTState.setEnabled(foundEnabled);      return newTState;    }