Skip to content

Commit

Permalink
Merge pull request #1746 from axetion/main
Browse files Browse the repository at this point in the history
Add texture blending settings to TexturedTriangle and TexturedQuad
  • Loading branch information
nicolasnoble authored Sep 22, 2024
2 parents 9e4b856 + 2f5a2b7 commit 6ec5348
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/mips/psyqo/primitives/quads.hh
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ static_assert(sizeof(Quad) == (sizeof(uint32_t) * 5), "Quad is not 5 words");
*/
struct TexturedQuad {
TexturedQuad() : command(0x2d000000) {}
TexturedQuad(Color c) : command(0x2c000000 | c.packed) {}
TexturedQuad& setColor(Color c) {
uint32_t wasSemiTrans = command & 0x02000000;
command = 0x2c000000 | c.packed | wasSemiTrans;
return *this;
}
TexturedQuad& setOpaque() {
command &= ~0x02000000;
return *this;
Expand Down
6 changes: 6 additions & 0 deletions src/mips/psyqo/primitives/triangles.hh
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ static_assert(sizeof(Triangle) == (sizeof(uint32_t) * 4), "Triangle is not 4 wor
*/
struct TexturedTriangle {
TexturedTriangle() : command(0x25000000) {}
TexturedTriangle(Color c) : command(0x24000000 | c.packed) {}
TexturedTriangle& setColor(Color c) {
uint32_t wasSemiTrans = command & 0x02000000;
command = 0x24000000 | c.packed | wasSemiTrans;
return *this;
}
TexturedTriangle& setOpaque() {
command &= ~0x02000000;
return *this;
Expand Down

0 comments on commit 6ec5348

Please # to comment.