Squashed 'deps/nostalgia/' changes from 124c7029..f128664a

f128664a [olympic/studio] Add ig::IndentStackItem
e84df780 [glutils] Add ProgramSource::vboLen
caa59f37 [nostalgia/core] Add functions for mapping tile idx to subsheet
1cf09433 [nostalgia/core/studio] Cleanup TileSheetEditor with new GlUtils helpers
9948346c [ox/model] Fix clangd false alarm
aa8200be [glutils] Add helper functions for setting up shaders

git-subtree-dir: deps/nostalgia
git-subtree-split: f128664a81b817aaf066de02cc3a09650958ace9
This commit is contained in:
2024-01-27 23:55:20 -06:00
parent ae1f8ce11a
commit db978290f3
9 changed files with 185 additions and 43 deletions

View File

@ -150,8 +150,39 @@ class FrameBufferBind {
void bind(const FrameBuffer &fb) noexcept;
struct ShaderVarSet {
GLsizei len{};
ox::String name;
};
ox::Result<GLProgram> buildShaderProgram(ox::CStringView const&vert, ox::CStringView const&frag, ox::CStringView const&geo = "") noexcept;
struct ProgramSource {
ox::Vector<glutils::ShaderVarSet> const shaderParams;
GLsizei const rowLen = [this] {
GLsizei len{};
for (auto const&v : shaderParams) {
len += v.len;
}
return len;
}();
GLsizei const vboLen = rowLen * 4;
ox::String const vertShader{};
ox::String const fragShader{};
ox::String const geomShader{};
};
ox::Result<GLProgram> buildShaderProgram(ProgramSource const&src) noexcept;
ox::Result<GLProgram> buildShaderProgram(
ox::CStringView const&vert,
ox::CStringView const&frag,
ox::CStringView const&geo = "") noexcept;
void setupShaderParams(
GLProgram const&shader,
ox::Vector<ShaderVarSet> const&vars,
GLsizei vertexRowLen) noexcept;
void setupShaderParams(GLProgram const&shader, ox::Vector<ShaderVarSet> const&vars) noexcept;
glutils::GLVertexArray generateVertexArrayObject() noexcept;
@ -160,6 +191,8 @@ glutils::GLBuffer generateBuffer() noexcept;
[[nodiscard]]
FrameBuffer generateFrameBuffer(int width, int height) noexcept;
void resizeFrameBuffer(FrameBuffer &fb, int width, int height) noexcept;
/**
* Resizes a FrameBuffer, and creates if it does not already exist.
*/