Exact clone of a TextureMaterial

58 views Asked by At

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 the cloned TextureMaterial does not look like the original (see attachment). Can anyone help me with that problem please? I think i am missing some important information from the texture? uv-coordinates maybe or something like that.

I also posted my problem here with an additional image as attachment: http://away3d.com/forum/viewthread/5956/

1

There are 1 answers

0
David O. On

I solved the Problem. It was just one wrong parameter. I enable mipmaping for the clone, but the original does not have mipmaping enabled.

The working Soulution looks like this:

clone = new TextureMaterial(original.texture, true, true, false);
clone.lightPicker = original.lightPicker;