Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Applying cpplint #999

Merged
merged 2 commits into from
Jul 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,18 @@
},
"json.schemas": [
{
"fileMatch": [
"/*.json"
],
"fileMatch": ["/*.json"],
"url": "./scripts/scene.schema.json"
}
],
"editor.formatOnSave": true
}
"editor.formatOnSave": true,
"cpplint.filters": [
"-runtime/references",
"-legal/copyright",
"-build/header_guard",
"-build/include_subdir",
"-whitespace/braces",
"-readability/casting",
"-build/c++11"
]
}
2 changes: 2 additions & 0 deletions libs/yocto/yocto_bvh.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@
// -----------------------------------------------------------------------------

#include <memory>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>

#include "yocto_math.h"

Expand Down
3 changes: 3 additions & 0 deletions libs/yocto/yocto_color.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@
// INCLUDES
// -----------------------------------------------------------------------------

#include <algorithm>
#include <utility>

#include "yocto_math.h"

// -----------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions libs/yocto/yocto_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include <deque>
#include <future>
#include <mutex>
#include <string>
#include <thread>
#include <unordered_map>
#include <utility>
Expand Down
3 changes: 2 additions & 1 deletion libs/yocto/yocto_commonio.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,8 @@ inline string format_duration(int64_t duration) {
auto secs = (int)(elapsed / 1000);
auto msecs = (int)(elapsed % 1000);
char buffer[256];
sprintf(buffer, "%02d:%02d:%02d.%03d", hours, mins, secs, msecs);
snprintf(
buffer, sizeof(buffer), "%02d:%02d:%02d.%03d", hours, mins, secs, msecs);
return buffer;
}

Expand Down
3 changes: 3 additions & 0 deletions libs/yocto/yocto_geometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
// INCLUDES
// -----------------------------------------------------------------------------

#include <algorithm>
#include <utility>

#include "yocto_math.h"

// -----------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions libs/yocto/yocto_image.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#include <functional>
#include <string>
#include <vector>
#include <utility>

#include "yocto_math.h"

Expand Down
55 changes: 27 additions & 28 deletions libs/yocto/yocto_math.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include <functional>
#include <limits>
#include <stdexcept>
#include <utility>
#include <vector>

// -----------------------------------------------------------------------------
Expand Down Expand Up @@ -1252,15 +1253,13 @@ inline vec2f log(const vec2f& a) { return {log(a.x), log(a.y)}; }
inline vec2f exp2(const vec2f& a) { return {exp2(a.x), exp2(a.y)}; }
inline vec2f log2(const vec2f& a) { return {log2(a.x), log2(a.y)}; }
inline bool isfinite(const vec2f& a) { return isfinite(a.x) && isfinite(a.y); }
inline vec2f pow(const vec2f& a, float b) {
return {pow(a.x, b), pow(a.y, b)};
};
inline vec2f pow(const vec2f& a, float b) { return {pow(a.x, b), pow(a.y, b)}; }
inline vec2f pow(const vec2f& a, const vec2f& b) {
return {pow(a.x, b.x), pow(a.y, b.y)};
};
}
inline vec2f gain(const vec2f& a, float b) {
return {gain(a.x, b), gain(a.y, b)};
};
}
inline void swap(vec2f& a, vec2f& b) { std::swap(a, b); }

// Vector sequence operations.
Expand Down Expand Up @@ -1401,24 +1400,24 @@ inline float sum(const vec3f& a) { return a.x + a.y + a.z; }
inline float mean(const vec3f& a) { return sum(a) / 3; }

