faet: add tile selector
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user