* Fix Material.hashCode/equals and RenderState.hashCode()
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9359 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
a625e8ae2a
commit
2339b7d2e5
@ -222,7 +222,7 @@ public class Material implements CloneableSmartAsset, Cloneable, Savable {
|
||||
* @param otherObj the material to compare to this material
|
||||
* @return true if the materials are equal.
|
||||
*/
|
||||
public boolean contentEquals(Object otherObj) {
|
||||
public boolean equals(Object otherObj) {
|
||||
if (!(otherObj instanceof Material)) {
|
||||
return false;
|
||||
}
|
||||
@ -286,15 +286,17 @@ public class Material implements CloneableSmartAsset, Cloneable, Savable {
|
||||
return true;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public int hashCode() {
|
||||
// int hash = 7;
|
||||
// hash = 29 * hash + (this.def != null ? this.def.hashCode() : 0);
|
||||
// hash = 29 * hash + (this.paramValues != null ? this.paramValues.hashCode() : 0);
|
||||
// hash = 29 * hash + (this.technique != null ? this.technique.getDef().getName().hashCode() : 0);
|
||||
// hash = 29 * hash + (this.additionalState != null ? this.additionalState.hashCode() : 0);
|
||||
// return hash;
|
||||
// }
|
||||
/**
|
||||
* Works like {@link Object#hashCode() } except it may change together with the material as the material is mutable by definition.
|
||||
*/
|
||||
public int dynamicHashCode() {
|
||||
int hash = 7;
|
||||
hash = 29 * hash + (this.def != null ? this.def.hashCode() : 0);
|
||||
hash = 29 * hash + (this.paramValues != null ? this.paramValues.hashCode() : 0);
|
||||
hash = 29 * hash + (this.technique != null ? this.technique.getDef().getName().hashCode() : 0);
|
||||
hash = 29 * hash + (this.additionalState != null ? this.additionalState.dynamicHashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the currently active technique.
|
||||
|
@ -1044,8 +1044,10 @@ public class RenderState implements Cloneable, Savable {
|
||||
return applyWireFrame;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public int dynamicHashCode() {
|
||||
if (cachedHashCode == -1){
|
||||
int hash = 7;
|
||||
hash = 79 * hash + (this.pointSprite ? 1 : 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user