commit
0629faf9b1
|
@ -1074,7 +1074,7 @@ namespace glTF2
|
||||||
std::string version; //!< Specifies the target rendering API (default: "1.0.3")
|
std::string version; //!< Specifies the target rendering API (default: "1.0.3")
|
||||||
} profile; //!< Specifies the target rendering API and version, e.g., WebGL 1.0.3. (default: {})
|
} profile; //!< Specifies the target rendering API and version, e.g., WebGL 1.0.3. (default: {})
|
||||||
|
|
||||||
int version; //!< The glTF format version
|
float version; //!< The glTF format version
|
||||||
|
|
||||||
void Read(Document& doc);
|
void Read(Document& doc);
|
||||||
|
|
||||||
|
|
|
@ -1229,7 +1229,7 @@ inline void Scene::Read(Value& obj, Asset& r)
|
||||||
inline void AssetMetadata::Read(Document& doc)
|
inline void AssetMetadata::Read(Document& doc)
|
||||||
{
|
{
|
||||||
// read the version, etc.
|
// read the version, etc.
|
||||||
int statedVersion = 0;
|
float statedVersion = 0;
|
||||||
if (Value* obj = FindObject(doc, "asset")) {
|
if (Value* obj = FindObject(doc, "asset")) {
|
||||||
ReadMember(*obj, "copyright", copyright);
|
ReadMember(*obj, "copyright", copyright);
|
||||||
ReadMember(*obj, "generator", generator);
|
ReadMember(*obj, "generator", generator);
|
||||||
|
@ -1244,14 +1244,15 @@ inline void AssetMetadata::Read(Document& doc)
|
||||||
}
|
}
|
||||||
|
|
||||||
version = std::max(statedVersion, version);
|
version = std::max(statedVersion, version);
|
||||||
|
|
||||||
if (version == 0) {
|
if (version == 0) {
|
||||||
// if missing version, we'll assume version 1...
|
// if missing version, we'll assume version 1.0...
|
||||||
version = 1;
|
version = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (version != 1) {
|
if (version != 1) {
|
||||||
char msg[128];
|
char msg[128];
|
||||||
ai_snprintf(msg, 128, "GLTF: Unsupported glTF version: %d", version);
|
ai_snprintf(msg, 128, "GLTF: Unsupported glTF version: %.1f", version);
|
||||||
throw DeadlyImportError(msg);
|
throw DeadlyImportError(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -600,7 +600,7 @@ namespace glTF2 {
|
||||||
asset.SetObject();
|
asset.SetObject();
|
||||||
{
|
{
|
||||||
char versionChar[10];
|
char versionChar[10];
|
||||||
ai_snprintf(versionChar, sizeof(versionChar), "%d", mAsset.asset.version);
|
ai_snprintf(versionChar, sizeof(versionChar), "%.1f", mAsset.asset.version);
|
||||||
asset.AddMember("version", Value(versionChar, mAl).Move(), mAl);
|
asset.AddMember("version", Value(versionChar, mAl).Move(), mAl);
|
||||||
|
|
||||||
asset.AddMember("generator", Value(mAsset.asset.generator, mAl).Move(), mAl);
|
asset.AddMember("generator", Value(mAsset.asset.generator, mAl).Move(), mAl);
|
||||||
|
|
|
@ -1058,7 +1058,7 @@ namespace glTF
|
||||||
std::string version; //!< Specifies the target rendering API (default: "1.0.3")
|
std::string version; //!< Specifies the target rendering API (default: "1.0.3")
|
||||||
} profile; //!< Specifies the target rendering API and version, e.g., WebGL 1.0.3. (default: {})
|
} profile; //!< Specifies the target rendering API and version, e.g., WebGL 1.0.3. (default: {})
|
||||||
|
|
||||||
int version; //!< The glTF format version (should be 1)
|
float version; //!< The glTF format version (should be 1.0)
|
||||||
|
|
||||||
void Read(Document& doc);
|
void Read(Document& doc);
|
||||||
|
|
||||||
|
|
|
@ -1228,7 +1228,7 @@ inline void Scene::Read(Value& obj, Asset& r)
|
||||||
inline void AssetMetadata::Read(Document& doc)
|
inline void AssetMetadata::Read(Document& doc)
|
||||||
{
|
{
|
||||||
// read the version, etc.
|
// read the version, etc.
|
||||||
int statedVersion = 0;
|
float statedVersion = 0;
|
||||||
if (Value* obj = FindObject(doc, "asset")) {
|
if (Value* obj = FindObject(doc, "asset")) {
|
||||||
ReadMember(*obj, "copyright", copyright);
|
ReadMember(*obj, "copyright", copyright);
|
||||||
ReadMember(*obj, "generator", generator);
|
ReadMember(*obj, "generator", generator);
|
||||||
|
@ -1250,7 +1250,7 @@ inline void AssetMetadata::Read(Document& doc)
|
||||||
|
|
||||||
if (version != 1) {
|
if (version != 1) {
|
||||||
char msg[128];
|
char msg[128];
|
||||||
ai_snprintf(msg, 128, "GLTF: Unsupported glTF version: %d", version);
|
ai_snprintf(msg, 128, "GLTF: Unsupported glTF version: %.0f", version);
|
||||||
throw DeadlyImportError(msg);
|
throw DeadlyImportError(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -608,7 +608,7 @@ namespace glTF {
|
||||||
asset.SetObject();
|
asset.SetObject();
|
||||||
{
|
{
|
||||||
char versionChar[10];
|
char versionChar[10];
|
||||||
ai_snprintf(versionChar, sizeof(versionChar), "%d", mAsset.asset.version);
|
ai_snprintf(versionChar, sizeof(versionChar), "%.0f", mAsset.asset.version);
|
||||||
asset.AddMember("version", Value(versionChar, mAl).Move(), mAl);
|
asset.AddMember("version", Value(versionChar, mAl).Move(), mAl);
|
||||||
|
|
||||||
asset.AddMember("generator", Value(mAsset.asset.generator, mAl).Move(), mAl);
|
asset.AddMember("generator", Value(mAsset.asset.generator, mAl).Move(), mAl);
|
||||||
|
|
Loading…
Reference in New Issue