Преглед на файлове

removed PixelFloat usage (getPixelF/setPixelF now on hxd.Pixels)

Nicolas Cannasse преди 4 години
родител
ревизия
330b12504b

+ 7 - 7
hide/prefab/terrain/TerrainEditor.hx

@@ -22,8 +22,8 @@ class TerrainRevertData {
 class TileRevertData {
 	public var x : Int;
 	public var y : Int;
-	public var prevHeightMapPixels : hxd.Pixels.PixelsFloat;
-	public var nextHeightMapPixels : hxd.Pixels.PixelsFloat;
+	public var prevHeightMapPixels : hxd.Pixels;
+	public var nextHeightMapPixels : hxd.Pixels;
 	public var prevWeightMapPixels : Array<hxd.Pixels> = [];
 	public var nextWeightMapPixels : Array<hxd.Pixels> = [];
 	public var prevSurfaceIndexMapPixels : hxd.Pixels;
@@ -70,7 +70,7 @@ class TerrainEditor {
 	var tileTrashBin : Array<TileRevertData> = [];
 	var paintRevertDatas : Array<TileRevertData> = [];
 	// Render UV offscreen
-	var uvTexPixels : hxd.Pixels.PixelsFloat;
+	var uvTexPixels : hxd.Pixels;
 	var uvTex : h3d.mat.Texture;
 	var uvTexRes = 0.5;
 	var customScene = new h3d.scene.Scene(false, false);
@@ -241,13 +241,13 @@ class TerrainEditor {
 
 		// Adjust the height to avoid seams
 		for( t in tiles ) {
-			var pixels : hxd.Pixels.PixelsFloat = t.heightMapPixels;
+			var pixels = t.heightMapPixels;
 			if( pixels == null )
 				throw("Try to blend the edges of a null heightmap.");
 			var adjTileX = t.terrain.getTile(t.tileX + 1, t.tileY);
 			var adjHeightMapX = adjTileX != null ? adjTileX.heightMap : null;
 			if( adjHeightMapX != null ) {
-				var adjpixels : hxd.Pixels.PixelsFloat = adjTileX.heightMapPixels;
+				var adjpixels = adjTileX.heightMapPixels;
 				for( i in 0 ... t.heightMap.height ) {
 					pixels.setPixelF(t.heightMap.width - 1, i, adjpixels.getPixelF(0,i) );
 				}
@@ -256,7 +256,7 @@ class TerrainEditor {
 			var adjTileY = t.terrain.getTile(t.tileX, t.tileY + 1);
 			var adjHeightMapY = adjTileY != null ? adjTileY.heightMap : null;
 			if( adjHeightMapY != null ) {
-				var adjpixels : hxd.Pixels.PixelsFloat = adjTileY.heightMapPixels;
+				var adjpixels = adjTileY.heightMapPixels;
 				for( i in 0 ... t.heightMap.width ) {
 					pixels.setPixelF(i, t.heightMap.height - 1, adjpixels.getPixelF(i,0) );
 				}
@@ -265,7 +265,7 @@ class TerrainEditor {
 			var adjTileXY = t.terrain.getTile(t.tileX + 1, t.tileY + 1);
 			var adjHeightMapXY = adjTileXY != null ? adjTileXY.heightMap : null;
 			if( adjHeightMapXY != null ) {
-				var adjpixels : hxd.Pixels.PixelsFloat = adjTileXY.heightMapPixels;
+				var adjpixels = adjTileXY.heightMapPixels;
 				pixels.setPixelF(t.heightMap.width - 1, t.heightMap.height - 1, adjpixels.getPixelF(0,0));
 			}
 

+ 4 - 4
hide/view/l3d/LightProbeBaker.hx

@@ -149,7 +149,7 @@ class LightProbeBaker {
 		offScreenScene.renderer.process(passes);
 	}
 
-	var pixels : hxd.Pixels.PixelsFloat = null;
+	var pixels : hxd.Pixels = null;
 	public function bake( volumetricLightMap : hrt.prefab.vlm.VolumetricMesh, resolution : Int, ?time :Float ) {
 
 		var timer = haxe.Timer.stamp();
@@ -313,7 +313,7 @@ class LightProbeBaker {
 		@:privateAccess renderer.ctx.engine.flushTarget();
 	}
 
-	function convertOuputTexturesIntoSH( volumetricLightMap : hrt.prefab.vlm.VolumetricMesh, pixelsOut : hxd.Pixels.PixelsFloat ) {
+	function convertOuputTexturesIntoSH( volumetricLightMap : hrt.prefab.vlm.VolumetricMesh, pixelsOut : hxd.Pixels ) {
 
 		var order = volumetricLightMap.shOrder;
 		var sh = new hrt.prefab.vlm.SphericalHarmonic(order);
@@ -321,7 +321,7 @@ class LightProbeBaker {
 		var maxCoef : Int = Std.int(Math.min(8, coefCount));
 
 		for(coef in 0 ... maxCoef){
-			var pixels : hxd.Pixels.PixelsFloat = textureArray[coef].capturePixels();
+			var pixels = textureArray[coef].capturePixels();
 			for( index in 0 ... pixels.width){
 				var coefs : h3d.Vector = pixels.getPixelF(index, 0);
 				var coords = volumetricLightMap.getProbeCoords(index);
@@ -346,7 +346,7 @@ class LightProbeBaker {
 	function convertEnvIntoSH_CPU( env : h3d.mat.Texture, order : Int ) : hrt.prefab.vlm.SphericalHarmonic {
 		var coefCount = order * order;
 		var sphericalHarmonic = new hrt.prefab.vlm.SphericalHarmonic(order);
-		var face : hxd.Pixels.PixelsFloat;
+		var face : hxd.Pixels;
 		var weightSum = 0.0;
 		var invWidth = 1.0 / env.width;
 		var shData : Array<Float> = [for ( value in 0...coefCount ) 0];

+ 3 - 3
hrt/prefab/terrain/Terrain.hx

@@ -263,7 +263,7 @@ class Terrain extends Object3D {
 			var pixels : hxd.Pixels = new hxd.Pixels(terrain.weightMapResolution.x, terrain.weightMapResolution.y, wd.res.entry.getBytes(), RGBA);
 			tmpPackedWeightTexture.uploadPixels(pixels);
 			t.packedWeightMapPixel = pixels;
-			
+
 			// Notice that we need the surfaceIndexMap loaded before doing the unpacking
 			var engine = h3d.Engine.getCurrent();
 			#if editor
@@ -297,7 +297,7 @@ class Terrain extends Object3D {
 		for( hd in heightData ) {
 			var t = terrain.getTile(hd.x, hd.y);
 			var bytes = hd.res.entry.getBytes();
-			var pixels : hxd.Pixels.PixelsFloat = new hxd.Pixels(terrain.heightMapResolution.x, terrain.heightMapResolution.y, bytes, R32F);
+			var pixels = new hxd.Pixels(terrain.heightMapResolution.x, terrain.heightMapResolution.y, bytes, R32F);
 			t.heightMapPixels = pixels;
 
 			if( !bakeHeightAndNormalInGeometry ) {
@@ -477,7 +477,7 @@ class Terrain extends Object3D {
 
 	public function saveHeightTextures( ctx : Context ) {
 		for( tile in terrain.tiles ) {
-			var pixels : hxd.Pixels.PixelsFloat = tile.heightMap.capturePixels();
+			var pixels = tile.heightMap.capturePixels();
 			var fileName = tile.tileX + "_" + tile.tileY + "_" + "h";
 			ctx.shared.savePrefabDat(fileName, "bin", name, pixels.bytes);
 		}

+ 1 - 1
hrt/prefab/terrain/Tile.hx

@@ -41,7 +41,7 @@ class Tile extends h3d.scene.Mesh {
 
 	// TEXTURE & PIXEL
 	public var heightMap : h3d.mat.Texture;
-	var heightMapPixels : hxd.Pixels.PixelsFloat;
+	var heightMapPixels : hxd.Pixels;
 
 	public var normalMap(default, null) : h3d.mat.Texture;
 	var normalMapPixels : hxd.Pixels.Pixels;

+ 4 - 4
hrt/prefab/vlm/LightProbe.hx

@@ -441,9 +441,9 @@ class LightProbe extends Object3D {
 
 	function serialize( env : Environment ) : haxe.io.Bytes {
 
-		var diffusePixels : Array<hxd.Pixels.PixelsFloat> = [ for( i in 0 ... 6) env.diffuse.capturePixels(i) ];
+		var diffusePixels : Array<hxd.Pixels> = [ for( i in 0 ... 6) env.diffuse.capturePixels(i) ];
 		var mipLevels = env.getMipLevels();
-		var specularPixels : Array<hxd.Pixels.PixelsFloat> =
+		var specularPixels : Array<hxd.Pixels> =
 		 [
 			for( i in 0 ... 6 ) {
 				for( m in 0 ... mipLevels ) {
@@ -499,7 +499,7 @@ class LightProbe extends Object3D {
 		for( i in 0 ... 6 ) {
 			var diffByte = bytes.sub(curPos, diffSize);
 			curPos += diffByte.length;
-			var diffPixels : hxd.Pixels.PixelsFloat = new hxd.Pixels(env.diffuse.width, env.diffuse.height, diffByte, env.diffuse.format);
+			var diffPixels = new hxd.Pixels(env.diffuse.width, env.diffuse.height, diffByte, env.diffuse.format);
 			env.diffuse.uploadPixels(diffPixels, 0, i);
 		}
 
@@ -510,7 +510,7 @@ class LightProbe extends Object3D {
 				var mipMapSize = hxd.Pixels.calcStride(env.specular.width >> m, env.specular.format) * env.specular.height >> m;
 				var specByte = bytes.sub(curPos, mipMapSize);
 				curPos += specByte.length;
-				var specPixels : hxd.Pixels.PixelsFloat = new hxd.Pixels(env.specular.width >> m, env.specular.height >> m, specByte, env.specular.format);
+				var specPixels = new hxd.Pixels(env.specular.width >> m, env.specular.height >> m, specByte, env.specular.format);
 				env.specular.uploadPixels(specPixels, m, i);
 			}
 		}

+ 5 - 5
hrt/prefab/vlm/ProbeBaker.hx

@@ -29,9 +29,9 @@ class ProbeBaker {
 	var output6 : h3d.mat.Texture;
 	var output7 : h3d.mat.Texture;
 	var textureArray: Array<h3d.mat.Texture>;
-	
+
 	// Tmp Buffer
-	var pixels : hxd.Pixels.PixelsFloat = null;
+	var pixels : hxd.Pixels = null;
 	var prim : h3d.prim.Plane2D;
 
 	public function new(){
@@ -183,7 +183,7 @@ class ProbeBaker {
 		@:privateAccess renderer.ctx.engine.flushTarget();
 	}
 
-	function convertOuputTexturesIntoSH( volumetricLightMap : hrt.prefab.vlm.VolumetricMesh, pixelsOut : hxd.Pixels.PixelsFloat ) {
+	function convertOuputTexturesIntoSH( volumetricLightMap : hrt.prefab.vlm.VolumetricMesh, pixelsOut : hxd.Pixels ) {
 
 		var order = volumetricLightMap.shOrder;
 		var sh = new hrt.prefab.vlm.SphericalHarmonic(order);
@@ -191,7 +191,7 @@ class ProbeBaker {
 		var maxCoef : Int = Std.int(Math.min(8, coefCount));
 
 		for(coef in 0 ... maxCoef){
-			var pixels : hxd.Pixels.PixelsFloat = textureArray[coef].capturePixels();
+			var pixels = textureArray[coef].capturePixels();
 			for( index in 0 ... pixels.width){
 				var coefs : h3d.Vector = pixels.getPixelF(index, 0);
 				var coords = volumetricLightMap.getProbeCoords(index);
@@ -216,7 +216,7 @@ class ProbeBaker {
 	function convertEnvIntoSH_CPU( env : h3d.mat.Texture, order : Int ) : hrt.prefab.vlm.SphericalHarmonic {
 		var coefCount = order * order;
 		var sphericalHarmonic = new hrt.prefab.vlm.SphericalHarmonic(order);
-		var face : hxd.Pixels.PixelsFloat;
+		var face : hxd.Pixels;
 		var weightSum = 0.0;
 		var invWidth = 1.0 / env.width;
 		var shData : Array<Float> = [for ( value in 0...coefCount ) 0];

+ 1 - 1
hrt/prefab/vlm/VolumetricLightmap.hx

@@ -118,7 +118,7 @@ class VolumetricLightmap extends Object3D {
 
 		if(volumetricLightmap == null) return;
 
-		var pixels : hxd.Pixels.PixelsFloat = null;
+		var pixels : hxd.Pixels = null;
 		if(volumetricLightmap.lightProbeTexture != null)
 			pixels = volumetricLightmap.lightProbeTexture.capturePixels();
 

+ 1 - 1
hrt/prefab/vlm/VolumetricMesh.hx

@@ -53,7 +53,7 @@ class VolumetricMesh extends h3d.scene.Mesh {
 		return vm;
 	}
 
-	public function getProbeSH(coords : h3d.col.IPoint, ?pixels : hxd.Pixels.PixelsFloat ) : SphericalHarmonic {
+	public function getProbeSH(coords : h3d.col.IPoint, ?pixels : hxd.Pixels ) : SphericalHarmonic {
 
 		if(lightProbeTexture == null)
 			return new SphericalHarmonic(shOrder);