Fixed unnecessary warnings in bitmap loading

This commit is contained in:
Josh-Larson
2022-07-25 12:08:55 -05:00
parent f990ad51b5
commit 0bff580dac
2 changed files with 7 additions and 3 deletions

View File

@@ -3,7 +3,6 @@ package com.projectswg.common.data.swgiff.parsers.terrain.bitmap
import com.projectswg.common.data.swgiff.IffChunk
import com.projectswg.common.data.swgiff.IffForm
import com.projectswg.common.data.swgiff.parsers.SWGParser
import me.joshlarson.jlcommon.log.Log
import java.io.IOException
class BitmapFamily : SWGParser {
@@ -21,7 +20,6 @@ class BitmapFamily : SWGParser {
bitmap.readFile(value)
this.bitmap = bitmap
} catch (e: IOException) {
Log.e("Failed to load height bitmap: %s", value)
this.bitmap = null
}
}

View File

@@ -6,6 +6,7 @@ import com.projectswg.common.data.swgiff.IffChunk
import com.projectswg.common.data.swgiff.IffForm
import com.projectswg.common.data.swgiff.parsers.terrain.TerrainInfoLookup
import com.projectswg.common.data.swgiff.parsers.terrain.bitmap.TargaBitmap
import me.joshlarson.jlcommon.log.Log
class FilterBitmap : FilterLayer() {
@@ -19,7 +20,12 @@ class FilterBitmap : FilterLayer() {
if (bitmap == null)
bitmap = terrainInfo.bitmaps[bitmapId]?.bitmap
val bitmap = bitmap ?: return 1f // Didnt find bitmap for filter
val bitmap = bitmap
if (bitmap == null) {
Log.e("Failed to find required terrain height bitmap: $bitmapId: ${terrainInfo.bitmaps[bitmapId]?.file}")
return 1f
}
val width = bitmap.width
val height = bitmap.height
val transformedX = (p.x - rectangle.minX) * width / (rectangle.maxX - rectangle.minX)