diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-14 15:14:25 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-14 15:14:25 +0100 |
| commit | 8ce27b7e15f0fc65c8ee78950c7501660b936178 (patch) | |
| tree | 391f32111b9a30a0156709b6c1ed2fae7b435d57 /tools/asset_packer.cc | |
| parent | e38be0dbf5816338ff97e2ee2f9adfff2902dc2b (diff) | |
style: Apply clang-format to codebase
Diffstat (limited to 'tools/asset_packer.cc')
| -rw-r--r-- | tools/asset_packer.cc | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/tools/asset_packer.cc b/tools/asset_packer.cc index af89a88..fdecb58 100644 --- a/tools/asset_packer.cc +++ b/tools/asset_packer.cc @@ -4,8 +4,8 @@ #include <algorithm> // For std::count #include <cmath> -#include <cstdio> // for simplicity, use fprintf() for output generation -#include <cstring> // For std::memcpy +#include <cstdio> // for simplicity, use fprintf() for output generation +#include <cstring> // For std::memcpy #include <filesystem> // For path normalization #include <fstream> #include <map> @@ -52,8 +52,8 @@ static bool HasMeshExtension(const std::string& filename) { struct AssetBuildInfo; static bool ParseProceduralParams(const std::string& params_str, - std::vector<float>* out_params, - const std::string& asset_name) { + std::vector<float>* out_params, + const std::string& asset_name) { size_t current_pos = 0; while (current_pos < params_str.length()) { size_t comma_pos = params_str.find(',', current_pos); @@ -93,7 +93,7 @@ struct AssetBuildInfo { }; static bool ParseProceduralFunction(const std::string& compression_type_str, - AssetBuildInfo* info, bool is_gpu) { + AssetBuildInfo* info, bool is_gpu) { const char* prefix = is_gpu ? "PROC_GPU(" : "PROC("; size_t prefix_len = is_gpu ? 9 : 5; @@ -144,15 +144,21 @@ static bool ParseProceduralFunction(const std::string& compression_type_str, struct Vec3 { float x, y, z; - Vec3 operator+(const Vec3& o) const { return {x + o.x, y + o.y, z + o.z}; } + Vec3 operator+(const Vec3& o) const { + return {x + o.x, y + o.y, z + o.z}; + } Vec3 operator+=(const Vec3& o) { x += o.x; y += o.y; z += o.z; return *this; } - Vec3 operator-(const Vec3& o) const { return {x - o.x, y - o.y, z - o.z}; } - Vec3 operator*(float s) const { return {x * s, y * s, z * s}; } + Vec3 operator-(const Vec3& o) const { + return {x - o.x, y - o.y, z - o.z}; + } + Vec3 operator*(float s) const { + return {x * s, y * s, z * s}; + } static Vec3 cross(const Vec3& a, const Vec3& b) { return {a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, a.x * b.y - a.y * b.x}; @@ -168,8 +174,8 @@ struct Vertex { }; static bool ProcessMeshFile(const std::string& full_path, - std::vector<uint8_t>* buffer, - const std::string& asset_name) { + std::vector<uint8_t>* buffer, + const std::string& asset_name) { std::ifstream obj_file(full_path); if (!obj_file.is_open()) { fprintf(stderr, "Error: Could not open mesh file: %s\n", full_path.c_str()); @@ -269,8 +275,8 @@ static bool ProcessMeshFile(const std::string& full_path, for (const auto& face : raw_faces) { for (int i = 0; i < 3; ++i) { char key_buf[128]; - std::snprintf(key_buf, sizeof(key_buf), "%d/%d/%d", face.v[i], - face.vt[i], face.vn[i]); + std::snprintf(key_buf, sizeof(key_buf), "%d/%d/%d", face.v[i], face.vt[i], + face.vn[i]); std::string key = key_buf; if (vertex_map.find(key) == vertex_map.end()) { @@ -318,8 +324,8 @@ static bool ProcessMeshFile(const std::string& full_path, } static bool ProcessImageFile(const std::string& full_path, - std::vector<uint8_t>* buffer, - const std::string& asset_name) { + std::vector<uint8_t>* buffer, + const std::string& asset_name) { int w, h, channels; unsigned char* img_data = stbi_load(full_path.c_str(), &w, &h, &channels, 4); // Force RGBA |
