@@ -60,6 +60,8 @@ class TextureCache {
var flags : Array<h3d.mat.Data.TextureFlags> = [Target];
if( isCube ) flags.push(Cube);
var newt = new h3d.mat.Texture(width, height, flags, format);
+ // make the texture disposable if we're out of memory
+ newt.realloc = function() {};
if( t != null )
cache.insert(position,newt);
else
@@ -100,10 +100,6 @@ class Texture {
if( tw != w || th != h )
this.flags.set(IsNPOT);
- // make the texture disposable if we're out of memory
- // this can be disabled after allocation by reseting realloc
- if( this.flags.has(Target) ) realloc = function() { };
-
this.width = w;
this.height = h;
this.mipMap = this.flags.has(MipMapped) ? Nearest : None;
@@ -159,6 +159,7 @@ class PointShadowMap extends Shadows {
if( tmpTex != null) return tmpTex;
tmpTex = new h3d.mat.Texture(1,1, [Target,Cube], format);
tmpTex.name = "defaultCubeShadowMap";
+ tmpTex.realloc = function() clear(tmpTex);
clear(tmpTex);
return tmpTex;
}
@@ -279,7 +279,6 @@ class Environment {
pass.shader.texture = source;
pass.shader.aboveThresholdScale = scale;
pass.shader.threshold = threshold;
- env.realloc = null;
for( i in 0...6 ) {
engine.pushTarget(env,i);
pass.shader.faceMatrix = getCubeMatrix(i);