animated 32bit logo
This commit is contained in:
parent
3474099acc
commit
2b96cea9fc
@ -4182,12 +4182,3 @@ const object objects[] = {
|
|||||||
.location = {0.000000, 0.000000, 0.000000},
|
.location = {0.000000, 0.000000, 0.000000},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const material materials[] = {
|
|
||||||
{
|
|
||||||
.start = (void *)&_binary_model_cars_32BitColors_data_start,
|
|
||||||
.size = (int)&_binary_model_cars_32BitColors_data_size,
|
|
||||||
.offset = 0,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ static const scene::scene scenes[] = {
|
|||||||
scene::logo::scene,
|
scene::logo::scene,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const scene::scene * current_scene = &scenes[0];
|
static const scene::scene * current_scene = &scenes[1];
|
||||||
|
|
||||||
void graphics_interrupt(uint32_t istnrm)
|
void graphics_interrupt(uint32_t istnrm)
|
||||||
{
|
{
|
||||||
@ -117,7 +117,7 @@ void graphics_event(ta_parameter_writer& writer)
|
|||||||
{
|
{
|
||||||
writer.offset = 0;
|
writer.offset = 0;
|
||||||
|
|
||||||
scene::tracker::transfer(writer);
|
current_scene->transfer(writer);
|
||||||
|
|
||||||
while (ta_in_use);
|
while (ta_in_use);
|
||||||
while (core_in_use);
|
while (core_in_use);
|
||||||
|
@ -51,7 +51,7 @@ void vbr600()
|
|||||||
aica::tactl_tima::TACTL(0) // increment once every sample
|
aica::tactl_tima::TACTL(0) // increment once every sample
|
||||||
| aica::tactl_tima::TIMA(0xffff) // interrupt after 1 counts
|
| aica::tactl_tima::TIMA(0xffff) // interrupt after 1 counts
|
||||||
;
|
;
|
||||||
interpreter::interrupt();
|
//interpreter::interrupt();
|
||||||
} else if (sh7091.CCN.EXPEVT == 0 && sh7091.CCN.INTEVT == 0x400) { // TMU0
|
} else if (sh7091.CCN.EXPEVT == 0 && sh7091.CCN.INTEVT == 0x400) { // TMU0
|
||||||
sh7091.TMU.TCR0
|
sh7091.TMU.TCR0
|
||||||
= tmu::tcr0::UNIE
|
= tmu::tcr0::UNIE
|
||||||
|
@ -1,7 +1,49 @@
|
|||||||
|
#include "math/float_types.hpp"
|
||||||
|
#include "math/transform.hpp"
|
||||||
|
|
||||||
#include "ta_parameter.hpp"
|
#include "ta_parameter.hpp"
|
||||||
|
|
||||||
#include "scene/logo/scene.hpp"
|
#include "scene/logo/scene.hpp"
|
||||||
|
|
||||||
|
#include "texture.hpp"
|
||||||
|
#include "framebuffer.hpp"
|
||||||
|
|
||||||
|
#include "model/blender_export.h"
|
||||||
|
#include "model/32bitlogo/model.h"
|
||||||
|
|
||||||
|
static vec3 screen_transform(const vec3& v)
|
||||||
|
{
|
||||||
|
return {v.x, v.y, 1.0f / v.z};
|
||||||
|
}
|
||||||
|
|
||||||
|
static void render_mesh(ta_parameter_writer& writer, const mesh& mesh, const mat4x4& trans)
|
||||||
|
{
|
||||||
|
const int base_color = 0xffffff;
|
||||||
|
|
||||||
|
vec3 position_cache[mesh.position_length];
|
||||||
|
for (int i = 0; i < mesh.position_length; i++) {
|
||||||
|
position_cache[i] = screen_transform(trans * mesh.position[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < mesh.polygons_length; i++) {
|
||||||
|
const polygon& p = mesh.polygons[i];
|
||||||
|
|
||||||
|
vec3 ap = position_cache[p.a];
|
||||||
|
vec3 bp = position_cache[p.b];
|
||||||
|
vec3 cp = position_cache[p.c];
|
||||||
|
|
||||||
|
vec2 at = mesh.uv_layers[0][p.uv_index + 0];
|
||||||
|
vec2 bt = mesh.uv_layers[0][p.uv_index + 1];
|
||||||
|
vec2 ct = mesh.uv_layers[0][p.uv_index + 2];
|
||||||
|
|
||||||
|
tri_type_3(writer,
|
||||||
|
ap, at,
|
||||||
|
bp, bt,
|
||||||
|
cp, ct,
|
||||||
|
base_color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
namespace scene::logo {
|
namespace scene::logo {
|
||||||
|
|
||||||
const struct scene::scene scene = {
|
const struct scene::scene scene = {
|
||||||
@ -20,9 +62,83 @@ namespace scene::logo {
|
|||||||
.transfer = transfer,
|
.transfer = transfer,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static int tick = 0;
|
||||||
|
static int last_tick = 0;
|
||||||
|
|
||||||
|
struct keyframe {
|
||||||
|
float rx;
|
||||||
|
float ry;
|
||||||
|
float duration;
|
||||||
|
};
|
||||||
|
|
||||||
|
const struct keyframe keyframes[] = {
|
||||||
|
{
|
||||||
|
.rx = 0,
|
||||||
|
.ry = 0,
|
||||||
|
.duration = 1.0 / (5 * 60),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.rx = pi / 4,
|
||||||
|
.ry = pi + pi / 4,
|
||||||
|
.duration = 1.0 / (10 * 60),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
static inline float clamp(float f)
|
||||||
|
{
|
||||||
|
if (f > 1.0)
|
||||||
|
return 1.0;
|
||||||
|
else if (f < 0.0)
|
||||||
|
return 0.0;
|
||||||
|
else
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline keyframe interpolate(const keyframe& a, const keyframe& b, const float dt)
|
||||||
|
{
|
||||||
|
float ratio = clamp(dt * a.duration);
|
||||||
|
|
||||||
|
float drx = b.rx - a.rx;
|
||||||
|
float dry = b.ry - a.ry;
|
||||||
|
|
||||||
|
return {
|
||||||
|
.rx = a.rx + drx * ratio,
|
||||||
|
.ry = a.ry + dry * ratio,
|
||||||
|
.duration = a.duration,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
void transfer(ta_parameter_writer& writer)
|
void transfer(ta_parameter_writer& writer)
|
||||||
{
|
{
|
||||||
|
uint32_t texture_size = tsp_instruction_word::texture_u_size::from_int(8)
|
||||||
|
| tsp_instruction_word::texture_v_size::from_int(8);
|
||||||
|
|
||||||
|
global_polygon_textured(writer,
|
||||||
|
para_control::list_type::opaque,
|
||||||
|
texture::offset::logo,
|
||||||
|
texture_size,
|
||||||
|
texture_control_word::pixel_format::_565);
|
||||||
|
|
||||||
|
vec3 t = {framebuffer.px_width / 2.f, framebuffer.px_height / 2.f, 0};
|
||||||
|
float s = framebuffer.px_height / 3.f;
|
||||||
|
|
||||||
|
keyframe k = interpolate(keyframes[0], keyframes[1], tick - last_tick);
|
||||||
|
|
||||||
|
mat4x4 trans
|
||||||
|
= translate(t)
|
||||||
|
* scale((vec3){s, s, 1})
|
||||||
|
* translate((vec3){0, 0, 10})
|
||||||
|
//* rotate_x(pi / 8)
|
||||||
|
//* rotate_y(pi + pi/8)
|
||||||
|
* rotate_x(k.rx)
|
||||||
|
* rotate_y(k.ry)
|
||||||
|
* scale((vec3){-1, -1, 1});
|
||||||
|
|
||||||
|
render_mesh(writer, mesh_logo, trans);
|
||||||
|
|
||||||
writer.append<ta_global_parameter::end_of_list>() =
|
writer.append<ta_global_parameter::end_of_list>() =
|
||||||
ta_global_parameter::end_of_list(para_control::para_type::end_of_list);
|
ta_global_parameter::end_of_list(para_control::para_type::end_of_list);
|
||||||
|
|
||||||
|
tick += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include "../../framebuffer.hpp"
|
#include "../../framebuffer.hpp"
|
||||||
|
|
||||||
#include "channel_status.hpp"
|
#include "channel_status.hpp"
|
||||||
|
#include "texture.hpp"
|
||||||
|
|
||||||
static inline int round_up_div(int n, int m)
|
static inline int round_up_div(int n, int m)
|
||||||
{
|
{
|
||||||
@ -70,8 +71,14 @@ void transfer(ta_parameter_writer& writer, int x, int y)
|
|||||||
base_color);
|
base_color);
|
||||||
|
|
||||||
if (ch < state.xm.number_of_channels) {
|
if (ch < state.xm.number_of_channels) {
|
||||||
|
uint32_t texture_size = tsp_instruction_word::texture_u_size::from_int(128)
|
||||||
|
| tsp_instruction_word::texture_v_size::from_int(256);
|
||||||
|
|
||||||
global_polygon_textured(writer,
|
global_polygon_textured(writer,
|
||||||
para_control::list_type::opaque);
|
para_control::list_type::opaque,
|
||||||
|
texture::offset::tandy1k,
|
||||||
|
texture_size,
|
||||||
|
texture_control_word::pixel_format::_4bpp_palette);
|
||||||
|
|
||||||
int hori_center = inner_width / 2 - (glyph::hori_advance * (ch >= 10)) / 2;
|
int hori_center = inner_width / 2 - (glyph::hori_advance * (ch >= 10)) / 2;
|
||||||
transfer_integer(writer, ch, xi + hori_center, y + vert_center,
|
transfer_integer(writer, ch, xi + hori_center, y + vert_center,
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include "notes.hpp"
|
#include "notes.hpp"
|
||||||
#include "channel_status.hpp"
|
#include "channel_status.hpp"
|
||||||
|
#include "texture.hpp"
|
||||||
|
|
||||||
namespace scene::tracker {
|
namespace scene::tracker {
|
||||||
|
|
||||||
@ -31,8 +32,14 @@ namespace scene::tracker {
|
|||||||
const int y = 100;
|
const int y = 100;
|
||||||
|
|
||||||
{ // punch-through
|
{ // punch-through
|
||||||
|
uint32_t texture_size = tsp_instruction_word::texture_u_size::from_int(128)
|
||||||
|
| tsp_instruction_word::texture_v_size::from_int(256);
|
||||||
|
|
||||||
global_polygon_textured(writer,
|
global_polygon_textured(writer,
|
||||||
para_control::list_type::punch_through);
|
para_control::list_type::punch_through,
|
||||||
|
texture::offset::tandy1k,
|
||||||
|
texture_size,
|
||||||
|
texture_control_word::pixel_format::_4bpp_palette);
|
||||||
|
|
||||||
tracker::notes::transfer_lines(writer, x, y);
|
tracker::notes::transfer_lines(writer, x, y);
|
||||||
|
|
||||||
|
@ -8,7 +8,11 @@
|
|||||||
#include "holly/texture_memory_alloc9.hpp"
|
#include "holly/texture_memory_alloc9.hpp"
|
||||||
#include "math/float_types.hpp"
|
#include "math/float_types.hpp"
|
||||||
|
|
||||||
static inline void global_polygon_textured(ta_parameter_writer& writer, uint32_t list_type)
|
static inline void global_polygon_textured(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
|
const uint32_t parameter_control_word = para_control::para_type::polygon_or_modifier_volume
|
||||||
| list_type
|
| list_type
|
||||||
@ -23,11 +27,10 @@ static inline void global_polygon_textured(ta_parameter_writer& writer, uint32_t
|
|||||||
| tsp_instruction_word::src_alpha_instr::one
|
| tsp_instruction_word::src_alpha_instr::one
|
||||||
| tsp_instruction_word::dst_alpha_instr::zero
|
| tsp_instruction_word::dst_alpha_instr::zero
|
||||||
| tsp_instruction_word::fog_control::no_fog
|
| tsp_instruction_word::fog_control::no_fog
|
||||||
| tsp_instruction_word::texture_u_size::from_int(128)
|
| texture_size;
|
||||||
| tsp_instruction_word::texture_v_size::from_int(256);
|
|
||||||
|
|
||||||
const uint32_t texture_address = texture_memory_alloc.texture.start;
|
const uint32_t texture_address = texture_memory_alloc.texture.start + texture_offset;
|
||||||
const uint32_t texture_control_word = texture_control_word::pixel_format::_4bpp_palette
|
const uint32_t texture_control_word = pixel_format
|
||||||
| texture_control_word::scan_order::twiddled
|
| texture_control_word::scan_order::twiddled
|
||||||
| texture_control_word::texture_address(texture_address / 8);
|
| texture_control_word::texture_address(texture_address / 8);
|
||||||
|
|
||||||
@ -106,6 +109,31 @@ static inline void quad_type_3(ta_parameter_writer& writer,
|
|||||||
base_color, 0);
|
base_color, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void tri_type_3(ta_parameter_writer& writer,
|
||||||
|
const vec3& ap, const vec2& at,
|
||||||
|
const vec3& bp, const vec2& bt,
|
||||||
|
const vec3& cp, const vec2& ct,
|
||||||
|
int base_color)
|
||||||
|
{
|
||||||
|
writer.append<ta_vertex_parameter::polygon_type_3>() =
|
||||||
|
ta_vertex_parameter::polygon_type_3(polygon_vertex_parameter_control_word(false),
|
||||||
|
ap.x, ap.y, ap.z,
|
||||||
|
at.x, at.y,
|
||||||
|
base_color, 0);
|
||||||
|
|
||||||
|
writer.append<ta_vertex_parameter::polygon_type_3>() =
|
||||||
|
ta_vertex_parameter::polygon_type_3(polygon_vertex_parameter_control_word(false),
|
||||||
|
bp.x, bp.y, bp.z,
|
||||||
|
bt.x, bt.y,
|
||||||
|
base_color, 0);
|
||||||
|
|
||||||
|
writer.append<ta_vertex_parameter::polygon_type_3>() =
|
||||||
|
ta_vertex_parameter::polygon_type_3(polygon_vertex_parameter_control_word(true),
|
||||||
|
cp.x, cp.y, cp.z,
|
||||||
|
ct.x, ct.y,
|
||||||
|
base_color, 0);
|
||||||
|
}
|
||||||
|
|
||||||
static inline void quad_type_0(ta_parameter_writer& writer,
|
static inline void quad_type_0(ta_parameter_writer& writer,
|
||||||
const vec3& ap,
|
const vec3& ap,
|
||||||
const vec3& bp,
|
const vec3& bp,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user