[nostalgia] Rename common package to geo

This commit is contained in:
2022-02-13 04:03:10 -06:00
parent 0aa71f1dbb
commit 320df614a9
26 changed files with 131 additions and 130 deletions
@@ -18,7 +18,7 @@ ox::Error TileSheetPixels::buildShader() noexcept {
return glutils::buildShaderProgram(Vshad, Fshad).moveTo(&m_shader);
}
void TileSheetPixels::draw(bool update, const common::Vec2 &scroll) noexcept {
void TileSheetPixels::draw(bool update, const geo::Vec2 &scroll) noexcept {
glUseProgram(m_shader);
glBindVertexArray(m_bufferSet.vao);
if (update) {
@@ -29,7 +29,7 @@ void TileSheetPixels::draw(bool update, const common::Vec2 &scroll) noexcept {
glDrawElements(GL_TRIANGLES, static_cast<GLsizei>(m_bufferSet.elements.size()), GL_UNSIGNED_INT, nullptr);
}
void TileSheetPixels::initBufferSet(const common::Vec2 &paneSize, const NostalgiaGraphic &img, const NostalgiaPalette &pal) noexcept {
void TileSheetPixels::initBufferSet(const geo::Vec2 &paneSize, const NostalgiaGraphic &img, const NostalgiaPalette &pal) noexcept {
// vao
m_bufferSet.vao = glutils::generateVertexArrayObject();
glBindVertexArray(m_bufferSet.vao);
@@ -49,14 +49,14 @@ void TileSheetPixels::initBufferSet(const common::Vec2 &paneSize, const Nostalgi
reinterpret_cast<void*>(2 * sizeof(float)));
}
common::Vec2 TileSheetPixels::pixelSize(const common::Vec2 &paneSize) const noexcept {
geo::Vec2 TileSheetPixels::pixelSize(const geo::Vec2 &paneSize) const noexcept {
const auto [sw, sh] = paneSize;
constexpr float ymod = 0.35f / 10.0f;
const auto xmod = ymod * sh / sw;
return {xmod * m_pixelSizeMod, ymod * m_pixelSizeMod};
}
void TileSheetPixels::setPixelBufferObject(const common::Vec2 &paneSize, unsigned vertexRow, float x, float y, Color16 color, float *vbo, GLuint *ebo) noexcept {
void TileSheetPixels::setPixelBufferObject(const geo::Vec2 &paneSize, unsigned vertexRow, float x, float y, Color16 color, float *vbo, GLuint *ebo) noexcept {
const auto [xmod, ymod] = pixelSize(paneSize);
x *= xmod;
y *= -ymod;
@@ -78,7 +78,7 @@ void TileSheetPixels::setPixelBufferObject(const common::Vec2 &paneSize, unsigne
memcpy(ebo, elms, sizeof(elms));
}
void TileSheetPixels::setBufferObjects(const common::Vec2 &paneSize, const NostalgiaGraphic &img, const NostalgiaPalette &pal, glutils::BufferSet *bg) noexcept {
void TileSheetPixels::setBufferObjects(const geo::Vec2 &paneSize, const NostalgiaGraphic &img, const NostalgiaPalette &pal, glutils::BufferSet *bg) noexcept {
const auto setPixel = [this, paneSize, bg, img, pal](std::size_t i, uint8_t p) {
const auto color = pal.colors[p];
const auto pt = idxToPt(static_cast<int>(i), img.columns);