[glutils,nostalgia/core] Move GlslVersion from GlUtils to Nostalgia Core
This commit is contained in:
parent
7d9a1676e8
commit
140005799f
@ -16,8 +16,6 @@
|
|||||||
|
|
||||||
namespace glutils {
|
namespace glutils {
|
||||||
|
|
||||||
constexpr ox::CStringView GlslVersion = "#version 330";
|
|
||||||
|
|
||||||
struct Empty {
|
struct Empty {
|
||||||
virtual ~Empty() noexcept = default;
|
virtual ~Empty() noexcept = default;
|
||||||
};
|
};
|
||||||
|
@ -78,6 +78,7 @@ void setSprite(Context &ctx, Sprite const&s) noexcept;
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace nostalgia::core::gl {
|
namespace nostalgia::core::gl {
|
||||||
|
constexpr ox::CStringView GlslVersion = "#version 330";
|
||||||
void draw(core::Context&, ox::Size const&) noexcept;
|
void draw(core::Context&, ox::Size const&) noexcept;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -372,10 +372,10 @@ ox::Error initGfx(
|
|||||||
InitParams const&initParams) noexcept {
|
InitParams const&initParams) noexcept {
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
const auto bgVshad = ox::sfmt(renderer::bgvshadTmpl, glutils::GlslVersion);
|
const auto bgVshad = ox::sfmt(renderer::bgvshadTmpl, gl::GlslVersion);
|
||||||
const auto bgFshad = ox::sfmt(renderer::bgfshadTmpl, glutils::GlslVersion);
|
const auto bgFshad = ox::sfmt(renderer::bgfshadTmpl, gl::GlslVersion);
|
||||||
const auto spriteVshad = ox::sfmt(renderer::spritevshadTmpl, glutils::GlslVersion);
|
const auto spriteVshad = ox::sfmt(renderer::spritevshadTmpl, gl::GlslVersion);
|
||||||
const auto spriteFshad = ox::sfmt(renderer::spritefshadTmpl, glutils::GlslVersion);
|
const auto spriteFshad = ox::sfmt(renderer::spritefshadTmpl, gl::GlslVersion);
|
||||||
auto &gctx = glctx(ctx);
|
auto &gctx = glctx(ctx);
|
||||||
oxReturnError(glutils::buildShaderProgram(bgVshad, bgFshad).moveTo(&gctx.bgShader));
|
oxReturnError(glutils::buildShaderProgram(bgVshad, bgFshad).moveTo(&gctx.bgShader));
|
||||||
oxReturnError(
|
oxReturnError(
|
||||||
@ -491,7 +491,7 @@ void setBgCbb(Context &ctx, uint_t bgIdx, uint_t cbbIdx) noexcept {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint8_t bgStatus(Context &ctx) noexcept {
|
uint8_t bgStatus(Context &ctx) noexcept {
|
||||||
const auto &gctx = glctx(ctx);
|
auto const&gctx = glctx(ctx);
|
||||||
uint8_t out = 0;
|
uint8_t out = 0;
|
||||||
for (uint_t i = 0; i < gctx.cbbs.size(); ++i) {
|
for (uint_t i = 0; i < gctx.cbbs.size(); ++i) {
|
||||||
out |= static_cast<uint8_t>(static_cast<uint_t>(gctx.backgrounds[i].enabled) << i);
|
out |= static_cast<uint8_t>(static_cast<uint_t>(gctx.backgrounds[i].enabled) << i);
|
||||||
@ -507,7 +507,7 @@ void setBgStatus(Context &ctx, uint32_t status) noexcept {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool bgStatus(Context &ctx, uint_t bg) noexcept {
|
bool bgStatus(Context &ctx, uint_t bg) noexcept {
|
||||||
const auto &gctx = glctx(ctx);
|
auto const&gctx = glctx(ctx);
|
||||||
return gctx.backgrounds[bg].enabled;
|
return gctx.backgrounds[bg].enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,9 +15,9 @@ void TileSheetGrid::setPixelSizeMod(float sm) noexcept {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ox::Error TileSheetGrid::buildShader() noexcept {
|
ox::Error TileSheetGrid::buildShader() noexcept {
|
||||||
const auto pixelLineVshad = ox::sfmt(VShad, glutils::GlslVersion);
|
const auto pixelLineVshad = ox::sfmt(VShad, gl::GlslVersion);
|
||||||
const auto pixelLineFshad = ox::sfmt(FShad, glutils::GlslVersion);
|
const auto pixelLineFshad = ox::sfmt(FShad, gl::GlslVersion);
|
||||||
const auto pixelLineGshad = ox::sfmt(GShad, glutils::GlslVersion);
|
const auto pixelLineGshad = ox::sfmt(GShad, gl::GlslVersion);
|
||||||
return glutils::buildShaderProgram(pixelLineVshad, pixelLineFshad, pixelLineGshad).moveTo(&m_shader);
|
return glutils::buildShaderProgram(pixelLineVshad, pixelLineFshad, pixelLineGshad).moveTo(&m_shader);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,8 +17,8 @@ void TileSheetPixels::setPixelSizeMod(float sm) noexcept {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ox::Error TileSheetPixels::buildShader() noexcept {
|
ox::Error TileSheetPixels::buildShader() noexcept {
|
||||||
const auto Vshad = ox::sfmt(VShad, glutils::GlslVersion);
|
const auto Vshad = ox::sfmt(VShad, gl::GlslVersion);
|
||||||
const auto Fshad = ox::sfmt(FShad, glutils::GlslVersion);
|
const auto Fshad = ox::sfmt(FShad, gl::GlslVersion);
|
||||||
return glutils::buildShaderProgram(Vshad, Fshad).moveTo(&m_shader);
|
return glutils::buildShaderProgram(Vshad, Fshad).moveTo(&m_shader);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user