samedi 26 septembre 2015

Exact clone of a TextureMaterial

I want to clone a TextureMaterial, modify it and keep the original and the clone for later use.

What I did so far is following:

var BT:BitmapTexture = defaultMaterial.texture as BitmapTexture;
var BD:BitmapData = BT.bitmapData;
var clone:BitmapData = BD.clone();
var newBT:BitmapTexture = new BitmapTexture(clone);
transparentMaterial = new TextureMaterial(newBT, false, true);
transparentMaterial.lightPicker = defaultMaterial.lightPicker; 

but it is not a full copy, because the cloned TextureMaterial does not look like the original. Can anyone help me with that problem please?

I also posted my problem here with an additional image as attachment:

Aucun commentaire:

Enregistrer un commentaire