35 lines
981 B
C++
35 lines
981 B
C++
#pragma once
|
|
|
|
#include <psyqo/gte-registers.hh>
|
|
#include <psyqo/primitives/common.hh>
|
|
|
|
namespace psxsplash {
|
|
|
|
// Sentinel value for untextured (vertex-color-only) triangles
|
|
static constexpr uint16_t UNTEXTURED_TPAGE = 0xFFFF;
|
|
|
|
class Tri final {
|
|
public:
|
|
psyqo::GTE::PackedVec3 v0, v1, v2;
|
|
psyqo::GTE::PackedVec3 normal;
|
|
|
|
psyqo::Color colorA, colorB, colorC;
|
|
|
|
psyqo::PrimPieces::UVCoords uvA, uvB;
|
|
psyqo::PrimPieces::UVCoordsPadded uvC;
|
|
|
|
psyqo::PrimPieces::TPageAttr tpage;
|
|
uint16_t clutX;
|
|
uint16_t clutY;
|
|
uint16_t padding;
|
|
|
|
/// Returns true if this triangle has no texture (vertex-color only).
|
|
/// These should be rendered as POLY_G3 (GouraudTriangle) instead of POLY_GT3.
|
|
bool isUntextured() const {
|
|
return *reinterpret_cast<const uint16_t*>(&tpage) == UNTEXTURED_TPAGE;
|
|
}
|
|
};
|
|
static_assert(sizeof(Tri) == 52, "Tri is not 52 bytes");
|
|
|
|
} // namespace psxsplash
|