cppcoreguidelines-prefer-member-initializer

This commit is contained in:
Bryn Lloyd 2023-06-21 22:30:14 +02:00
parent 3e98ac4564
commit cb6a707014

View File

@ -572,9 +572,9 @@ struct Animation {
struct Skin { struct Skin {
std::string name; std::string name;
int inverseBindMatrices; // required here but not in the spec int inverseBindMatrices{-1}; // required here but not in the spec
int skeleton; // The index of the node used as a skeleton root int skeleton{-1}; // The index of the node used as a skeleton root
std::vector<int> joints; // Indices of skeleton nodes std::vector<int> joints; // Indices of skeleton nodes
Value extras; Value extras;
ExtensionMap extensions; ExtensionMap extensions;
@ -583,10 +583,7 @@ struct Skin {
std::string extras_json_string; std::string extras_json_string;
std::string extensions_json_string; std::string extensions_json_string;
Skin() { Skin() = default;
inverseBindMatrices = -1;
skeleton = -1;
}
DEFAULT_METHODS(Skin) DEFAULT_METHODS(Skin)
bool operator==(const Skin &) const; bool operator==(const Skin &) const;
}; };
@ -624,14 +621,14 @@ struct Sampler {
struct Image { struct Image {
std::string name; std::string name;
int width; int width{-1};
int height; int height{-1};
int component; int component{-1};
int bits; // bit depth per channel. 8(byte), 16 or 32. int bits{-1}; // bit depth per channel. 8(byte), 16 or 32.
int pixel_type; // pixel type(TINYGLTF_COMPONENT_TYPE_***). usually int pixel_type{-1}; // pixel type(TINYGLTF_COMPONENT_TYPE_***). usually
// UBYTE(bits = 8) or USHORT(bits = 16) // UBYTE(bits = 8) or USHORT(bits = 16)
std::vector<unsigned char> image; std::vector<unsigned char> image;
int bufferView; // (required if no uri) int bufferView{-1}; // (required if no uri)
std::string mimeType; // (required if no uri) ["image/jpeg", "image/png", std::string mimeType; // (required if no uri) ["image/jpeg", "image/png",
// "image/bmp", "image/gif"] // "image/bmp", "image/gif"]
std::string uri; // (required if no mimeType) uri is not decoded(e.g. std::string uri; // (required if no mimeType) uri is not decoded(e.g.
@ -651,14 +648,7 @@ struct Image {
// function) // function)
bool as_is{false}; bool as_is{false};
Image() { Image() = default;
bufferView = -1;
width = -1;
height = -1;
component = -1;
bits = -1;
pixel_type = -1;
}
DEFAULT_METHODS(Image) DEFAULT_METHODS(Image)
bool operator==(const Image &) const; bool operator==(const Image &) const;
@ -972,10 +962,10 @@ struct Primitive {
// integer, where each integer // integer, where each integer
// is the index of the accessor // is the index of the accessor
// containing an attribute. // containing an attribute.
int material; // The index of the material to apply to this primitive int material{-1}; // The index of the material to apply to this primitive
// when rendering. // when rendering.
int indices; // The index of the accessor that contains the indices. int indices{-1}; // The index of the accessor that contains the indices.
int mode; // one of TINYGLTF_MODE_*** int mode{-1}; // one of TINYGLTF_MODE_***
std::vector<std::map<std::string, int> > targets; // array of morph targets, std::vector<std::map<std::string, int> > targets; // array of morph targets,
// where each target is a dict with attributes in ["POSITION, "NORMAL", // where each target is a dict with attributes in ["POSITION, "NORMAL",
// "TANGENT"] pointing // "TANGENT"] pointing
@ -987,11 +977,7 @@ struct Primitive {
std::string extras_json_string; std::string extras_json_string;
std::string extensions_json_string; std::string extensions_json_string;
Primitive() { Primitive() = default;
material = -1;
indices = -1;
mode = -1;
}
DEFAULT_METHODS(Primitive) DEFAULT_METHODS(Primitive)
bool operator==(const Primitive &) const; bool operator==(const Primitive &) const;
}; };
@ -1238,7 +1224,7 @@ class Model {
std::vector<AudioEmitter> audioEmitters; std::vector<AudioEmitter> audioEmitters;
std::vector<AudioSource> audioSources; std::vector<AudioSource> audioSources;
int defaultScene = -1; int defaultScene{-1};
std::vector<std::string> extensionsUsed; std::vector<std::string> extensionsUsed;
std::vector<std::string> extensionsRequired; std::vector<std::string> extensionsRequired;
@ -7629,7 +7615,6 @@ static void SerializeGltfAudioSource(const AudioSource &source,
detail::json &o) { detail::json &o) {
std::string name; std::string name;
std::string uri; std::string uri;
int bufferView; // (required if no uri)
std::string mimeType; // (required if no uri) ["audio/mp3", "audio/ogg", std::string mimeType; // (required if no uri) ["audio/mp3", "audio/ogg",
// "audio/wav", "audio/m4a"] // "audio/wav", "audio/m4a"]