mirror of
https://git.mirrors.martin98.com/https://github.com/syoyo/tinygltf.git
synced 2025-08-15 20:06:02 +08:00
TINYGLTF_USE_NOEXCEPT
This commit is contained in:
parent
23467959ca
commit
b74fadef8e
157
tiny_gltf.h
157
tiny_gltf.h
@ -67,6 +67,18 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if TINYGLTF_USE_NOEXECEPT
|
||||||
|
#define TINYGLTF_NOEXCEPT noexcept
|
||||||
|
#else
|
||||||
|
#define TINYGLTF_NOEXCEPT
|
||||||
|
#endif
|
||||||
|
#define DEFAULT_METHODS(x) \
|
||||||
|
~x() = default; \
|
||||||
|
x(const x&) = default; \
|
||||||
|
x(x&&) TINYGLTF_NOEXCEPT = default; \
|
||||||
|
x& operator=(const x&) = default; \
|
||||||
|
x& operator=(x&&) TINYGLTF_NOEXCEPT = default;
|
||||||
|
|
||||||
namespace tinygltf {
|
namespace tinygltf {
|
||||||
|
|
||||||
#define TINYGLTF_MODE_POINTS (0)
|
#define TINYGLTF_MODE_POINTS (0)
|
||||||
@ -271,10 +283,8 @@ class Value {
|
|||||||
explicit Value(const Object &o) : type_(OBJECT_TYPE) { object_value_ = o; }
|
explicit Value(const Object &o) : type_(OBJECT_TYPE) { object_value_ = o; }
|
||||||
explicit Value(Object &&o) noexcept : type_(OBJECT_TYPE),
|
explicit Value(Object &&o) noexcept : type_(OBJECT_TYPE),
|
||||||
object_value_(std::move(o)) {}
|
object_value_(std::move(o)) {}
|
||||||
Value(const Value &) = default;
|
|
||||||
Value(Value &&) noexcept = default;
|
DEFAULT_METHODS(Value)
|
||||||
Value &operator=(const Value &) = default;
|
|
||||||
Value &operator=(Value &&) noexcept = default;
|
|
||||||
|
|
||||||
char Type() const { return static_cast<const char>(type_); }
|
char Type() const { return static_cast<const char>(type_); }
|
||||||
|
|
||||||
@ -486,10 +496,7 @@ struct Parameter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Parameter() = default;
|
Parameter() = default;
|
||||||
Parameter(const Parameter &) = default;
|
DEFAULT_METHODS(Parameter)
|
||||||
Parameter(Parameter &&) noexcept = default;
|
|
||||||
Parameter &operator=(const Parameter &) = default;
|
|
||||||
Parameter &operator=(Parameter &&) noexcept = default;
|
|
||||||
bool operator==(const Parameter &) const;
|
bool operator==(const Parameter &) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -514,10 +521,7 @@ struct AnimationChannel {
|
|||||||
ExtensionMap extensions;
|
ExtensionMap extensions;
|
||||||
|
|
||||||
AnimationChannel() : sampler(-1), target_node(-1) {}
|
AnimationChannel() : sampler(-1), target_node(-1) {}
|
||||||
AnimationChannel(const AnimationChannel &) = default;
|
DEFAULT_METHODS(AnimationChannel)
|
||||||
AnimationChannel(AnimationChannel &&) noexcept = default;
|
|
||||||
AnimationChannel &operator=(const AnimationChannel &) = default;
|
|
||||||
AnimationChannel &operator=(AnimationChannel &&) noexcept = default;
|
|
||||||
bool operator==(const AnimationChannel &) const;
|
bool operator==(const AnimationChannel &) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -529,10 +533,7 @@ struct AnimationSampler {
|
|||||||
Value extras;
|
Value extras;
|
||||||
|
|
||||||
AnimationSampler() : input(-1), output(-1), interpolation("LINEAR") {}
|
AnimationSampler() : input(-1), output(-1), interpolation("LINEAR") {}
|
||||||
AnimationSampler(const AnimationSampler &) = default;
|
DEFAULT_METHODS(AnimationSampler)
|
||||||
AnimationSampler(AnimationSampler &&) noexcept = default;
|
|
||||||
AnimationSampler &operator=(const AnimationSampler &) = default;
|
|
||||||
AnimationSampler &operator=(AnimationSampler &&) noexcept = default;
|
|
||||||
bool operator==(const AnimationSampler &) const;
|
bool operator==(const AnimationSampler &) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -544,10 +545,7 @@ struct Animation {
|
|||||||
ExtensionMap extensions;
|
ExtensionMap extensions;
|
||||||
|
|
||||||
Animation() = default;
|
Animation() = default;
|
||||||
Animation(const Animation &) = default;
|
DEFAULT_METHODS(Animation)
|
||||||
Animation(Animation &&) noexcept = default;
|
|
||||||
Animation &operator=(const Animation &) = default;
|
|
||||||
Animation &operator=(Animation &&) noexcept = default;
|
|
||||||
bool operator==(const Animation &) const;
|
bool operator==(const Animation &) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -561,10 +559,7 @@ struct Skin {
|
|||||||
inverseBindMatrices = -1;
|
inverseBindMatrices = -1;
|
||||||
skeleton = -1;
|
skeleton = -1;
|
||||||
}
|
}
|
||||||
Skin(const Skin &) = default;
|
DEFAULT_METHODS(Skin)
|
||||||
Skin(Skin &&) noexcept = default;
|
|
||||||
Skin &operator=(const Skin &) = default;
|
|
||||||
Skin &operator=(Skin &&) noexcept = default;
|
|
||||||
bool operator==(const Skin &) const;
|
bool operator==(const Skin &) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -593,10 +588,7 @@ struct Sampler {
|
|||||||
wrapS(TINYGLTF_TEXTURE_WRAP_REPEAT),
|
wrapS(TINYGLTF_TEXTURE_WRAP_REPEAT),
|
||||||
wrapT(TINYGLTF_TEXTURE_WRAP_REPEAT),
|
wrapT(TINYGLTF_TEXTURE_WRAP_REPEAT),
|
||||||
wrapR(TINYGLTF_TEXTURE_WRAP_REPEAT) {}
|
wrapR(TINYGLTF_TEXTURE_WRAP_REPEAT) {}
|
||||||
Sampler(const Sampler &) = default;
|
DEFAULT_METHODS(Sampler)
|
||||||
Sampler(Sampler &&) noexcept = default;
|
|
||||||
Sampler &operator=(const Sampler &) = default;
|
|
||||||
Sampler &operator=(Sampler &&) noexcept = default;
|
|
||||||
bool operator==(const Sampler &) const;
|
bool operator==(const Sampler &) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -630,10 +622,7 @@ struct Image {
|
|||||||
height = -1;
|
height = -1;
|
||||||
component = -1;
|
component = -1;
|
||||||
}
|
}
|
||||||
Image(const Image &) = default;
|
DEFAULT_METHODS(Image)
|
||||||
Image(Image &&) noexcept = default;
|
|
||||||
Image &operator=(const Image &) = default;
|
|
||||||
Image &operator=(Image &&) noexcept = default;
|
|
||||||
|
|
||||||
bool operator==(const Image &) const;
|
bool operator==(const Image &) const;
|
||||||
};
|
};
|
||||||
@ -647,10 +636,7 @@ struct Texture {
|
|||||||
ExtensionMap extensions;
|
ExtensionMap extensions;
|
||||||
|
|
||||||
Texture() : sampler(-1), source(-1) {}
|
Texture() : sampler(-1), source(-1) {}
|
||||||
Texture(const Texture &) = default;
|
DEFAULT_METHODS(Texture)
|
||||||
Texture(Texture &&) noexcept = default;
|
|
||||||
Texture &operator=(const Texture &) = default;
|
|
||||||
Texture &operator=(Texture &&) noexcept = default;
|
|
||||||
|
|
||||||
bool operator==(const Texture &) const;
|
bool operator==(const Texture &) const;
|
||||||
};
|
};
|
||||||
@ -664,10 +650,7 @@ struct TextureInfo {
|
|||||||
ExtensionMap extensions;
|
ExtensionMap extensions;
|
||||||
|
|
||||||
TextureInfo() : index(-1), texCoord(0) {}
|
TextureInfo() : index(-1), texCoord(0) {}
|
||||||
TextureInfo(const TextureInfo &) = default;
|
DEFAULT_METHODS(TextureInfo)
|
||||||
TextureInfo(TextureInfo &&) noexcept = default;
|
|
||||||
TextureInfo &operator=(const TextureInfo &) = default;
|
|
||||||
TextureInfo &operator=(TextureInfo &&) noexcept = default;
|
|
||||||
bool operator==(const TextureInfo &) const;
|
bool operator==(const TextureInfo &) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -682,10 +665,7 @@ struct NormalTextureInfo {
|
|||||||
ExtensionMap extensions;
|
ExtensionMap extensions;
|
||||||
|
|
||||||
NormalTextureInfo() : index(-1), texCoord(0), scale(1.0) {}
|
NormalTextureInfo() : index(-1), texCoord(0), scale(1.0) {}
|
||||||
NormalTextureInfo(const NormalTextureInfo &) = default;
|
DEFAULT_METHODS(NormalTextureInfo)
|
||||||
NormalTextureInfo(NormalTextureInfo &&) noexcept = default;
|
|
||||||
NormalTextureInfo &operator=(const NormalTextureInfo &) = default;
|
|
||||||
NormalTextureInfo &operator=(NormalTextureInfo &&) noexcept = default;
|
|
||||||
bool operator==(const NormalTextureInfo &) const;
|
bool operator==(const NormalTextureInfo &) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -700,10 +680,7 @@ struct OcclusionTextureInfo {
|
|||||||
ExtensionMap extensions;
|
ExtensionMap extensions;
|
||||||
|
|
||||||
OcclusionTextureInfo() : index(-1), texCoord(0), strength(1.0) {}
|
OcclusionTextureInfo() : index(-1), texCoord(0), strength(1.0) {}
|
||||||
OcclusionTextureInfo(const OcclusionTextureInfo &) = default;
|
DEFAULT_METHODS(OcclusionTextureInfo)
|
||||||
OcclusionTextureInfo(OcclusionTextureInfo &&) noexcept = default;
|
|
||||||
OcclusionTextureInfo &operator=(const OcclusionTextureInfo &) = default;
|
|
||||||
OcclusionTextureInfo &operator=(OcclusionTextureInfo &&) noexcept = default;
|
|
||||||
bool operator==(const OcclusionTextureInfo &) const;
|
bool operator==(const OcclusionTextureInfo &) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -719,10 +696,7 @@ struct PbrMetallicRoughness {
|
|||||||
ExtensionMap extensions;
|
ExtensionMap extensions;
|
||||||
|
|
||||||
PbrMetallicRoughness() : baseColorFactor(std::vector<double>{ 1.0,1.0,1.0,1.0 }), metallicFactor(1.0), roughnessFactor(1.0) {}
|
PbrMetallicRoughness() : baseColorFactor(std::vector<double>{ 1.0,1.0,1.0,1.0 }), metallicFactor(1.0), roughnessFactor(1.0) {}
|
||||||
PbrMetallicRoughness(const PbrMetallicRoughness &) = default;
|
DEFAULT_METHODS(PbrMetallicRoughness)
|
||||||
PbrMetallicRoughness(PbrMetallicRoughness &&rhs) noexcept = default;
|
|
||||||
PbrMetallicRoughness &operator=(const PbrMetallicRoughness &) = default;
|
|
||||||
PbrMetallicRoughness &operator=(PbrMetallicRoughness &&) noexcept = default;
|
|
||||||
bool operator==(const PbrMetallicRoughness &) const;
|
bool operator==(const PbrMetallicRoughness &) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -752,10 +726,7 @@ struct Material {
|
|||||||
Value extras;
|
Value extras;
|
||||||
|
|
||||||
Material() : alphaMode("OPAQUE"), alphaCutoff(0.5), doubleSided(false) {}
|
Material() : alphaMode("OPAQUE"), alphaCutoff(0.5), doubleSided(false) {}
|
||||||
Material(const Material &) = default;
|
DEFAULT_METHODS(Material)
|
||||||
Material(Material &&rhs) noexcept = default;
|
|
||||||
Material &operator=(const Material &) = default;
|
|
||||||
Material &operator=(Material &&) noexcept = default;
|
|
||||||
|
|
||||||
bool operator==(const Material &) const;
|
bool operator==(const Material &) const;
|
||||||
};
|
};
|
||||||
@ -772,10 +743,7 @@ struct BufferView {
|
|||||||
bool dracoDecoded; // Flag indicating this has been draco decoded
|
bool dracoDecoded; // Flag indicating this has been draco decoded
|
||||||
|
|
||||||
BufferView() : byteOffset(0), byteStride(0), dracoDecoded(false) {}
|
BufferView() : byteOffset(0), byteStride(0), dracoDecoded(false) {}
|
||||||
BufferView(const BufferView &) = default;
|
DEFAULT_METHODS(BufferView)
|
||||||
BufferView(BufferView &&) noexcept = default;
|
|
||||||
BufferView &operator=(const BufferView &) = default;
|
|
||||||
BufferView &operator=(BufferView &&) noexcept = default;
|
|
||||||
bool operator==(const BufferView &) const;
|
bool operator==(const BufferView &) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -848,10 +816,7 @@ struct Accessor {
|
|||||||
bufferView = -1;
|
bufferView = -1;
|
||||||
sparse.isSparse = false;
|
sparse.isSparse = false;
|
||||||
}
|
}
|
||||||
Accessor(const Accessor &) = default;
|
DEFAULT_METHODS(Accessor)
|
||||||
Accessor(Accessor &&) noexcept = default;
|
|
||||||
Accessor &operator=(const Accessor &) = default;
|
|
||||||
Accessor &operator=(Accessor &&) noexcept = default;
|
|
||||||
bool operator==(const tinygltf::Accessor &) const;
|
bool operator==(const tinygltf::Accessor &) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -867,10 +832,7 @@ struct PerspectiveCamera {
|
|||||||
zfar(0.0) // 0 = use infinite projecton matrix
|
zfar(0.0) // 0 = use infinite projecton matrix
|
||||||
,
|
,
|
||||||
znear(0.0) {}
|
znear(0.0) {}
|
||||||
PerspectiveCamera(const PerspectiveCamera &) = default;
|
DEFAULT_METHODS(PerspectiveCamera)
|
||||||
PerspectiveCamera(PerspectiveCamera &&) noexcept = default;
|
|
||||||
PerspectiveCamera &operator=(const PerspectiveCamera &) = default;
|
|
||||||
PerspectiveCamera &operator=(PerspectiveCamera &&) noexcept = default;
|
|
||||||
bool operator==(const PerspectiveCamera &) const;
|
bool operator==(const PerspectiveCamera &) const;
|
||||||
|
|
||||||
ExtensionMap extensions;
|
ExtensionMap extensions;
|
||||||
@ -884,10 +846,7 @@ struct OrthographicCamera {
|
|||||||
double znear; // required
|
double znear; // required
|
||||||
|
|
||||||
OrthographicCamera() : xmag(0.0), ymag(0.0), zfar(0.0), znear(0.0) {}
|
OrthographicCamera() : xmag(0.0), ymag(0.0), zfar(0.0), znear(0.0) {}
|
||||||
OrthographicCamera(const OrthographicCamera &) = default;
|
DEFAULT_METHODS(OrthographicCamera)
|
||||||
OrthographicCamera(OrthographicCamera &&) noexcept = default;
|
|
||||||
OrthographicCamera &operator=(const OrthographicCamera &) = default;
|
|
||||||
OrthographicCamera &operator=(OrthographicCamera &&) noexcept = default;
|
|
||||||
bool operator==(const OrthographicCamera &) const;
|
bool operator==(const OrthographicCamera &) const;
|
||||||
|
|
||||||
ExtensionMap extensions;
|
ExtensionMap extensions;
|
||||||
@ -902,10 +861,7 @@ struct Camera {
|
|||||||
OrthographicCamera orthographic;
|
OrthographicCamera orthographic;
|
||||||
|
|
||||||
Camera() {}
|
Camera() {}
|
||||||
Camera(const Camera &) = default;
|
DEFAULT_METHODS(Camera)
|
||||||
Camera(Camera &&) noexcept = default;
|
|
||||||
Camera &operator=(const Camera &) = default;
|
|
||||||
Camera &operator=(Camera &&) noexcept = default;
|
|
||||||
bool operator==(const Camera &) const;
|
bool operator==(const Camera &) const;
|
||||||
|
|
||||||
ExtensionMap extensions;
|
ExtensionMap extensions;
|
||||||
@ -932,10 +888,7 @@ struct Primitive {
|
|||||||
material = -1;
|
material = -1;
|
||||||
indices = -1;
|
indices = -1;
|
||||||
}
|
}
|
||||||
Primitive(const Primitive &) = default;
|
DEFAULT_METHODS(Primitive)
|
||||||
Primitive(Primitive &&) noexcept = default;
|
|
||||||
Primitive &operator=(const Primitive &) = default;
|
|
||||||
Primitive &operator=(Primitive &&) noexcept = default;
|
|
||||||
bool operator==(const Primitive &) const;
|
bool operator==(const Primitive &) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -947,11 +900,7 @@ struct Mesh {
|
|||||||
Value extras;
|
Value extras;
|
||||||
|
|
||||||
Mesh() = default;
|
Mesh() = default;
|
||||||
~Mesh() = default;
|
DEFAULT_METHODS(Mesh)
|
||||||
Mesh(const Mesh &) = default;
|
|
||||||
Mesh(Mesh &&) noexcept = default;
|
|
||||||
Mesh &operator=(const Mesh &) = default;
|
|
||||||
Mesh &operator=(Mesh &&) noexcept = default;
|
|
||||||
bool operator==(const Mesh &) const;
|
bool operator==(const Mesh &) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -959,10 +908,7 @@ class Node {
|
|||||||
public:
|
public:
|
||||||
Node() : camera(-1), skin(-1), mesh(-1) {}
|
Node() : camera(-1), skin(-1), mesh(-1) {}
|
||||||
|
|
||||||
Node(const Node &) = default;
|
DEFAULT_METHODS(Node)
|
||||||
Node(Node &&) noexcept = default;
|
|
||||||
Node &operator=(const Node &) = default;
|
|
||||||
Node &operator=(Node &&) noexcept = default;
|
|
||||||
|
|
||||||
bool operator==(const Node &) const;
|
bool operator==(const Node &) const;
|
||||||
|
|
||||||
@ -983,17 +929,14 @@ class Node {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct Buffer {
|
struct Buffer {
|
||||||
Buffer() = default;
|
|
||||||
Buffer(const Buffer &) = default;
|
|
||||||
Buffer(Buffer &&) noexcept = default;
|
|
||||||
Buffer &operator=(const Buffer &) = default;
|
|
||||||
Buffer &operator=(Buffer &&) noexcept = default;
|
|
||||||
std::string name;
|
std::string name;
|
||||||
std::vector<unsigned char> data;
|
std::vector<unsigned char> data;
|
||||||
std::string
|
std::string
|
||||||
uri; // considered as required here but not in the spec (need to clarify)
|
uri; // considered as required here but not in the spec (need to clarify)
|
||||||
Value extras;
|
Value extras;
|
||||||
|
|
||||||
|
Buffer() = default;
|
||||||
|
DEFAULT_METHODS(Buffer)
|
||||||
bool operator==(const Buffer &) const;
|
bool operator==(const Buffer &) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1006,11 +949,7 @@ struct Asset {
|
|||||||
Value extras;
|
Value extras;
|
||||||
|
|
||||||
Asset() = default;
|
Asset() = default;
|
||||||
~Asset() = default;
|
DEFAULT_METHODS(Asset)
|
||||||
Asset(const Asset &) = default;
|
|
||||||
Asset(Asset &&) noexcept = default;
|
|
||||||
Asset &operator=(const Asset &) = default;
|
|
||||||
Asset &operator=(Asset &&) noexcept = default;
|
|
||||||
bool operator==(const Asset &) const;
|
bool operator==(const Asset &) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1022,10 +961,7 @@ struct Scene {
|
|||||||
Value extras;
|
Value extras;
|
||||||
|
|
||||||
Scene() = default;
|
Scene() = default;
|
||||||
Scene(const Scene &) = default;
|
DEFAULT_METHODS(Scene)
|
||||||
Scene(Scene &&) noexcept = default;
|
|
||||||
Scene &operator=(const Scene &) = default;
|
|
||||||
Scene &operator=(Scene &&) noexcept = default;
|
|
||||||
bool operator==(const Scene &) const;
|
bool operator==(const Scene &) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1034,10 +970,7 @@ struct SpotLight {
|
|||||||
double outerConeAngle;
|
double outerConeAngle;
|
||||||
|
|
||||||
SpotLight() : innerConeAngle(0.0), outerConeAngle(0.7853981634) {}
|
SpotLight() : innerConeAngle(0.0), outerConeAngle(0.7853981634) {}
|
||||||
SpotLight(const SpotLight &) = default;
|
DEFAULT_METHODS(SpotLight)
|
||||||
SpotLight(SpotLight &&) noexcept = default;
|
|
||||||
SpotLight &operator=(const SpotLight &) = default;
|
|
||||||
SpotLight &operator=(SpotLight &&) noexcept = default;
|
|
||||||
bool operator==(const SpotLight &) const;
|
bool operator==(const SpotLight &) const;
|
||||||
|
|
||||||
ExtensionMap extensions;
|
ExtensionMap extensions;
|
||||||
@ -1053,10 +986,7 @@ struct Light {
|
|||||||
SpotLight spot;
|
SpotLight spot;
|
||||||
|
|
||||||
Light() : intensity(1.0), range(0.0) {}
|
Light() : intensity(1.0), range(0.0) {}
|
||||||
Light(const Light &) = default;
|
DEFAULT_METHODS(Light)
|
||||||
Light(Light &&) noexcept = default;
|
|
||||||
Light &operator=(const Light &) = default;
|
|
||||||
Light &operator=(Light &&) noexcept = default;
|
|
||||||
|
|
||||||
bool operator==(const Light &) const;
|
bool operator==(const Light &) const;
|
||||||
|
|
||||||
@ -1067,10 +997,7 @@ struct Light {
|
|||||||
class Model {
|
class Model {
|
||||||
public:
|
public:
|
||||||
Model() = default;
|
Model() = default;
|
||||||
Model(const Model &) = default;
|
DEFAULT_METHODS(Model)
|
||||||
Model(Model &&) noexcept = default;
|
|
||||||
Model &operator=(const Model &) = default;
|
|
||||||
Model &operator=(Model &&) noexcept = default;
|
|
||||||
|
|
||||||
bool operator==(const Model &) const;
|
bool operator==(const Model &) const;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user