From 3c5f029889db977dae80455144d8a473d369a395 Mon Sep 17 00:00:00 2001 From: Andrew Opalach Date: Sat, 24 Oct 2020 00:59:53 -0400 Subject: cleanup --- src/mauri.cc | 3 ++- src/objects/pass.cc | 2 +- src/texture.cc | 31 +++++++++++++------------------ src/texture.h | 24 +++++++++++------------- 4 files changed, 27 insertions(+), 33 deletions(-) (limited to 'src') diff --git a/src/mauri.cc b/src/mauri.cc index 4e70580..83e811f 100644 --- a/src/mauri.cc +++ b/src/mauri.cc @@ -33,7 +33,8 @@ s32 main(s32 argc, char *argv[]) //Context *context = new ContextX11(2560, 1440, "mauri", true); //Context *context = new ContextGLFW(720, 1280, "mauri", false); - Context *context = new ContextGLFW(1920, 1080, "mauri", false); + //Context *context = new ContextGLFW(1920, 1080, "mauri", false); + Context *context = new ContextGLFW(720, 1280, "mauri", false); //Context *context = new ContextX11(1920, 1080, "mauri", false); //Context *context = new ContextNull(1920, 1080, "mauri", false); diff --git a/src/objects/pass.cc b/src/objects/pass.cc index 2d9edf5..2301321 100644 --- a/src/objects/pass.cc +++ b/src/objects/pass.cc @@ -236,7 +236,7 @@ RenderPass::RenderPass(Engine *engine, Pass *pass) { // Take value as reference because "uniform_override->value" points // to the value stored in the parser. This allows changing that value - // to have instant effect. + // to have an instant effect. shader_uniform->value = &uniform_override->value; break; } diff --git a/src/texture.cc b/src/texture.cc index f147472..e4a848b 100644 --- a/src/texture.cc +++ b/src/texture.cc @@ -33,11 +33,9 @@ Texture::Texture(Asset *asset) auto format = (TextureFormat)asset->read(); - TextureFlags flags; + flags.i = asset->read(); - flags.u.i = asset->read(); - - is_gif = flags.u.flags.IS_GIF == 1; + is_gif = flags.map.IS_GIF == 1; auto texture_width = asset->read(); auto texture_height = asset->read(); @@ -83,7 +81,8 @@ Texture::Texture(Asset *asset) { auto mm_count = asset->read(); - auto _texture = new RenderTexture(flags.u.flags.NO_INTERPOLATION, flags.u.flags.CLAMP_UV, mm_count); + // TODO this can be figured out through renderdoc + auto _texture = new RenderTexture(flags.map.NO_INTERPOLATION, flags.map.CLAMP_UV, mm_count); for (int i = 0; i < mm_count; i++) { @@ -128,7 +127,6 @@ Texture::Texture(Asset *asset) _texture->upload(reinterpret_cast(decompressed), mwidth, mheight, i, GL_RGBA, true, true); delete[] decompressed; - log_warn("%s", "DXT5 Texture"); break; } case DXT1: { @@ -137,19 +135,15 @@ Texture::Texture(Asset *asset) _texture->upload(reinterpret_cast(decompressed), mwidth, mheight, i, GL_RGBA, true, true); delete[] decompressed; - log_warn("%s", "DXT1 Texture"); break; } case DXT3: - log_warn("%s", "DXT3 Texture"); break; case RG88: _texture->upload(buffer, mwidth, mheight, i, GL_RG, true); - log_warn("%s", "RG88 Texture"); break; case R8: _texture->upload(buffer, mwidth, mheight, i, GL_RED, true); - log_warn("%s", "RG8 Texture"); break; default: log_warn("%s", "Uknown Texture"); @@ -189,15 +183,16 @@ Texture::Texture(Asset *asset) for (int i = 0; i < frame_count; i++) { + // See TextureFrame frames.push_back(TextureFrame { - asset->read(), // id - asset->read(), // frame_time - asset->read(), // x - asset->read(), // y - asset->read(), // width - asset->read(), // unknown0 - asset->read(), // unknown1 - asset->read(), // height + asset->read(), + asset->read(), + asset->read(), + asset->read(), + asset->read(), + asset->read(), + asset->read(), + asset->read(), }); } } diff --git a/src/texture.h b/src/texture.h index 3f2e6fa..c379c8d 100644 --- a/src/texture.h +++ b/src/texture.h @@ -24,25 +24,18 @@ enum TextureFormat enum TextureVersion { + UNKNOWN, TEXB0001, TEXB0002, - TEXB0003, - UNKNOWN + TEXB0003 }; -// TODO make better struct TextureFlags { - union { - struct - { - bool NO_INTERPOLATION : 1; - bool CLAMP_UV : 1; - bool IS_GIF : 1; - u32 UNKNWON : 29; - } flags; - u32 i; - } u; + bool NO_INTERPOLATION : 1; + bool CLAMP_UV : 1; + bool IS_GIF : 1; + u32 UNKNOWN : 29; }; struct TextureFrame @@ -68,6 +61,11 @@ class Texture s32 width; s32 height; + union { + TextureFlags map; + u32 i; + } flags; + u64 hash; bool wrapped = false; -- cgit v1.2.3-101-g0448