MCPcopy Create free account
hub / github.com/assimp/assimp / Copy

Method Copy

code/Common/SceneCombiner.cpp:1072–1114  ·  view source on GitHub ↗

------------------------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

1070
1071// ------------------------------------------------------------------------------------------------
1072void SceneCombiner::Copy(aiMesh **_dest, const aiMesh *src) {
1073 if (nullptr == _dest || nullptr == src) {
1074 return;
1075 }
1076
1077 aiMesh *dest = *_dest = new aiMesh();
1078
1079 // get a flat copy
1080 *dest = *src;
1081
1082 // and reallocate all arrays
1083 GetArrayCopy(dest->mVertices, dest->mNumVertices);
1084 GetArrayCopy(dest->mNormals, dest->mNumVertices);
1085 GetArrayCopy(dest->mTangents, dest->mNumVertices);
1086 GetArrayCopy(dest->mBitangents, dest->mNumVertices);
1087
1088 unsigned int n = 0;
1089 while (dest->HasTextureCoords(n)) {
1090 GetArrayCopy(dest->mTextureCoords[n++], dest->mNumVertices);
1091 }
1092
1093 n = 0;
1094 while (dest->HasVertexColors(n)) {
1095 GetArrayCopy(dest->mColors[n++], dest->mNumVertices);
1096 }
1097
1098 // make a deep copy of all bones
1099 CopyPtrArray(dest->mBones, dest->mBones, dest->mNumBones);
1100
1101 // make a deep copy of all faces
1102 GetArrayCopy(dest->mFaces, dest->mNumFaces);
1103
1104 // make a deep copy of all blend shapes
1105 CopyPtrArray(dest->mAnimMeshes, dest->mAnimMeshes, dest->mNumAnimMeshes);
1106
1107 // make a deep copy of all texture coordinate names
1108 if (src->mTextureCoordsNames != nullptr) {
1109 dest->mTextureCoordsNames = new aiString *[AI_MAX_NUMBER_OF_TEXTURECOORDS] {};
1110 for (unsigned int i = 0; i < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++i) {
1111 Copy(&dest->mTextureCoordsNames[i], src->mTextureCoordsNames[i]);
1112 }
1113 }
1114}
1115
1116// ------------------------------------------------------------------------------------------------
1117void SceneCombiner::Copy(aiAnimMesh **_dest, const aiAnimMesh *src) {

Callers

nothing calls this directly

Calls 6

GetArrayCopyFunction · 0.85
CopyPtrArrayFunction · 0.85
CopyFunction · 0.85
HasTextureCoordsMethod · 0.45
HasVertexColorsMethod · 0.45
ClearMethod · 0.45

Tested by

no test coverage detected