Coverity-findings
parent
9c78a43fbe
commit
4c6db68d34
|
@ -70,14 +70,27 @@ public: // public data members
|
||||||
bool force_has_children = false;
|
bool force_has_children = false;
|
||||||
|
|
||||||
public: // constructors
|
public: // constructors
|
||||||
|
/// The default class constructor.
|
||||||
Node() = default;
|
Node() = default;
|
||||||
Node(const std::string& n) : name(n) {}
|
|
||||||
|
/// The class constructor with the name.
|
||||||
|
Node(const std::string& n)
|
||||||
|
: name(n)
|
||||||
|
, properties()
|
||||||
|
, children()
|
||||||
|
, force_has_children( false ) {
|
||||||
|
// empty
|
||||||
|
}
|
||||||
|
|
||||||
// convenience template to construct with properties directly
|
// convenience template to construct with properties directly
|
||||||
template <typename... More>
|
template <typename... More>
|
||||||
Node(const std::string& n, const More... more)
|
Node(const std::string& n, const More... more)
|
||||||
: name(n)
|
: name(n)
|
||||||
{ AddProperties(more...); }
|
, properties()
|
||||||
|
, children()
|
||||||
|
, force_has_children(false) {
|
||||||
|
AddProperties(more...);
|
||||||
|
}
|
||||||
|
|
||||||
public: // functions to add properties or children
|
public: // functions to add properties or children
|
||||||
// add a single property to the node
|
// add a single property to the node
|
||||||
|
|
|
@ -131,13 +131,15 @@ namespace Assimp {
|
||||||
|
|
||||||
} // end of namespace Assimp
|
} // end of namespace Assimp
|
||||||
|
|
||||||
FBXExporter::FBXExporter (
|
FBXExporter::FBXExporter ( const aiScene* pScene, const ExportProperties* pProperties )
|
||||||
const aiScene* pScene,
|
: binary(false)
|
||||||
const ExportProperties* pProperties
|
, mScene(pScene)
|
||||||
)
|
, mProperties(pProperties)
|
||||||
: mScene(pScene)
|
, outfile()
|
||||||
, mProperties(pProperties)
|
, connections()
|
||||||
{
|
, mesh_uids()
|
||||||
|
, material_uids()
|
||||||
|
, node_uids() {
|
||||||
// will probably need to determine UIDs, connections, etc here.
|
// will probably need to determine UIDs, connections, etc here.
|
||||||
// basically anything that needs to be known
|
// basically anything that needs to be known
|
||||||
// before we start writing sections to the stream.
|
// before we start writing sections to the stream.
|
||||||
|
|
|
@ -731,11 +731,10 @@ unsigned int XGLImporter::ResolveMaterialRef(TempScope& scope)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void XGLImporter::ReadMaterial(TempScope& scope)
|
void XGLImporter::ReadMaterial(TempScope& scope) {
|
||||||
{
|
|
||||||
const unsigned int mat_id = ReadIDAttr();
|
const unsigned int mat_id = ReadIDAttr();
|
||||||
|
|
||||||
std::unique_ptr<aiMaterial> mat(new aiMaterial());
|
aiMaterial *mat(new aiMaterial );
|
||||||
while (ReadElementUpToClosing("mat")) {
|
while (ReadElementUpToClosing("mat")) {
|
||||||
const std::string& s = GetElementName();
|
const std::string& s = GetElementName();
|
||||||
if (s == "amb") {
|
if (s == "amb") {
|
||||||
|
@ -764,11 +763,10 @@ void XGLImporter::ReadMaterial(TempScope& scope)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
scope.materials[mat_id] = mat.get();
|
scope.materials[mat_id] = mat;
|
||||||
scope.materials_linear.push_back(mat.release());
|
scope.materials_linear.push_back(mat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------------
|
||||||
void XGLImporter::ReadFaceVertex(const TempMesh& t, TempFace& out)
|
void XGLImporter::ReadFaceVertex(const TempMesh& t, TempFace& out)
|
||||||
{
|
{
|
||||||
|
|
|
@ -744,6 +744,9 @@ namespace glTF2 {
|
||||||
if (!(dict = FindArray(*container, d.mDictId))) {
|
if (!(dict = FindArray(*container, d.mDictId))) {
|
||||||
container->AddMember(StringRef(d.mDictId), Value().SetArray().Move(), mDoc.GetAllocator());
|
container->AddMember(StringRef(d.mDictId), Value().SetArray().Move(), mDoc.GetAllocator());
|
||||||
dict = FindArray(*container, d.mDictId);
|
dict = FindArray(*container, d.mDictId);
|
||||||
|
if (nullptr == dict) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < d.mObjs.size(); ++i) {
|
for (size_t i = 0; i < d.mObjs.size(); ++i) {
|
||||||
|
|
|
@ -643,11 +643,12 @@ void ExportSkin(Asset& mAsset, const aiMesh* aimesh, Ref<Mesh>& meshRef, Ref<Buf
|
||||||
Ref<Buffer> buf = vertexJointAccessor->bufferView->buffer;
|
Ref<Buffer> buf = vertexJointAccessor->bufferView->buffer;
|
||||||
uint8_t* arrys = new uint8_t[bytesLen];
|
uint8_t* arrys = new uint8_t[bytesLen];
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
|
uint8_t* data = new uint8_t[s_bytesPerComp];
|
||||||
for ( unsigned int j = 0; j <= bytesLen; j += bytesPerComp ){
|
for ( unsigned int j = 0; j <= bytesLen; j += bytesPerComp ){
|
||||||
size_t len_p = offset + j;
|
size_t len_p = offset + j;
|
||||||
float f_value = *(float *)&buf->GetPointer()[len_p];
|
float f_value = *(float *)&buf->GetPointer()[len_p];
|
||||||
unsigned short c = static_cast<unsigned short>(f_value);
|
unsigned short c = static_cast<unsigned short>(f_value);
|
||||||
uint8_t* data = new uint8_t[s_bytesPerComp];
|
::memset(data, 0, s_bytesPerComp * sizeof(uint8_t));
|
||||||
data = (uint8_t*)&c;
|
data = (uint8_t*)&c;
|
||||||
memcpy(&arrys[i*s_bytesPerComp], data, s_bytesPerComp);
|
memcpy(&arrys[i*s_bytesPerComp], data, s_bytesPerComp);
|
||||||
++i;
|
++i;
|
||||||
|
@ -657,6 +658,8 @@ void ExportSkin(Asset& mAsset, const aiMesh* aimesh, Ref<Mesh>& meshRef, Ref<Buf
|
||||||
vertexJointAccessor->bufferView->byteLength = s_bytesLen;
|
vertexJointAccessor->bufferView->byteLength = s_bytesLen;
|
||||||
|
|
||||||
p.attributes.joint.push_back( vertexJointAccessor );
|
p.attributes.joint.push_back( vertexJointAccessor );
|
||||||
|
delete[] arrys;
|
||||||
|
delete[] data;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<Accessor> vertexWeightAccessor = ExportData(mAsset, skinRef->id, bufferRef, aimesh->mNumVertices, vertexWeightData, AttribType::VEC4, AttribType::VEC4, ComponentType_FLOAT);
|
Ref<Accessor> vertexWeightAccessor = ExportData(mAsset, skinRef->id, bufferRef, aimesh->mNumVertices, vertexWeightData, AttribType::VEC4, AttribType::VEC4, ComponentType_FLOAT);
|
||||||
|
|
Loading…
Reference in New Issue