fix gltf image loading
This commit is contained in:
parent
292bb10214
commit
9061cba577
5
assets.d
5
assets.d
@ -225,7 +225,8 @@ LoadImage(cgltf_image* asset_image, string tex_path)
|
||||
{
|
||||
if(asset_image.uri != null)
|
||||
{
|
||||
if(strlen(asset_image.uri) > 5 && ConvToStr(asset_image.uri[0 .. 5]) == "data:")
|
||||
u64 uri_len = strlen(asset_image.uri);
|
||||
if(uri_len > 5 && ConvToStr(asset_image.uri[0 .. 5]) == "data:")
|
||||
{
|
||||
u32 i;
|
||||
for(; asset_image.uri[i] != ',' && asset_image.uri[i] != 0; i += 1) {}
|
||||
@ -258,7 +259,7 @@ LoadImage(cgltf_image* asset_image, string tex_path)
|
||||
else
|
||||
{
|
||||
char[512] buf;
|
||||
char[] file_path = buf.sformat("%s%s%s", tex_path, dirSeparator, cast(char*)asset_image.uri);
|
||||
char[] file_path = buf.sformat("%s%s", tex_path, (cast(char*)asset_image.uri)[0 .. uri_len]);
|
||||
u8[] image_file = OpenFile(ConvToStr(file_path));
|
||||
|
||||
image = LoadImage(image_file.ptr, cast(i32)image_file.length);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user