浏览代码

Environment.hx : Move quiToCube() call from new() to computeIrradLut()

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

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

@@ -202,7 +202,6 @@ class Environment  {
 	*/
 	public function new( src : h3d.mat.Texture, ?diffSize = 64, ?specSize = 512, ?sampleBits = 12 ) {
 		this.source = src;
-		equiToCube();
 		this.diffSize = diffSize;
 		this.specSize = specSize;
 		this.sampleBits = sampleBits;
@@ -311,6 +310,9 @@ class Environment  {
 
 	function computeIrradiance() {
 
+		if( env == null )
+			equiToCube();
+
 		var screen = new h3d.pass.ScreenFx(new IrradShader());
 		screen.shader.samplesBits = sampleBits;
 		screen.shader.envMap = env;