Explorar o código

better shaderMaterial clone func

David Catuhe %!s(int64=5) %!d(string=hai) anos
pai
achega
23d05fa285
Modificáronse 1 ficheiros con 7 adicións e 2 borrados
  1. 7 2
      src/Materials/shaderMaterial.ts

+ 7 - 2
src/Materials/shaderMaterial.ts

@@ -742,11 +742,16 @@ export class ShaderMaterial extends Material {
      * @returns the cloned material
      */
     public clone(name: string): ShaderMaterial {
-        var newShaderMaterial = new ShaderMaterial(name, this.getScene(), this._shaderPath, this._options);
+        var result = SerializationHelper.Clone(() => new ShaderMaterial(name, this.getScene(), this._shaderPath, this._options), this);
 
-        return newShaderMaterial;
+        result.name = name;
+        result.id = name;
+
+        return result;
     }
 
+
+
     /**
      * Disposes the material
      * @param forceDisposeEffect specifies if effects should be forcefully disposed