diff options
author | Mark Lobodzinski <mark@lunarg.com> | 2017-01-26 13:34:13 -0700 |
---|---|---|
committer | Mark Lobodzinski <mark@lunarg.com> | 2017-01-26 15:45:51 -0700 |
commit | cc7c305c82f6443c324165edb7af59f60fc87eeb (patch) | |
tree | 330d2642bc6d6dbff2e36e905ab91ddad1853f36 /demos/smoke/Meshes.cpp | |
parent | ead2ba671e50e31961a0dd229fcf6874fa4e67c0 (diff) |
repo: Clang-format LVL source files using Google
Switch clang-format standard from the LLVM style to the
Google style for more consistency.
Change-Id: I247c4abc275d7873a91522e1e234198adaa24033
Diffstat (limited to 'demos/smoke/Meshes.cpp')
-rw-r--r-- | demos/smoke/Meshes.cpp | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/demos/smoke/Meshes.cpp b/demos/smoke/Meshes.cpp index dac0a1f3..e077be71 100644 --- a/demos/smoke/Meshes.cpp +++ b/demos/smoke/Meshes.cpp @@ -26,7 +26,7 @@ namespace { class Mesh { - public: + public: struct Position { float x; float y; @@ -96,8 +96,7 @@ class Mesh { } faces_.reserve(faces.size()); - for (const auto &f : faces) - faces_.emplace_back(Face{f[0], f[1], f[2]}); + for (const auto &f : faces) faces_.emplace_back(Face{f[0], f[1], f[2]}); } uint32_t vertex_count() const { return static_cast<uint32_t>(positions_.size()); } @@ -139,7 +138,7 @@ class Mesh { }; class BuildPyramid { - public: + public: BuildPyramid(Mesh &mesh) { const std::vector<std::array<float, 6>> vertices = { // position normal @@ -157,16 +156,15 @@ class BuildPyramid { }; class BuildIcosphere { - public: + public: BuildIcosphere(Mesh &mesh) : mesh_(mesh), radius_(1.0f) { const int tessellate_level = 2; build_icosahedron(); - for (int i = 0; i < tessellate_level; i++) - tessellate(); + for (int i = 0; i < tessellate_level; i++) tessellate(); } - private: + private: void build_icosahedron() { // https://en.wikipedia.org/wiki/Regular_icosahedron const float l1 = std::sqrt(2.0f / (5.0f + std::sqrt(5.0f))) * radius_; @@ -277,8 +275,7 @@ class BuildIcosphere { int add_middle_point(int a, int b) { uint64_t key = (a < b) ? ((uint64_t)a << 32 | b) : ((uint64_t)b << 32 | a); auto it = middle_points_.find(key); - if (it != middle_points_.end()) - return it->second; + if (it != middle_points_.end()) return it->second; const Mesh::Position &pos_a = mesh_.positions_[a]; const Mesh::Position &pos_b = mesh_.positions_[b]; @@ -310,7 +307,7 @@ class BuildIcosphere { }; class BuildTeapot { - public: + public: BuildTeapot(Mesh &mesh) { #include "Meshes.teapot.h" const int position_count = sizeof(teapot_positions) / sizeof(teapot_positions[0]); @@ -346,10 +343,8 @@ class BuildTeapot { }; for (int i = 3; i < position_count; i += 3) { for (int j = 0; j < 3; j++) { - if (min[j] > positions[i + j]) - min[j] = positions[i + j]; - if (max[j] < positions[i + j]) - max[j] = positions[i + j]; + if (min[j] > positions[i + j]) min[j] = positions[i + j]; + if (max[j] < positions[i + j]) max[j] = positions[i + j]; } } @@ -362,10 +357,8 @@ class BuildTeapot { }; float max_extent = extents[0]; - if (max_extent < extents[1]) - max_extent = extents[1]; - if (max_extent < extents[2]) - max_extent = extents[2]; + if (max_extent < extents[1]) max_extent = extents[1]; + if (max_extent < extents[2]) max_extent = extents[2]; scale = 1.0f / max_extent; } @@ -377,11 +370,15 @@ void build_meshes(std::array<Mesh, Meshes::MESH_COUNT> &meshes) { BuildTeapot build_teapot(meshes[Meshes::MESH_TEAPOT]); } -} // namespace +} // namespace Meshes::Meshes(VkDevice dev, const std::vector<VkMemoryPropertyFlags> &mem_flags) - : dev_(dev), vertex_input_binding_(Mesh::vertex_input_binding()), vertex_input_attrs_(Mesh::vertex_input_attributes()), - vertex_input_state_(), input_assembly_state_(Mesh::input_assembly_state()), index_type_(Mesh::index_type()) { + : dev_(dev), + vertex_input_binding_(Mesh::vertex_input_binding()), + vertex_input_attrs_(Mesh::vertex_input_attributes()), + vertex_input_state_(), + input_assembly_state_(Mesh::input_assembly_state()), + index_type_(Mesh::index_type()) { vertex_input_state_.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO; vertex_input_state_.vertexBindingDescriptionCount = 1; vertex_input_state_.pVertexBindingDescriptions = &vertex_input_binding_; |