PageRenderTime 33ms CodeModel.GetById 23ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/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 ***********************************************************************/
 18package org.mt4j.util.opengl;
 19
 20import org.mt4j.util.opengl.GLTexture.EXPANSION_FILTER;
 21import org.mt4j.util.opengl.GLTexture.SHRINKAGE_FILTER;
 22import org.mt4j.util.opengl.GLTexture.TEXTURE_TARGET;
 23import org.mt4j.util.opengl.GLTexture.WRAP_MODE;
 24
 25
 26/**
 27 * The Class GLTextureSettings.
 28 *
 29 * @author Christopher Ruff
 30 */
 31public class GLTextureSettings {
 32	
 33	/** The shrink filter. */
 34	public SHRINKAGE_FILTER shrinkFilter;
 35	
 36	/** The expansion filter. */
 37	public EXPANSION_FILTER expansionFilter;
 38	
 39	/** The wrapping horizontal. */
 40	public WRAP_MODE wrappingHorizontal;
 41	
 42	/** The wrapping vertical. */
 43	public WRAP_MODE wrappingVertical;
 44	
 45	/** The target. */
 46	public TEXTURE_TARGET target;
 47	
 48//	public INTERNAL_FORMAT textureInternalFormat;
 49	
 50	//INFO we may not use mip maps by default because in abstractshape we would create a gltexture form a pimage automatically
 51	//but we will un normalize the tex coords while they should still be normalized if we use gluBuildMipmaps2d which scales NPOT tex to POT
 52    
 53    /**
 54 * Instantiates a new gL texture settings.
 55 */
 56public GLTextureSettings(){
 57    	this(TEXTURE_TARGET.TEXTURE_2D, SHRINKAGE_FILTER.BilinearNoMipMaps, EXPANSION_FILTER.Bilinear, WRAP_MODE.CLAMP_TO_EDGE, WRAP_MODE.CLAMP_TO_EDGE);
 58    }
 59    
 60    /**
 61     * Instantiates a new gL texture settings.
 62     *
 63     * @param target the target
 64     * @param shrinkFilter the shrink filter
 65     * @param expansionFilter the expansion filter
 66     * @param wrappingHorizontal the wrapping horizontal
 67     * @param wrappingVertical the wrapping vertical
 68     */
 69    public GLTextureSettings(TEXTURE_TARGET target, SHRINKAGE_FILTER shrinkFilter, EXPANSION_FILTER expansionFilter, WRAP_MODE wrappingHorizontal, WRAP_MODE wrappingVertical){
 70    	this.target = target;
 71		
 72		// Filter mode
 73		this.shrinkFilter 		= shrinkFilter;
 74		this.expansionFilter 	= expansionFilter;
 75		
 76		// Texture Wrapping mode
 77		this.wrappingHorizontal = wrappingHorizontal; //TODO use clamp_to_edge - but what examples etc would that break?
 78		this.wrappingVertical 	= wrappingVertical;
 79    }
 80    
 81    
 82    /* (non-Javadoc)
 83     * @see java.lang.Object#equals(java.lang.Object)
 84     */
 85    @Override
 86    public boolean equals(Object obj) {
 87//    	return super.equals(obj);
 88    	
 89    	if (obj instanceof GLTextureSettings) {
 90			GLTextureSettings settings = (GLTextureSettings) obj;
 91			return( 
 92					this.target == settings.target
 93					&& this.shrinkFilter == settings.shrinkFilter
 94					&& this.expansionFilter == settings.expansionFilter
 95					&& this.wrappingHorizontal == settings.wrappingHorizontal
 96					&& this.wrappingVertical == settings.wrappingVertical
 97//					&& this.textureInternalFormat == settings.textureInternalFormat //FIXME REMOVE!?
 98			);
 99		}else{
100			return false;
101		}
102    }
103	
104
105}