예제 #1
0
  private List<TextureOptionValue> parseTextureOptions(final List<String> values) {
    final List<TextureOptionValue> matchList = new ArrayList<TextureOptionValue>();

    if (values.isEmpty() || values.size() == 1) {
      return matchList;
    }

    // Loop through all but the last value, the last one is going to be the path.
    for (int i = 0; i < values.size() - 1; i++) {
      final String value = values.get(i);
      final TextureOption textureOption = TextureOption.getTextureOption(value);

      if (textureOption == null
          && !value.contains("\\")
          && !value.contains("/")
          && !values.get(0).equals("Flip")
          && !values.get(0).equals("Repeat")) {
        logger.log(
            Level.WARNING,
            "Unknown texture option \"{0}\" encountered for \"{1}\" in material \"{2}\"",
            new Object[] {value, key, material.getKey().getName()});
      } else if (textureOption != null) {
        final String option = textureOption.getOptionValue(value);
        matchList.add(new TextureOptionValue(textureOption, option));
      }
    }

    return matchList;
  }
예제 #2
0
    public static TextureOption getTextureOption(final String option) {
      for (final TextureOption textureOption : TextureOption.values()) {
        if (option.startsWith(textureOption.name())) {
          return textureOption;
        }
      }

      return null;
    }
예제 #3
0
 public void applyToTexture(final Texture texture) {
   textureOption.applyToTexture(value, texture);
 }
예제 #4
0
 public void applyToTextureKey(final TextureKey textureKey) {
   textureOption.applyToTextureKey(value, textureKey);
 }