From 3c5f029889db977dae80455144d8a473d369a395 Mon Sep 17 00:00:00 2001 From: Andrew Opalach Date: Sat, 24 Oct 2020 00:59:53 -0400 Subject: cleanup --- TODO | 12 +++++------- random.sh | 8 ++++---- src/mauri.cc | 3 ++- src/objects/pass.cc | 2 +- src/texture.cc | 31 +++++++++++++------------------ src/texture.h | 24 +++++++++++------------- 6 files changed, 36 insertions(+), 44 deletions(-) diff --git a/TODO b/TODO index 75e1b56..fa118a9 100644 --- a/TODO +++ b/TODO @@ -6,6 +6,9 @@ [X] cleanup build system +[ ] start commiting in a more structured way + - most of the bulk work is done so this will make things easier going forward + [ ] more acurate visualizer [ ] seperate program to extract scene.pkg @@ -16,12 +19,6 @@ [ ] RG88 & R8 textures - i think it works need to test more -[ ] Re-think parse/load stage, parse stage could possibly be 1 stage where textures and framebuffers, - generate itermediate objects then "load" could simply load and map the resources either to the - itermediate objects or something else. - - We already know when a single pass is generated so we could just transfer that logic to only the parse step - - The intermediate objects should probably store the resource - Broken: [ ] ./mauri ../../../c/workshop_wallpapers/1703298496/scene.pkg - xray only works in the middle @@ -52,8 +49,9 @@ Broken: [X] ./mauri ../../../c/workshop_wallpapers/2008251577/scene.pkg - effect doesnt draw correctly - It was because of incorrect GL_TEXTURE_WRAP + - should analyze this in renderdoc -[ ] if version 2 is defined as a combo, g_Alpha and g_Color need to be set from the object +[X] if version 2 is defined as a combo, g_Alpha and g_Color need to be set from the object visible should be a draw time check not handled when parsing [ ] mouse paralax diff --git a/random.sh b/random.sh index 04f7907..cbe9cc3 100755 --- a/random.sh +++ b/random.sh @@ -3,26 +3,26 @@ cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" WALLPAPERS_PATH=../../c/workshop_wallpapers -BUILD_DIR=build-debug +BUILD_DIR=build-release export mesa_glthread=true if [[ $1 == "audio" ]] then while : ; do - DIR=$(find $WALLPAPERS_PATH -maxdepth 1 -type d | shuf | head -n 1) + DIR=$(find $WALLPAPERS_PATH -maxdepth 1 -type d | shuf -n 1) RES=$(cat $DIR/project.json | jq '.["general"]["supportsaudioprocessing"]') [[ "$RES" == 'null' || "$RES" == 'false' ]] || break done elif [[ $1 == "safe" ]] then while : ; do - DIR=$(find $WALLPAPERS_PATH -maxdepth 1 -type d | shuf | head -n 1) + DIR=$(find $WALLPAPERS_PATH -maxdepth 1 -type d | shuf -n 1) RES=$(cat $DIR/project.json | jq '.["contentrating"]') [[ "$RES" == 'null' || "$RES" != '"Everyone"' ]] || break done else - DIR=$(find $WALLPAPERS_PATH -maxdepth 1 -type d | shuf | head -n 1) + DIR=$(find $WALLPAPERS_PATH -maxdepth 1 -type d | shuf -n 1) fi echo $DIR 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