Fixed material reading with new prefixedName in MatParam

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7657 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
rem..om 14 years ago
parent 447fd87d2c
commit bc2de8626d
  1. 28
      engine/src/core/com/jme3/material/MatParam.java

@ -29,7 +29,6 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.jme3.material;
import com.jme3.asset.TextureKey;
@ -122,6 +121,7 @@ public class MatParam implements Savable, Cloneable {
*/
void setName(String name) {
this.name = name;
this.prefixedName = "m_" + name;
}
/**
@ -187,16 +187,16 @@ public class MatParam implements Savable, Cloneable {
// can be either ColorRGBA, Vector4f or Quaternion
if (value instanceof Vector4f) {
Vector4f v4 = (Vector4f) value;
return v4.getX() + " " + v4.getY() + " " +
v4.getZ() + " " + v4.getW();
return v4.getX() + " " + v4.getY() + " "
+ v4.getZ() + " " + v4.getW();
} else if (value instanceof ColorRGBA) {
ColorRGBA color = (ColorRGBA) value;
return color.getRed() + " " + color.getGreen() + " " +
color.getBlue() + " " + color.getAlpha();
return color.getRed() + " " + color.getGreen() + " "
+ color.getBlue() + " " + color.getAlpha();
} else if (value instanceof Quaternion) {
Quaternion quat = (Quaternion) value;
return quat.getX() + " " + quat.getY() + " " +
quat.getZ() + " " + quat.getW();
return quat.getX() + " " + quat.getY() + " "
+ quat.getZ() + " " + quat.getW();
} else {
throw new UnsupportedOperationException("Unexpected Vector4 type: " + value);
}
@ -208,10 +208,12 @@ public class MatParam implements Savable, Cloneable {
Texture texVal = (Texture) value;
TextureKey texKey = (TextureKey) texVal.getKey();
String ret = "";
if (texKey.isFlipY())
if (texKey.isFlipY()) {
ret += "Flip ";
if (texVal.getWrap(Texture.WrapAxis.S) == WrapMode.Repeat)
}
if (texVal.getWrap(Texture.WrapAxis.S) == WrapMode.Repeat) {
ret += "Repeat ";
}
return ret + texKey.getName();
default:
@ -272,12 +274,13 @@ public class MatParam implements Savable, Cloneable {
@Override
public boolean equals(Object other) {
if (!(other instanceof MatParam))
if (!(other instanceof MatParam)) {
return false;
}
MatParam otherParam = (MatParam) other;
return otherParam.type == type &&
otherParam.name.equals(name);
return otherParam.type == type
&& otherParam.name.equals(name);
}
@Override
@ -293,4 +296,3 @@ public class MatParam implements Savable, Cloneable {
return type.name() + " " + name + " : " + getValueAsString();
}
}

Loading…
Cancel
Save