// Functions applied to vector elements
inline vec3f abs(const vec3f& a) { return {abs(a.x), abs(a.y), abs(a.z)}; };
inline vec3f sqrt(const vec3f& a) { return {sqrt(a.x), sqrt(a.y), sqrt(a.z)}; };
inline vec3f exp(const vec3f& a) { return {exp(a.x), exp(a.y), exp(a.z)}; };
inline vec3f log(const vec3f& a) { return {log(a.x), log(a.y), log(a.z)}; };
inline vec3f exp2(const vec3f& a) { return {exp2(a.x), exp2(a.y), exp2(a.z)}; };
inline vec3f log2(const vec3f& a) { return {log2(a.x), log2(a.y), log2(a.z)}; };
inline vec3f abs(const vec3f& a) { return {abs(a.x), abs(a.y), abs(a.z)}; }
inline vec3f sqrt(const vec3f& a) { return {sqrt(a.x), sqrt(a.y), sqrt(a.z)}; }
inline vec3f exp(const vec3f& a) { return {exp(a.x), exp(a.y), exp(a.z)}; }
inline vec3f log(const vec3f& a) { return {log(a.x), log(a.y), log(a.z)}; }
inline vec3f exp2(const vec3f& a) { return {exp2(a.x), exp2(a.y), exp2(a.z)}; }
inline vec3f log2(const vec3f& a) { return {log2(a.x), log2(a.y), log2(a.z)}; }
inline vec3f pow(const vec3f& a, float b) {
return {pow(a.x, b), pow(a.y, b), pow(a.z, b)};
};
}
inline vec3f pow(const vec3f& a, const vec3f& b) {
return {pow(a.x, b.x), pow(a.y, b.y), pow(a.z, b.z)};
};
}
inline vec3f gain(const vec3f& a, float b) {
return {gain(a.x, b), gain(a.y, b), gain(a.z, b)};
};
}
inline bool isfinite(const vec3f& a) {
return isfinite(a.x) && isfinite(a.y) && isfinite(a.z);
};
}
inline void swap(vec3f& a, vec3f& b) { std::swap(a, b); }

// Vector sequence operations.
Expand Down Expand Up @@ -1552,34 +1551,34 @@ inline float mean(const vec4f& a) { return sum(a) / 4; }
// Functions applied to vector elements
inline vec4f abs(const vec4f& a) {
return {abs(a.x), abs(a.y), abs(a.z), abs(a.w)};
};
}
inline vec4f sqrt(const vec4f& a) {
return {sqrt(a.x), sqrt(a.y), sqrt(a.z), sqrt(a.w)};
};
}
inline vec4f exp(const vec4f& a) {
return {exp(a.x), exp(a.y), exp(a.z), exp(a.w)};
};
}
inline vec4f log(const vec4f& a) {
return {log(a.x), log(a.y), log(a.z), log(a.w)};
};
}
inline vec4f exp2(const vec4f& a) {
return {exp2(a.x), exp2(a.y), exp2(a.z), exp2(a.w)};
};
}
inline vec4f log2(const vec4f& a) {
return {log2(a.x), log2(a.y), log2(a.z), log2(a.w)};
};
}
inline vec4f pow(const vec4f& a, float b) {
return {pow(a.x, b), pow(a.y, b), pow(a.z, b), pow(a.w, b)};
};
}
inline vec4f pow(const vec4f& a, const vec4f& b) {
return {pow(a.x, b.x), pow(a.y, b.y), pow(a.z, b.z), pow(a.w, b.w)};
};
}
inline vec4f gain(const vec4f& a, float b) {
return {gain(a.x, b), gain(a.y, b), gain(a.z, b), gain(a.w, b)};
};
}
inline bool isfinite(const vec4f& a) {
return isfinite(a.x) && isfinite(a.y) && isfinite(a.z) && isfinite(a.w);
};
}
inline void swap(vec4f& a, vec4f& b) { std::swap(a, b); }

// Quaternion operatons represented as xi + yj + zk + w
Expand Down Expand Up @@ -1700,7 +1699,7 @@ inline int min(const vec2i& a) { return min(a.x, a.y); }
inline int sum(const vec2i& a) { return a.x + a.y; }

// Functions applied to vector elements
inline vec2i abs(const vec2i& a) { return {abs(a.x), abs(a.y)}; };
inline vec2i abs(const vec2i& a) { return {abs(a.x), abs(a.y)}; }
inline void swap(vec2i& a, vec2i& b) { std::swap(a, b); }

// Vector sequence operations.
Expand Down Expand Up @@ -1792,7 +1791,7 @@ inline int min(const vec3i& a) { return min(min(a.x, a.y), a.z); }
inline int sum(const vec3i& a) { return a.x + a.y + a.z; }

// Functions applied to vector elements
inline vec3i abs(const vec3i& a) { return {abs(a.x), abs(a.y), abs(a.z)}; };
inline vec3i abs(const vec3i& a) { return {abs(a.x), abs(a.y), abs(a.z)}; }
inline void swap(vec3i& a, vec3i& b) { std::swap(a, b); }

