Text rendering optimizations + resolution increase on normal font

Increased resolution of normal font 2x
Combined all normal font characters into a sprite sheet
Adjusted kerning on normal font
Removed 'rotatedUV' setting for DJUI fonts
This commit is contained in:
MysterD 2023-04-02 13:16:32 -07:00
parent e578943700
commit 68346eecf1
101 changed files with 159 additions and 724 deletions

View File

@ -3511,535 +3511,25 @@ const s16 seg2_painting_mesh_neighbor_tris[] = {
//////////////////////////////////////////////////////////
ALIGNED8 static const u8 texture_font_normal_char_03[] = {
#include "textures/segment2/custom_font_normal_char_03.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_04[] = {
#include "textures/segment2/custom_font_normal_char_04.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_10[] = {
#include "textures/segment2/custom_font_normal_char_10.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_11[] = {
#include "textures/segment2/custom_font_normal_char_11.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_15[] = {
#include "textures/segment2/custom_font_normal_char_15.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_26[] = {
#include "textures/segment2/custom_font_normal_char_26.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_27[] = {
#include "textures/segment2/custom_font_normal_char_27.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_28[] = {
#include "textures/segment2/custom_font_normal_char_28.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_29[] = {
#include "textures/segment2/custom_font_normal_char_29.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_30[] = {
#include "textures/segment2/custom_font_normal_char_30.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_32[] = {
#include "textures/segment2/custom_font_normal_char_32.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_59[] = {
#include "textures/segment2/custom_font_normal_char_59.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_60[] = {
#include "textures/segment2/custom_font_normal_char_60.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_61[] = {
#include "textures/segment2/custom_font_normal_char_61.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_62[] = {
#include "textures/segment2/custom_font_normal_char_62.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_63[] = {
#include "textures/segment2/custom_font_normal_char_63.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_64[] = {
#include "textures/segment2/custom_font_normal_char_64.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_91[] = {
#include "textures/segment2/custom_font_normal_char_91.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_92[] = {
#include "textures/segment2/custom_font_normal_char_92.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_93[] = {
#include "textures/segment2/custom_font_normal_char_93.ia4.inc.c"
};
// extended
ALIGNED8 static const u8 texture_font_normal_char_ca_a[] = {
#include "textures/segment2/custom_font_normal_char_ca_a.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_ca_ang[] = {
#include "textures/segment2/custom_font_normal_char_ca_ang.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_ca_c[] = {
#include "textures/segment2/custom_font_normal_char_ca_c.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_ca_g[] = {
#include "textures/segment2/custom_font_normal_char_ca_g.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_ca_t[] = {
#include "textures/segment2/custom_font_normal_char_ca_t.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_ca_u[] = {
#include "textures/segment2/custom_font_normal_char_ca_u.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_cc_ced[] = {
#include "textures/segment2/custom_font_normal_char_cc_ced.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_ce_a[] = {
#include "textures/segment2/custom_font_normal_char_ce_a.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_ce_c[] = {
#include "textures/segment2/custom_font_normal_char_ce_c.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_ce_g[] = {
#include "textures/segment2/custom_font_normal_char_ce_g.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_ce_u[] = {
#include "textures/segment2/custom_font_normal_char_ce_u.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_ci_a[] = {
#include "textures/segment2/custom_font_normal_char_ci_a.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_ci_c[] = {
#include "textures/segment2/custom_font_normal_char_ci_c.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_ci_g[] = {
#include "textures/segment2/custom_font_normal_char_ci_g.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_ci_u[] = {
#include "textures/segment2/custom_font_normal_char_ci_u.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_cn_t[] = {
#include "textures/segment2/custom_font_normal_char_cn_t.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_co_a[] = {
#include "textures/segment2/custom_font_normal_char_co_a.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_co_c[] = {
#include "textures/segment2/custom_font_normal_char_co_c.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_co_g[] = {
#include "textures/segment2/custom_font_normal_char_co_g.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_co_u[] = {
#include "textures/segment2/custom_font_normal_char_co_u.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_co_t[] = {
#include "textures/segment2/custom_font_normal_char_co_t.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_cu_a[] = {
#include "textures/segment2/custom_font_normal_char_cu_a.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_cu_c[] = {
#include "textures/segment2/custom_font_normal_char_cu_c.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_cu_g[] = {
#include "textures/segment2/custom_font_normal_char_cu_g.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_cu_u[] = {
#include "textures/segment2/custom_font_normal_char_cu_u.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_cy_a[] = {
#include "textures/segment2/custom_font_normal_char_cy_a.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_cy_u[] = {
#include "textures/segment2/custom_font_normal_char_cy_u.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_la_a[] = {
#include "textures/segment2/custom_font_normal_char_la_a.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_la_ang[] = {
#include "textures/segment2/custom_font_normal_char_la_ang.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_la_c[] = {
#include "textures/segment2/custom_font_normal_char_la_c.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_la_g[] = {
#include "textures/segment2/custom_font_normal_char_la_g.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_la_t[] = {
#include "textures/segment2/custom_font_normal_char_la_t.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_la_u[] = {
#include "textures/segment2/custom_font_normal_char_la_u.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_lc_ced[] = {
#include "textures/segment2/custom_font_normal_char_lc_ced.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_le_a[] = {
#include "textures/segment2/custom_font_normal_char_le_a.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_le_c[] = {
#include "textures/segment2/custom_font_normal_char_le_c.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_le_g[] = {
#include "textures/segment2/custom_font_normal_char_le_g.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_le_u[] = {
#include "textures/segment2/custom_font_normal_char_le_u.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_li_a[] = {
#include "textures/segment2/custom_font_normal_char_li_a.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_li_c[] = {
#include "textures/segment2/custom_font_normal_char_li_c.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_li_g[] = {
#include "textures/segment2/custom_font_normal_char_li_g.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_li_u[] = {
#include "textures/segment2/custom_font_normal_char_li_u.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_ln_t[] = {
#include "textures/segment2/custom_font_normal_char_ln_t.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_lo_a[] = {
#include "textures/segment2/custom_font_normal_char_lo_a.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_lo_c[] = {
#include "textures/segment2/custom_font_normal_char_lo_c.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_lo_g[] = {
#include "textures/segment2/custom_font_normal_char_lo_g.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_lo_u[] = {
#include "textures/segment2/custom_font_normal_char_lo_u.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_lo_t[] = {
#include "textures/segment2/custom_font_normal_char_lo_t.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_lu_a[] = {
#include "textures/segment2/custom_font_normal_char_lu_a.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_lu_c[] = {
#include "textures/segment2/custom_font_normal_char_lu_c.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_lu_g[] = {
#include "textures/segment2/custom_font_normal_char_lu_g.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_lu_u[] = {
#include "textures/segment2/custom_font_normal_char_lu_u.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_ly_a[] = {
#include "textures/segment2/custom_font_normal_char_ly_a.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_ly_u[] = {
#include "textures/segment2/custom_font_normal_char_ly_u.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_lae[] = {
#include "textures/segment2/custom_font_normal_char_lae.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_cae[] = {
#include "textures/segment2/custom_font_normal_char_cae.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_loe[] = {
#include "textures/segment2/custom_font_normal_char_loe.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_coe[] = {
#include "textures/segment2/custom_font_normal_char_coe.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_leth[] = {
#include "textures/segment2/custom_font_normal_char_leth.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_ceth[] = {
#include "textures/segment2/custom_font_normal_char_ceth.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_los[] = {
#include "textures/segment2/custom_font_normal_char_los.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_cos[] = {
#include "textures/segment2/custom_font_normal_char_cos.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_ss[] = {
#include "textures/segment2/custom_font_normal_char_ss.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_punc_sp_ex[] = {
#include "textures/segment2/custom_font_normal_char_punc_sp_ex.ia4.inc.c"
};
ALIGNED8 static const u8 texture_font_normal_char_punc_sp_qu[] = {
#include "textures/segment2/custom_font_normal_char_punc_sp_qu.ia4.inc.c"
};
ALIGNED8 const u8 texture_font_normal[] = {
#include "textures/custom_font_title/custom_font_normal.rgba32.inc.c"
};
const u8* const font_normal_chars[] = {
texture_font_char_us_exclamation, // !
texture_font_char_us_double_quote_open, // "
texture_font_normal_char_03, // #
texture_font_normal_char_04, // $
texture_font_char_us_percent, // %
texture_font_char_us_ampersand, // &
texture_font_char_us_apostrophe, // '
texture_font_char_us_open_parentheses, // (
texture_font_char_us_close_parentheses, // )
texture_font_normal_char_10, // *
texture_font_normal_char_11, // +
texture_font_char_us_comma, // ,
texture_font_char_us_slash, // -
texture_font_char_us_period, // .
texture_font_normal_char_15, // /
texture_font_char_us_0, // 0
texture_font_char_us_1, // 1
texture_font_char_us_2, // 2
texture_font_char_us_3, // 3
texture_font_char_us_4, // 4
texture_font_char_us_5, // 5
texture_font_char_us_6, // 6
texture_font_char_us_7, // 7
texture_font_char_us_8, // 8
texture_font_char_us_9, // 9
texture_font_normal_char_26, // :
texture_font_normal_char_27, // ;
texture_font_normal_char_28, // <
texture_font_normal_char_29, // =
texture_font_normal_char_30, // >
texture_font_char_us_question, // ?
texture_font_normal_char_32, // @
texture_font_char_us_A, // A
texture_font_char_us_B, // B
texture_font_char_us_C, // C
texture_font_char_us_D, // D
texture_font_char_us_E, // E
texture_font_char_us_F, // F
texture_font_char_us_G, // G
texture_font_char_us_H, // H
texture_font_char_us_I, // I
texture_font_char_us_J, // J
texture_font_char_us_K, // K
texture_font_char_us_L, // L
texture_font_char_us_M, // M
texture_font_char_us_N, // N
texture_font_char_us_O, // O
texture_font_char_us_P, // P
texture_font_char_us_Q, // Q
texture_font_char_us_R, // R
texture_font_char_us_S, // S
texture_font_char_us_T, // T
texture_font_char_us_U, // U
texture_font_char_us_V, // V
texture_font_char_us_W, // W
texture_font_char_us_X, // X
texture_font_char_us_Y, // Y
texture_font_char_us_Z, // Z
texture_font_normal_char_59, // [
texture_font_normal_char_60, // \ //
texture_font_normal_char_61, // ]
texture_font_normal_char_62, // ^
texture_font_normal_char_63, // _
texture_font_normal_char_64, // `
texture_font_char_us_a, // a
texture_font_char_us_b, // b
texture_font_char_us_c, // c
texture_font_char_us_d, // d
texture_font_char_us_e, // e
texture_font_char_us_f, // f
texture_font_char_us_g, // g
texture_font_char_us_h, // h
texture_font_char_us_i, // i
texture_font_char_us_j, // j
texture_font_char_us_k, // k
texture_font_char_us_l, // l
texture_font_char_us_m, // m
texture_font_char_us_n, // n
texture_font_char_us_o, // o
texture_font_char_us_p, // p
texture_font_char_us_q, // q
texture_font_char_us_r, // r
texture_font_char_us_s, // s
texture_font_char_us_t, // t
texture_font_char_us_u, // u
texture_font_char_us_v, // v
texture_font_char_us_w, // w
texture_font_char_us_x, // x
texture_font_char_us_y, // y
texture_font_char_us_z, // z
texture_font_normal_char_91, // {
texture_font_normal_char_92, // |
texture_font_normal_char_93, // }
texture_font_char_us_tilde, // ~
texture_font_char_us_star_filled, // DEL
texture_font_normal_char_ca_a, // Á
texture_font_normal_char_ca_ang, // Å
texture_font_normal_char_ca_c, // Â
texture_font_normal_char_ca_g, // À
texture_font_normal_char_ca_t, // Ã
texture_font_normal_char_ca_u, // Ä
texture_font_normal_char_cc_ced, // Ç
texture_font_normal_char_ce_a, // É
texture_font_normal_char_ce_c, // Ê
texture_font_normal_char_ce_g, // È
texture_font_normal_char_ce_u, // Ë
texture_font_normal_char_ci_a, // Í
texture_font_normal_char_ci_c, // Î
texture_font_normal_char_ci_g, // Ì
texture_font_normal_char_ci_u, // Ï
texture_font_normal_char_cn_t, // Ñ
texture_font_normal_char_co_a, // Ó
texture_font_normal_char_co_c, // Ô
texture_font_normal_char_co_g, // Ò
texture_font_normal_char_co_t, // Õ
texture_font_normal_char_co_u, // Ö
texture_font_normal_char_cu_a, // Ú
texture_font_normal_char_cu_c, // Û
texture_font_normal_char_cu_g, // Ù
texture_font_normal_char_cu_u, // Ü
texture_font_normal_char_cy_a, // Ý
texture_font_normal_char_cy_u, // Ÿ
texture_font_normal_char_la_a, // á
texture_font_normal_char_la_ang, // å
texture_font_normal_char_la_c, // â
texture_font_normal_char_la_g, // à
texture_font_normal_char_la_t, // ã
texture_font_normal_char_la_u, // ä
texture_font_normal_char_lc_ced, // ç
texture_font_normal_char_le_a, // é
texture_font_normal_char_le_c, // ê
texture_font_normal_char_le_g, // è
texture_font_normal_char_le_u, // ë
texture_font_normal_char_li_a, // í
texture_font_normal_char_li_c, // î
texture_font_normal_char_li_g, // ì
texture_font_normal_char_li_u, // ï
texture_font_normal_char_ln_t, // ñ
texture_font_normal_char_lo_a, // ó
texture_font_normal_char_lo_c, // ô
texture_font_normal_char_lo_g, // ò
texture_font_normal_char_lo_t, // õ
texture_font_normal_char_lo_u, // ö
texture_font_normal_char_lu_a, // ú
texture_font_normal_char_lu_c, // û
texture_font_normal_char_lu_g, // ù
texture_font_normal_char_lu_u, // ü
texture_font_normal_char_ly_a, // ý
texture_font_normal_char_ly_u, // ÿ
texture_font_normal_char_lae, // æ
texture_font_normal_char_cae, // Æ
texture_font_normal_char_loe, // œ
texture_font_normal_char_coe, // Œ
texture_font_normal_char_leth, // ð
texture_font_normal_char_ceth, // Ð
texture_font_normal_char_los, // ø
texture_font_normal_char_cos, // Ø
texture_font_normal_char_ss, // ß
texture_font_normal_char_punc_sp_ex, // ¡
texture_font_normal_char_punc_sp_qu, // ¿
};
const f32 font_normal_widths[] = {
/* ! " # $ % & ' ( ) * + , - . / */
0.3125f, 0.3750f, 0.4375f, 0.3750f, 0.4375f, 0.5000f, 0.2500f, 0.3125f, 0.3125f, 0.3750f, 0.4375f, 0.2500f, 0.3750f, 0.2500f, 0.3125f,
0.2200f, 0.3750f, 0.4375f, 0.3750f, 0.4375f, 0.5000f, 0.2500f, 0.3125f, 0.3125f, 0.3750f, 0.4375f, 0.2500f, 0.3750f, 0.2500f, 0.3125f,
/* 0 1 2 3 4 5 6 7 8 9 */
0.4375f, 0.4375f, 0.4375f, 0.4375f, 0.4375f, 0.4375f, 0.4375f, 0.4375f, 0.4375f, 0.4375f,
0.4375f, 0.3800f, 0.4200f, 0.4375f, 0.4300f, 0.4375f, 0.4375f, 0.4000f, 0.4375f, 0.4375f,
/* : ; < = > ? @ */
0.2500f, 0.2500f, 0.3125f, 0.3750f, 0.3125f, 0.4375f, 0.5750f,
0.2000f, 0.2500f, 0.3125f, 0.3750f, 0.3125f, 0.3125f, 0.5750f,
/* A B C D E F G H I J K L M N O P Q R S T U V W X Y Z */
0.3750f, 0.3750f, 0.3750f, 0.3750f, 0.3750f, 0.3750f, 0.3750f, 0.3750f, 0.3125f, 0.3750f, 0.3750f, 0.3125f, 0.5000f, 0.5000f, 0.3750f, 0.3750f, 0.3750f, 0.3750f, 0.3750f, 0.3125f, 0.3750f, 0.3750f, 0.5000f, 0.4375f, 0.3750f, 0.3750f,
0.3750f, 0.3750f, 0.3750f, 0.3750f, 0.3750f, 0.3125f, 0.3750f, 0.3750f, 0.3125f, 0.3750f, 0.3750f, 0.3125f, 0.5000f, 0.5000f, 0.3750f, 0.3750f, 0.3750f, 0.3750f, 0.3750f, 0.3125f, 0.3750f, 0.3750f, 0.5000f, 0.4375f, 0.3750f, 0.3750f,
/* [ \ ] ^ _ ` */
0.3125f, 0.3125f, 0.3125f, 0.3750f, 0.3750f, 0.2500f,
/* a b c d e f g h i j k l m n o p q r s t u v w x y z */
0.3750f, 0.3125f, 0.3125f, 0.3125f, 0.3125f, 0.3125f, 0.3750f, 0.3125f, 0.2500f, 0.3125f, 0.3125f, 0.1875f, 0.4375f, 0.3125f, 0.3125f, 0.3125f, 0.3750f, 0.3125f, 0.3125f, 0.3125f, 0.3125f, 0.3125f, 0.4375f, 0.4375f, 0.3125f, 0.3125f,
0.3000f, 0.3125f, 0.3125f, 0.3125f, 0.3125f, 0.3000f, 0.3750f, 0.3125f, 0.2200f, 0.3125f, 0.3125f, 0.1700f, 0.4350f, 0.3125f, 0.3000f, 0.3000f, 0.3125f, 0.2700f, 0.3125f, 0.3125f, 0.3125f, 0.2750f, 0.4375f, 0.3750f, 0.3125f, 0.3125f,
/* { | } ~ DEL */
0.3125f, 0.2500f, 0.3125f, 0.5000f, 0.5000f,
0.3125f, 0.2500f, 0.3125f, 0.5000f, 0.2000f,
};

View File

@ -64,7 +64,7 @@ struct DjuiBind* djui_bind_create(struct DjuiBase* parent, const char* message,
djui_base_set_size_type(&text->base, DJUI_SVT_RELATIVE, DJUI_SVT_RELATIVE);
djui_base_set_size(&text->base, 0.3f, 1.0f);
djui_text_set_alignment(text, DJUI_HALIGN_LEFT, DJUI_VALIGN_BOTTOM);
djui_text_set_drop_shadow(text, 120, 120, 120, 64);
djui_text_set_drop_shadow(text, 255, 255, 255, 128);
djui_base_set_color(&text->base, 200, 200, 200, 255);
bind->text = text;

View File

@ -11,11 +11,11 @@ static void djui_button_update_style(struct DjuiBase* base) {
} else if (gDjuiCursorDownOn == base) {
djui_base_set_border_color(base, 0, 84, 153, 255);
djui_base_set_color(&button->rect->base, 204, 228, 247, 255);
djui_base_set_location(&button->text->base, 0.5f, 0.5f);
djui_base_set_location(&button->text->base, 1.0f, 1.0f);
} else if (gDjuiHovered == base) {
djui_base_set_border_color(base, 0, 120, 215, 255);
djui_base_set_color(&button->rect->base, 229, 241, 251, 255);
djui_base_set_location(&button->text->base, -0.5f, -1.0f);
djui_base_set_location(&button->text->base, -1.0f, -1.0f);
} else {
u8 borderBrightness = button->style ? 100 : 150;
u8 rectBrightness = button->style ? 150 : 222;

View File

@ -63,7 +63,7 @@ struct DjuiCheckbox* djui_checkbox_create(struct DjuiBase* parent, const char* m
djui_base_set_size_type(&text->base, DJUI_SVT_RELATIVE, DJUI_SVT_RELATIVE);
djui_base_set_size(&text->base, 1.0f, 1.0f);
djui_text_set_alignment(text, DJUI_HALIGN_LEFT, DJUI_VALIGN_BOTTOM);
djui_text_set_drop_shadow(text, 120, 120, 120, 64);
djui_text_set_drop_shadow(text, 255, 255, 255, 128);
checkbox->text = text;
struct DjuiRect* rect = djui_rect_create(&checkbox->base);

View File

@ -6,52 +6,16 @@
// font 0 (built-in normal font) //
///////////////////////////////////
static Vtx djui_font_normal_vertices[] = {
{{{ 0, -1, 0}, 0, { 0, 256}, { 0xff, 0xff, 0xff, 0xff }}},
{{{ 0.5f, -1, 0}, 0, { 0, 0}, { 0xff, 0xff, 0xff, 0xff }}},
{{{ 0.5f, 0, 0}, 0, { 512, 0}, { 0xff, 0xff, 0xff, 0xff }}},
{{{ 0, 0, 0}, 0, { 512, 256}, { 0xff, 0xff, 0xff, 0xff }}},
};
const Gfx dl_font_normal_display_list_begin[] = {
gsDPPipeSync(),
gsSPClearGeometryMode(G_LIGHTING),
gsDPSetCombineMode(G_CC_FADEA, G_CC_FADEA),
gsDPSetRenderMode(G_RM_XLU_SURF, G_RM_XLU_SURF2),
gsDPSetTextureFilter(G_TF_POINT),
gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON),
gsDPSetTile(G_IM_FMT_IA, G_IM_SIZ_4b, 1, 0, G_TX_RENDERTILE, 0, G_TX_WRAP | G_TX_NOMIRROR, 3, G_TX_NOLOD, G_TX_WRAP | G_TX_NOMIRROR, 4, G_TX_NOLOD),
gsDPSetTileSize(0, 0, 0, (16 - 1) << G_TEXTURE_IMAGE_FRAC, (8 - 1) << G_TEXTURE_IMAGE_FRAC),
gsSPEndDisplayList(),
};
const Gfx dl_font_normal_display_list[] = {
gsDPLoadBlock(G_TX_LOADTILE, 0, 0, ((16 * 8 + G_IM_SIZ_4b_INCR) >> G_IM_SIZ_4b_SHIFT) - 1, CALC_DXT(16, G_IM_SIZ_4b_BYTES)),
gsSPVertexDjui(djui_font_normal_vertices, 4, 0),
gsSPExecuteDjui(G_TEXCLIP_DJUI),
gsSP2TrianglesDjui(0, 1, 2, 0x0, 0, 2, 3, 0x0),
gsSPEndDisplayList(),
};
static void djui_font_normal_render_char(char* c) {
// replace undisplayable characters
if (*c == ' ') { return; }
u32 index = djui_unicode_get_sprite_index(c);
//extern const u8* const font_normal_chars[];
//void* fontChar = (void*)font_normal_chars[index];
extern ALIGNED8 const u8 texture_font_normal[];
void* fontChar = texture_font_normal;
//djui_gfx_render_texture(texture_font_normal, 256, 128, 32);
//djui_gfx_render_texture_tile(texture_font_normal, 8, 16, 32, 0, 0, 256, 128);
u32 tx = index % 32;
u32 ty = index / 32;
djui_gfx_render_texture_tile(texture_font_normal, 256, 128, 32, tx * 8, ty * 16, 8, 16);
//gDPSetTextureImage(gDisplayListHead++, G_IM_FMT_IA, G_IM_SIZ_16b, 1, (void*)fontChar);
//gSPDisplayList(gDisplayListHead++, dl_font_normal_display_list);
extern ALIGNED8 const u8 texture_font_normal[];
djui_gfx_render_texture_tile(texture_font_normal, 512, 256, 32, tx * 16 + 1, ty * 32, 16, 32);
}
static f32 djui_font_normal_char_width(char* c) {
@ -65,8 +29,7 @@ static const struct DjuiFont sDjuiFontNormal = {
.charHeight = 1.0f,
.lineHeight = 0.8125f,
.defaultFontScale = 32.0f,
.rotatedUV = false,
.textBeginDisplayList = NULL, //dl_font_normal_display_list_begin,
.textBeginDisplayList = NULL,
.render_char = djui_font_normal_render_char,
.char_width = djui_font_normal_char_width,
};
@ -97,7 +60,6 @@ static const struct DjuiFont sDjuiFontTitle = {
.charHeight = 0.9f,
.lineHeight = 0.7f,
.defaultFontScale = 64.0f,
.rotatedUV = false,
.textBeginDisplayList = NULL,
.render_char = djui_font_title_render_char,
.char_width = djui_font_title_char_width,
@ -150,7 +112,6 @@ static const struct DjuiFont sDjuiFontHud = {
.charHeight = 0.9f,
.lineHeight = 0.7f,
.defaultFontScale = 16.0f,
.rotatedUV = false,
.textBeginDisplayList = NULL,
.render_char = djui_font_hud_render_char,
.char_width = djui_font_hud_char_width,

View File

@ -7,7 +7,6 @@ struct DjuiFont {
f32 lineHeight;
f32 defaultFontScale;
u8 textureBitSize;
bool rotatedUV;
const Gfx* textBeginDisplayList;
void (*render_char)(char*);
f32 (*char_width)(char*);

View File

@ -6,11 +6,11 @@
#define G_DJUI_SIMPLE_TRI2 0x12
#define G_EXECUTE_DJUI 0xdd
#define gSetClippingDjui(pkt, cmd, rot, x1, y1, x2, y2) \
#define gSetClippingDjui(pkt, cmd, x1, y1, x2, y2) \
{ \
Gfx *_g = (Gfx *)(pkt); \
_g->words.w0 = _SHIFTL(cmd, 24, 8) | _SHIFTL( x1, 16, 8) | \
_SHIFTL( y1, 8, 8) | _SHIFTL(rot, 0, 8); \
_SHIFTL( y1, 8, 8) | _SHIFTL(0x00, 0, 8); \
_g->words.w1 = _SHIFTL(x2, 16, 8) | _SHIFTL(y2, 8, 8); \
}
@ -63,7 +63,7 @@
((height)-1) << G_TEXTURE_IMAGE_FRAC) \
}
#define gDPSetTextureClippingDjui(pkt, rot, x1, y1, x2, y2) gSetClippingDjui(pkt, G_TEXCLIP_DJUI, rot, x1, y1, x2, y2)
#define gDPSetTextureClippingDjui(pkt, x1, y1, x2, y2) gSetClippingDjui(pkt, G_TEXCLIP_DJUI, x1, y1, x2, y2)
#define gDPSetTextureOverrideDjui(pkt, texture, w, h, bitSize) gSetOverrideDjui(pkt, G_TEXOVERRIDE_DJUI, texture, w, h, bitSize)

View File

@ -94,15 +94,18 @@ void djui_gfx_render_texture_tile(const u8* texture, u32 w, u32 h, u32 bitSize,
gDPSetCombineMode(gDisplayListHead++, G_CC_FADEA, G_CC_FADEA);
gDPSetRenderMode(gDisplayListHead++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
gDPSetTextureFilter(gDisplayListHead++, G_TF_POINT);
gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON);
gDPSetTextureOverrideDjui(gDisplayListHead++, texture, djui_gfx_power_of_two(w), djui_gfx_power_of_two(h), bitSize);
gDPLoadTextureBlockWithoutTexture(gDisplayListHead++, NULL, G_IM_FMT_RGBA, G_IM_SIZ_16b, 16, 16, 0, G_TX_CLAMP, G_TX_CLAMP, 5, 5, G_TX_NOLOD, G_TX_NOLOD);
*(gDisplayListHead++) = (Gfx) gsSPExecuteDjui(G_TEXOVERRIDE_DJUI);
gSPVertexDjui(gDisplayListHead++, vtx, 4, 0);
*(gDisplayListHead++) = (Gfx) gsSPExecuteDjui(G_TEXCLIP_DJUI);
gSP2TrianglesDjui(gDisplayListHead++, 0, 1, 2, 0x0, 0, 2, 3, 0x0);
gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_OFF);
gDPSetCombineMode(gDisplayListHead++, G_CC_SHADE, G_CC_SHADE);
}
@ -119,7 +122,7 @@ void djui_gfx_position_translate(f32* x, f32* y) {
void djui_gfx_scale_translate(f32* width, f32* height) {
u32 windowWidth, windowHeight;
wm_api->get_dimensions(&windowWidth, &windowHeight);
*width = *width * ((f32)SCREEN_HEIGHT / (f32)windowHeight) * djui_gfx_get_scale();
*height = *height * ((f32)SCREEN_HEIGHT / (f32)windowHeight) * djui_gfx_get_scale();
}
@ -131,7 +134,7 @@ void djui_gfx_size_translate(f32* size) {
*size = *size * ((f32)SCREEN_HEIGHT / (f32)windowHeight) * djui_gfx_get_scale();
}
bool djui_gfx_add_clipping_specific(struct DjuiBase* base, bool rotatedUV, f32 dX, f32 dY, f32 dW, f32 dH) {
bool djui_gfx_add_clipping_specific(struct DjuiBase* base, f32 dX, f32 dY, f32 dW, f32 dH) {
struct DjuiBaseRect* clip = &base->clip;
f32 clipX2 = clip->x + clip->width;
@ -152,7 +155,7 @@ bool djui_gfx_add_clipping_specific(struct DjuiBase* base, bool rotatedUV, f32 d
f32 dClipY2 = fmax((dY - (clipY2 - dH)) / dH, 0);
if ((dClipX1 != 0) || (dClipY1 != 0) || (dClipX2 != 0) || (dClipY2 != 0)) {
gDPSetTextureClippingDjui(gDisplayListHead++, rotatedUV, (u8)(dClipX1 * 255), (u8)(dClipY1 * 255), (u8)(dClipX2 * 255), (u8)(dClipY2 * 255));
gDPSetTextureClippingDjui(gDisplayListHead++, (u8)(dClipX1 * 255), (u8)(dClipY1 * 255), (u8)(dClipX2 * 255), (u8)(dClipY2 * 255));
}
return false;
@ -160,5 +163,5 @@ bool djui_gfx_add_clipping_specific(struct DjuiBase* base, bool rotatedUV, f32 d
bool djui_gfx_add_clipping(struct DjuiBase* base) {
struct DjuiBaseRect* comp = &base->comp;
return djui_gfx_add_clipping_specific(base, false, comp->x, comp->y, comp->width, comp->height);
return djui_gfx_add_clipping_specific(base, comp->x, comp->y, comp->width, comp->height);
}

View File

@ -18,5 +18,5 @@ void djui_gfx_position_translate(f32* x, f32* y);
void djui_gfx_scale_translate(f32* width, f32* height);
void djui_gfx_size_translate(f32* size);
bool djui_gfx_add_clipping_specific(struct DjuiBase* base, bool rotatedUV, f32 dX, f32 dY, f32 dW, f32 dH);
bool djui_gfx_add_clipping_specific(struct DjuiBase* base, f32 dX, f32 dY, f32 dW, f32 dH);
bool djui_gfx_add_clipping(struct DjuiBase* base);

View File

@ -7,7 +7,7 @@
#include "game/segment2.h"
#include "pc/controller/controller_keyboard.h"
#define DJUI_INPUTBOX_YOFF (-2)
#define DJUI_INPUTBOX_YOFF (-3)
#define DJUI_INPUTBOX_MAX_BLINK 50
#define DJUI_INPUTBOX_MID_BLINK (DJUI_INPUTBOX_MAX_BLINK / 2)
#define DJUI_INPUTBOX_CURSOR_WIDTH (2.0f / 32.0f)
@ -376,7 +376,7 @@ static void djui_inputbox_render_char(struct DjuiInputbox* inputbox, char* c, f3
f32 charWidth = font->char_width(c);
*drawX += charWidth * font->defaultFontScale;
if (*c != ' ' && !djui_gfx_add_clipping_specific(&inputbox->base, font->rotatedUV, dX, dY, dW, dH)) {
if (*c != ' ' && !djui_gfx_add_clipping_specific(&inputbox->base, dX, dY, dW, dH)) {
if (*additionalShift > 0) {
create_dl_translation_matrix(DJUI_MTX_NOPUSH, *additionalShift, 0, 0);
*additionalShift = 0;
@ -483,7 +483,7 @@ static bool djui_inputbox_render(struct DjuiBase* base) {
f32 translatedX = comp->x + inputbox->viewX;
f32 translatedY = comp->y + DJUI_INPUTBOX_YOFF;
djui_gfx_position_translate(&translatedX, &translatedY);
create_dl_translation_matrix(DJUI_MTX_PUSH, translatedX, translatedY, 0);
create_dl_translation_matrix(DJUI_MTX_PUSH, (int)translatedX, (int)translatedY, 0);
// compute font size
f32 translatedFontSize = font->defaultFontScale;

View File

@ -94,7 +94,7 @@ struct DjuiSelectionbox* djui_selectionbox_create(struct DjuiBase* parent, const
djui_base_set_size_type(&text->base, DJUI_SVT_RELATIVE, DJUI_SVT_RELATIVE);
djui_base_set_size(&text->base, 0.6f, 1.0f);
djui_text_set_alignment(text, DJUI_HALIGN_LEFT, DJUI_VALIGN_BOTTOM);
djui_text_set_drop_shadow(text, 120, 120, 120, 64);
djui_text_set_drop_shadow(text, 255, 255, 255, 128);
selectionbox->text = text;
struct DjuiRect* rect = djui_rect_create(&selectionbox->base);
@ -111,7 +111,7 @@ struct DjuiSelectionbox* djui_selectionbox_create(struct DjuiBase* parent, const
djui_base_set_size_type(&rectText->base, DJUI_SVT_RELATIVE, DJUI_SVT_RELATIVE);
djui_base_set_size(&rectText->base, 1.0f, 1.0f);
djui_text_set_alignment(rectText, DJUI_HALIGN_LEFT, DJUI_VALIGN_BOTTOM);
djui_text_set_drop_shadow(rectText, 120, 120, 120, 64);
djui_text_set_drop_shadow(rectText, 255, 255, 255, 128);
selectionbox->rectText = rectText;
struct DjuiImage* rectImage = djui_image_create(&rect->base, texture_selectionbox_icon, 16, 16, 16);

View File

@ -116,7 +116,7 @@ struct DjuiSlider* djui_slider_create(struct DjuiBase* parent, const char* messa
djui_base_set_size_type(&text->base, DJUI_SVT_RELATIVE, DJUI_SVT_RELATIVE);
djui_base_set_size(&text->base, 0.6f, 1.0f);
djui_text_set_alignment(text, DJUI_HALIGN_LEFT, DJUI_VALIGN_BOTTOM);
djui_text_set_drop_shadow(text, 120, 120, 120, 64);
djui_text_set_drop_shadow(text, 255, 255, 255, 128);
slider->text = text;
struct DjuiRect* rect = djui_rect_create(&slider->base);

View File

@ -71,7 +71,7 @@ static void djui_text_render_single_char(struct DjuiText* text, char* c) {
f32 dW = text->font->charWidth * text->fontScale;
f32 dH = text->font->charHeight * text->fontScale;
if (djui_gfx_add_clipping_specific(&text->base, text->font->rotatedUV, dX, dY, dW, dH)) {
if (djui_gfx_add_clipping_specific(&text->base, dX, dY, dW, dH)) {
return;
}

View File

@ -81,7 +81,7 @@ struct SmCodeGlyph sSmCodeGlyphs[] = {
{ "ß", 'S', 0, 0 },
{ "¡", '!', 0, 0 },
{ "¿", '?', 0, 0 },
{ "¿", '?', 0.3750f, 0 },
};
static void* sCharMap = NULL;

View File

@ -75,10 +75,10 @@ struct LoadedVertex {
struct TextureHashmapNode {
struct TextureHashmapNode *next;
const uint8_t *texture_addr;
uint8_t fmt, siz;
uint32_t texture_id;
uint8_t cms, cmt;
bool linear_filter;
@ -101,24 +101,24 @@ static uint8_t color_combiner_pool_size;
static struct RSP {
float modelview_matrix_stack[11][4][4];
uint8_t modelview_matrix_stack_size;
float MP_matrix[4][4];
float P_matrix[4][4];
Light_t current_lights[MAX_LIGHTS + 1];
float current_lights_coeffs[MAX_LIGHTS][3];
float current_lookat_coeffs[2][3]; // lookat_x, lookat_y
uint8_t current_num_lights; // includes ambient light
bool lights_changed;
uint32_t geometry_mode;
int16_t fog_mul, fog_offset;
struct {
// U0.16
uint16_t s, t;
} texture_scaling_factor;
struct LoadedVertex loaded_vertices[MAX_VERTICES + 4];
} rsp;
@ -141,10 +141,10 @@ static struct RDP {
uint32_t line_size_bytes;
} texture_tile;
bool textures_changed[2];
uint32_t other_mode_l, other_mode_h;
uint32_t combine_mode;
struct RGBA env_color, prim_color, fog_color, fill_color;
struct XYWidthHeight viewport, scissor;
bool viewport_or_scissor_changed;
@ -284,7 +284,7 @@ static struct ColorCombiner *gfx_lookup_or_create_color_combiner(uint32_t cc_id)
if (prev_combiner != NULL && prev_combiner->cc_id == cc_id) {
return prev_combiner;
}
for (size_t i = 0; i < color_combiner_pool_size; i++) {
if (color_combiner_pool[i].cc_id == cc_id) {
return prev_combiner = &color_combiner_pool[i];
@ -348,7 +348,7 @@ static void import_texture_rgba32(int tile) {
static void import_texture_rgba16(int tile) {
uint8_t rgba32_buf[8192];
for (uint32_t i = 0; i < rdp.loaded_texture[tile].size_bytes / 2; i++) {
uint16_t col16 = (rdp.loaded_texture[tile].addr[2 * i] << 8) | rdp.loaded_texture[tile].addr[2 * i + 1];
uint8_t a = col16 & 1;
@ -360,16 +360,16 @@ static void import_texture_rgba16(int tile) {
rgba32_buf[4*i + 2] = SCALE_5_8(b);
rgba32_buf[4*i + 3] = a ? 255 : 0;
}
uint32_t width = rdp.texture_tile.line_size_bytes / 2;
uint32_t height = rdp.loaded_texture[tile].size_bytes / rdp.texture_tile.line_size_bytes;
gfx_rapi->upload_texture(rgba32_buf, width, height);
}
static void import_texture_ia4(int tile) {
uint8_t rgba32_buf[32768];
for (uint32_t i = 0; i < rdp.loaded_texture[tile].size_bytes * 2; i++) {
uint8_t byte = rdp.loaded_texture[tile].addr[i / 2];
uint8_t part = (byte >> (4 - (i % 2) * 4)) & 0xf;
@ -383,16 +383,16 @@ static void import_texture_ia4(int tile) {
rgba32_buf[4*i + 2] = SCALE_3_8(b);
rgba32_buf[4*i + 3] = alpha ? 255 : 0;
}
uint32_t width = rdp.texture_tile.line_size_bytes * 2;
uint32_t height = rdp.loaded_texture[tile].size_bytes / rdp.texture_tile.line_size_bytes;
gfx_rapi->upload_texture(rgba32_buf, width, height);
}
static void import_texture_ia8(int tile) {
uint8_t rgba32_buf[16384];
for (uint32_t i = 0; i < rdp.loaded_texture[tile].size_bytes; i++) {
uint8_t intensity = rdp.loaded_texture[tile].addr[i] >> 4;
uint8_t alpha = rdp.loaded_texture[tile].addr[i] & 0xf;
@ -404,16 +404,16 @@ static void import_texture_ia8(int tile) {
rgba32_buf[4*i + 2] = SCALE_4_8(b);
rgba32_buf[4*i + 3] = SCALE_4_8(alpha);
}
uint32_t width = rdp.texture_tile.line_size_bytes;
uint32_t height = rdp.loaded_texture[tile].size_bytes / rdp.texture_tile.line_size_bytes;
gfx_rapi->upload_texture(rgba32_buf, width, height);
}
static void import_texture_ia16(int tile) {
uint8_t rgba32_buf[8192];
for (uint32_t i = 0; i < rdp.loaded_texture[tile].size_bytes / 2; i++) {
uint8_t intensity = rdp.loaded_texture[tile].addr[2 * i];
uint8_t alpha = rdp.loaded_texture[tile].addr[2 * i + 1];
@ -425,16 +425,16 @@ static void import_texture_ia16(int tile) {
rgba32_buf[4*i + 2] = b;
rgba32_buf[4*i + 3] = alpha;
}
uint32_t width = rdp.texture_tile.line_size_bytes / 2;
uint32_t height = rdp.loaded_texture[tile].size_bytes / rdp.texture_tile.line_size_bytes;
gfx_rapi->upload_texture(rgba32_buf, width, height);
}
static void import_texture_i4(int tile) {
uint8_t rgba32_buf[32768];
for (uint32_t i = 0; i < rdp.loaded_texture[tile].size_bytes * 2; i++) {
uint8_t byte = rdp.loaded_texture[tile].addr[i / 2];
uint8_t intensity = (byte >> (4 - (i % 2) * 4)) & 0xf;
@ -443,10 +443,10 @@ static void import_texture_i4(int tile) {
rgba32_buf[4*i + 2] = SCALE_4_8(intensity);
rgba32_buf[4*i + 3] = 255;
}
uint32_t width = rdp.texture_tile.line_size_bytes * 2;
uint32_t height = rdp.loaded_texture[tile].size_bytes / rdp.texture_tile.line_size_bytes;
gfx_rapi->upload_texture(rgba32_buf, width, height);
}
@ -460,16 +460,16 @@ static void import_texture_i8(int tile) {
rgba32_buf[4*i + 2] = intensity;
rgba32_buf[4*i + 3] = 255;
}
uint32_t width = rdp.texture_tile.line_size_bytes;
uint32_t height = rdp.loaded_texture[tile].size_bytes / rdp.texture_tile.line_size_bytes;
gfx_rapi->upload_texture(rgba32_buf, width, height);
}
static void import_texture_ci4(int tile) {
uint8_t rgba32_buf[32768];
for (uint32_t i = 0; i < rdp.loaded_texture[tile].size_bytes * 2; i++) {
uint8_t byte = rdp.loaded_texture[tile].addr[i / 2];
uint8_t idx = (byte >> (4 - (i % 2) * 4)) & 0xf;
@ -483,16 +483,16 @@ static void import_texture_ci4(int tile) {
rgba32_buf[4*i + 2] = SCALE_5_8(b);
rgba32_buf[4*i + 3] = a ? 255 : 0;
}
uint32_t width = rdp.texture_tile.line_size_bytes * 2;
uint32_t height = rdp.loaded_texture[tile].size_bytes / rdp.texture_tile.line_size_bytes;
gfx_rapi->upload_texture(rgba32_buf, width, height);
}
static void import_texture_ci8(int tile) {
uint8_t rgba32_buf[16384];
for (uint32_t i = 0; i < rdp.loaded_texture[tile].size_bytes; i++) {
uint8_t idx = rdp.loaded_texture[tile].addr[i];
uint16_t col16 = (rdp.palette[idx * 2] << 8) | rdp.palette[idx * 2 + 1]; // Big endian load
@ -505,10 +505,10 @@ static void import_texture_ci8(int tile) {
rgba32_buf[4*i + 2] = SCALE_5_8(b);
rgba32_buf[4*i + 3] = a ? 255 : 0;
}
uint32_t width = rdp.texture_tile.line_size_bytes;
uint32_t height = rdp.loaded_texture[tile].size_bytes / rdp.texture_tile.line_size_bytes;
gfx_rapi->upload_texture(rgba32_buf, width, height);
}
@ -601,7 +601,7 @@ static bool preload_texture(UNUSED void *user, const char *path) {
//fprintf(stdout, "Loading new texture: `%s.`\n", actualname);
load_texture(path); // new texture, load it
}
return true;
}
@ -748,7 +748,7 @@ static void gfx_sp_matrix(uint8_t parameters, const int32_t *addr) {
#else
memcpy(matrix, addr, sizeof(matrix));
#endif
if (parameters & G_MTX_PROJECTION) {
if (parameters & G_MTX_LOAD) {
memcpy(rsp.P_matrix, matrix, sizeof(matrix));
@ -790,17 +790,17 @@ static void OPTIMIZE_O3 gfx_sp_vertex(size_t n_vertices, size_t dest_index, cons
const Vtx_t *v = &vertices[i].v;
const Vtx_tn *vn = &vertices[i].n;
struct LoadedVertex *d = &rsp.loaded_vertices[dest_index];
float x = v->ob[0] * rsp.MP_matrix[0][0] + v->ob[1] * rsp.MP_matrix[1][0] + v->ob[2] * rsp.MP_matrix[2][0] + rsp.MP_matrix[3][0];
float y = v->ob[0] * rsp.MP_matrix[0][1] + v->ob[1] * rsp.MP_matrix[1][1] + v->ob[2] * rsp.MP_matrix[2][1] + rsp.MP_matrix[3][1];
float z = v->ob[0] * rsp.MP_matrix[0][2] + v->ob[1] * rsp.MP_matrix[1][2] + v->ob[2] * rsp.MP_matrix[2][2] + rsp.MP_matrix[3][2];
float w = v->ob[0] * rsp.MP_matrix[0][3] + v->ob[1] * rsp.MP_matrix[1][3] + v->ob[2] * rsp.MP_matrix[2][3] + rsp.MP_matrix[3][3];
x = gfx_adjust_x_for_aspect_ratio(x);
short U = v->tc[0] * rsp.texture_scaling_factor.s >> 16;
short V = v->tc[1] * rsp.texture_scaling_factor.t >> 16;
if (rsp.geometry_mode & G_LIGHTING) {
if (rsp.lights_changed) {
for (int32_t i = 0; i < rsp.current_num_lights - 1; i++) {
@ -812,11 +812,11 @@ static void OPTIMIZE_O3 gfx_sp_vertex(size_t n_vertices, size_t dest_index, cons
calculate_normal_dir(&lookat_y, rsp.current_lookat_coeffs[1]);
rsp.lights_changed = false;
}
int r = rsp.current_lights[rsp.current_num_lights - 1].col[0];
int g = rsp.current_lights[rsp.current_num_lights - 1].col[1];
int b = rsp.current_lights[rsp.current_num_lights - 1].col[2];
for (int32_t i = 0; i < rsp.current_num_lights - 1; i++) {
float intensity = 0;
intensity += vn->n[0] * rsp.current_lights_coeffs[i][0];
@ -829,11 +829,11 @@ static void OPTIMIZE_O3 gfx_sp_vertex(size_t n_vertices, size_t dest_index, cons
b += intensity * rsp.current_lights[i].col[2];
}
}
d->color.r = r > 255 ? 255 : r;
d->color.g = g > 255 ? 255 : g;
d->color.b = b > 255 ? 255 : b;
if (rsp.geometry_mode & G_TEXTURE_GEN) {
float dotx = 0, doty = 0;
dotx += vn->n[0] * rsp.current_lookat_coeffs[0][0];
@ -842,7 +842,7 @@ static void OPTIMIZE_O3 gfx_sp_vertex(size_t n_vertices, size_t dest_index, cons
doty += vn->n[0] * rsp.current_lookat_coeffs[1][0];
doty += vn->n[1] * rsp.current_lookat_coeffs[1][1];
doty += vn->n[2] * rsp.current_lookat_coeffs[1][2];
U = (int32_t)((dotx / 127.0f + 1.0f) / 4.0f * rsp.texture_scaling_factor.s);
V = (int32_t)((doty / 127.0f + 1.0f) / 4.0f * rsp.texture_scaling_factor.t);
}
@ -851,10 +851,10 @@ static void OPTIMIZE_O3 gfx_sp_vertex(size_t n_vertices, size_t dest_index, cons
d->color.g = v->cn[1];
d->color.b = v->cn[2];
}
d->u = U;
d->v = V;
// trivial clip rejection
d->clip_rej = 0;
if (x < -w) d->clip_rej |= 1;
@ -863,18 +863,18 @@ static void OPTIMIZE_O3 gfx_sp_vertex(size_t n_vertices, size_t dest_index, cons
if (y > w) d->clip_rej |= 8;
if (z < -w) d->clip_rej |= 16;
if (z > w) d->clip_rej |= 32;
d->x = x;
d->y = y;
d->z = z;
d->w = w;
if (rsp.geometry_mode & G_FOG) {
if (fabsf(w) < 0.001f) {
// To avoid division by zero
w = 0.001f;
}
float winv = 1.0f / w;
if (winv < 0.0f) {
winv = 32767.0f;
@ -905,20 +905,20 @@ static void OPTIMIZE_O3 gfx_sp_tri1(uint8_t vtx1_idx, uint8_t vtx2_idx, uint8_t
// The whole triangle lies outside the visible area
return;
}
if ((rsp.geometry_mode & G_CULL_BOTH) != 0) {
float dx1 = v1->x / (v1->w) - v2->x / (v2->w);
float dy1 = v1->y / (v1->w) - v2->y / (v2->w);
float dx2 = v3->x / (v3->w) - v2->x / (v2->w);
float dy2 = v3->y / (v3->w) - v2->y / (v2->w);
float cross = dx1 * dy2 - dy1 * dx2;
if ((v1->w < 0) ^ (v2->w < 0) ^ (v3->w < 0)) {
// If one vertex lies behind the eye, negating cross will give the correct result.
// If all vertices lie behind the eye, the triangle will be rejected anyway.
cross = -cross;
}
switch (rsp.geometry_mode & G_CULL_BOTH) {
case G_CULL_FRONT:
if (cross <= 0) return;
@ -931,28 +931,28 @@ static void OPTIMIZE_O3 gfx_sp_tri1(uint8_t vtx1_idx, uint8_t vtx2_idx, uint8_t
return;
}
}
bool depth_test = (rsp.geometry_mode & G_ZBUFFER) == G_ZBUFFER;
if (depth_test != rendering_state.depth_test) {
gfx_flush();
gfx_rapi->set_depth_test(depth_test);
rendering_state.depth_test = depth_test;
}
bool z_upd = (rdp.other_mode_l & Z_UPD) == Z_UPD;
if (z_upd != rendering_state.depth_mask) {
gfx_flush();
gfx_rapi->set_depth_mask(z_upd);
rendering_state.depth_mask = z_upd;
}
bool zmode_decal = (rdp.other_mode_l & ZMODE_DEC) == ZMODE_DEC;
if (zmode_decal != rendering_state.decal_mode) {
gfx_flush();
gfx_rapi->set_zmode_decal(zmode_decal);
rendering_state.decal_mode = zmode_decal;
}
if (rdp.viewport_or_scissor_changed) {
if (memcmp(&rdp.viewport, &rendering_state.viewport, sizeof(rdp.viewport)) != 0) {
gfx_flush();
@ -966,27 +966,27 @@ static void OPTIMIZE_O3 gfx_sp_tri1(uint8_t vtx1_idx, uint8_t vtx2_idx, uint8_t
}
rdp.viewport_or_scissor_changed = false;
}
uint32_t cc_id = rdp.combine_mode;
bool use_alpha = (rdp.other_mode_l & (G_BL_A_MEM << 18)) == 0;
bool use_fog = (rdp.other_mode_l >> 30) == G_BL_CLR_FOG;
bool texture_edge = (rdp.other_mode_l & CVG_X_ALPHA) == CVG_X_ALPHA;
bool use_noise = (rdp.other_mode_l & G_AC_DITHER) == G_AC_DITHER;
if (texture_edge) {
use_alpha = true;
}
if (use_alpha) cc_id |= SHADER_OPT_ALPHA;
if (use_fog) cc_id |= SHADER_OPT_FOG;
if (texture_edge) cc_id |= SHADER_OPT_TEXTURE_EDGE;
if (use_noise) cc_id |= SHADER_OPT_NOISE;
if (!use_alpha) {
cc_id &= ~0xfff000;
}
struct ColorCombiner *comb = gfx_lookup_or_create_color_combiner(cc_id);
struct ShaderProgram *prg = comb->prg;
if (prg != rendering_state.shader_program) {
@ -1003,7 +1003,7 @@ static void OPTIMIZE_O3 gfx_sp_tri1(uint8_t vtx1_idx, uint8_t vtx2_idx, uint8_t
uint8_t num_inputs;
bool used_textures[2];
gfx_rapi->shader_get_info(prg, &num_inputs, used_textures);
for (int32_t i = 0; i < 2; i++) {
if (used_textures[i]) {
if (rdp.textures_changed[i]) {
@ -1021,13 +1021,13 @@ static void OPTIMIZE_O3 gfx_sp_tri1(uint8_t vtx1_idx, uint8_t vtx2_idx, uint8_t
}
}
}
bool use_texture = used_textures[0] || used_textures[1];
uint32_t tex_width = (rdp.texture_tile.lrs - rdp.texture_tile.uls + 4) / 4;
uint32_t tex_height = (rdp.texture_tile.lrt - rdp.texture_tile.ult + 4) / 4;
bool z_is_from_0_to_1 = gfx_rapi->z_is_from_0_to_1();
for (int32_t i = 0; i < 3; i++) {
float z = v_arr[i]->z, w = v_arr[i]->w;
if (z_is_from_0_to_1) {
@ -1037,7 +1037,7 @@ static void OPTIMIZE_O3 gfx_sp_tri1(uint8_t vtx1_idx, uint8_t vtx2_idx, uint8_t
buf_vbo[buf_vbo_len++] = v_arr[i]->y;
buf_vbo[buf_vbo_len++] = z;
buf_vbo[buf_vbo_len++] = w;
if (use_texture) {
float u = (v_arr[i]->u - rdp.texture_tile.uls * 8) / 32.0f;
float v = (v_arr[i]->v - rdp.texture_tile.ult * 8) / 32.0f;
@ -1049,14 +1049,14 @@ static void OPTIMIZE_O3 gfx_sp_tri1(uint8_t vtx1_idx, uint8_t vtx2_idx, uint8_t
buf_vbo[buf_vbo_len++] = u / tex_width;
buf_vbo[buf_vbo_len++] = v / tex_height;
}
if (use_fog) {
buf_vbo[buf_vbo_len++] = rdp.fog_color.r / 255.0f;
buf_vbo[buf_vbo_len++] = rdp.fog_color.g / 255.0f;
buf_vbo[buf_vbo_len++] = rdp.fog_color.b / 255.0f;
buf_vbo[buf_vbo_len++] = v_arr[i]->color.a / 255.0f; // fog factor (not alpha)
}
for (int j = 0; j < num_inputs; j++) {
struct RGBA *color;
struct RGBA tmp;
@ -1121,17 +1121,17 @@ static void gfx_calc_and_set_viewport(const Vp_t *viewport) {
float height = 2.0f * viewport->vscale[1] / 4.0f;
float x = (viewport->vtrans[0] / 4.0f) - width / 2.0f;
float y = SCREEN_HEIGHT - ((viewport->vtrans[1] / 4.0f) + height / 2.0f);
width *= RATIO_X;
height *= RATIO_Y;
x *= RATIO_X;
y *= RATIO_Y;
rdp.viewport.x = x;
rdp.viewport.y = y;
rdp.viewport.width = width;
rdp.viewport.height = height;
rdp.viewport_or_scissor_changed = true;
}
@ -1218,12 +1218,12 @@ static void gfx_dp_set_scissor(UNUSED uint32_t mode, uint32_t ulx, uint32_t uly,
float y = (SCREEN_HEIGHT - lry / 4.0f) * RATIO_Y;
float width = (lrx - ulx) / 4.0f * RATIO_X;
float height = (lry - uly) / 4.0f * RATIO_Y;
rdp.scissor.x = x;
rdp.scissor.y = y;
rdp.scissor.width = width;
rdp.scissor.height = height;
rdp.viewport_or_scissor_changed = true;
}
@ -1233,7 +1233,7 @@ static void gfx_dp_set_texture_image(UNUSED uint32_t format, uint32_t size, UNUS
}
static void gfx_dp_set_tile(uint8_t fmt, uint32_t siz, uint32_t line, uint32_t tmem, uint8_t tile, uint32_t palette, uint32_t cmt, UNUSED uint32_t maskt, UNUSED uint32_t shiftt, uint32_t cms, UNUSED uint32_t masks, UNUSED uint32_t shifts) {
if (tile == G_TX_RENDERTILE) {
SUPPORT_CHECK(palette == 0); // palette should set upper 4 bits of color index in 4b mode
rdp.texture_tile.fmt = fmt;
@ -1244,7 +1244,7 @@ static void gfx_dp_set_tile(uint8_t fmt, uint32_t siz, uint32_t line, uint32_t t
rdp.textures_changed[0] = true;
rdp.textures_changed[1] = true;
}
if (tile == G_TX_LOADTILE) {
rdp.texture_to_load.tile_number = tmem / 256;
}
@ -1272,7 +1272,7 @@ static void gfx_dp_load_block(uint8_t tile, uint32_t uls, uint32_t ult, uint32_t
SUPPORT_CHECK(tile == G_TX_LOADTILE);
SUPPORT_CHECK(uls == 0);
SUPPORT_CHECK(ult == 0);
// The lrs field rather seems to be number of pixels to load
uint32_t word_size_shift = 0;
switch (rdp.texture_to_load.siz) {
@ -1291,9 +1291,8 @@ static void gfx_dp_load_block(uint8_t tile, uint32_t uls, uint32_t ult, uint32_t
}
uint32_t size_bytes = (lrs + 1) << word_size_shift;
rdp.loaded_texture[rdp.texture_to_load.tile_number].size_bytes = size_bytes;
rdp.textures_changed[rdp.texture_to_load.tile_number] = rdp.loaded_texture[rdp.texture_to_load.tile_number].addr != rdp.texture_to_load.addr;
rdp.loaded_texture[rdp.texture_to_load.tile_number].addr = rdp.texture_to_load.addr;
rdp.textures_changed[rdp.texture_to_load.tile_number] = true;
}
static void gfx_dp_load_tile(uint8_t tile, uint32_t uls, uint32_t ult, uint32_t lrs, uint32_t lrt) {
@ -1398,66 +1397,66 @@ static void gfx_dp_set_fill_color(uint32_t packed_color) {
static void gfx_draw_rectangle(int32_t ulx, int32_t uly, int32_t lrx, int32_t lry) {
uint32_t saved_other_mode_h = rdp.other_mode_h;
uint32_t cycle_type = (rdp.other_mode_h & (3U << G_MDSFT_CYCLETYPE));
if (cycle_type == G_CYC_COPY) {
rdp.other_mode_h = (rdp.other_mode_h & ~(3U << G_MDSFT_TEXTFILT)) | G_TF_POINT;
}
// U10.2 coordinates
float ulxf = ulx;
float ulyf = uly;
float lrxf = lrx;
float lryf = lry;
ulxf = ulxf / (4.0f * HALF_SCREEN_WIDTH) - 1.0f;
ulyf = -(ulyf / (4.0f * HALF_SCREEN_HEIGHT)) + 1.0f;
lrxf = lrxf / (4.0f * HALF_SCREEN_WIDTH) - 1.0f;
lryf = -(lryf / (4.0f * HALF_SCREEN_HEIGHT)) + 1.0f;
ulxf = gfx_adjust_x_for_aspect_ratio(ulxf);
lrxf = gfx_adjust_x_for_aspect_ratio(lrxf);
struct LoadedVertex* ul = &rsp.loaded_vertices[MAX_VERTICES + 0];
struct LoadedVertex* ll = &rsp.loaded_vertices[MAX_VERTICES + 1];
struct LoadedVertex* lr = &rsp.loaded_vertices[MAX_VERTICES + 2];
struct LoadedVertex* ur = &rsp.loaded_vertices[MAX_VERTICES + 3];
ul->x = ulxf;
ul->y = ulyf;
ul->z = -1.0f;
ul->w = 1.0f;
ll->x = ulxf;
ll->y = lryf;
ll->z = -1.0f;
ll->w = 1.0f;
lr->x = lrxf;
lr->y = lryf;
lr->z = -1.0f;
lr->w = 1.0f;
ur->x = lrxf;
ur->y = ulyf;
ur->z = -1.0f;
ur->w = 1.0f;
// The coordinates for texture rectangle shall bypass the viewport setting
struct XYWidthHeight default_viewport = {0, 0, gfx_current_dimensions.width, gfx_current_dimensions.height};
struct XYWidthHeight viewport_saved = rdp.viewport;
uint32_t geometry_mode_saved = rsp.geometry_mode;
rdp.viewport = default_viewport;
rdp.viewport_or_scissor_changed = true;
rsp.geometry_mode = 0;
gfx_sp_tri1(MAX_VERTICES + 0, MAX_VERTICES + 1, MAX_VERTICES + 3);
gfx_sp_tri1(MAX_VERTICES + 1, MAX_VERTICES + 2, MAX_VERTICES + 3);
rsp.geometry_mode = geometry_mode_saved;
rdp.viewport = viewport_saved;
rdp.viewport_or_scissor_changed = true;
if (cycle_type == G_CYC_COPY) {
rdp.other_mode_h = saved_other_mode_h;
}
@ -1469,15 +1468,15 @@ static void gfx_dp_texture_rectangle(int32_t ulx, int32_t uly, int32_t lrx, int3
// Per RDP Command Summary Set Tile's shift s and this dsdx should be set to 4 texels
// Divide by 4 to get 1 instead
dsdx >>= 2;
// Color combiner is turned off in copy mode
gfx_dp_set_combine_mode(color_comb(0, 0, 0, G_CCMUX_TEXEL0), color_comb(0, 0, 0, G_ACMUX_TEXEL0));
// Per documentation one extra pixel is added in this modes to each edge
lrx += 1 << 2;
lry += 1 << 2;
}
// uls and ult are S10.5
// dsdx and dtdy are S5.10
// lrx, lry, ulx, uly are U10.2
@ -1490,7 +1489,7 @@ static void gfx_dp_texture_rectangle(int32_t ulx, int32_t uly, int32_t lrx, int3
int16_t height = !flip ? lry - uly : lrx - ulx;
float lrs = ((uls << 7) + dsdx * width) >> 7;
float lrt = ((ult << 7) + dtdy * height) >> 7;
struct LoadedVertex* ul = &rsp.loaded_vertices[MAX_VERTICES + 0];
struct LoadedVertex* ll = &rsp.loaded_vertices[MAX_VERTICES + 1];
struct LoadedVertex* lr = &rsp.loaded_vertices[MAX_VERTICES + 2];
@ -1510,7 +1509,7 @@ static void gfx_dp_texture_rectangle(int32_t ulx, int32_t uly, int32_t lrx, int3
ur->u = uls;
ur->v = lrt;
}
gfx_draw_rectangle(ulx, uly, lrx, lry);
rdp.combine_mode = saved_combine_mode;
}
@ -1521,18 +1520,18 @@ static void gfx_dp_fill_rectangle(int32_t ulx, int32_t uly, int32_t lrx, int32_t
return;
}
uint32_t mode = (rdp.other_mode_h & (3U << G_MDSFT_CYCLETYPE));
if (mode == G_CYC_COPY || mode == G_CYC_FILL) {
// Per documentation one extra pixel is added in this modes to each edge
lrx += 1 << 2;
lry += 1 << 2;
}
for (int32_t i = MAX_VERTICES; i < MAX_VERTICES + 4; i++) {
struct LoadedVertex* v = &rsp.loaded_vertices[i];
v->color = rdp.fill_color;
}
uint32_t saved_combine_mode = rdp.combine_mode;
gfx_dp_set_combine_mode(color_comb(0, 0, 0, G_CCMUX_SHADE), color_comb(0, 0, 0, G_ACMUX_SHADE));
gfx_draw_rectangle(ulx, uly, lrx, lry);
@ -1565,7 +1564,7 @@ static inline void *seg_addr(uintptr_t w1) {
static void OPTIMIZE_O3 gfx_run_dl(Gfx* cmd) {
for (;;) {
uint32_t opcode = cmd->words.w0 >> 24;
switch (opcode) {
// RSP commands:
case G_MTX:
@ -1669,7 +1668,7 @@ static void OPTIMIZE_O3 gfx_run_dl(Gfx* cmd) {
gfx_sp_set_other_mode(C0(8, 8) + 32, C0(0, 8), (uint64_t) cmd->words.w1 << 32);
#endif
break;
// RDP Commands:
case G_SETTIMG:
gfx_dp_set_texture_image(C0(21, 3), C0(19, 2), C0(0, 10), seg_addr(cmd->words.w1));
@ -1791,7 +1790,7 @@ void gfx_init(struct GfxWindowManagerAPI *wapi, struct GfxRenderingAPI *rapi, co
gfx_rapi = rapi;
gfx_wapi->init(window_title);
gfx_rapi->init();
// Used in the 120 star TAS
static uint32_t precomp_shaders[] = {
0x01200200,
@ -1849,15 +1848,15 @@ void gfx_start_frame(void) {
void gfx_run(Gfx *commands) {
gfx_sp_reset();
//puts("New frame");
if (!gfx_wapi->start_frame()) {
dropped_frame = true;
return;
}
dropped_frame = false;
//double t0 = gfx_wapi->get_time();
gfx_rapi->start_frame();
gfx_run_dl(commands);
@ -1891,7 +1890,6 @@ void gfx_shutdown(void) {
/////////////////////////
static bool sDjuiClip = 0;
static bool sDjuiClipRotatedUV = 0;
static uint8_t sDjuiClipX1 = 0;
static uint8_t sDjuiClipY1 = 0;
static uint8_t sDjuiClipX2 = 0;
@ -1950,30 +1948,15 @@ static void OPTIMIZE_O3 djui_gfx_dp_execute_clipping(void) {
d->y -= (maxY - minY) * (sDjuiClipY1 / 255.0f);
}
if (sDjuiClipRotatedUV) {
if (d->u <= midU) {
d->u += (maxU - minU) * (sDjuiClipY2 / 255.0f);
}
else {
d->u -= (maxU - minU) * (sDjuiClipY1 / 255.0f);
}
if (d->v <= midV) {
d->v += (maxV - minV) * (sDjuiClipX2 / 255.0f);
}
else {
d->v -= (maxV - minV) * (sDjuiClipX1 / 255.0f);
}
if (d->u <= midU) {
d->u += (maxU - minU) * (sDjuiClipX1 / 255.0f);
} else {
if (d->u <= midU) {
d->u += (maxU - minU) * (sDjuiClipX1 / 255.0f);
} else {
d->u -= (maxU - minU) * (sDjuiClipX2 / 255.0f);
}
if (d->v <= midV) {
d->v += (maxV - minV) * (sDjuiClipY1 / 255.0f);
} else {
d->v -= (maxV - minV) * (sDjuiClipY2 / 255.0f);
}
d->u -= (maxU - minU) * (sDjuiClipX2 / 255.0f);
}
if (d->v <= midV) {
d->v += (maxV - minV) * (sDjuiClipY1 / 255.0f);
} else {
d->v -= (maxV - minV) * (sDjuiClipY2 / 255.0f);
}
}
}
@ -2017,8 +2000,7 @@ static void OPTIMIZE_O3 djui_gfx_dp_execute_djui(uint32_t opcode) {
}
}
static void OPTIMIZE_O3 djui_gfx_dp_set_clipping(bool rotatedUV, uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2) {
sDjuiClipRotatedUV = rotatedUV;
static void OPTIMIZE_O3 djui_gfx_dp_set_clipping(uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2) {
sDjuiClipX1 = x1;
sDjuiClipY1 = y1;
sDjuiClipX2 = x2;
@ -2038,21 +2020,21 @@ static void OPTIMIZE_O3 djui_gfx_sp_simple_vertex(size_t n_vertices, size_t dest
for (size_t i = 0; i < n_vertices; i++, dest_index++) {
const Vtx_t *v = &vertices[i].v;
struct LoadedVertex *d = &rsp.loaded_vertices[dest_index];
float x = v->ob[0] * rsp.MP_matrix[0][0] + v->ob[1] * rsp.MP_matrix[1][0] + v->ob[2] * rsp.MP_matrix[2][0] + rsp.MP_matrix[3][0];
float y = v->ob[0] * rsp.MP_matrix[0][1] + v->ob[1] * rsp.MP_matrix[1][1] + v->ob[2] * rsp.MP_matrix[2][1] + rsp.MP_matrix[3][1];
float z = v->ob[0] * rsp.MP_matrix[0][2] + v->ob[1] * rsp.MP_matrix[1][2] + v->ob[2] * rsp.MP_matrix[2][2] + rsp.MP_matrix[3][2];
float w = v->ob[0] * rsp.MP_matrix[0][3] + v->ob[1] * rsp.MP_matrix[1][3] + v->ob[2] * rsp.MP_matrix[2][3] + rsp.MP_matrix[3][3];
x = gfx_adjust_x_for_aspect_ratio(x);
short U = v->tc[0] * rsp.texture_scaling_factor.s >> 16;
short V = v->tc[1] * rsp.texture_scaling_factor.t >> 16;
d->color.r = v->cn[0];
d->color.g = v->cn[1];
d->color.b = v->cn[2];
d->u = U;
d->v = V;
@ -2060,7 +2042,7 @@ static void OPTIMIZE_O3 djui_gfx_sp_simple_vertex(size_t n_vertices, size_t dest
d->y = y;
d->z = z;
d->w = w;
d->color.a = v->cn[3];
}
}
@ -2072,14 +2054,14 @@ static void OPTIMIZE_O3 djui_gfx_sp_simple_tri1(uint8_t vtx1_idx, uint8_t vtx2_i
struct LoadedVertex *v_arr[3] = {v1, v2, v3};
uint32_t cc_id = rdp.combine_mode;
bool use_alpha = true;
cc_id |= SHADER_OPT_ALPHA;
if (!use_alpha) {
cc_id &= ~0xfff000;
}
struct ColorCombiner *comb = gfx_lookup_or_create_color_combiner(cc_id);
struct ShaderProgram *prg = comb->prg;
if (prg != rendering_state.shader_program) {
@ -2097,9 +2079,9 @@ static void OPTIMIZE_O3 djui_gfx_sp_simple_tri1(uint8_t vtx1_idx, uint8_t vtx2_i
uint32_t tex_width = (rdp.texture_tile.lrs - rdp.texture_tile.uls + 4) / 4;
uint32_t tex_height = (rdp.texture_tile.lrt - rdp.texture_tile.ult + 4) / 4;
bool z_is_from_0_to_1 = gfx_rapi->z_is_from_0_to_1();
for (int32_t i = 0; i < 3; i++) {
float z = v_arr[i]->z, w = v_arr[i]->w;
if (z_is_from_0_to_1) {
@ -2131,7 +2113,7 @@ void OPTIMIZE_O3 djui_gfx_run_dl(Gfx* cmd) {
uint32_t opcode = cmd->words.w0 >> 24;
switch (opcode) {
case G_TEXCLIP_DJUI:
djui_gfx_dp_set_clipping(C0(0, 8), C0(16, 8), C0(8, 8), C1(16, 8), C1(8, 8));
djui_gfx_dp_set_clipping(C0(16, 8), C0(8, 8), C1(16, 8), C1(8, 8));
break;
case G_TEXOVERRIDE_DJUI:
djui_gfx_dp_set_override(seg_addr(cmd->words.w1), 1 << C0(16, 8), 1 << C0(8, 8), C0(0, 8));

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 108 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 108 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 93 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 97 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 97 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 95 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 97 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 131 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 95 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 112 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 103 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 89 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 109 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 512 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 518 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 514 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 515 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 521 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 517 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 530 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 511 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 515 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 513 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 513 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 509 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 523 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 514 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 513 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 509 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 511 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 534 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 514 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 520 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 516 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 522 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 518 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 534 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 522 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 513 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 517 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 514 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 519 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 505 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 509 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 504 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 515 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 510 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 509 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 512 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 511 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 513 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 507 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 504 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 510 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 506 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 511 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 512 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 502 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 496 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 492 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 497 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 498 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 503 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 504 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 507 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 496 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 506 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 508 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 505 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 509 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 512 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 508 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 510 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 515 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 508 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 499 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 509 B

Some files were not shown because too many files have changed in this diff Show More