Fix a gazillion typos.

This commit is contained in:
imallett 2022-10-07 10:37:09 -07:00
parent 56e1098993
commit d9ce9eb9d2

View File

@ -32,7 +32,7 @@
// - v2.6.0 Support serializing sparse accessor(Thanks to @fynv).
// Disable expanding file path for security(no use of awkward `wordexp` anymore).
// - v2.5.0 Add SetPreserveImageChannels() option to load image data as is.
// - v2.4.3 Fix null object output when when material has all default
// - v2.4.3 Fix null object output when material has all default
// parameters.
// - v2.4.2 Decode percent-encoded URI.
// - v2.4.1 Fix some glTF object class does not have `extensions` and/or
@ -46,7 +46,7 @@
// - v2.2.0 Add loading 16bit PNG support. Add Sparse accessor support(Thanks
// to @Ybalrid)
// - v2.1.0 Add draco compression.
// - v2.0.1 Add comparsion feature(Thanks to @Selmar).
// - v2.0.1 Add comparison feature(Thanks to @Selmar).
// - v2.0.0 glTF 2.0!.
//
// Tiny glTF loader is using following third party libraries:
@ -233,7 +233,7 @@ static inline int32_t GetComponentSizeInBytes(uint32_t componentType) {
} else if (componentType == TINYGLTF_COMPONENT_TYPE_DOUBLE) {
return 8;
} else {
// Unknown componenty type
// Unknown component type
return -1;
}
}
@ -254,7 +254,7 @@ static inline int32_t GetNumComponentsInType(uint32_t ty) {
} else if (ty == TINYGLTF_TYPE_MAT4) {
return 16;
} else {
// Unknown componenty type
// Unknown component type
return -1;
}
}
@ -441,7 +441,7 @@ TINYGLTF_VALUE_GET(Value::Object, object_value_)
#pragma clang diagnostic ignored "-Wpadded"
#endif
/// Agregate object for representing a color
/// Aggregate object for representing a color
using ColorValue = std::array<double, 4>;
// === legacy interface ====
@ -478,7 +478,7 @@ struct Parameter {
if (it != std::end(json_double_value)) {
return int(it->second);
}
// As per the spec, if texCoord is ommited, this parameter is 0
// As per the spec, if texCoord is omitted, this parameter is 0
return 0;
}
@ -490,7 +490,7 @@ struct Parameter {
if (it != std::end(json_double_value)) {
return it->second;
}
// As per the spec, if scale is ommited, this paramter is 1
// As per the spec, if scale is omitted, this parameter is 1
return 1;
}
@ -502,7 +502,7 @@ struct Parameter {
if (it != std::end(json_double_value)) {
return it->second;
}
// As per the spec, if strenghth is ommited, this parameter is 1
// As per the spec, if strength is omitted, this parameter is 1
return 1;
}
@ -516,7 +516,7 @@ struct Parameter {
/// material
ColorValue ColorFactor() const {
return {
{// this agregate intialize the std::array object, and uses C++11 RVO.
{// this aggregate initialize the std::array object, and uses C++11 RVO.
number_array[0], number_array[1], number_array[2],
(number_array.size() > 3 ? number_array[3] : 1.0)}};
}
@ -827,7 +827,7 @@ struct BufferView {
size_t byteStride{0}; // minimum 4, maximum 252 (multiple of 4), default 0 =
// understood to be tightly packed
int target{0}; // ["ARRAY_BUFFER", "ELEMENT_ARRAY_BUFFER"] for vertex indices
// or atttribs. Could be 0 for other data
// or attribs. Could be 0 for other data
Value extras;
ExtensionMap extensions;
@ -903,7 +903,7 @@ struct Accessor {
return componentSizeInBytes * numComponents;
} else {
// Check if byteStride is a mulple of the size of the accessor's component
// Check if byteStride is a multiple of the size of the accessor's component
// type.
int componentSizeInBytes =
GetComponentSizeInBytes(static_cast<uint32_t>(componentType));
@ -942,7 +942,7 @@ struct PerspectiveCamera {
PerspectiveCamera()
: aspectRatio(0.0),
yfov(0.0),
zfar(0.0) // 0 = use infinite projecton matrix
zfar(0.0) // 0 = use infinite projection matrix
,
znear(0.0) {}
DEFAULT_METHODS(PerspectiveCamera)
@ -1003,7 +1003,7 @@ struct Primitive {
int indices; // The index of the accessor that contains the indices.
int mode; // one of TINYGLTF_MODE_***
std::vector<std::map<std::string, int> > targets; // array of morph targets,
// where each target is a dict with attribues in ["POSITION, "NORMAL",
// where each target is a dict with attributes in ["POSITION, "NORMAL",
// "TANGENT"] pointing
// to their corresponding accessors
ExtensionMap extensions;
@ -1138,7 +1138,7 @@ struct Light {
std::vector<double> color;
double intensity{1.0};
std::string type;
double range{0.0}; // 0.0 = inifinite
double range{0.0}; // 0.0 = infinite
SpotLight spot;
Light() : intensity(1.0), range(0.0) {}
@ -1288,7 +1288,7 @@ bool WriteWholeFile(std::string *err, const std::string &filepath,
#endif
///
/// glTF Parser/Serialier context.
/// glTF Parser/Serializer context.
///
class TinyGLTF {
public:
@ -1351,7 +1351,7 @@ class TinyGLTF {
unsigned int check_sections = REQUIRE_VERSION);
///
/// Write glTF to stream, buffers and images will be embeded
/// Write glTF to stream, buffers and images will be embedded
///
bool WriteGltfSceneToStream(Model *model, std::ostream &stream,
bool prettyPrint, bool writeBinary);
@ -1386,7 +1386,7 @@ class TinyGLTF {
///
/// Set serializing default values(default = false).
/// When true, default values are force serialized to .glTF.
/// This may be helpfull if you want to serialize a full description of glTF
/// This may be helpful if you want to serialize a full description of glTF
/// data.
///
/// TODO(LTE): Supply parsing option as function arguments to
@ -1412,8 +1412,8 @@ class TinyGLTF {
}
///
/// Specify whether preserve image channales when loading images or not.
/// (Not effective when the user suppy their own LoadImageData callbacks)
/// Specify whether preserve image channels when loading images or not.
/// (Not effective when the user supplies their own LoadImageData callbacks)
///
void SetPreserveImageChannels(bool onoff) {
preserve_image_channels_ = onoff;
@ -1550,7 +1550,7 @@ class TinyGLTF {
#endif
#endif
// Disable GCC warnigs
// Disable GCC warnings
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wtype-limits"
@ -1740,7 +1740,7 @@ namespace tinygltf {
struct LoadImageDataOption {
// true: preserve image channels(e.g. load as RGB image if the image has RGB
// channels) default `false`(channels are expanded to RGBA for backward
// compatiblity).
// compatibility).
bool preserve_channels{false};
};
@ -2387,7 +2387,7 @@ bool LoadImageData(Image *image, const int image_idx, std::string *err,
// It is possible that the image we want to load is a 16bit per channel image
// We are going to attempt to load it as 16bit per channel, and if it worked,
// set the image data accodingly. We are casting the returned pointer into
// set the image data accordingly. We are casting the returned pointer into
// unsigned char, because we are representing "bytes". But we are updating
// the Image metadata to signal that this image uses 2 bytes (16bits) per
// channel:
@ -2402,7 +2402,7 @@ bool LoadImageData(Image *image, const int image_idx, std::string *err,
// at this point, if data is still NULL, it means that the image wasn't
// 16bit per channel, we are going to load it as a normal 8bit per channel
// mage as we used to do:
// image as we used to do:
// if image cannot be decoded, ignore parsing and keep it by its path
// don't break in this case
// FIXME we should only enter this function if the image is embedded. If
@ -2826,7 +2826,7 @@ static void UpdateImageObject(Image &image, std::string &baseDir, int index,
void *user_data = nullptr) {
std::string filename;
std::string ext;
// If image has uri, use it it as a filename
// If image has uri, use it as a filename
if (image.uri.size()) {
filename = GetBaseFilename(image.uri);
ext = GetFilePathExtension(filename);
@ -4272,7 +4272,7 @@ static bool ParseSparseAccessor(Accessor *accessor, std::string *err,
}
if (!FindMember(o, "values", values_iterator)) {
(*err) = "the sparse object ob ths accessor doesn't have values";
(*err) = "the sparse object of this accessor doesn't have values";
return false;
}
@ -4618,7 +4618,7 @@ static bool ParsePrimitive(Primitive *primitive, Model *model, std::string *err,
int mode = TINYGLTF_MODE_TRIANGLES;
ParseIntegerProperty(&mode, err, o, "mode", false);
primitive->mode = mode; // Why only triangled were supported ?
primitive->mode = mode; // Why only triangles were supported ?
int indices = -1;
ParseIntegerProperty(&indices, err, o, "indices", false);
@ -4901,7 +4901,7 @@ static bool ParseMaterial(Material *material, std::string *err, const json &o,
// Old code path. For backward compatibility, we still store material values
// as Parameter. This will create duplicated information for
// example(pbrMetallicRoughness), but should be neglible in terms of memory
// example(pbrMetallicRoughness), but should be negligible in terms of memory
// consumption.
// TODO(syoyo): Remove in the next major release.
material->values.clear();
@ -4934,7 +4934,7 @@ static bool ParseMaterial(Material *material, std::string *err, const json &o,
Parameter param;
if (ParseParameterProperty(&param, err, o, key, false)) {
// names of materials have already been parsed. Putting it in this map
// doesn't correctly reflext the glTF specification
// doesn't correctly reflect the glTF specification
if (key != "name")
material->additionalValues.emplace(std::move(key), std::move(param));
}
@ -5140,7 +5140,7 @@ static bool ParseSampler(Sampler *sampler, std::string *err, const json &o,
// ParseIntegerProperty(&wrapR, err, o, "wrapR", false); // tinygltf
// extension
// TODO(syoyo): Check the value is alloed one.
// TODO(syoyo): Check the value is allowed one.
// (e.g. we allow 9728(NEAREST), but don't allow 9727)
sampler->minFilter = minFilter;
@ -5349,7 +5349,7 @@ static bool ParseCamera(Camera *camera, std::string *err, const json &o,
if (!FindMember(o, "orthographic", orthoIt)) {
if (err) {
std::stringstream ss;
ss << "Orhographic camera description not found." << std::endl;
ss << "Orthographic camera description not found." << std::endl;
(*err) += ss.str();
}
return false;
@ -5801,7 +5801,7 @@ bool TinyGLTF::LoadFromString(Model *model, std::string *err, std::string *warn,
model->bufferViews[size_t(bufferView)].target =
TINYGLTF_TARGET_ELEMENT_ARRAY_BUFFER;
// we could optionally check if acessors' bufferView type is Scalar, as
// we could optionally check if accessors' bufferView type is Scalar, as
// it should be
}
@ -6324,7 +6324,7 @@ bool TinyGLTF::LoadBinaryFromMemory(Model *model, std::string *err,
bin_size_ = 0;
} else {
// Read Chunk1 info(BIN data)
// At least Chunk1 should have 12 bytes(8 bytes(header) + 4 bytes(bin payload could be 1~3 bytes, but need to be aliged to 4 bytes)
// At least Chunk1 should have 12 bytes(8 bytes(header) + 4 bytes(bin payload could be 1~3 bytes, but need to be aligned to 4 bytes)
if ((header_and_json_size + 12ull) > uint64_t(length)) {
if (err) {
(*err) = "Insufficient storage space for Chunk1(BIN data). At least Chunk1 Must have 4 bytes or more bytes, but got " + std::to_string((header_and_json_size + 12ull) - uint64_t(length)) + ".\n";
@ -6364,7 +6364,7 @@ bool TinyGLTF::LoadBinaryFromMemory(Model *model, std::string *err,
if (chunk1_format != 0x004e4942) {
if (err) {
(*err) = "Invlid type for chunk1 data.";
(*err) = "Invalid type for chunk1 data.";
}
return false;
}
@ -6653,7 +6653,7 @@ static void SerializeGltfBufferData(const std::vector<unsigned char> &data,
SerializeStringProperty("uri", header + encodedData, o);
} else {
// Issue #229
// size 0 is allowd. Just emit mime header.
// size 0 is allowed. Just emit mime header.
SerializeStringProperty("uri", header, o);
}
}
@ -7151,7 +7151,7 @@ static void SerializeGltfMaterial(Material &material, json &o) {
// Do not serialize `pbrMetallicRoughness` if pbrMetallicRoughness has all
// default values(json is null). Otherwise it will serialize to
// `pbrMetallicRoughness : null`, which cannot be read by other glTF
// importers(and validators).
// importers (and validators).
//
if (!JsonIsNull(pbrMetallicRoughness)) {
JsonAddMember(o, "pbrMetallicRoughness", std::move(pbrMetallicRoughness));
@ -7193,7 +7193,7 @@ static void SerializeGltfMesh(Mesh &mesh, json &o) {
JsonAddMember(primitive, "attributes", std::move(attributes));
}
// Indicies is optional
// Indices is optional
if (gltfPrimitive.indices > -1) {
SerializeNumberProperty<int>("indices", gltfPrimitive.indices, primitive);
}