Browse Source

Env using either RGBA32F or RGBA16F

clementlandrin 2 years ago
parent
commit
edb169bca2
1 changed files with 5 additions and 3 deletions
  1. 5 3
      h3d/scene/pbr/Environment.hx

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

@@ -208,6 +208,8 @@ class CubeToPanorama extends h3d.shader.ScreenShader {
 
 class Environment {
 
+	static var DEFAULT_FORMAT : hxd.PixelFormat = RGBA32F;
+
 	public var sampleBits : Int;
 	public var diffSize : Int;
 	public var specSize : Int;
@@ -273,7 +275,7 @@ class Environment {
 
 		if( source.width != source.height * 2 )
 			throw "Unrecognized environment map format";
-		var env = new h3d.mat.Texture(source.height, source.height, [Cube, Target], hxd.Pixels.isFloatFormat(source.format) ? RGBA32F : RGBA );
+		var env = new h3d.mat.Texture(source.height, source.height, [Cube, Target], hxd.Pixels.isFloatFormat(source.format) ? DEFAULT_FORMAT : RGBA );
 		var pass = new h3d.pass.ScreenFx(new PanoramaToCube());
 		var engine = h3d.Engine.getCurrent();
 		pass.shader.texture = source;
@@ -297,12 +299,12 @@ class Environment {
 
 	function createTextures() {
 		if( diffuse == null ) {
-			diffuse = new h3d.mat.Texture(diffSize, diffSize, [Cube, Target], RGBA32F);
+			diffuse = new h3d.mat.Texture(diffSize, diffSize, [Cube, Target], DEFAULT_FORMAT);
 			diffuse.setName("irradDiffuse");
 			diffuse.preventAutoDispose();
 		}
 		if( specular == null ) {
-			specular = new h3d.mat.Texture(specSize, specSize, [Cube, Target, MipMapped, ManualMipMapGen], RGBA32F);
+			specular = new h3d.mat.Texture(specSize, specSize, [Cube, Target, MipMapped, ManualMipMapGen], DEFAULT_FORMAT);
 			specular.setName("irradSpecular");
 			specular.mipMap = Linear;
 			specular.preventAutoDispose();