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

Loading…
Cancel
Save