diff --git a/.gitignore b/.gitignore index 0f61213..854b0a5 100644 --- a/.gitignore +++ b/.gitignore @@ -144,4 +144,4 @@ friends/ # Python virtualenv/ __pycache__/ -*.pyc \ No newline at end of file +*.pyc diff --git a/assignments/hw3/src/Makefile b/assignments/hw3/src/Makefile index 6ab14d5..77e72ca 100644 --- a/assignments/hw3/src/Makefile +++ b/assignments/hw3/src/Makefile @@ -22,6 +22,7 @@ hw3_flat: flat.cpp .PHONY += codegen codegen: cd code_generation; python3 ./generate.py flat.cpp > ../flat.cpp + clang-format -i flat.cpp # cd code_generation; python3 ./generate.py sphere.cpp > ../sphere.cpp codegen-build: codegen hw3_flat diff --git a/assignments/hw3/src/flat.cpp b/assignments/hw3/src/flat.cpp index 0518ca0..7856e19 100644 --- a/assignments/hw3/src/flat.cpp +++ b/assignments/hw3/src/flat.cpp @@ -665,38 +665,35 @@ struct HW3Utility { // MESH GENERATION void GenerateTerrainVertices() { - - for (auto z = 0; z < TextureHeight; ++z) { - for (auto x = 0; x < TextureWidth; ++x) { - Vertices.push_back({ - .Position = glm::vec3((float) x, 0.0f, (float) z), - .TextureCoordinates = glm::vec2((float) -x / TextureWidth, - (float) -z / TextureHeight) - }); - } - } + for (auto z = 0; z < TextureHeight; ++z) { + for (auto x = 0; x < TextureWidth; ++x) { + Vertices.push_back( + {.Position = glm::vec3((float)x, 0.0f, (float)z), + .TextureCoordinates = glm::vec2( + (float)-x / TextureWidth, (float)-z / TextureHeight)}); + } + } } void GenerateTerrainIndices() { - - for (auto i = 0; i < TextureHeight - 1; ++i) { - for (auto j = 0; j < TextureWidth - 1; ++j) { - auto Current = i * TextureWidth + j; - auto Right = Current + 1; - auto Bottom = Current + TextureWidth; - auto BottomRight = Bottom + 1; - - Indices.push_back(Current); - Indices.push_back(Right); - Indices.push_back(Bottom); - Indices.push_back(Right); - Indices.push_back(BottomRight); - Indices.push_back(Bottom); - } - } + for (auto i = 0; i < TextureHeight - 1; ++i) { + for (auto j = 0; j < TextureWidth - 1; ++j) { + auto Current = i * TextureWidth + j; + auto Right = Current + 1; + auto Bottom = Current + TextureWidth; + auto BottomRight = Bottom + 1; + + Indices.push_back(Current); + Indices.push_back(Right); + Indices.push_back(Bottom); + Indices.push_back(Right); + Indices.push_back(BottomRight); + Indices.push_back(Bottom); + } + } } // LIFETIME METHODS