background color animation
This commit is contained in:
parent
f679129e30
commit
28fda4551d
@ -5,6 +5,9 @@
|
||||
#include "texture.hpp"
|
||||
#include "framebuffer.hpp"
|
||||
|
||||
#include "holly/background.hpp"
|
||||
#include "holly/holly.hpp"
|
||||
|
||||
namespace scene::tracker::cover {
|
||||
|
||||
struct cover {
|
||||
@ -15,11 +18,14 @@ namespace scene::tracker::cover {
|
||||
float width;
|
||||
float height;
|
||||
float scale;
|
||||
vec3 color;
|
||||
};
|
||||
|
||||
int cover_ix = -1;
|
||||
|
||||
float zoom_interp = 0.0;
|
||||
static float zoom_interp = 0.0;
|
||||
|
||||
static vec3 bg_color = {0, 0, 0};
|
||||
|
||||
static const cover covers[] = {
|
||||
[thebeach] = {
|
||||
@ -31,6 +37,7 @@ namespace scene::tracker::cover {
|
||||
.width = 72,
|
||||
.height = 72,
|
||||
.scale = 6,
|
||||
.color = {0x1a, 0x13, 0x11},
|
||||
},
|
||||
[silvertrees] = {
|
||||
.texture_offset = texture::offset::silvertrees,
|
||||
@ -41,6 +48,7 @@ namespace scene::tracker::cover {
|
||||
.width = 72,
|
||||
.height = 72,
|
||||
.scale = 6,
|
||||
.color = {0x0d, 0x10, 0x1a},
|
||||
},
|
||||
[redtree] = {
|
||||
.texture_offset = texture::offset::redtree,
|
||||
@ -51,6 +59,7 @@ namespace scene::tracker::cover {
|
||||
.width = 72,
|
||||
.height = 72,
|
||||
.scale = 6,
|
||||
.color = {0x1a, 0x00, 0x00},
|
||||
},
|
||||
[mountain] = {
|
||||
.texture_offset = texture::offset::mountain,
|
||||
@ -61,6 +70,7 @@ namespace scene::tracker::cover {
|
||||
.width = 72,
|
||||
.height = 72,
|
||||
.scale = 6,
|
||||
.color = {0x00, 0x02, 0x1a},
|
||||
},
|
||||
[mossycottage] = {
|
||||
.texture_offset = texture::offset::mossycottage,
|
||||
@ -71,6 +81,7 @@ namespace scene::tracker::cover {
|
||||
.width = 72,
|
||||
.height = 72,
|
||||
.scale = 6,
|
||||
.color = {0x0f, 0x1a, 0x14},
|
||||
},
|
||||
[clocks] = {
|
||||
.texture_offset = texture::offset::clocks,
|
||||
@ -81,6 +92,7 @@ namespace scene::tracker::cover {
|
||||
.width = 72,
|
||||
.height = 72,
|
||||
.scale = 6,
|
||||
.color = {0x00, 0x0a, 0x1a},
|
||||
},
|
||||
[tree] = {
|
||||
.texture_offset = texture::offset::tree,
|
||||
@ -91,6 +103,7 @@ namespace scene::tracker::cover {
|
||||
.width = 72,
|
||||
.height = 72,
|
||||
.scale = 6,
|
||||
.color = {0x0d, 0x1a, 0x0e},
|
||||
},
|
||||
};
|
||||
|
||||
@ -158,19 +171,36 @@ namespace scene::tracker::cover {
|
||||
|
||||
const static float alpha = 207;
|
||||
|
||||
void draw_shroud(ta_parameter_writer& writer)
|
||||
void draw_shroud(ta_parameter_writer& writer, const cover& cover)
|
||||
{
|
||||
global_polygon_translucent(writer);
|
||||
|
||||
uint32_t a = ((uint32_t)(zoom_interp * alpha)) << 24;
|
||||
float z = 1.0 / 3.5f;
|
||||
|
||||
const vec3& bg = cover.color;
|
||||
int color = (((int)bg.x) << 24) | (((int)bg.y) << 8) | (((int)bg.z) << 0);
|
||||
|
||||
quad_type_0(writer,
|
||||
{0, 0, z},
|
||||
{(float)framebuffer.px_width, 0, z},
|
||||
{(float)framebuffer.px_width, (float)framebuffer.px_height, z},
|
||||
{0, (float)framebuffer.px_height, z},
|
||||
a | 0x202020);
|
||||
a | color);
|
||||
}
|
||||
|
||||
void update_background(const cover& cover)
|
||||
{
|
||||
vec3 newbg = lerp(bg_color, cover.color, 0.005);
|
||||
|
||||
if (newbg.x != bg_color.x || newbg.y != bg_color.y || newbg.z != bg_color.z) {
|
||||
bg_color = newbg;
|
||||
int color = (((int)newbg.x) << 24) | (((int)newbg.y) << 8) | (((int)newbg.z) << 0);
|
||||
|
||||
background_parameter2(texture_memory_alloc.background[1].start,
|
||||
color);
|
||||
holly.VO_BORDER_COL = color;
|
||||
}
|
||||
}
|
||||
|
||||
void draw(ta_multiwriter& multi, float x, float y, bool zoom)
|
||||
@ -180,6 +210,8 @@ namespace scene::tracker::cover {
|
||||
|
||||
const cover& cover = covers[cover_ix];
|
||||
|
||||
update_background(cover);
|
||||
|
||||
uint32_t texture_size = cover.texture_size
|
||||
| tsp_instruction_word::dst_alpha_instr::zero;
|
||||
|
||||
@ -231,6 +263,6 @@ namespace scene::tracker::cover {
|
||||
base_color);
|
||||
|
||||
if (zoom_interp > 0)
|
||||
draw_shroud(multi.op);
|
||||
draw_shroud(multi.op, cover);
|
||||
}
|
||||
}
|
||||
|
@ -177,8 +177,8 @@ namespace scene::tracker {
|
||||
void init()
|
||||
{
|
||||
background_parameter2(texture_memory_alloc.background[1].start,
|
||||
0x110012);
|
||||
holly.VO_BORDER_COL = 0x110012;
|
||||
0x000000);
|
||||
holly.VO_BORDER_COL = 0x000000;
|
||||
|
||||
::scene::options::init();
|
||||
|
||||
|
@ -78,7 +78,7 @@ namespace scene::tracker::tracklist {
|
||||
|
||||
transfer_string(writer, (const char *)interpreter::state.xm.instrument_header[i]->instrument_name,
|
||||
x+1, y+1, 1.0 / 11.0,
|
||||
0x444444);
|
||||
0x000000);
|
||||
y += glyph::vert_advance + 1;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user