com.threerings.cast
Class ComponentClass

java.lang.Object
  extended by com.threerings.cast.ComponentClass
All Implemented Interfaces:
Serializable

public class ComponentClass
extends Object
implements Serializable

Denotes a class of components to which CharacterComponent objects belong. Examples include "Hat", "Head", and "Feet". A component class dictates a component's rendering priority so that components can be rendered in an order that causes them to overlap properly.

Components support render priority overrides for particular actions, orientations or combinations of actions and orientations. The system is currently structured with the expectation that the overrides will be relatively few (less than fifteen, say) for any given component class. A system that relied on many overrides for its components would want to implement a more scalable algorithm for determining which, if any, override matches a particular action and orientation combination.

See Also:
Serialized Form

Nested Class Summary
static class ComponentClass.PriorityOverride
          Used to effect custom render orders for particular actions, orientations, etc.
 
Field Summary
protected  ComparableArrayList<ComponentClass.PriorityOverride> _overrides
          A list of render priority overrides.
 String[] colors
          The color classes to use when recoloring components of this class.
 String mask
          The class name of the layer from which this component class obtains a mask to limit rendering to certain areas.
 String name
          The component class name.
 int renderPriority
          The default render priority.
 String shadow
          Indicates the class name of the shadow layer to which this component class contributes a shadow.
 float shadowAlpha
          1.0 for a normal component, the alpha value of the pre-composited shadow for the special "shadow" component class.
 boolean translate
          Whether or not components of this class will have translations applied.
 
Constructor Summary
ComponentClass()
          Creates an uninitialized instance suitable for unserialization or population during XML parsing.
 
Method Summary
 void addPriorityOverride(ComponentClass.PriorityOverride override)
          Adds the supplied render priority override record to this component class.
 boolean equals(Object other)
          Classes with the same name are the same.
 int getRenderPriority(String action, int orientation)
          Deprecated. 
 int getRenderPriority(String action, String component, int orientation)
          Returns the render priority appropriate for the specified action, orientation and component.
 int hashCode()
          Hashcode is based on component class name.
 boolean isShadow()
          Returns true if this component class is a shadow layer rather than a normal component class.
 boolean isShadowed()
          Returns true if this component class contributes a shadow to a particular shadow layer.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

name

public String name
The component class name.


renderPriority

public int renderPriority
The default render priority.


colors

public String[] colors
The color classes to use when recoloring components of this class. May be null if a system does not use recolorable components.


mask

public String mask
The class name of the layer from which this component class obtains a mask to limit rendering to certain areas.


shadow

public String shadow
Indicates the class name of the shadow layer to which this component class contributes a shadow.


shadowAlpha

public float shadowAlpha
1.0 for a normal component, the alpha value of the pre-composited shadow for the special "shadow" component class.


translate

public boolean translate
Whether or not components of this class will have translations applied.


_overrides

protected ComparableArrayList<ComponentClass.PriorityOverride> _overrides
A list of render priority overrides.

Constructor Detail

ComponentClass

public ComponentClass()
Creates an uninitialized instance suitable for unserialization or population during XML parsing.

Method Detail

getRenderPriority

@Deprecated
public int getRenderPriority(String action,
                                        int orientation)
Deprecated. 

Returns the render priority appropriate for the specified action and orientation. This is deprecated; you should really use getRenderPriority(String, String, int) to handle potential per-component priority overrides.


getRenderPriority

public int getRenderPriority(String action,
                             String component,
                             int orientation)
Returns the render priority appropriate for the specified action, orientation and component.


addPriorityOverride

public void addPriorityOverride(ComponentClass.PriorityOverride override)
Adds the supplied render priority override record to this component class.


isShadowed

public boolean isShadowed()
Returns true if this component class contributes a shadow to a particular shadow layer. Note: this is different from being a shadow layer which is determined by calling isShadow().


isShadow

public boolean isShadow()
Returns true if this component class is a shadow layer rather than a normal component class.


equals

public boolean equals(Object other)
Classes with the same name are the same.

Overrides:
equals in class Object

hashCode

public int hashCode()
Hashcode is based on component class name.

Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object