com.badlogic.gdx.graphics.g3d
Class Attributes

java.lang.Object
  extended by com.badlogic.gdx.graphics.g3d.Attributes
All Implemented Interfaces:
Iterable<Attribute>, Comparator<Attribute>
Direct Known Subclasses:
Environment, Material

public class Attributes
extends Object
implements Iterable<Attribute>, Comparator<Attribute>


Constructor Summary
Attributes()
           
 
Method Summary
 void clear()
          Removes all attributes
 int compare(Attribute arg0, Attribute arg1)
          Used for sorting attributes
 Array<Attribute> get(Array<Attribute> out, long type)
          Get multiple attributes at once.
<T extends Attribute>
T
get(Class<T> clazz, long type)
          Example usage: ((BlendingAttribute)material.get(BlendingAttribute.ID)).sourceFunction;
 Attribute get(long type)
          Example usage: ((BlendingAttribute)material.get(BlendingAttribute.ID)).sourceFunction;
 long getMask()
           
 boolean has(long type)
           
 Iterator<Attribute> iterator()
          Used for iterating through the attributes
 void remove(long mask)
          Removes the attribute from the material, i.e.: material.remove(BlendingAttribute.ID); Can also be used to remove multiple attributes also, i.e.
 boolean same(Attributes other)
          See same(Attributes, boolean)
 boolean same(Attributes other, boolean compareValues)
          Check if this collection has the same attributes as the other collection.
 void set(Attribute... attributes)
          Add an array of attributes to this material.
 void set(Attribute attribute)
          Add a attribute to this material.
 void set(Attribute attribute1, Attribute attribute2)
          Add multiple attributes to this material.
 void set(Attribute attribute1, Attribute attribute2, Attribute attribute3)
          Add multiple attributes to this material.
 void set(Attribute attribute1, Attribute attribute2, Attribute attribute3, Attribute attribute4)
          Add multiple attributes to this material.
 void set(Iterable<Attribute> attributes)
          Add an array of attributes to this material.
 int size()
           
 void sort()
          Sort the attributes by their ID
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

Attributes

public Attributes()
Method Detail

sort

public final void sort()
Sort the attributes by their ID


getMask

public final long getMask()
Returns:
Bitwise mask of the ID's of all the containing attributes

get

public final Attribute get(long type)
Example usage: ((BlendingAttribute)material.get(BlendingAttribute.ID)).sourceFunction;

Returns:
The attribute (which can safely be cast) if any, otherwise null

get

public final <T extends Attribute> T get(Class<T> clazz,
                                         long type)
Example usage: ((BlendingAttribute)material.get(BlendingAttribute.ID)).sourceFunction;

Returns:
The attribute if any, otherwise null

get

public final Array<Attribute> get(Array<Attribute> out,
                                  long type)
Get multiple attributes at once. Example: material.get(out, ColorAttribute.Diffuse | ColorAttribute.Specular | TextureAttribute.Diffuse);


clear

public final void clear()
Removes all attributes


size

public int size()
Returns:
The amount of attributes this material contains.

set

public final void set(Attribute attribute)
Add a attribute to this material. If the material already contains an attribute of the same type it is overwritten.


set

public final void set(Attribute attribute1,
                      Attribute attribute2)
Add multiple attributes to this material. If the material already contains an attribute of the same type it is overwritten.


set

public final void set(Attribute attribute1,
                      Attribute attribute2,
                      Attribute attribute3)
Add multiple attributes to this material. If the material already contains an attribute of the same type it is overwritten.


set

public final void set(Attribute attribute1,
                      Attribute attribute2,
                      Attribute attribute3,
                      Attribute attribute4)
Add multiple attributes to this material. If the material already contains an attribute of the same type it is overwritten.


set

public final void set(Attribute... attributes)
Add an array of attributes to this material. If the material already contains an attribute of the same type it is overwritten.


set

public final void set(Iterable<Attribute> attributes)
Add an array of attributes to this material. If the material already contains an attribute of the same type it is overwritten.


remove

public final void remove(long mask)
Removes the attribute from the material, i.e.: material.remove(BlendingAttribute.ID); Can also be used to remove multiple attributes also, i.e. remove(AttributeA.ID | AttributeB.ID);


has

public final boolean has(long type)
Returns:
True if this collection has the specified attribute, i.e. attributes.has(ColorAttribute.Diffuse); Or when multiple attribute types are specified, true if this collection has all specified attributes, i.e. attributes.has(out, ColorAttribute.Diffuse | ColorAttribute.Specular | TextureAttribute.Diffuse);

same

public final boolean same(Attributes other,
                          boolean compareValues)
Check if this collection has the same attributes as the other collection. If compareValues is true, it also compares the values of each attribute.

Parameters:
compareValues - True to compare attribute values, false to only compare attribute types
Returns:
True if this collection contains the same attributes (and optionally attribute values) as the other.

same

public final boolean same(Attributes other)
See same(Attributes, boolean)

Returns:
True if this collection contains the same attributes (but not values) as the other.

compare

public final int compare(Attribute arg0,
                         Attribute arg1)
Used for sorting attributes

Specified by:
compare in interface Comparator<Attribute>

iterator

public final Iterator<Attribute> iterator()
Used for iterating through the attributes

Specified by:
iterator in interface Iterable<Attribute>


Copyright © 2013. All Rights Reserved.