Formatting
parent
83bfa61f8d
commit
5b3b80cbc2
|
@ -1080,7 +1080,7 @@ namespace glTF2
|
||||||
|
|
||||||
AssetMetadata()
|
AssetMetadata()
|
||||||
: premultipliedAlpha(false)
|
: premultipliedAlpha(false)
|
||||||
, version(0.)
|
, version(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -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.
|
||||||
float 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);
|
||||||
|
@ -1245,12 +1245,12 @@ 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.0...
|
// 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: %.1f", version);
|
ai_snprintf(msg, 128, "GLTF: Unsupported glTF version: %.1f", version);
|
||||||
throw DeadlyImportError(msg);
|
throw DeadlyImportError(msg);
|
||||||
|
|
|
@ -574,7 +574,7 @@ namespace glTF2 {
|
||||||
GLB_Header header;
|
GLB_Header header;
|
||||||
memcpy(header.magic, AI_GLB_MAGIC_NUMBER, sizeof(header.magic));
|
memcpy(header.magic, AI_GLB_MAGIC_NUMBER, sizeof(header.magic));
|
||||||
|
|
||||||
header.version = 2.;
|
header.version = 2;
|
||||||
AI_SWAP4(header.version);
|
AI_SWAP4(header.version);
|
||||||
|
|
||||||
header.length = uint32_t(sizeof(header) + sceneLength + bodyLength);
|
header.length = uint32_t(sizeof(header) + sceneLength + bodyLength);
|
||||||
|
|
|
@ -466,8 +466,8 @@ void ExportSkin(Asset& mAsset, const aiMesh* aimesh, Ref<Mesh>& meshRef, Ref<Buf
|
||||||
float vertWeight = aib->mWeights[idx_weights].mWeight;
|
float vertWeight = aib->mWeights[idx_weights].mWeight;
|
||||||
|
|
||||||
// A vertex can only have at most four joint weights. Ignore all others.
|
// A vertex can only have at most four joint weights. Ignore all others.
|
||||||
if (jointsPerVertex[vertexId] > 3) {
|
if (jointsPerVertex[vertexId] > 3) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
vertexJointData[vertexId][jointsPerVertex[vertexId]] = jointNamesIndex;
|
vertexJointData[vertexId][jointsPerVertex[vertexId]] = jointNamesIndex;
|
||||||
|
@ -845,7 +845,7 @@ void glTF2Exporter::ExportScene()
|
||||||
void glTF2Exporter::ExportMetadata()
|
void glTF2Exporter::ExportMetadata()
|
||||||
{
|
{
|
||||||
AssetMetadata& asset = mAsset->asset;
|
AssetMetadata& asset = mAsset->asset;
|
||||||
asset.version = 2.;
|
asset.version = 2;
|
||||||
|
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
ai_snprintf(buffer, 256, "Open Asset Import Library (assimp v%d.%d.%d)",
|
ai_snprintf(buffer, 256, "Open Asset Import Library (assimp v%d.%d.%d)",
|
||||||
|
|
|
@ -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.
|
||||||
float 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);
|
||||||
|
@ -1243,12 +1243,12 @@ 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...
|
||||||
version = 1;
|
version = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (version != 1.) {
|
if (version != 1) {
|
||||||
char msg[128];
|
char msg[128];
|
||||||
ai_snprintf(msg, 128, "GLTF: Unsupported glTF version: %.0f", version);
|
ai_snprintf(msg, 128, "GLTF: Unsupported glTF version: %.0f", version);
|
||||||
throw DeadlyImportError(msg);
|
throw DeadlyImportError(msg);
|
||||||
|
|
|
@ -582,7 +582,7 @@ namespace glTF {
|
||||||
GLB_Header header;
|
GLB_Header header;
|
||||||
memcpy(header.magic, AI_GLB_MAGIC_NUMBER, sizeof(header.magic));
|
memcpy(header.magic, AI_GLB_MAGIC_NUMBER, sizeof(header.magic));
|
||||||
|
|
||||||
header.version = 1.;
|
header.version = 1;
|
||||||
AI_SWAP4(header.version);
|
AI_SWAP4(header.version);
|
||||||
|
|
||||||
header.length = uint32_t(sizeof(header) + sceneLength + bodyLength);
|
header.length = uint32_t(sizeof(header) + sceneLength + bodyLength);
|
||||||
|
|
|
@ -469,8 +469,8 @@ void ExportSkin(Asset& mAsset, const aiMesh* aimesh, Ref<Mesh>& meshRef, Ref<Buf
|
||||||
float vertWeight = aib->mWeights[idx_weights].mWeight;
|
float vertWeight = aib->mWeights[idx_weights].mWeight;
|
||||||
|
|
||||||
// A vertex can only have at most four joint weights. Ignore all others.
|
// A vertex can only have at most four joint weights. Ignore all others.
|
||||||
if (jointsPerVertex[vertexId] > 3) {
|
if (jointsPerVertex[vertexId] > 3) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
vertexJointData[vertexId][jointsPerVertex[vertexId]] = jointNamesIndex;
|
vertexJointData[vertexId][jointsPerVertex[vertexId]] = jointNamesIndex;
|
||||||
|
@ -834,7 +834,7 @@ void glTFExporter::ExportScene()
|
||||||
void glTFExporter::ExportMetadata()
|
void glTFExporter::ExportMetadata()
|
||||||
{
|
{
|
||||||
glTF::AssetMetadata& asset = mAsset->asset;
|
glTF::AssetMetadata& asset = mAsset->asset;
|
||||||
asset.version = 1.;
|
asset.version = 1;
|
||||||
|
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
ai_snprintf(buffer, 256, "Open Asset Import Library (assimp v%d.%d.%d)",
|
ai_snprintf(buffer, 256, "Open Asset Import Library (assimp v%d.%d.%d)",
|
||||||
|
|
Loading…
Reference in New Issue