Ignore case when checking texture naming convention
This commit is contained in:
parent
8fa5c63039
commit
aec4a4a882
@ -275,10 +275,10 @@ export fn game_init(global_allocator: *std.mem.Allocator) void {
|
||||
}
|
||||
}
|
||||
|
||||
const scene = globals.g_mem.world.createScene(globals.g_assetman.resolveScene(a.Scenes.scifi_helmet.SciFiHelmet.scene));
|
||||
const scene = globals.g_mem.world.createScene(globals.g_assetman.resolveScene(a.Scenes.amd_ryzen_9.scene));
|
||||
const ent = globals.g_mem.world.getEntity(scene) orelse @panic("WTF");
|
||||
ent.data.transform.pos = Vec3.new(0, 1, 0);
|
||||
// ent.data.transform.scale = Vec3.one().scale(4);
|
||||
ent.data.transform.scale = Vec3.one().scale(0.2);
|
||||
}
|
||||
|
||||
export fn game_update() bool {
|
||||
|
@ -552,13 +552,18 @@ fn processTextureFromFile(allocator: std.mem.Allocator, input: []const u8, outpu
|
||||
/// Using naming conventions
|
||||
fn guessTextureTypeFromName(name: []const u8) TextureType {
|
||||
const stem = std.fs.path.stem(name);
|
||||
const sub_ext = std.fs.path.extension(stem);
|
||||
var buf: [std.fs.MAX_NAME_BYTES]u8 = undefined;
|
||||
const lower_stem = std.ascii.lowerString(&buf, stem);
|
||||
const sub_ext = std.fs.path.extension(lower_stem);
|
||||
if (std.mem.eql(u8, sub_ext, ".norm")) {
|
||||
return .Normal;
|
||||
}
|
||||
if (std.mem.endsWith(u8, stem, "Normal")) {
|
||||
if (std.mem.endsWith(u8, lower_stem, "normal")) {
|
||||
return .Normal;
|
||||
}
|
||||
if (std.mem.endsWith(u8, lower_stem, "metallicroughness")) {
|
||||
return .MetallicRoughness;
|
||||
}
|
||||
|
||||
return .Color;
|
||||
}
|
||||
@ -566,6 +571,7 @@ fn guessTextureTypeFromName(name: []const u8) TextureType {
|
||||
const TextureType = enum {
|
||||
Color,
|
||||
Normal,
|
||||
MetallicRoughness,
|
||||
HDR,
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user