[nostalgia] Start on new TileSheetEditor
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <imgui.h>
|
||||
|
||||
#include <nostalgia/core/gfx.hpp>
|
||||
#include <nostalgia/glutils/glutils.hpp>
|
||||
#include <nostalgia/studio/studio.hpp>
|
||||
|
||||
namespace nostalgia::core {
|
||||
|
||||
class TileSheetPixels {
|
||||
|
||||
private:
|
||||
static constexpr auto VertexVboRows = 4;
|
||||
static constexpr auto VertexVboRowLength = 5;
|
||||
static constexpr auto VertexVboLength = VertexVboRows * VertexVboRowLength;
|
||||
static constexpr auto VertexEboLength = 6;
|
||||
static constexpr auto VShad = R"(
|
||||
{}
|
||||
in vec2 vPosition;
|
||||
in vec3 vColor;
|
||||
out vec3 fColor;
|
||||
void main() {
|
||||
gl_Position = vec4(vPosition, 0.0, 1.0);
|
||||
fColor = vColor;
|
||||
})";
|
||||
static constexpr auto FShad = R"(
|
||||
{}
|
||||
in vec3 fColor;
|
||||
out vec4 outColor;
|
||||
void main() {
|
||||
//outColor = vec4(0.0, 0.7, 1.0, 1.0);
|
||||
outColor = vec4(fColor, 1.0);
|
||||
})";
|
||||
|
||||
glutils::GLProgram m_shader;
|
||||
glutils::BufferSet m_bufferSet;
|
||||
|
||||
public:
|
||||
ox::Error buildShader() noexcept;
|
||||
|
||||
void draw(bool update) noexcept;
|
||||
|
||||
void initBufferSet(const NostalgiaGraphic &img, const NostalgiaPalette &pal) noexcept;
|
||||
|
||||
private:
|
||||
static void setPixelBufferObject(unsigned vertexRow, float x, float y, Color16 color, float *vbo, GLuint *ebo) noexcept;
|
||||
|
||||
void setBufferObjects(const NostalgiaGraphic &img, const NostalgiaPalette &pal, glutils::BufferSet *bg) noexcept;
|
||||
|
||||
static class ImVec2 pixelSize() noexcept;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user