Merge branch 'master' into integrate-tinyusdz-br-rendermesh-refactor

pull/5551/head
Steve M 2024-05-02 16:20:23 -07:00 committed by GitHub
commit 1e410113ee
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 15 additions and 7 deletions

View File

@ -247,7 +247,9 @@ aiNode *ColladaLoader::BuildHierarchy(const ColladaParser &pParser, const Collad
// add children. first the *real* ones // add children. first the *real* ones
node->mNumChildren = static_cast<unsigned int>(pNode->mChildren.size() + instances.size()); node->mNumChildren = static_cast<unsigned int>(pNode->mChildren.size() + instances.size());
node->mChildren = new aiNode *[node->mNumChildren]; if (node->mNumChildren != 0) {
node->mChildren = new aiNode * [node->mNumChildren];
}
for (size_t a = 0; a < pNode->mChildren.size(); ++a) { for (size_t a = 0; a < pNode->mChildren.size(); ++a) {
node->mChildren[a] = BuildHierarchy(pParser, pNode->mChildren[a]); node->mChildren[a] = BuildHierarchy(pParser, pNode->mChildren[a]);

View File

@ -635,7 +635,8 @@ void ColladaParser::ReadController(XmlNode &node, Collada::Controller &controlle
const std::string &currentName = currentNode.name(); const std::string &currentName = currentNode.name();
if (currentName == "morph") { if (currentName == "morph") {
controller.mType = Morph; controller.mType = Morph;
controller.mMeshId = currentNode.attribute("source").as_string(); std::string id = currentNode.attribute("source").as_string();
controller.mMeshId = id.substr(1, id.size() - 1);
int methodIndex = currentNode.attribute("method").as_int(); int methodIndex = currentNode.attribute("method").as_int();
if (methodIndex > 0) { if (methodIndex > 0) {
std::string method; std::string method;

View File

@ -250,6 +250,10 @@ void Q3DImporter::InternReadFile(const std::string &pFile,
c = stream.GetI1(); c = stream.GetI1();
while (c) { while (c) {
mat.name.data[mat.name.length++] = c; mat.name.data[mat.name.length++] = c;
if (mat.name.length == MAXLEN) {
ASSIMP_LOG_ERROR("String ouverflow detected, skipped material name parsing.");
break;
}
c = stream.GetI1(); c = stream.GetI1();
} }

View File

@ -185,9 +185,9 @@ bool CalcTangentsProcess::ProcessMesh(aiMesh *pMesh, unsigned int meshIndex) {
tangent.x = (w.x * sy - v.x * ty) * dirCorrection; tangent.x = (w.x * sy - v.x * ty) * dirCorrection;
tangent.y = (w.y * sy - v.y * ty) * dirCorrection; tangent.y = (w.y * sy - v.y * ty) * dirCorrection;
tangent.z = (w.z * sy - v.z * ty) * dirCorrection; tangent.z = (w.z * sy - v.z * ty) * dirCorrection;
bitangent.x = (- w.x * sx + v.x * tx) * dirCorrection; bitangent.x = (w.x * sx - v.x * tx) * dirCorrection;
bitangent.y = (- w.y * sx + v.y * tx) * dirCorrection; bitangent.y = (w.y * sx - v.y * tx) * dirCorrection;
bitangent.z = (- w.z * sx + v.z * tx) * dirCorrection; bitangent.z = (w.z * sx - v.z * tx) * dirCorrection;
// store for every vertex of that face // store for every vertex of that face
for (unsigned int b = 0; b < face.mNumIndices; ++b) { for (unsigned int b = 0; b < face.mNumIndices; ++b) {
@ -195,7 +195,7 @@ bool CalcTangentsProcess::ProcessMesh(aiMesh *pMesh, unsigned int meshIndex) {
// project tangent and bitangent into the plane formed by the vertex' normal // project tangent and bitangent into the plane formed by the vertex' normal
aiVector3D localTangent = tangent - meshNorm[p] * (tangent * meshNorm[p]); aiVector3D localTangent = tangent - meshNorm[p] * (tangent * meshNorm[p]);
aiVector3D localBitangent = bitangent - meshNorm[p] * (bitangent * meshNorm[p]) - localTangent * (bitangent * localTangent); aiVector3D localBitangent = bitangent - meshNorm[p] * (bitangent * meshNorm[p]);
localTangent.NormalizeSafe(); localTangent.NormalizeSafe();
localBitangent.NormalizeSafe(); localBitangent.NormalizeSafe();

View File

@ -394,7 +394,7 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vector<aiMesh
// Recursively updates the node's mesh list to account for the changed mesh list // Recursively updates the node's mesh list to account for the changed mesh list
void SplitByBoneCountProcess::UpdateNode( aiNode* pNode) const { void SplitByBoneCountProcess::UpdateNode( aiNode* pNode) const {
// rebuild the node's mesh index list // rebuild the node's mesh index list
if( pNode->mNumMeshes == 0 ) { if( pNode->mNumMeshes != 0 ) {
IndexArray newMeshList; IndexArray newMeshList;
for( unsigned int a = 0; a < pNode->mNumMeshes; ++a) { for( unsigned int a = 0; a < pNode->mNumMeshes; ++a) {
unsigned int srcIndex = pNode->mMeshes[a]; unsigned int srcIndex = pNode->mMeshes[a];

View File

@ -28,6 +28,7 @@ __Importers__:
+ KHR_texture_transform ( 5.1 under test ) + KHR_texture_transform ( 5.1 under test )
- HMB - HMB
- IFC-STEP - IFC-STEP
- IQM
- IRR / IRRMESH - IRR / IRRMESH
- [LWO](https://en.wikipedia.org/wiki/LightWave_3D) - [LWO](https://en.wikipedia.org/wiki/LightWave_3D)
- LWS - LWS