refactor: format code

This commit is contained in:
2021-09-19 17:33:16 +02:00
parent 52a143769e
commit 0856ca47ca
71 changed files with 1102 additions and 1110 deletions

View File

@@ -10,7 +10,7 @@ namespace render {
namespace WorldLoader {
GL::VertexArray loadMobModel(){
GL::VertexArray loadMobModel() {
std::vector<float> positions = {
-0.5, -0.5,
0.5, -0.5,
@@ -48,19 +48,19 @@ GL::VertexArray loadMobModel(){
return mobVao;
}
GL::VertexArray loadWorldModel(const td::game::World* world){
GL::VertexArray loadWorldModel(const td::game::World* world) {
std::vector<float> positions;
std::vector<float> colors;
for (const auto& chunkInfo : world->getChunks()){
for (const auto& chunkInfo : world->getChunks()) {
const td::game::ChunkCoord& coords = chunkInfo.first;
td::game::ChunkPtr chunk = chunkInfo.second;
std::int32_t chunkX = coords.first * td::game::Chunk::ChunkWidth;
std::int32_t chunkY = coords.second * td::game::Chunk::ChunkHeight;
for (int tileY = 0; tileY < td::game::Chunk::ChunkHeight; tileY++){
for (int tileX = 0; tileX < td::game::Chunk::ChunkWidth; tileX++){
for (int tileY = 0; tileY < td::game::Chunk::ChunkHeight; tileY++) {
for (int tileX = 0; tileX < td::game::Chunk::ChunkWidth; tileX++) {
int tileNumber = tileY * td::game::Chunk::ChunkWidth + tileX;
td::game::TileIndex tileIndex = chunk->getTileIndex(tileNumber);
td::game::TilePtr tile = world->getTilePtr(tileIndex);
@@ -100,7 +100,7 @@ GL::VertexArray loadWorldModel(const td::game::World* world){
const td::game::Color* tileColor = world->getTileColor(tile);
for (int i = 0; i < 6; i++){
for (int i = 0; i < 6; i++) {
int color = 255;
color |= tileColor->r << 24;
color |= tileColor->g << 16;
@@ -115,7 +115,7 @@ GL::VertexArray loadWorldModel(const td::game::World* world){
}
}
for (int spawnColor = 0; spawnColor < 2; spawnColor++){
for (int spawnColor = 0; spawnColor < 2; spawnColor++) {
const game::Spawn& spawn = world->getTeam(game::TeamColor(spawnColor)).getSpawn();
float fromX = spawn.x - 2, toX = spawn.x + 3;
float fromY = spawn.y - 2, toY = spawn.y + 3;
@@ -130,7 +130,7 @@ GL::VertexArray loadWorldModel(const td::game::World* world){
toX, fromY,
});
for (int i = 0; i < 6; i++){
for (int i = 0; i < 6; i++) {
int color = 255;
color |= world->getSpawnColor(game::TeamColor(spawnColor)).r << 24;
color |= world->getSpawnColor(game::TeamColor(spawnColor)).g << 16;
@@ -156,7 +156,7 @@ GL::VertexArray loadWorldModel(const td::game::World* world){
return worldVao;
}
GL::VertexArray loadTileSelectModel(){
GL::VertexArray loadTileSelectModel() {
std::vector<float> positions = {
0, 0,
1, 0,
@@ -170,7 +170,7 @@ GL::VertexArray loadTileSelectModel(){
int color = 255 << 24 | 255 << 16 | 255 << 8 | 150;
float colorFloat;
memcpy((std::uint8_t*) &colorFloat, &color, sizeof(float));
memcpy((std::uint8_t*)&colorFloat, &color, sizeof(float));
std::vector<float> colors(6, colorFloat);