// Vector sequence operations.
Expand Down Expand Up @@ -1887,7 +1886,7 @@ inline int sum(const vec4i& a) { return a.x + a.y + a.z + a.w; }
// Functions applied to vector elements
inline vec4i abs(const vec4i& a) {
return {abs(a.x), abs(a.y), abs(a.z), abs(a.w)};
};
}
inline void swap(vec4i& a, vec4i& b) { std::swap(a, b); }

} // namespace yocto
Expand Down
4 changes: 2 additions & 2 deletions libs/yocto/yocto_modelio.h
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,8 @@ struct obj_texture {
unordered_map<string, vector<float>> props;

obj_texture() {}
obj_texture(const char* path) : path{path} {}
obj_texture(const string& path) : path{path} {}
explicit obj_texture(const char* path) : path{path} {}
explicit obj_texture(const string& path) : path{path} {}
};

// Obj element
Expand Down
3 changes: 3 additions & 0 deletions libs/yocto/yocto_sampling.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
// INCLUDES
// -----------------------------------------------------------------------------

#include <utility>
#include <vector>

#include "yocto_math.h"

// -----------------------------------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions libs/yocto/yocto_scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

#include "yocto_scene.h"

#include <algorithm>
#include <atomic>
#include <cassert>
#include <cctype>
Expand All @@ -37,6 +38,7 @@
#include <deque>
#include <future>
#include <memory>
#include <unordered_map>

#include "yocto_color.h"
#include "yocto_geometry.h"
Expand Down
3 changes: 3 additions & 0 deletions libs/yocto/yocto_scene.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@

#include <functional>
#include <memory>
#include <string>
#include <utility>
#include <vector>

#include "yocto_image.h"
#include "yocto_math.h"
Expand Down
4 changes: 4 additions & 0 deletions libs/yocto/yocto_sceneio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

#include "yocto_sceneio.h"

#include <algorithm>
#include <atomic>
#include <cassert>
#include <cctype>
Expand All @@ -36,6 +37,9 @@
#include <deque>
#include <future>
#include <memory>
#include <unordered_map>
#include <utility>
#include <vector>

#include "ext/cgltf.h"
#include "ext/filesystem.hpp"
Expand Down
1 change: 1 addition & 0 deletions libs/yocto/yocto_sceneio.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

#include <functional>
#include <memory>
#include <string>

#include "yocto_scene.h"

Expand Down
2 changes: 2 additions & 0 deletions libs/yocto/yocto_shading.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@
// INCLUDES
// -----------------------------------------------------------------------------

#include <algorithm>
#include <string>
#include <unordered_map>
#include <utility>

#include "yocto_math.h"
#include "yocto_sampling.h"
Expand Down
1 change: 1 addition & 0 deletions libs/yocto/yocto_shape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include "yocto_shape.h"

#include <algorithm>
#include <atomic>
#include <deque>
#include <memory>
Expand Down
3 changes: 3 additions & 0 deletions libs/yocto/yocto_shape.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,11 @@
// -----------------------------------------------------------------------------

#include <memory>
#include <string>
#include <tuple>
#include <unordered_map>
#include <utility>
#include <vector>

#include "yocto_math.h"

Expand Down
8 changes: 4 additions & 4 deletions libs/yocto/yocto_trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
//
//

// TODO: flatten state

#ifndef _YOCTO_TRACE_H_
#define _YOCTO_TRACE_H_

Expand All @@ -42,6 +40,8 @@
#include <atomic>
#include <future>
#include <memory>
#include <string>
#include <vector>

#include "yocto_image.h"
#include "yocto_math.h"
Expand Down Expand Up @@ -83,8 +83,8 @@ enum struct trace_sampler_type {
// Type of false color visualization
enum struct trace_falsecolor_type {
// clang-format off
position, normal, frontfacing, gnormal, gfrontfacing, texcoord, color,
emission, diffuse, specular, coat, metal, transmission, translucency,
position, normal, frontfacing, gnormal, gfrontfacing, texcoord, color,
emission, diffuse, specular, coat, metal, transmission, translucency,
refraction, roughness, opacity, ior, instance, element, highlight
// clang-format on
};
Expand Down
Loading