summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Opalach <andrew@akon.city> 2020-10-24 00:59:53 -0400
committerAndrew Opalach <andrew@akon.city> 2020-10-24 00:59:53 -0400
commit3c5f029889db977dae80455144d8a473d369a395 (patch)
tree6c92eb820486dfbb13e79de3aecd8dcaefe193a4 /src
parentb66ba3884135ec746a84a78c38d4fb2fdc0c98a4 (diff)
downloadmauri-3c5f029889db977dae80455144d8a473d369a395.tar.gz
mauri-3c5f029889db977dae80455144d8a473d369a395.tar.bz2
mauri-3c5f029889db977dae80455144d8a473d369a395.zip
cleanup
Diffstat (limited to 'src')
-rw-r--r--src/mauri.cc3
-rw-r--r--src/objects/pass.cc2
-rw-r--r--src/texture.cc31
-rw-r--r--src/texture.h24
4 files changed, 27 insertions, 33 deletions
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<u32>();
- TextureFlags flags;
+ flags.i = asset->read<u32>();
- flags.u.i = asset->read<u32>();
-
- is_gif = flags.u.flags.IS_GIF == 1;
+ is_gif = flags.map.IS_GIF == 1;
auto texture_width = asset->read<u32>();
auto texture_height = asset->read<u32>();
@@ -83,7 +81,8 @@ Texture::Texture(Asset *asset)
{
auto mm_count = asset->read<u32>();
- 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<byte *>(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<byte *>(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<u32>(), // id
- asset->read<f32>(), // frame_time
- asset->read<f32>(), // x
- asset->read<f32>(), // y
- asset->read<f32>(), // width
- asset->read<f32>(), // unknown0
- asset->read<f32>(), // unknown1
- asset->read<f32>(), // height
+ asset->read<u32>(),
+ asset->read<f32>(),
+ asset->read<f32>(),
+ asset->read<f32>(),
+ asset->read<f32>(),
+ asset->read<f32>(),
+ asset->read<f32>(),
+ asset->read<f32>(),
});
}
}
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;