瀏覽代碼

Materials: missing props in clone()

trethaller 7 年之前
父節點
當前提交
602f0d8294
共有 3 個文件被更改,包括 9 次插入0 次删除
  1. 1 0
      h3d/mat/BaseMaterial.hx
  2. 2 0
      h3d/mat/Material.hx
  3. 6 0
      h3d/mat/PbrMaterial.hx

+ 1 - 0
h3d/mat/BaseMaterial.hx

@@ -81,6 +81,7 @@ class BaseMaterial extends hxd.impl.AnyProps implements hxd.impl.Serializable {
 		m.mainPass.load(mainPass);
 		// DO NOT clone passes (it's up to the superclass to recreate the passes + shaders)
 		m.name = name;
+		m.props = props;
 		return m;
 	}
 

+ 2 - 0
h3d/mat/Material.hx

@@ -109,6 +109,8 @@ class Material extends BaseMaterial {
 		m.castShadows = castShadows;
 		m.receiveShadows = receiveShadows;
 		m.texture = texture;
+		m.specularTexture = specularTexture;
+		m.normalMap = normalMap;
 		if( textureShader != null ) {
 			m.textureShader.additive = textureShader.additive;
 			m.textureShader.killAlpha = textureShader.killAlpha;

+ 6 - 0
h3d/mat/PbrMaterial.hx

@@ -125,6 +125,12 @@ class PbrMaterial extends Material {
 
 	}
 
+	override function clone( ?m : BaseMaterial ) : BaseMaterial {
+		var m = m == null ? new PbrMaterial() : cast m;
+		super.clone(m);
+			return m;
+	}
+
 	#if js
 	override function editProps() {
 		var props : PbrProps = props;