fix meshing failure on sculpt maps smaller than 64x64
							parent
							
								
									ccc26f7443
								
							
						
					
					
						commit
						212326eeb0
					
				|  | @ -62,6 +62,8 @@ namespace PrimMesher | ||||||
| 
 | 
 | ||||||
|             bool needsScaling = false; |             bool needsScaling = false; | ||||||
| 
 | 
 | ||||||
|  |             bool smallMap = bmW * bmH <= lod * lod; | ||||||
|  | 
 | ||||||
|             width = bmW; |             width = bmW; | ||||||
|             height = bmH; |             height = bmH; | ||||||
|             while (width * height > numLodPixels) |             while (width * height > numLodPixels) | ||||||
|  | @ -104,9 +106,14 @@ namespace PrimMesher | ||||||
|                 { |                 { | ||||||
|                     for (int x = 0; x <= width; x++) |                     for (int x = 0; x <= width; x++) | ||||||
|                     { |                     { | ||||||
|                         int bmY = y < height ? y * 2 : y * 2 - 1; |                         Color c; | ||||||
|                         int bmX = x < width ? x * 2 : x * 2 - 1; | 
 | ||||||
|                         Color c = bm.GetPixel(bmX, bmY); |                         if (smallMap) | ||||||
|  |                             c = bm.GetPixel(x < width ? x : x - 1, | ||||||
|  |                                             y < height ? y : y - 1); | ||||||
|  |                         else | ||||||
|  |                             c = bm.GetPixel(x < width ? x * 2 : x * 2 - 1, | ||||||
|  |                                             y < height ? y * 2 : y * 2 - 1); | ||||||
| 
 | 
 | ||||||
|                         redBytes[byteNdx] = c.R; |                         redBytes[byteNdx] = c.R; | ||||||
|                         greenBytes[byteNdx] = c.G; |                         greenBytes[byteNdx] = c.G; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 dahlia
						dahlia