Explorar el Código

add Pixels R16U -> R32F conversion

trethaller hace 5 años
padre
commit
5c6d78a4b4
Se han modificado 1 ficheros con 10 adiciones y 0 borrados
  1. 10 0
      hxd/Pixels.hx

+ 10 - 0
hxd/Pixels.hx

@@ -394,6 +394,16 @@ class Pixels {
 				bytes[p++] = v;
 				bytes[p++] = 0xFF;
 			}
+
+		case [R16U, R32F]:
+			var nbytes = haxe.io.Bytes.alloc(width * height * 4);
+			var fbytes = this.bytes;
+			for( i in 0...width*height ) {
+				var nv = fbytes.getUInt16(i << 1);
+				nbytes.setFloat(i << 2, nv / 65535.0);
+			}
+			this.bytes = nbytes;
+
 		case [S3TC(a),S3TC(b)] if( a == b ):
 			// nothing