40 lines
1.3 KiB
C++
40 lines
1.3 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() {
|
|
static const auto apply_to = [](GTE::SVECTOR vector) -> GPU::Vertex {
|
|
GTE::VECTOR output;
|
|
int32_t flag;
|
|
|
|
GTE::rot_trans(vector, output, flag);
|
|
return output.to<GPU::Vertex>();
|
|
};
|
|
|
|
const auto& area = this->area;
|
|
this->display.vertex0 = apply_to(GTE::SVECTOR::from(area.get_top_left()));
|
|
this->display.vertex1 = apply_to(GTE::SVECTOR::from(area.get_top_right()));
|
|
this->display.vertex2 = apply_to(GTE::SVECTOR::from(area.get_bottom_left()));
|
|
this->display.vertex3 = apply_to(GTE::SVECTOR::from(area.get_bottom_right()));
|
|
}
|
|
|
|
void render() {
|
|
GPU::render(this->display);
|
|
}
|
|
};
|
|
} |