faet: add tile selector

This commit is contained in:
2021-09-02 18:37:16 +02:00
parent ba291a1428
commit fc9c07f041
6 changed files with 75 additions and 1 deletions

View File

@@ -156,6 +156,38 @@ GL::VAO loadWorldModel(const td::game::World* world){
return worldVao;
}
GL::VAO loadTileSelectModel(){
std::vector<float> positions = {
0, 0,
1, 0,
0, 1,
1, 0,
0, 1,
1, 1
};
int color = 255 << 24 | 255 << 16 | 255 << 8 | 150;
float colorFloat;
memcpy((std::uint8_t*) &colorFloat, &color, sizeof(float));
std::vector<float> colors(6, colorFloat);
GL::VBO positionVBO(positions, 2);
positionVBO.addVertexAttribPointer(0, 2, 0);
GL::VBO colorVBO(colors, 1);
colorVBO.addVertexAttribPointer(1, 1, 0);
GL::VAO tileSelectVao(positions.size() / 2); // each pos = 2 vertecies
tileSelectVao.bind();
tileSelectVao.bindVBO(positionVBO);
tileSelectVao.bindVBO(colorVBO);
tileSelectVao.unbind();
return tileSelectVao;
}
} // namespace WorldLoader