/src/org/mt4j/util/opengl/GLTextureSettings.java

http://mt4j.googlecode.com/ · Java · 105 lines · 37 code · 19 blank · 49 comment · 10 complexity · 2b5b0f7dad33e2b8688d433be7e9e35b MD5 · raw file

  1. /***********************************************************************
  2. * mt4j Copyright (c) 2008 - 2010 Christopher Ruff, Fraunhofer-Gesellschaft All rights reserved.
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation, either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. *
  17. ***********************************************************************/
  18. package org.mt4j.util.opengl;
  19. import org.mt4j.util.opengl.GLTexture.EXPANSION_FILTER;
  20. import org.mt4j.util.opengl.GLTexture.SHRINKAGE_FILTER;
  21. import org.mt4j.util.opengl.GLTexture.TEXTURE_TARGET;
  22. import org.mt4j.util.opengl.GLTexture.WRAP_MODE;
  23. /**
  24. * The Class GLTextureSettings.
  25. *
  26. * @author Christopher Ruff
  27. */
  28. public class GLTextureSettings {
  29. /** The shrink filter. */
  30. public SHRINKAGE_FILTER shrinkFilter;
  31. /** The expansion filter. */
  32. public EXPANSION_FILTER expansionFilter;
  33. /** The wrapping horizontal. */
  34. public WRAP_MODE wrappingHorizontal;
  35. /** The wrapping vertical. */
  36. public WRAP_MODE wrappingVertical;
  37. /** The target. */
  38. public TEXTURE_TARGET target;
  39. // public INTERNAL_FORMAT textureInternalFormat;
  40. //INFO we may not use mip maps by default because in abstractshape we would create a gltexture form a pimage automatically
  41. //but we will un normalize the tex coords while they should still be normalized if we use gluBuildMipmaps2d which scales NPOT tex to POT
  42. /**
  43. * Instantiates a new gL texture settings.
  44. */
  45. public GLTextureSettings(){
  46. this(TEXTURE_TARGET.TEXTURE_2D, SHRINKAGE_FILTER.BilinearNoMipMaps, EXPANSION_FILTER.Bilinear, WRAP_MODE.CLAMP_TO_EDGE, WRAP_MODE.CLAMP_TO_EDGE);
  47. }
  48. /**
  49. * Instantiates a new gL texture settings.
  50. *
  51. * @param target the target
  52. * @param shrinkFilter the shrink filter
  53. * @param expansionFilter the expansion filter
  54. * @param wrappingHorizontal the wrapping horizontal
  55. * @param wrappingVertical the wrapping vertical
  56. */
  57. public GLTextureSettings(TEXTURE_TARGET target, SHRINKAGE_FILTER shrinkFilter, EXPANSION_FILTER expansionFilter, WRAP_MODE wrappingHorizontal, WRAP_MODE wrappingVertical){
  58. this.target = target;
  59. // Filter mode
  60. this.shrinkFilter = shrinkFilter;
  61. this.expansionFilter = expansionFilter;
  62. // Texture Wrapping mode
  63. this.wrappingHorizontal = wrappingHorizontal; //TODO use clamp_to_edge - but what examples etc would that break?
  64. this.wrappingVertical = wrappingVertical;
  65. }
  66. /* (non-Javadoc)
  67. * @see java.lang.Object#equals(java.lang.Object)
  68. */
  69. @Override
  70. public boolean equals(Object obj) {
  71. // return super.equals(obj);
  72. if (obj instanceof GLTextureSettings) {
  73. GLTextureSettings settings = (GLTextureSettings) obj;
  74. return(
  75. this.target == settings.target
  76. && this.shrinkFilter == settings.shrinkFilter
  77. && this.expansionFilter == settings.expansionFilter
  78. && this.wrappingHorizontal == settings.wrappingHorizontal
  79. && this.wrappingVertical == settings.wrappingVertical
  80. // && this.textureInternalFormat == settings.textureInternalFormat //FIXME REMOVE!?
  81. );
  82. }else{
  83. return false;
  84. }
  85. }
  86. }