refactor: format all files
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
namespace td {
|
||||
namespace render {
|
||||
|
||||
void VertexCache::addData(std::uint64_t index, std::vector<float> positions, std::vector<float> colors){
|
||||
void VertexCache::addData(std::uint64_t index, std::vector<float> positions, std::vector<float> colors) {
|
||||
ElementsIndex positionsIndexes;
|
||||
positionsIndexes.first = m_Positions.end();
|
||||
m_Positions.insert(m_Positions.end(), positions.begin(), positions.end());
|
||||
@@ -15,12 +15,12 @@ void VertexCache::addData(std::uint64_t index, std::vector<float> positions, std
|
||||
m_Colors.insert(m_Colors.end(), colors.begin(), colors.end());
|
||||
colorsIndexes.second = m_Colors.end() - 1;
|
||||
|
||||
m_Indexes.insert({index, {positionsIndexes, colorsIndexes}});
|
||||
m_Indexes.insert({ index, {positionsIndexes, colorsIndexes} });
|
||||
}
|
||||
|
||||
void VertexCache::removeData(std::uint64_t index){
|
||||
void VertexCache::removeData(std::uint64_t index) {
|
||||
auto it = m_Indexes.find(index);
|
||||
if(it != m_Indexes.end()){
|
||||
if (it != m_Indexes.end()) {
|
||||
DataIndex indexes = it->second;
|
||||
ElementsIndex positionsIndexes = indexes.first;
|
||||
ElementsIndex colorsIndexes = indexes.second;
|
||||
@@ -32,13 +32,13 @@ void VertexCache::removeData(std::uint64_t index){
|
||||
}
|
||||
}
|
||||
|
||||
void VertexCache::clear(){
|
||||
void VertexCache::clear() {
|
||||
m_Positions.clear();
|
||||
m_Colors.clear();
|
||||
m_Indexes.clear();
|
||||
}
|
||||
|
||||
void VertexCache::updateVertexArray(){
|
||||
void VertexCache::updateVertexArray() {
|
||||
m_VertexArray = std::make_unique<GL::VertexArray>(m_Colors.size()); // one color per vertex
|
||||
|
||||
GL::VertexBuffer positionsBuffer(m_Positions, 2);
|
||||
|
||||
@@ -62,7 +62,7 @@ void WorldRenderer::renderMobs() const {
|
||||
}
|
||||
|
||||
void WorldRenderer::renderTowers() const {
|
||||
if(!m_TowersCache.isEmpty())
|
||||
if (!m_TowersCache.isEmpty())
|
||||
m_Renderer->renderVAO(m_TowersCache.getVertexArray());
|
||||
}
|
||||
|
||||
@@ -152,13 +152,13 @@ void WorldRenderer::detectClick() {
|
||||
}
|
||||
}
|
||||
|
||||
void WorldRenderer::addTower(game::TowerPtr tower){
|
||||
void WorldRenderer::addTower(game::TowerPtr tower) {
|
||||
const WorldLoader::RenderData& renderData = WorldLoader::loadTowerModel(tower);
|
||||
m_TowersCache.addData(tower->getID(), renderData.positions, renderData.colors);
|
||||
m_TowersCache.updateVertexArray();
|
||||
}
|
||||
|
||||
void WorldRenderer::removeTower(game::TowerPtr tower){
|
||||
void WorldRenderer::removeTower(game::TowerPtr tower) {
|
||||
m_TowersCache.removeData(tower->getID());
|
||||
m_TowersCache.updateVertexArray();
|
||||
}
|
||||
|
||||
@@ -231,7 +231,7 @@ void capValues(int* values, int& value) {
|
||||
for (int j = 0; j < 16; j++) {
|
||||
total += values[j];
|
||||
}
|
||||
if(total == 13)
|
||||
if (total == 13)
|
||||
value--;
|
||||
}
|
||||
|
||||
@@ -278,7 +278,7 @@ void renderSummonMenu() {
|
||||
ImGui::PopID();
|
||||
}
|
||||
ImGui::PopItemWidth();
|
||||
if(ImGui::Button("Send")){
|
||||
if (ImGui::Button("Send")) {
|
||||
std::cout << "Sending Troops ...\n";
|
||||
}
|
||||
ImGui::End();
|
||||
|
||||
@@ -188,7 +188,7 @@ GL::VertexArray loadTileSelectModel() {
|
||||
return tileSelectVao;
|
||||
}
|
||||
|
||||
RenderData loadTowerModel(game::TowerPtr tower){
|
||||
RenderData loadTowerModel(game::TowerPtr tower) {
|
||||
RenderData renderData;
|
||||
|
||||
float towerX = tower->getX() - 1;
|
||||
|
||||
Reference in New Issue
Block a user