Skip to content

名不符實 in static functions of Util::Image class #94

@ntut-rick

Description

@ntut-rick

This Three functions seems are static, but no static keyword or comment to explain why.

void Image::InitProgram() {
// TODO: Create `BaseProgram` from `Program` and pass it into `Drawable`
s_Program = std::make_unique<Core::Program>("../assets/shaders/Base.vert",
"../assets/shaders/Base.frag");
s_Program->Bind();
GLint location = glGetUniformLocation(s_Program->GetId(), "surface");
glUniform1i(location, UNIFORM_SURFACE_LOCATION);
}
void Image::InitVertexArray() {
s_VertexArray = std::make_unique<Core::VertexArray>();
// NOLINTBEGIN
// These are vertex data for the rectangle but clang-tidy has magic
// number warnings
// Vertex
s_VertexArray->AddVertexBuffer(std::make_unique<Core::VertexBuffer>(
std::vector<float>{
-0.5F, 0.5F, //
-0.5F, -0.5F, //
0.5F, -0.5F, //
0.5F, 0.5F, //
},
2));
// UV
s_VertexArray->AddVertexBuffer(std::make_unique<Core::VertexBuffer>(
std::vector<float>{
0.0F, 0.0F, //
0.0F, 1.0F, //
1.0F, 1.0F, //
1.0F, 0.0F, //
},
2));
// Index
s_VertexArray->SetIndexBuffer(
std::make_unique<Core::IndexBuffer>(std::vector<unsigned int>{
0, 1, 2, //
0, 2, 3, //
}));
// NOLINTEND
}
void Image::InitUniformBuffer() {
s_UniformBuffer = std::make_unique<Core::UniformBuffer<Core::Matrices>>(
*s_Program, "Matrices", 0);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomersrefactoringOr Improve structure / Format of the code

    Type

    No type

    Projects

    Status

    🆕 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions