changeset 1416:a4fd9c31a225

did: clean up compiler warnings
author sam <sam@basx.dev>
date Wed, 01 Jan 2025 12:42:43 +0700
parents 62ebf735ecfa
children 23b4d8c84501
files semicongine/gltf.nim semicongine/loaders.nim
diffstat 2 files changed, 4 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/semicongine/gltf.nim	Fri Dec 27 22:00:46 2024 +0700
+++ b/semicongine/gltf.nim	Wed Jan 01 12:42:43 2025 +0700
@@ -236,7 +236,7 @@
 ): TMaterial =
   result = TMaterial()
 
-  let pbr = materialNode["pbrMetallicRoughness"]
+  let pbr {.warning[InheritFromException]: off.} = materialNode["pbrMetallicRoughness"]
   for name, value in fieldPairs(result):
     for gltfAttribute, mappedName in fieldPairs(mapping):
       when gltfAttribute != "" and name == mappedName:
--- a/semicongine/loaders.nim	Fri Dec 27 22:00:46 2024 +0700
+++ b/semicongine/loaders.nim	Wed Jan 01 12:42:43 2025 +0700
@@ -27,10 +27,6 @@
 ): Image[T] {.gcsafe.} =
   assert path.splitFile().ext.toLowerAscii == ".png",
     "Unsupported image type: " & path.splitFile().ext.toLowerAscii
-  when T is Gray:
-    let pngType = 0.cint
-  elif T is BGRA:
-    let pngType = 6.cint
 
   let (width, height, data) =
     loadImageData[T](loadResource_intern(path, package = package).readAll())
@@ -43,10 +39,6 @@
   for path in paths:
     assert path.splitFile().ext.toLowerAscii == ".png",
       "Unsupported image type: " & path.splitFile().ext.toLowerAscii
-  when T is Gray:
-    let pngType = 0.cint
-  elif T is BGRA:
-    let pngType = 6.cint
 
   let (width, height, data) =
     loadImageData[T](loadResource_intern(paths[0], package = package).readAll())
@@ -66,18 +58,14 @@
 ): ImageArray[T] {.gcsafe.} =
   assert path.splitFile().ext.toLowerAscii == ".png",
     "Unsupported image type: " & path.splitFile().ext.toLowerAscii
-  when T is Gray:
-    let pngType = 0.cint
-  elif T is BGRA:
-    let pngType = 6.cint
 
   let (width, height, data) =
     loadImageData[T](loadResource_intern(path, package = package).readAll())
-  let
-    tilesX = width div tilesize
-    tilesY = height div tilesize
+  let tilesY = height div tilesize
+
   result = ImageArray[T](width: tilesize, height: tilesize)
   var tile = newSeq[T](tilesize * tilesize)
+
   for ty in 0 ..< tilesY:
     for tx in 0 ..< tilesY:
       var hasNonTransparent = when T is BGRA: false else: true