126 lines
6.7 KiB
C++
126 lines
6.7 KiB
C++
void global_polygon_textured(ta_parameter_writer& writer, uint32_t list_type)
|
|
{
|
|
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
|
|
| tsp_instruction_word::src_alpha_instr::one
|
|
| tsp_instruction_word::dst_alpha_instr::zero
|
|
| tsp_instruction_word::fog_control::no_fog
|
|
| tsp_instruction_word::texture_u_size::from_int(128)
|
|
| tsp_instruction_word::texture_v_size::from_int(256);
|
|
|
|
const uint32_t texture_address = texture_memory_alloc.texture.start;
|
|
const uint32_t texture_control_word = texture_control_word::pixel_format::_4bpp_palette
|
|
| texture_control_word::scan_order::twiddled
|
|
| texture_control_word::texture_address(texture_address / 8);
|
|
|
|
writer.append<ta_global_parameter::polygon_type_0>() =
|
|
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
|
|
);
|
|
}
|
|
|
|
|
|
void global_polygon_untextured(ta_parameter_writer& writer, uint32_t list_type, uint32_t dst_alpha)
|
|
{
|
|
const uint32_t parameter_control_word = para_control::para_type::polygon_or_modifier_volume
|
|
| list_type
|
|
| obj_control::col_type::packed_color
|
|
;
|
|
|
|
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
|
|
| tsp_instruction_word::src_alpha_instr::one
|
|
| dst_alpha
|
|
| tsp_instruction_word::fog_control::no_fog
|
|
| tsp_instruction_word::texture_u_size::from_int(128)
|
|
| tsp_instruction_word::texture_v_size::from_int(256);
|
|
|
|
const uint32_t texture_address = texture_memory_alloc.texture.start;
|
|
const uint32_t texture_control_word = texture_control_word::pixel_format::_4bpp_palette
|
|
| texture_control_word::scan_order::twiddled
|
|
| texture_control_word::texture_address(texture_address / 8);
|
|
|
|
writer.append<ta_global_parameter::polygon_type_0>() =
|
|
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 quad_type_3(ta_parameter_writer& writer,
|
|
const vec3& ap, const vec2& at,
|
|
const vec3& bp, const vec2& bt,
|
|
const vec3& cp, const vec2& ct,
|
|
const vec3& dp, const vec2& dt,
|
|
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(false),
|
|
dp.x, dp.y, dp.z,
|
|
dt.x, dt.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,
|
|
const vec3& ap,
|
|
const vec3& bp,
|
|
const vec3& cp,
|
|
const vec3& dp,
|
|
int base_color)
|
|
{
|
|
writer.append<ta_vertex_parameter::polygon_type_0>() =
|
|
ta_vertex_parameter::polygon_type_0(polygon_vertex_parameter_control_word(false),
|
|
ap.x, ap.y, ap.z,
|
|
base_color);
|
|
|
|
writer.append<ta_vertex_parameter::polygon_type_0>() =
|
|
ta_vertex_parameter::polygon_type_0(polygon_vertex_parameter_control_word(false),
|
|
bp.x, bp.y, bp.z,
|
|
base_color);
|
|
|
|
writer.append<ta_vertex_parameter::polygon_type_0>() =
|
|
ta_vertex_parameter::polygon_type_0(polygon_vertex_parameter_control_word(false),
|
|
dp.x, dp.y, dp.z,
|
|
base_color);
|
|
|
|
writer.append<ta_vertex_parameter::polygon_type_0>() =
|
|
ta_vertex_parameter::polygon_type_0(polygon_vertex_parameter_control_word(true),
|
|
cp.x, cp.y, cp.z,
|
|
base_color);
|
|
}
|