comparison semiconginev2/gltf.nim @ 1258:5442d0e9d8ff

did: improve testing lighting, try new glb model (need to add jpeg support first)
author sam <sam@basx.dev>
date Sun, 28 Jul 2024 20:42:51 +0700
parents 2b5ca798f6d6
children
comparison
equal deleted inserted replaced
1257:e9b8d87b9883 1258:5442d0e9d8ff
148 let imageIndex = textureNode["source"].getInt() 148 let imageIndex = textureNode["source"].getInt()
149 149
150 if root["images"][imageIndex].hasKey("uri"): 150 if root["images"][imageIndex].hasKey("uri"):
151 raise newException(Exception, "Unsupported feature: Cannot load images from external files") 151 raise newException(Exception, "Unsupported feature: Cannot load images from external files")
152 let imageType = root["images"][imageIndex]["mimeType"].getStr() 152 let imageType = root["images"][imageIndex]["mimeType"].getStr()
153 assert imageType == "image/png", "glTF loader currently only supports PNG" 153 assert imageType == "image/png", "glTF loader currently only supports PNG, but found '" & imageType & "'"
154 154
155 let bufferView = root["bufferViews"][root["images"][imageIndex][ 155 let bufferView = root["bufferViews"][root["images"][imageIndex][
156 "bufferView"].getInt()] 156 "bufferView"].getInt()]
157 result = LoadImageData[BGRA](getBufferViewData(bufferView, mainBuffer)) 157 result = LoadImageData[BGRA](getBufferViewData(bufferView, mainBuffer))
158 158