comparison semiconginev2/gltf.nim @ 1252:01e9f41d35b1

add:support for push constants
author sam <sam@basx.dev>
date Fri, 26 Jul 2024 23:04:01 +0700
parents 3f98ad20a9d3
children c4f98eb4bb05
comparison
equal deleted inserted replaced
1251:3f98ad20a9d3 1252:01e9f41d35b1
143 raise newException(Exception, "Unsupported feature: Cannot load images from external files") 143 raise newException(Exception, "Unsupported feature: Cannot load images from external files")
144 let imageType = root["images"][imageIndex]["mimeType"].getStr() 144 let imageType = root["images"][imageIndex]["mimeType"].getStr()
145 assert imageType == "image/png", "glTF loader currently only supports PNG" 145 assert imageType == "image/png", "glTF loader currently only supports PNG"
146 146
147 let bufferView = root["bufferViews"][root["images"][imageIndex]["bufferView"].getInt()] 147 let bufferView = root["bufferViews"][root["images"][imageIndex]["bufferView"].getInt()]
148 result = LoadImage[BGRA](getBufferViewData(bufferView, mainBuffer)) 148 result = LoadImageData[BGRA](getBufferViewData(bufferView, mainBuffer))
149 149
150 if textureNode.hasKey("sampler"): 150 if textureNode.hasKey("sampler"):
151 let sampler = root["samplers"][textureNode["sampler"].getInt()] 151 let sampler = root["samplers"][textureNode["sampler"].getInt()]
152 if sampler.hasKey("magFilter"): 152 if sampler.hasKey("magFilter"):
153 result.magInterpolation = SAMPLER_FILTER_MODE_MAP[sampler["magFilter"].getInt()] 153 result.magInterpolation = SAMPLER_FILTER_MODE_MAP[sampler["magFilter"].getInt()]