mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-07 18:30:55 +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
c334f465ca
commit
e0b19449a6
@ -294,23 +294,23 @@ void XCAFDoc_VisMaterial::FillAspect (const Handle(Graphic3d_Aspects)& theAspect
|
|||||||
Handle(Graphic3d_TextureSet) aTextureSet = new Graphic3d_TextureSet (aNbTexUnits);
|
Handle(Graphic3d_TextureSet) aTextureSet = new Graphic3d_TextureSet (aNbTexUnits);
|
||||||
if (!aColorTexture.IsNull())
|
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())
|
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())
|
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())
|
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())
|
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);
|
theAspect->SetTextureSet (aTextureSet);
|
||||||
|
@ -21,14 +21,14 @@ IMPLEMENT_STANDARD_RTTIEXT(XCAFPrs_Texture, Graphic3d_Texture2D)
|
|||||||
//function : XCAFPrs_Texture
|
//function : XCAFPrs_Texture
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
XCAFPrs_Texture::XCAFPrs_Texture (const Image_Texture& theImageSource,
|
XCAFPrs_Texture::XCAFPrs_Texture (const Handle(Image_Texture)& theImageSource,
|
||||||
const Graphic3d_TextureUnit theUnit)
|
const Graphic3d_TextureUnit theUnit)
|
||||||
: Graphic3d_Texture2D (""),
|
: Graphic3d_Texture2D (""),
|
||||||
myImageSource (theImageSource)
|
myImageSource (theImageSource)
|
||||||
{
|
{
|
||||||
if (!myImageSource.TextureId().IsEmpty())
|
if (!myImageSource.IsNull() && !myImageSource->TextureId().IsEmpty())
|
||||||
{
|
{
|
||||||
myTexId = myImageSource.TextureId();
|
myTexId = myImageSource->TextureId();
|
||||||
}
|
}
|
||||||
myParams->SetTextureUnit (theUnit);
|
myParams->SetTextureUnit (theUnit);
|
||||||
myIsColorMap = theUnit == Graphic3d_TextureUnit_BaseColor
|
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)
|
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) XCAFPrs_Texture::GetImage (const Handle(Image_SupportedFormats)& theSupported)
|
||||||
{
|
{
|
||||||
Handle(Image_PixMap) anImage = myImageSource.ReadImage (theSupported);
|
Handle(Image_PixMap) anImage;
|
||||||
|
if (!myImageSource.IsNull())
|
||||||
|
{
|
||||||
|
anImage = myImageSource->ReadImage(theSupported);
|
||||||
convertToCompatible(theSupported, anImage);
|
convertToCompatible(theSupported, anImage);
|
||||||
|
}
|
||||||
return anImage;
|
return anImage;
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ class XCAFPrs_Texture : public Graphic3d_Texture2D
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
//! Constructor.
|
//! Constructor.
|
||||||
Standard_EXPORT explicit XCAFPrs_Texture (const Image_Texture& theImageSource,
|
Standard_EXPORT XCAFPrs_Texture (const Handle(Image_Texture)& theImageSource,
|
||||||
const Graphic3d_TextureUnit theUnit);
|
const Graphic3d_TextureUnit theUnit);
|
||||||
|
|
||||||
//! Image reader.
|
//! Image reader.
|
||||||
@ -37,12 +37,11 @@ public:
|
|||||||
Standard_EXPORT virtual Handle(Image_PixMap) GetImage (const Handle(Image_SupportedFormats)& theSupported) Standard_OVERRIDE;
|
Standard_EXPORT virtual Handle(Image_PixMap) GetImage (const Handle(Image_SupportedFormats)& theSupported) Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Return image source.
|
//! Return image source.
|
||||||
const Image_Texture& GetImageSource() const { return myImageSource; }
|
const Handle(Image_Texture)& GetImageSource() const { return myImageSource; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
Image_Texture myImageSource;
|
Handle(Image_Texture) myImageSource;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _XCAFPrs_Texture_HeaderFile
|
#endif // _XCAFPrs_Texture_HeaderFile
|
||||||
|
Loading…
x
Reference in New Issue
Block a user