Experiment with rotation

This commit is contained in:
2024-04-02 15:33:23 -05:00
parent 53eacdae43
commit 87f71a6c61
4 changed files with 72 additions and 32 deletions

View File

@@ -1,33 +1,25 @@
#include "../../../include/asset_mgr.hpp"
#include "../../../include/shared.hpp"
#include <PSX/GTE/gte.hpp>
#include <PSX/GPU/make_gpu_primitives.hpp>
#include "include/GTE_Sprite.hpp"
#include <PSX/Periphery/periphery.hpp>
#include <stdio.h>
namespace GTETest {
using namespace JabyEngine;
using namespace GTETest;
static auto matrix = GTE::MATRIX::identity();
static GPU::POLY_FT4 doener_fish;
static auto rotation = 5_DEG;
static GPU::POLY_FT4 create_doener_fish() {
return Make::POLY_FT4(
GPU::Display::center(Make::AreaI16(Make::PositionI16(0, 0), Assets::Main::DoenerFishInfo.size)),
Assets::Main::DoenerFishInfo.tim.get_page_offset_clut4(),
Make::TPage(Assets::Main::DoenerFishInfo.tim.get_texture_position(), GPU::SemiTransparency::B_add_F, GPU::TextureColorMode::clut4),
Make::PageClut(Assets::Main::DoenerFishInfo.tim.get_clut_position()),
GPU::Color24::Grey()
);
}
static auto doener_fish = GTE_Sprite::create(Make::POLY_FT4(
Make::AreaI16(Make::PositionI16(0, 0), Assets::Main::DoenerFishInfo.size),
Assets::Main::DoenerFishInfo.tim.get_page_offset_clut4(),
Make::TPage(Assets::Main::DoenerFishInfo.tim.get_texture_position(), GPU::SemiTransparency::B_add_F, GPU::TextureColorMode::clut4),
Make::PageClut(Assets::Main::DoenerFishInfo.tim.get_clut_position()),
GPU::Color24::Grey()
));
static auto rotation = 0_DEG;
static void setup() {
Shared::back_menu.reset();
matrix = GTE::MATRIX::rotation(0, 0, 0);
doener_fish = create_doener_fish();
GTE::set_geom_offset(0, 0);
GTE::set_geom_screen(512);
}
@@ -38,28 +30,17 @@ namespace GTETest {
return true;
}
const auto matrix = GTE::MATRIX::rotation(0, 0, rotation);
GTE::set_trans_matrix(matrix);
GTE::set_rot_matrix(matrix);
// for now?
doener_fish = create_doener_fish();
GPU::Vertex* doener_vertices[] = {&doener_fish.vertex0, &doener_fish.vertex1, &doener_fish.vertex2, &doener_fish.vertex3};
for(auto* vertex : doener_vertices) {
GTE::VECTOR output;
int32_t flag;
GTE::rot_trans(GTE::SVECTOR::from(*vertex), output, flag);
*vertex = output.to<GPU::Vertex>();
}
matrix = GTE::MATRIX::rotation(0, 0, rotation);
doener_fish.apply();
rotation += 5_DEG;
//GTE::multiply_matrix(matrix, GTE::MATRIX::rotation(0, 0, 5_DEG), matrix);
return false;
}
static void render() {
GPU::render(doener_fish);
doener_fish.render();
Shared::back_menu.render();
}