[nostalgia/core/studio] Add pixel outline to tile sheet editor

This commit is contained in:
2022-01-29 21:53:48 -06:00
parent 99550b60ee
commit f6be36741c
4 changed files with 81 additions and 61 deletions
@@ -17,45 +17,45 @@ class TileSheetGrid {
private:
static constexpr auto VertexVboRows = 1;
static constexpr auto VertexVboRowLength = 4;
static constexpr auto VertexVboRowLength = 7;
static constexpr auto VertexVboLength = VertexVboRows * VertexVboRowLength;
static constexpr auto VertexEboLength = 1;
static constexpr auto VShad = R"(
static constexpr auto VShad = R"glsl(
{}
in vec2 vPt1;
in vec2 vPt2;
out VS_OUT {
vec2 pt1;
vec2 pt2;
} vs_out;
in vec3 vColor;
out vec2 gPt2;
out vec3 gColor;
void main() {
vs_out.pt1 = vPt1;
vs_out.pt2 = vPt2;
gColor = vColor;
gl_Position = vec4(vPt1, 0.0, 1.0);
})";
gPt2 = vPt2;
})glsl";
static constexpr auto FShad = R"(
static constexpr auto FShad = R"glsl(
{}
in vec3 fColor;
out vec4 outColor;
void main() {
outColor = vec4(0.4431, 0.4901, 0.4941, 1.0);
})";
outColor = vec4(fColor, 1);
//outColor = vec4(0.4431, 0.4901, 0.4941, 1.0);
})glsl";
static constexpr auto GShad = R"glsl(
{}
in VS_OUT {
vec2 pt1;
vec2 pt2;
} gs_in[];
layout(line_strip, max_vertices = 2) out;
layout(points) in;
layout(line_strip, max_vertices = 9) out;
in vec3 gColor[];
in vec2 gPt2[];
out vec3 fColor;
void main() {
//gl_Position = vec4(gs_in[0].pt1, 0, 0);
//EmitVertex();
//gl_Position = vec4(gs_in[0].pt2, 0, 0);
//EmitVertex();
//EndPrimitive();
fColor = gColor[0];
gl_Position = gl_in[0].gl_Position;
EmitVertex();
gl_Position = vec4(gPt2[0], 0, 1);
EmitVertex();
EndPrimitive();
})glsl";
glutils::GLProgram m_shader;
@@ -69,7 +69,7 @@ class TileSheetGrid {
void initBufferSet(const NostalgiaGraphic &img) noexcept;
private:
static void setBufferObject(unsigned vertexRow, common::Point pt1, common::Point pt2, float *vbo, GLuint *ebo) noexcept;
static void setBufferObject(common::Point pt1, common::Point pt2, Color32 c, float *vbo, const ImVec2 &pixSize) noexcept;
void setBufferObjects(const NostalgiaGraphic &img, glutils::BufferSet *bg) noexcept;