diff --git a/cover/silvertreesfull.png b/cover/silvertreesfull.png index f3c0606..e09164e 100644 Binary files a/cover/silvertreesfull.png and b/cover/silvertreesfull.png differ diff --git a/src/scene/tracker/cover.cpp b/src/scene/tracker/cover.cpp index 9fc9a05..5d34ddb 100644 --- a/src/scene/tracker/cover.cpp +++ b/src/scene/tracker/cover.cpp @@ -19,6 +19,7 @@ namespace scene::tracker::cover { float height; float scale; vec3 color; + uint32_t texture_full_offset; }; int cover_ix = -1; @@ -27,6 +28,15 @@ namespace scene::tracker::cover { static vec3 bg_color = {0, 0, 0}; + const uint32_t full_texture_size = tsp_instruction_word::texture_u_size::from_int(512) + | tsp_instruction_word::texture_v_size::from_int(512); + + const float full_texture_width = 1.0 / 512.f; + const float full_texture_height = 1.0 / 512.f; + + const float full_width = 432.0f; + const float full_height = 432.0f; + static const cover covers[] = { [thebeach] = { .texture_offset = texture::offset::thebeach, @@ -49,6 +59,7 @@ namespace scene::tracker::cover { .height = 72, .scale = 6, .color = {0x0d, 0x10, 0x1a}, + .texture_full_offset = texture::offset::silvertreesfull, }, [redtree] = { .texture_offset = texture::offset::redtree, @@ -60,6 +71,7 @@ namespace scene::tracker::cover { .height = 72, .scale = 6, .color = {0x1a, 0x00, 0x00}, + .texture_full_offset = texture::offset::redtreefull, }, [mountain] = { .texture_offset = texture::offset::mountain, @@ -151,6 +163,14 @@ namespace scene::tracker::cover { }; } + constexpr inline vec2 transform_texture_full(const vec2& t) + { + return { + (t.x * full_width) * full_texture_width, + (t.y * full_height) * full_texture_height, + }; + } + constexpr inline vec2 transform_texture(const cover& cover, const vec2& t) { @@ -223,15 +243,6 @@ namespace scene::tracker::cover { update_background(cover); - uint32_t texture_size = cover.texture_size - | tsp_instruction_word::dst_alpha_instr::zero; - - global_polygon_textured(multi.op, - para_control::list_type::translucent, - cover.texture_offset, - texture_size, - texture_control_word::pixel_format::_565); - float z = 1.0 / 3.0f; int base_color = 0xffffff; @@ -266,12 +277,61 @@ namespace scene::tracker::cover { vec2 ct = transform_texture(cover, vtx[2]); vec2 dt = transform_texture(cover, vtx[3]); - quad_type_3(multi.op, - ap, at, - bp, bt, - cp, ct, - dp, dt, - base_color); + if (cover.texture_full_offset == 0) { + uint32_t texture_size = cover.texture_size + | tsp_instruction_word::dst_alpha_instr::zero; + + global_polygon_textured(multi.op, + para_control::list_type::translucent, + cover.texture_offset, + texture_size, + texture_control_word::pixel_format::_565); + + quad_type_3(multi.op, + ap, at, + bp, bt, + cp, ct, + dp, dt, + base_color); + } else { + vec2 atf = transform_texture_full(vtx[0]); + vec2 btf = transform_texture_full(vtx[1]); + vec2 ctf = transform_texture_full(vtx[2]); + vec2 dtf = transform_texture_full(vtx[3]); + + uint32_t texture_size = cover.texture_size + | tsp_instruction_word::dst_alpha_instr::zero; + + global_polygon_textured_tl(multi.op, + para_control::list_type::translucent, + cover.texture_offset, + texture_size, + texture_control_word::pixel_format::_565); + + uint32_t alpha0 = (uint32_t)(255.0 * (1.0 - zoom_interp)) << 24; + + quad_type_3(multi.op, + ap, at, + bp, bt, + cp, ct, + dp, dt, + alpha0 | base_color); + + uint32_t alpha1 = (uint32_t)(255.0 * (zoom_interp)) << 24; + + global_polygon_textured_tl(multi.op, + para_control::list_type::translucent, + cover.texture_full_offset, + full_texture_size | tsp_instruction_word::dst_alpha_instr::inverse_src_alpha, + texture_control_word::pixel_format::_565); + + quad_type_3(multi.op, + ap, atf, + bp, btf, + cp, ctf, + dp, dtf, + alpha1 | base_color); + } if (zoom_interp > 0) draw_shroud(multi.op, cover); diff --git a/src/ta_parameter.hpp b/src/ta_parameter.hpp index 432aedb..0a46865 100644 --- a/src/ta_parameter.hpp +++ b/src/ta_parameter.hpp @@ -45,6 +45,42 @@ static inline void global_polygon_textured(ta_parameter_writer& writer, ); } +static inline void global_polygon_textured_tl(ta_parameter_writer& writer, + uint32_t list_type, + uint32_t texture_offset, + uint32_t texture_size, + uint32_t pixel_format) +{ + const uint32_t parameter_control_word = para_control::para_type::polygon_or_modifier_volume + | list_type + | obj_control::col_type::packed_color + | obj_control::texture + ; + + const uint32_t isp_tsp_instruction_word = isp_tsp_instruction_word::depth_compare_mode::greater_or_equal + | isp_tsp_instruction_word::culling_mode::no_culling; + + const uint32_t tsp_instruction_word = tsp_instruction_word::texture_shading_instruction::modulate_alpha + | tsp_instruction_word::src_alpha_instr::src_alpha + | tsp_instruction_word::fog_control::no_fog + | tsp_instruction_word::use_alpha + | texture_size; + + const uint32_t texture_address = texture_memory_alloc.texture.start + texture_offset; + const uint32_t texture_control_word = pixel_format + | texture_control_word::scan_order::twiddled + | texture_control_word::texture_address(texture_address / 8); + + writer.append() = + ta_global_parameter::polygon_type_0(parameter_control_word, + isp_tsp_instruction_word, + tsp_instruction_word, + texture_control_word, + 0, // data_size_for_sort_dma + 0 // next_address_for_sort_dma + ); +} + static inline void global_polygon_intensity(ta_parameter_writer& writer, uint32_t list_type, uint32_t texture_offset, diff --git a/src/texture.cpp b/src/texture.cpp index 3ee7122..81ea0d4 100644 --- a/src/texture.cpp +++ b/src/texture.cpp @@ -23,6 +23,8 @@ #include "cover/thebeach.data.h" #include "cover/tree.data.h" #include "cover/moonmountains.data.h" +#include "cover/redtreefull.data.h" +#include "cover/silvertreesfull.data.h" #include "printf/printf.h" @@ -94,6 +96,16 @@ namespace texture { .size = reinterpret_cast(&_binary_cover_moonmountains_data_size), .offset = offset::moonmountains, }, + { + .start = reinterpret_cast(&_binary_cover_redtreefull_data_start), + .size = reinterpret_cast(&_binary_cover_redtreefull_data_size), + .offset = offset::redtreefull, + }, + { + .start = reinterpret_cast(&_binary_cover_silvertreesfull_data_start), + .size = reinterpret_cast(&_binary_cover_silvertreesfull_data_size), + .offset = offset::silvertreesfull, + }, }; const int textures_length = (sizeof (textures)) / (sizeof (textures[0])); diff --git a/src/texture.hpp b/src/texture.hpp index b44d46e..7de99c2 100644 --- a/src/texture.hpp +++ b/src/texture.hpp @@ -21,6 +21,8 @@ namespace texture { constexpr int thebeach = silvertrees + 32768; constexpr int tree = thebeach + 32768; constexpr int moonmountains= tree + 32768; + constexpr int redtreefull = moonmountains+ 32768; + constexpr int silvertreesfull = redtreefull+ 524288; }; extern struct texture textures[]; diff --git a/xm_player.mk b/xm_player.mk index 12f4698..3b9c3e3 100644 --- a/xm_player.mk +++ b/xm_player.mk @@ -22,7 +22,9 @@ TEXTURE_OBJ = \ cover/silvertrees.data.o \ cover/thebeach.data.o \ cover/tree.data.o \ - cover/moonmountains.data.o + cover/moonmountains.data.o \ + cover/redtreefull.data.o \ + cover/silvertreesfull.data.o PCM_OBJ = \ pcm/start3.adpcm.o \