From 4b7389da8d7b15b21ec99764776e3611f1797b60 Mon Sep 17 00:00:00 2001 From: jracek Date: Wed, 19 Mar 2025 02:07:35 +0100 Subject: [PATCH] Indentation errors --- .gitignore | 1 + src/gameobject.hh | 16 +++--- src/main.cpp | 10 +--- src/mesh.hh | 10 ++-- src/renderer.cpp | 129 ++++++++++++++++++++++++---------------------- src/renderer.hh | 16 +++--- src/texture.hh | 4 +- 7 files changed, 93 insertions(+), 93 deletions(-) diff --git a/.gitignore b/.gitignore index 0d3b5c8..27e98c9 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,5 @@ PSX.Dev-README.md .cache/ .vscode/ .editorconfig +.clang-format compile_commands.json diff --git a/src/gameobject.hh b/src/gameobject.hh index f3a9994..80eb40a 100644 --- a/src/gameobject.hh +++ b/src/gameobject.hh @@ -7,11 +7,11 @@ namespace psxsplash { - class GameObject final { - public: - psyqo::Vec3 m_pos; - psyqo::Angle m_rot[3]; - Mesh m_mesh; - bool m_is_static; - }; -} \ No newline at end of file +class GameObject final { + public: + psyqo::Vec3 m_pos; + psyqo::Angle m_rot[3]; + Mesh m_mesh; + bool m_is_static; +}; +} // namespace psxsplash \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 267db5e..87f52ed 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -24,17 +24,13 @@ class PSXSplash final : public psyqo::Application { class MainScene final : public psyqo::Scene { void frame() override; - - uint8_t m_anim = 0; - bool m_direction = true; - eastl::array objects; }; PSXSplash psxSplash; MainScene mainScene; -} +} // namespace void PSXSplash::prepare() { psyqo::GPU::Configuration config; @@ -51,8 +47,6 @@ void PSXSplash::createScene() { pushScene(&mainScene); } -void MainScene::frame() { - psxSplash.m_renderer.render(objects); -} +void MainScene::frame() { psxSplash.m_renderer.render(objects); } int main() { return psxSplash.run(); } diff --git a/src/mesh.hh b/src/mesh.hh index 8bbd487..71c0843 100644 --- a/src/mesh.hh +++ b/src/mesh.hh @@ -8,17 +8,17 @@ namespace psxsplash { class Tri final { - public: - psyqo::GTE::PackedVec3 v0,v1,v2; - psyqo::GTE::PackedVec3 n0,n1,n2; + public: + psyqo::GTE::PackedVec3 v0, v1, v2; + psyqo::GTE::PackedVec3 n0, n1, n2; psyqo::PrimPieces::UVCoords uvA, uvB; psyqo::PrimPieces::UVCoordsPadded uvC; psyqo::Color colorA, colorB, colorC; }; class Mesh final { - public: + public: Texture m_texture; eastl::array m_polygons; }; -} \ No newline at end of file +} // namespace psxsplash \ No newline at end of file diff --git a/src/renderer.cpp b/src/renderer.cpp index edbb1e1..c97e143 100644 --- a/src/renderer.cpp +++ b/src/renderer.cpp @@ -11,95 +11,100 @@ void psxsplash::Renderer::initialize() { psyqo::GTE::clear(); psyqo::GTE::clear(); - psyqo::GTE::write(psyqo::FixedPoint<16>(160.0).raw()); - psyqo::GTE::write(psyqo::FixedPoint<16>(120.0).raw()); + psyqo::GTE::write( + psyqo::FixedPoint<16>(160.0).raw()); + psyqo::GTE::write( + psyqo::FixedPoint<16>(120.0).raw()); psyqo::GTE::write(120); - psyqo::GTE::write(ORDERING_TABLE_SIZE / 3); - psyqo::GTE::write(ORDERING_TABLE_SIZE / 4); + psyqo::GTE::write( + ORDERING_TABLE_SIZE / 3); + psyqo::GTE::write( + ORDERING_TABLE_SIZE / 4); } void psxsplash::Renderer::render(eastl::array &objects) { - uint8_t parity = m_gpu.getParity(); + uint8_t parity = m_gpu.getParity(); - auto &ot = m_ots[parity]; - auto &clear = m_clear[parity]; - auto &balloc = m_ballocs[parity]; + auto &ot = m_ots[parity]; + auto &clear = m_clear[parity]; + auto &balloc = m_ballocs[parity]; - eastl::array projected; + eastl::array projected; - m_gpu.getNextClear(clear.primitive, m_clearcolor); - m_gpu.chain(clear); + m_gpu.getNextClear(clear.primitive, m_clearcolor); + m_gpu.chain(clear); - balloc.reset(); + balloc.reset(); - for (auto &obj : objects) { + for (auto &obj : objects) { - auto &mesh = obj.m_mesh; - auto &texture = mesh.m_texture; + auto &mesh = obj.m_mesh; + auto &texture = mesh.m_texture; - psyqo::GTE::write( - obj.m_pos.x.raw()); - psyqo::GTE::write( - obj.m_pos.y.raw()); - psyqo::GTE::write( - obj.m_pos.z.raw()); + psyqo::GTE::write( + obj.m_pos.x.raw()); + psyqo::GTE::write( + obj.m_pos.y.raw()); + psyqo::GTE::write( + obj.m_pos.z.raw()); - auto transform = psyqo::SoftMath::generateRotationMatrix33( - obj.m_rot[0], psyqo::SoftMath::Axis::X, m_trig); - auto rot = psyqo::SoftMath::generateRotationMatrix33( - obj.m_rot[1], psyqo::SoftMath::Axis::Y, m_trig); + auto transform = psyqo::SoftMath::generateRotationMatrix33( + obj.m_rot[0], psyqo::SoftMath::Axis::X, m_trig); + auto rot = psyqo::SoftMath::generateRotationMatrix33( + obj.m_rot[1], psyqo::SoftMath::Axis::Y, m_trig); - psyqo::SoftMath::multiplyMatrix33(transform, rot, &transform); + psyqo::SoftMath::multiplyMatrix33(transform, rot, &transform); - auto rotZ = psyqo::SoftMath::generateRotationMatrix33( - obj.m_rot[2], psyqo::SoftMath::Axis::Z, m_trig); + auto rotZ = psyqo::SoftMath::generateRotationMatrix33( + obj.m_rot[2], psyqo::SoftMath::Axis::Z, m_trig); - psyqo::SoftMath::multiplyMatrix33(transform, rotZ, &transform); + psyqo::SoftMath::multiplyMatrix33(transform, rotZ, &transform); - psyqo::GTE::writeUnsafe(transform); + psyqo::GTE::writeUnsafe( + transform); - for (auto &tri : mesh.m_polygons) { + for (auto &tri : mesh.m_polygons) { - psyqo::GTE::writeUnsafe(tri.v0); - psyqo::GTE::writeUnsafe(tri.v1); - psyqo::GTE::writeUnsafe(tri.v2); + psyqo::GTE::writeUnsafe(tri.v0); + psyqo::GTE::writeUnsafe(tri.v1); + psyqo::GTE::writeUnsafe(tri.v2); - psyqo::GTE::Kernels::rtpt(); - psyqo::GTE::Kernels::nclip(); + psyqo::GTE::Kernels::rtpt(); + psyqo::GTE::Kernels::nclip(); - int32_t mac0 = 0; - psyqo::GTE::read( - reinterpret_cast(&mac0)); - if (mac0 <= 0) - continue; + int32_t mac0 = 0; + psyqo::GTE::read( + reinterpret_cast(&mac0)); + if (mac0 <= 0) + continue; - psyqo::GTE::Kernels::avsz4(); - int32_t zIndex = 0; - psyqo::GTE::read( - reinterpret_cast(&zIndex)); - if (zIndex < 0 || zIndex >= ORDERING_TABLE_SIZE) - continue; + psyqo::GTE::Kernels::avsz4(); + int32_t zIndex = 0; + psyqo::GTE::read( + reinterpret_cast(&zIndex)); + if (zIndex < 0 || zIndex >= ORDERING_TABLE_SIZE) + continue; - psyqo::GTE::read(&projected[1].packed); - psyqo::GTE::read(&projected[2].packed); - psyqo::GTE::read(&projected[3].packed); + psyqo::GTE::read(&projected[1].packed); + psyqo::GTE::read(&projected[2].packed); + psyqo::GTE::read(&projected[3].packed); - auto &prim = balloc.allocate< - psyqo::Fragments::SimpleFragment>(); + auto &prim = balloc.allocate>(); - prim.primitive.pointA = projected[0]; - prim.primitive.pointB = projected[1]; - prim.primitive.pointC = projected[2]; - prim.primitive.uvA = tri.uvA; - prim.primitive.uvB = tri.uvB; - prim.primitive.uvC = tri.uvC; - prim.primitive.tpage = texture.m_tpage; + prim.primitive.pointA = projected[0]; + prim.primitive.pointB = projected[1]; + prim.primitive.pointC = projected[2]; + prim.primitive.uvA = tri.uvA; + prim.primitive.uvB = tri.uvB; + prim.primitive.uvC = tri.uvC; + prim.primitive.tpage = texture.m_tpage; - ot.insert(prim, zIndex); + ot.insert(prim, zIndex); + } } - } - m_gpu.chain(ot); + m_gpu.chain(ot); } \ No newline at end of file diff --git a/src/renderer.hh b/src/renderer.hh index 5ce1fa5..172d2a8 100644 --- a/src/renderer.hh +++ b/src/renderer.hh @@ -2,12 +2,12 @@ #include "EASTL/array.h" #include "gameobject.hh" +#include "psyqo/bump-allocator.hh" #include "psyqo/fragments.hh" #include "psyqo/gpu.hh" #include "psyqo/ordering-table.hh" #include "psyqo/primitives/common.hh" #include "psyqo/primitives/misc.hh" -#include "psyqo/bump-allocator.hh" #include "psyqo/trigonometry.hh" namespace psxsplash { @@ -15,19 +15,19 @@ namespace psxsplash { class Renderer final { static constexpr size_t ORDERING_TABLE_SIZE = 1024; static constexpr size_t BUMP_ALLOCATOR_SIZE = 100000; - - psyqo::GPU& m_gpu; + + psyqo::GPU &m_gpu; psyqo::Trig<> m_trig; - - public: + + public: psyqo::OrderingTable m_ots[2]; psyqo::Fragments::SimpleFragment m_clear[2]; psyqo::Color m_clearcolor = {.r = 63, .g = 63, .b = 63}; psyqo::BumpAllocator m_ballocs[2]; - Renderer(psyqo::GPU& gpuInstance) : m_gpu(gpuInstance) {} + Renderer(psyqo::GPU &gpuInstance) : m_gpu(gpuInstance) {} void initialize(); - void render(eastl::array& objects); + void render(eastl::array &objects); }; -} \ No newline at end of file +} // namespace psxsplash \ No newline at end of file diff --git a/src/texture.hh b/src/texture.hh index 58e3969..c1dc616 100644 --- a/src/texture.hh +++ b/src/texture.hh @@ -6,9 +6,9 @@ namespace psxsplash { class Texture final { - public: + public: psyqo::Prim::TPageAttr::ColorMode m_colormode; psyqo::PrimPieces::TPageAttr m_tpage; uint8_t m_width, m_height; }; -} \ No newline at end of file +} // namespace psxsplash \ No newline at end of file