浏览代码

fix envmap realloc

trethaller 5 年之前
父节点
当前提交
1af34c026d
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      h3d/scene/pbr/Environment.hx

+ 2 - 1
h3d/scene/pbr/Environment.hx

@@ -217,7 +217,8 @@ class Environment  {
 		} else {
 			if( source.width != source.height * 2 )
 				throw "Unrecognized environment map format";
-			env = new h3d.mat.Texture(source.height, source.height, [Cube, Target]);
+			if(env == null)
+				env = new h3d.mat.Texture(source.height, source.height, [Cube, Target]);
 			var pass = new h3d.pass.ScreenFx(new IrradEquiProj());
 			var engine = h3d.Engine.getCurrent();
 			pass.shader.texture = source;