mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-04 18:06:22 +03:00
0033218: Data Exchange - XCAFPrs_Texture not allow to use classes inherited from Image_Texture
Type of field XCAFPrs_Texture::myImageSource was changed from Image_Texture to Handle(Image_Texture)
This commit is contained in:
parent
c07f4ee70d
commit
7ea3eff4f8
@ -294,23 +294,23 @@ void XCAFDoc_VisMaterial::FillAspect (const Handle(Graphic3d_Aspects)& theAspect
|
||||
Handle(Graphic3d_TextureSet) aTextureSet = new Graphic3d_TextureSet (aNbTexUnits);
|
||||
if (!aColorTexture.IsNull())
|
||||
{
|
||||
aTextureSet->SetValue (aTexIter++, new XCAFPrs_Texture (*aColorTexture, Graphic3d_TextureUnit_BaseColor));
|
||||
aTextureSet->SetValue (aTexIter++, new XCAFPrs_Texture (aColorTexture, Graphic3d_TextureUnit_BaseColor));
|
||||
}
|
||||
if (!myPbrMat.EmissiveTexture.IsNull())
|
||||
{
|
||||
aTextureSet->SetValue (aTexIter++, new XCAFPrs_Texture (*myPbrMat.EmissiveTexture, Graphic3d_TextureUnit_Emissive));
|
||||
aTextureSet->SetValue (aTexIter++, new XCAFPrs_Texture (myPbrMat.EmissiveTexture, Graphic3d_TextureUnit_Emissive));
|
||||
}
|
||||
if (!myPbrMat.OcclusionTexture.IsNull())
|
||||
{
|
||||
aTextureSet->SetValue (aTexIter++, new XCAFPrs_Texture (*myPbrMat.OcclusionTexture, Graphic3d_TextureUnit_Occlusion));
|
||||
aTextureSet->SetValue (aTexIter++, new XCAFPrs_Texture (myPbrMat.OcclusionTexture, Graphic3d_TextureUnit_Occlusion));
|
||||
}
|
||||
if (!myPbrMat.NormalTexture.IsNull())
|
||||
{
|
||||
aTextureSet->SetValue (aTexIter++, new XCAFPrs_Texture (*myPbrMat.NormalTexture, Graphic3d_TextureUnit_Normal));
|
||||
aTextureSet->SetValue (aTexIter++, new XCAFPrs_Texture (myPbrMat.NormalTexture, Graphic3d_TextureUnit_Normal));
|
||||
}
|
||||
if (!myPbrMat.MetallicRoughnessTexture.IsNull())
|
||||
{
|
||||
aTextureSet->SetValue (aTexIter++, new XCAFPrs_Texture (*myPbrMat.MetallicRoughnessTexture, Graphic3d_TextureUnit_MetallicRoughness));
|
||||
aTextureSet->SetValue (aTexIter++, new XCAFPrs_Texture (myPbrMat.MetallicRoughnessTexture, Graphic3d_TextureUnit_MetallicRoughness));
|
||||
}
|
||||
|
||||
theAspect->SetTextureSet (aTextureSet);
|
||||
|
@ -21,14 +21,14 @@ IMPLEMENT_STANDARD_RTTIEXT(XCAFPrs_Texture, Graphic3d_Texture2D)
|
||||
//function : XCAFPrs_Texture
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
XCAFPrs_Texture::XCAFPrs_Texture (const Image_Texture& theImageSource,
|
||||
XCAFPrs_Texture::XCAFPrs_Texture (const Handle(Image_Texture)& theImageSource,
|
||||
const Graphic3d_TextureUnit theUnit)
|
||||
: Graphic3d_Texture2D (""),
|
||||
myImageSource (theImageSource)
|
||||
{
|
||||
if (!myImageSource.TextureId().IsEmpty())
|
||||
if (!myImageSource.IsNull() && !myImageSource->TextureId().IsEmpty())
|
||||
{
|
||||
myTexId = myImageSource.TextureId();
|
||||
myTexId = myImageSource->TextureId();
|
||||
}
|
||||
myParams->SetTextureUnit (theUnit);
|
||||
myIsColorMap = theUnit == Graphic3d_TextureUnit_BaseColor
|
||||
@ -41,7 +41,7 @@ XCAFPrs_Texture::XCAFPrs_Texture (const Image_Texture& theImageSource,
|
||||
//=======================================================================
|
||||
Handle(Image_CompressedPixMap) XCAFPrs_Texture::GetCompressedImage (const Handle(Image_SupportedFormats)& theSupported)
|
||||
{
|
||||
return myImageSource.ReadCompressedImage (theSupported);
|
||||
return !myImageSource.IsNull() ? myImageSource->ReadCompressedImage (theSupported) : Handle(Image_CompressedPixMap)();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@ -50,7 +50,11 @@ Handle(Image_CompressedPixMap) XCAFPrs_Texture::GetCompressedImage (const Handle
|
||||
//=======================================================================
|
||||
Handle(Image_PixMap) XCAFPrs_Texture::GetImage (const Handle(Image_SupportedFormats)& theSupported)
|
||||
{
|
||||
Handle(Image_PixMap) anImage = myImageSource.ReadImage (theSupported);
|
||||
convertToCompatible (theSupported, anImage);
|
||||
Handle(Image_PixMap) anImage;
|
||||
if (!myImageSource.IsNull())
|
||||
{
|
||||
anImage = myImageSource->ReadImage(theSupported);
|
||||
convertToCompatible(theSupported, anImage);
|
||||
}
|
||||
return anImage;
|
||||
}
|
||||
|
@ -27,8 +27,8 @@ class XCAFPrs_Texture : public Graphic3d_Texture2D
|
||||
public:
|
||||
|
||||
//! Constructor.
|
||||
Standard_EXPORT explicit XCAFPrs_Texture (const Image_Texture& theImageSource,
|
||||
const Graphic3d_TextureUnit theUnit);
|
||||
Standard_EXPORT XCAFPrs_Texture (const Handle(Image_Texture)& theImageSource,
|
||||
const Graphic3d_TextureUnit theUnit);
|
||||
|
||||
//! Image reader.
|
||||
Standard_EXPORT virtual Handle(Image_CompressedPixMap) GetCompressedImage (const Handle(Image_SupportedFormats)& theSupported) Standard_OVERRIDE;
|
||||
@ -37,12 +37,11 @@ public:
|
||||
Standard_EXPORT virtual Handle(Image_PixMap) GetImage (const Handle(Image_SupportedFormats)& theSupported) Standard_OVERRIDE;
|
||||
|
||||
//! Return image source.
|
||||
const Image_Texture& GetImageSource() const { return myImageSource; }
|
||||
const Handle(Image_Texture)& GetImageSource() const { return myImageSource; }
|
||||
|
||||
protected:
|
||||
|
||||
Image_Texture myImageSource;
|
||||
|
||||
Handle(Image_Texture) myImageSource;
|
||||
};
|
||||
|
||||
#endif // _XCAFPrs_Texture_HeaderFile
|
||||
|
Loading…
x
Reference in New Issue
Block a user