34 lines
1.2 KiB
C++
34 lines
1.2 KiB
C++
#pragma once
|
|
#include <PSX/GPU/gpu_primitives.hpp>
|
|
#include <PSX/GPU/gpu.hpp>
|
|
#include <PSX/GTE/gte.hpp>
|
|
|
|
namespace GTETest {
|
|
using namespace JabyEngine;
|
|
|
|
struct GTE_Sprite {
|
|
GPU::AreaI16 area;
|
|
GPU::POLY_FT4 display;
|
|
|
|
static constexpr GTE_Sprite create(const GPU::POLY_FT4& base) {
|
|
return GTE_Sprite{
|
|
.area = GPU::AreaI16::create(base.get_rect_pos(), base.get_rect_size()),
|
|
.display = base
|
|
};
|
|
}
|
|
|
|
void apply(const GTE::MATRIX& matrix) {
|
|
const auto move_back = GTE::MATRIX::comp(GTE::MATRIX::translated(-matrix.transfer.x, -matrix.transfer.y, -matrix.transfer.z), matrix);
|
|
const auto& area = this->area;
|
|
|
|
this->display.vertex0 = move_back.apply_to(area.get_top_left());
|
|
this->display.vertex1 = move_back.apply_to(area.get_top_right());
|
|
this->display.vertex2 = move_back.apply_to(area.get_bottom_left());
|
|
this->display.vertex3 = move_back.apply_to(area.get_bottom_right());
|
|
}
|
|
|
|
void render() {
|
|
GPU::render(this->display);
|
|
}
|
|
};
|
|
} |