@@ -94,7 +94,7 @@ bool deep_aiNodeTransformationHasScaling(const aiNode* node)
94
94
|| scaling.x < 0 . || scaling.y < 0 . || scaling.z < 0 .
95
95
)
96
96
{
97
- // std::cout << "[TRACE] hasScaling: " << scaling.x << " " << scaling.y << " " <<scaling.z << std::endl;
97
+ // std::cout << "[TRACE] hasScaling: " << scaling.x << " " << scaling.y << " " << scaling.z << std::endl;
98
98
return true ;
99
99
}
100
100
@@ -121,9 +121,9 @@ gp_Trsf toOccTrsf(const aiMatrix4x4& matrix)
121
121
const aiVector3D scaling = aiMatrixScaling (matrix);
122
122
gp_Trsf trsf;
123
123
trsf.SetValues (
124
- matrix.a1 / scaling.x , matrix.a2 / scaling.x , matrix.a3 / scaling.x , matrix.a4 ,
125
- matrix.b1 / scaling.y , matrix.b2 / scaling.y , matrix.b3 / scaling.y , matrix.b4 ,
126
- matrix.c1 / scaling.z , matrix.c2 / scaling.z , matrix.c3 / scaling.z , matrix.c4
124
+ matrix.a1 / scaling.x , matrix.a2 / scaling.x , matrix.a3 / scaling.x , matrix.a4 ,
125
+ matrix.b1 / scaling.y , matrix.b2 / scaling.y , matrix.b3 / scaling.y , matrix.b4 ,
126
+ matrix.c1 / scaling.z , matrix.c2 / scaling.z , matrix.c3 / scaling.z , matrix.c4
127
127
);
128
128
return trsf;
129
129
}
@@ -135,12 +135,12 @@ Quantity_Color toOccColor(const aiColor4D& color, Quantity_TypeOfColor colorType
135
135
}
136
136
137
137
// Create an OpenCascade Image_Texture object from assimp texture
138
- Handle ( Image_Texture) createOccTexture(const aiTexture* texture)
138
+ OccHandle< Image_Texture> createOccTexture (const aiTexture* texture)
139
139
{
140
140
const auto textureWidth = texture->mWidth ;
141
141
const auto textureHeight = texture->mHeight ;
142
142
const auto textureSize = textureHeight == 0 ? textureWidth : 4 * textureWidth * textureHeight;
143
- Handle (NCollection_Buffer) buff = new NCollection_Buffer (
143
+ auto buff = makeOccHandle< NCollection_Buffer> (
144
144
NCollection_BaseAllocator::CommonBaseAllocator (),
145
145
textureSize
146
146
);
@@ -151,14 +151,14 @@ Handle(Image_Texture) createOccTexture(const aiTexture* texture)
151
151
152
152
// Create an OpenCascade Poly_Triangulation object from assimp mesh
153
153
// The input 'mesh' is assumed to contain only triangles
154
- Handle ( Poly_Triangulation) createOccTriangulation(const aiMesh* mesh)
154
+ OccHandle< Poly_Triangulation> createOccTriangulation (const aiMesh* mesh)
155
155
{
156
156
assert (mesh != nullptr );
157
157
assert (mesh->mPrimitiveTypes & aiPrimitiveType_TRIANGLE);
158
158
159
159
const unsigned textureIndex = 0 ;
160
160
const bool hasUvNodes = mesh->HasTextureCoords (textureIndex) && mesh->mNumUVComponents [textureIndex] == 2 ;
161
- Handle (Poly_Triangulation) triangulation = new Poly_Triangulation (mesh->mNumVertices , mesh->mNumFaces , hasUvNodes);
161
+ auto triangulation = makeOccHandle< Poly_Triangulation> (mesh->mNumVertices , mesh->mNumFaces , hasUvNodes);
162
162
163
163
for (unsigned i = 0 ; i < mesh->mNumVertices ; ++i) {
164
164
const aiVector3D& vertex = mesh->mVertices [i];
@@ -340,7 +340,7 @@ TDF_LabelSequence AssimpReader::transfer(DocumentPtr doc, TaskProgress* progress
340
340
341
341
// Add materials in target document
342
342
auto materialTool = doc->xcaf ().visMaterialTool ();
343
- for (const Handle_XCAFDoc_VisMaterial & material : m_vecMaterial) {
343
+ for (const OccHandle<XCAFDoc_VisMaterial> & material : m_vecMaterial) {
344
344
const TDF_Label label = materialTool->AddMaterial (material, material->RawName ()->String ());
345
345
m_mapMaterialLabel.insert ({ material, label });
346
346
}
@@ -370,22 +370,22 @@ void AssimpReader::applyProperties(const PropertyGroup* group)
370
370
}
371
371
}
372
372
373
- Handle ( Image_Texture) AssimpReader::findOccTexture(
373
+ OccHandle< Image_Texture> AssimpReader::findOccTexture (
374
374
const std::string& strFilepath, const FilePath& modelFilepath
375
375
)
376
376
{
377
377
// Texture might be embedded
378
378
{
379
379
// Note: aiScene::GetEmbeddedTextureAndIndex() isn't available for version < 5.1
380
380
const aiTexture* texture = m_scene->GetEmbeddedTexture (strFilepath.c_str ());
381
- Handle ( Image_Texture) occTexture = Cpp::findValue (texture, m_mapEmbeddedTexture);
381
+ OccHandle< Image_Texture> occTexture = Cpp::findValue (texture, m_mapEmbeddedTexture);
382
382
if (occTexture)
383
383
return occTexture;
384
384
}
385
385
386
386
// Texture might have already been loaded from file
387
387
{
388
- Handle ( Image_Texture) texture = CppUtils::findValue (strFilepath, m_mapFileTexture);
388
+ OccHandle< Image_Texture> texture = CppUtils::findValue (strFilepath, m_mapFileTexture);
389
389
if (texture)
390
390
return texture;
391
391
}
@@ -410,7 +410,7 @@ Handle(Image_Texture) AssimpReader::findOccTexture(
410
410
411
411
// Could find an existing filepath for the texture
412
412
if (ptrTextureFilepath) {
413
- Handle (Image_Texture) texture = new Image_Texture (filepathTo<TCollection_AsciiString>(*ptrTextureFilepath));
413
+ auto texture = makeOccHandle< Image_Texture> (filepathTo<TCollection_AsciiString>(*ptrTextureFilepath));
414
414
// Cache texture
415
415
m_mapFileTexture.insert ({ strFilepath, texture });
416
416
return texture;
@@ -425,11 +425,11 @@ Handle(Image_Texture) AssimpReader::findOccTexture(
425
425
return {};
426
426
}
427
427
428
- Handle ( XCAFDoc_VisMaterial) AssimpReader::createOccVisMaterial(
428
+ OccHandle< XCAFDoc_VisMaterial> AssimpReader::createOccVisMaterial (
429
429
const aiMaterial* material, const FilePath& modelFilepath
430
430
)
431
431
{
432
- Handle (XCAFDoc_VisMaterial) mat = new XCAFDoc_VisMaterial;
432
+ auto mat = makeOccHandle< XCAFDoc_VisMaterial>() ;
433
433
434
434
// mat->SetAlphaMode(Graphic3d_AlphaMode_Opaque);
435
435
@@ -448,7 +448,7 @@ Handle(XCAFDoc_VisMaterial) AssimpReader::createOccVisMaterial(
448
448
aiString matName;
449
449
material->Get (AI_MATKEY_NAME, matName);
450
450
std::string_view vMatName{ matName.C_Str (), matName.length };
451
- mat->SetRawName (string_conv<Handle ( TCollection_HAsciiString) >(vMatName));
451
+ mat->SetRawName (string_conv<OccHandle< TCollection_HAsciiString> >(vMatName));
452
452
}
453
453
454
454
// Backface culling
0 commit comments