[nostalgia/gfx/gba] Remove teagba scroll bg function call
All checks were successful
Build / build (push) Successful in 1m15s
All checks were successful
Build / build (push) Successful in 1m15s
This commit is contained in:
@@ -23,17 +23,15 @@ struct BgCbbData {
|
|||||||
unsigned bpp = 4;
|
unsigned bpp = 4;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Context {
|
class Context final {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
turbine::Context &turbineCtx;
|
turbine::Context &turbineCtx;
|
||||||
ox::Array<BgCbbData, 4> cbbData;
|
ox::Array<BgCbbData, 4> cbbData;
|
||||||
|
ox::Array<OffsetPair, 4> bgOffsets;
|
||||||
|
|
||||||
explicit Context(turbine::Context &tctx) noexcept: turbineCtx{tctx} {}
|
explicit Context(turbine::Context &tctx) noexcept: turbineCtx{tctx} {}
|
||||||
Context(Context &other) noexcept = delete;
|
|
||||||
Context(Context const &other) noexcept = delete;
|
Context(Context const &other) noexcept = delete;
|
||||||
Context(Context const &&other) noexcept = delete;
|
|
||||||
virtual ~Context() noexcept = default;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -295,12 +293,16 @@ void setBgPriority(Context&, uint_t const bgIdx, uint_t const priority) noexcept
|
|||||||
bgCtl = (bgCtl & 0b1111'1111'1111'1100u) | (priority & 0b11);
|
bgCtl = (bgCtl & 0b1111'1111'1111'1100u) | (priority & 0b11);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setBgOffset(Context&, uint16_t const bg, int16_t const x, int16_t const y) noexcept {
|
void setBgOffset(Context &ctx, uint16_t const bg, int16_t const x, int16_t const y) noexcept {
|
||||||
|
ctx.bgOffsets[bg] = {.x = x, .y = y};
|
||||||
teagba::setBgOffset(bg, x, y);
|
teagba::setBgOffset(bg, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void scrollBgOffset(Context&, uint16_t const bg, int16_t const x, int16_t const y) noexcept {
|
void scrollBgOffset(Context &ctx, uint16_t const bg, int16_t const x, int16_t const y) noexcept {
|
||||||
teagba::scrollBgOffset(bg, x, y);
|
auto &o = ctx.bgOffsets[bg];
|
||||||
|
o.x += x;
|
||||||
|
o.y += y;
|
||||||
|
teagba::setBgOffset(bg, o.x, o.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void hideSprite(Context&, unsigned const idx) noexcept {
|
void hideSprite(Context&, unsigned const idx) noexcept {
|
||||||
|
|||||||
@@ -87,9 +87,7 @@ class Context {
|
|||||||
blocksPerSprite{params.glBlocksPerSprite} {
|
blocksPerSprite{params.glBlocksPerSprite} {
|
||||||
}
|
}
|
||||||
Context(Context const&) = delete;
|
Context(Context const&) = delete;
|
||||||
Context(Context&&) = delete;
|
|
||||||
Context &operator=(Context const&) = delete;
|
Context &operator=(Context const&) = delete;
|
||||||
Context &operator=(Context&&) = delete;
|
|
||||||
~Context() noexcept {
|
~Context() noexcept {
|
||||||
turbine::gl::removeDrawer(turbineCtx, &drawer);
|
turbine::gl::removeDrawer(turbineCtx, &drawer);
|
||||||
}
|
}
|
||||||
@@ -113,7 +111,7 @@ namespace renderer {
|
|||||||
static constexpr auto Scale = 1;
|
static constexpr auto Scale = 1;
|
||||||
static constexpr auto PriorityScale = 0.01f;
|
static constexpr auto PriorityScale = 0.01f;
|
||||||
|
|
||||||
static constexpr ox::CStringView bgvshadTmpl = R"glsl(
|
static constexpr ox::StringLiteral bgvshadTmpl{R"glsl(
|
||||||
{}
|
{}
|
||||||
in vec2 vTexCoord;
|
in vec2 vTexCoord;
|
||||||
in vec3 vPosition;
|
in vec3 vPosition;
|
||||||
@@ -135,9 +133,9 @@ static constexpr ox::CStringView bgvshadTmpl = R"glsl(
|
|||||||
vTexCoord.x,
|
vTexCoord.x,
|
||||||
vTexCoord.y * vTileHeight + vTileIdx * vTileHeight);
|
vTexCoord.y * vTileHeight + vTileIdx * vTileHeight);
|
||||||
fPalOffset = vPalOffset;
|
fPalOffset = vPalOffset;
|
||||||
})glsl";
|
})glsl"};
|
||||||
|
|
||||||
static constexpr ox::CStringView bgfshadTmpl = R"glsl(
|
static constexpr ox::StringLiteral bgfshadTmpl{R"glsl(
|
||||||
{}
|
{}
|
||||||
out vec4 outColor;
|
out vec4 outColor;
|
||||||
in float fPalOffset;
|
in float fPalOffset;
|
||||||
@@ -151,9 +149,9 @@ static constexpr ox::CStringView bgfshadTmpl = R"glsl(
|
|||||||
if (outColor.a == 0) {
|
if (outColor.a == 0) {
|
||||||
discard;
|
discard;
|
||||||
}
|
}
|
||||||
})glsl";
|
})glsl"};
|
||||||
|
|
||||||
static constexpr ox::CStringView spritevshadTmpl = R"glsl(
|
static constexpr ox::StringLiteral spritevshadTmpl{R"glsl(
|
||||||
{}
|
{}
|
||||||
in float vEnabled;
|
in float vEnabled;
|
||||||
in vec3 vPosition;
|
in vec3 vPosition;
|
||||||
@@ -170,9 +168,9 @@ static constexpr ox::CStringView spritevshadTmpl = R"glsl(
|
|||||||
vPosition.z - 0.004,
|
vPosition.z - 0.004,
|
||||||
1.0) * vEnabled;
|
1.0) * vEnabled;
|
||||||
fTexCoord = vTexCoord * vec2(1, vTileHeight);
|
fTexCoord = vTexCoord * vec2(1, vTileHeight);
|
||||||
})glsl";
|
})glsl"};
|
||||||
|
|
||||||
static constexpr ox::CStringView spritefshadTmpl = R"glsl(
|
static constexpr ox::StringLiteral spritefshadTmpl{R"glsl(
|
||||||
{}
|
{}
|
||||||
out vec4 outColor;
|
out vec4 outColor;
|
||||||
in vec2 fTexCoord;
|
in vec2 fTexCoord;
|
||||||
@@ -185,7 +183,7 @@ static constexpr ox::CStringView spritefshadTmpl = R"glsl(
|
|||||||
if (outColor.a == 0) {
|
if (outColor.a == 0) {
|
||||||
discard;
|
discard;
|
||||||
}
|
}
|
||||||
})glsl";
|
})glsl"};
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
static constexpr auto bgVertexRow(uint_t const x, uint_t const y) noexcept {
|
static constexpr auto bgVertexRow(uint_t const x, uint_t const y) noexcept {
|
||||||
@@ -841,6 +839,12 @@ void setBgPriority(Context &ctx, uint_t const bgIdx, uint_t const priority) noex
|
|||||||
bg.priority = static_cast<float>(priority & 0b11);
|
bg.priority = static_cast<float>(priority & 0b11);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setBgOffset(Context&, uint16_t const, int16_t const, int16_t const) noexcept {
|
||||||
|
}
|
||||||
|
|
||||||
|
void scrollBgOffset(Context&, uint16_t const, int16_t const, int16_t const) noexcept {
|
||||||
|
}
|
||||||
|
|
||||||
void hideSprite(Context &ctx, uint_t const idx) noexcept {
|
void hideSprite(Context &ctx, uint_t const idx) noexcept {
|
||||||
auto &s = ctx.spriteStates[idx];
|
auto &s = ctx.spriteStates[idx];
|
||||||
s.enabled = false;
|
s.enabled = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user