Skip to content

Commit

Permalink
Issue #468 - added generateMipmaps boolean to prevent texture used on…
Browse files Browse the repository at this point in the history
… the view.background to create mipmaps
  • Loading branch information
ringodotnl committed Mar 23, 2013
1 parent e378470 commit d1304d0
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/away3d/textures/BitmapTexture.as
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package away3d.textures
{
package away3d.textures {
import away3d.arcane;
import away3d.materials.utils.MipmapGenerator;
import away3d.tools.utils.TextureUtils;

import flash.display.BitmapData;
import flash.display3D.textures.Texture;
import flash.display3D.textures.TextureBase;

use namespace arcane;
Expand All @@ -16,12 +16,14 @@

private var _bitmapData : BitmapData;
private var _mipMapHolder : BitmapData;
private var _generateMipmaps: Boolean;

public function BitmapTexture(bitmapData : BitmapData)
public function BitmapTexture(bitmapData : BitmapData, generateMipmaps:Boolean = true)
{
super();

this.bitmapData = bitmapData;
_generateMipmaps = generateMipmaps;
}

public function get bitmapData() : BitmapData
Expand All @@ -41,12 +43,13 @@

_bitmapData = value;

setMipMap();
if (_generateMipmaps) setMipMap();
}

override protected function uploadContent(texture : TextureBase) : void
{
MipmapGenerator.generateMipMaps(_bitmapData, texture, _mipMapHolder, true);
if (_generateMipmaps) MipmapGenerator.generateMipMaps(_bitmapData, texture, _mipMapHolder, true);
else Texture(texture).uploadFromBitmapData (_bitmapData, 0);
}

private function setMipMap() : void
Expand Down

0 comments on commit d1304d0

Please sign in to comment.