org.proteinshader.graphics.textures
Class Texture

java.lang.Object
  extended by org.proteinshader.graphics.textures.Texture
All Implemented Interfaces:
Comparable<Texture>

public class Texture
extends Object
implements Comparable<Texture>

Stores information on an OpenGL texture object.

An OpenGL texture object created on the graphics card is referenced by an integer name. This Java class will store the OpenGL name for a texture object, as well as information on the file the texture was read from, and a String name suitable for use in a menu. The Comparable interface is implemented so that Texture objects can be sorted by their menu names.


Constructor Summary
Texture(int name, String menuName, String filename, File file)
          Constructs a Texture object.
 
Method Summary
 int compareTo(Texture other)
          Compares this Texture object to the Texture object given as an argument by making a lexicographic comparison of their menu names.
 File getFile()
          Returns a File object with the complete pathname for the file the texture was read from.
 String getFilename()
          Returns the name of the file the texture was read from.
 String getMenuName()
          Returns a name suitable for use in a menu.
 int getName()
          Gets the OpenGL reference (an integer) for a texture object stored on the graphics card.
 void setFile(File file)
          Sets the File with the complete pathname for the file the texture was read from.
 void setFilename(String filename)
          Sets the name of the file that the texture was read from.
 void setMenuName(String menuName)
          Sets the menu name for the texture.
 void setName(int name)
          Sets the OpenGL reference (an integer) for a texture object stored on the graphics card.
 String toString()
          Returns the menu name of the Texture.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Texture

public Texture(int name,
               String menuName,
               String filename,
               File file)
Constructs a Texture object.

Parameters:
name - the name (an integer) of an OpenGL texture object.
menuName - a name suitable for use in a GUI menu.
filename - the name of the file the texture is read from.
file - a File object with the complete name of the file.
Method Detail

getName

public int getName()
Gets the OpenGL reference (an integer) for a texture object stored on the graphics card.

Returns:
The name (an integer) for an OpenGL texture object.

setName

public void setName(int name)
Sets the OpenGL reference (an integer) for a texture object stored on the graphics card.

Parameters:
name - the name (an integer) for an OpenGL texture object.

getMenuName

public String getMenuName()
Returns a name suitable for use in a menu.

Returns:
The menu name of the texture.

setMenuName

public void setMenuName(String menuName)
Sets the menu name for the texture.

Parameters:
menuName - a name suitable for use in a menu.

getFilename

public String getFilename()
Returns the name of the file the texture was read from.

Returns:
The name of the texture file.

setFilename

public void setFilename(String filename)
Sets the name of the file that the texture was read from.

Parameters:
filename - the name of the texture file.

getFile

public File getFile()
Returns a File object with the complete pathname for the file the texture was read from.

Returns:
A File with the complete pathname of the texture file.

setFile

public void setFile(File file)
Sets the File with the complete pathname for the file the texture was read from.

Parameters:
file - a File object with the pathname for the texture file.

compareTo

public int compareTo(Texture other)
Compares this Texture object to the Texture object given as an argument by making a lexicographic comparison of their menu names.

This method allows a list of Texture objects to be sorted such that they will be in alphabetical order based on their menu names.

Specified by:
compareTo in interface Comparable<Texture>
Parameters:
other - the Texture object for comparison.

toString

public String toString()
Returns the menu name of the Texture.

Overrides:
toString in class Object
Returns:
A name suitable for use in a menu.


Copyright © 2007-2008