1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0029902: Data Exchange, XCAF - provide extended Material definition for visualization purposes

Introduced new attribute XCAFDoc_VisMaterial storing visualization material definition.

XCAFPrs_Style has been exteneded Material() property.
XCAFPrs_AISObject::DispatchStyles() maps new XCAFPrs_Style::Material() property onto graphics aspects.

RWGltf_GltfJsonParser and RWObj_CafReader now put Material definition into XCAF document instead of a color label.
RWGltf_MaterialMetallicRoughness - added missing properties AlphaMode, AlphaCutOff and IsDoubleSided;
fixed default values in constructor for Metallic and Roughness.

Added commands XGetAllVisMaterials, XGetVisMaterial, XAddVisMaterial,
XRemoveVisMaterial, XSetVisMaterial, XUnsetVisMaterial for working with
new visualization materials table in the document.
This commit is contained in:
kgv
2019-07-03 11:28:26 +03:00
committed by apn
parent ba00aab7a0
commit a4815d5509
49 changed files with 3252 additions and 256 deletions

View File

@@ -16,3 +16,5 @@ XCAFPrs_Driver.cxx
XCAFPrs_Driver.hxx
XCAFPrs_Style.cxx
XCAFPrs_Style.hxx
XCAFPrs_Texture.cxx
XCAFPrs_Texture.hxx

View File

@@ -13,8 +13,8 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <XCAFPrs.hxx>
#include <BRep_Builder.hxx>
#include <TColStd_HSequenceOfExtendedString.hxx>
#include <TDF_AttributeSequence.hxx>
#include <TDF_Label.hxx>
@@ -29,12 +29,33 @@
#include <XCAFDoc_DocumentTool.hxx>
#include <XCAFDoc_GraphNode.hxx>
#include <XCAFDoc_LayerTool.hxx>
#include <XCAFDoc_VisMaterialTool.hxx>
#include <XCAFDoc_ShapeTool.hxx>
#include <XCAFPrs.hxx>
#include <XCAFPrs_Style.hxx>
static Standard_Boolean viewnameMode = Standard_False;
//! Fill colors of XCAFPrs_Style structure.
static void fillStyleColors (XCAFPrs_Style& theStyle,
const Handle(XCAFDoc_ColorTool)& theTool,
const TDF_Label& theLabel)
{
Quantity_ColorRGBA aColor;
if (theTool->GetColor (theLabel, XCAFDoc_ColorGen, aColor))
{
theStyle.SetColorCurv (aColor.GetRGB());
theStyle.SetColorSurf (aColor);
}
if (theTool->GetColor (theLabel, XCAFDoc_ColorSurf, aColor))
{
theStyle.SetColorSurf (aColor);
}
if (theTool->GetColor (theLabel, XCAFDoc_ColorCurv, aColor))
{
theStyle.SetColorCurv (aColor.GetRGB());
}
}
static Standard_Boolean getShapesOfSHUO (TopLoc_IndexedMapOfLocation& theaPrevLocMap,
const Handle(XCAFDoc_ShapeTool)& theSTool,
const TDF_Label& theSHUOlab,
@@ -128,6 +149,8 @@ void XCAFPrs::CollectStyleSettings (const TDF_Label& theLabel,
// collect settings on subshapes
Handle(XCAFDoc_ColorTool) aColorTool = XCAFDoc_DocumentTool::ColorTool(theLabel);
Handle(XCAFDoc_VisMaterialTool) aMatTool = XCAFDoc_DocumentTool::VisMaterialTool (theLabel);
TDF_LabelSequence aLabSeq;
XCAFDoc_ShapeTool::GetSubShapes (theLabel, aLabSeq);
// and add the shape itself
@@ -136,12 +159,14 @@ void XCAFPrs::CollectStyleSettings (const TDF_Label& theLabel,
{
const TDF_Label& aLabel = aLabIter.Value();
XCAFPrs_Style aStyle;
aStyle.SetVisibility (aColorTool->IsVisible (aLabel));
aStyle.SetMaterial (aMatTool->GetShapeMaterial (aLabel));
Standard_Boolean isVisible = aColorTool->IsVisible (aLabel);
if (isVisible)
Handle(TColStd_HSequenceOfExtendedString) aLayerNames;
Handle(XCAFDoc_LayerTool) aLayerTool = XCAFDoc_DocumentTool::LayerTool (aLabel);
if (aStyle.IsVisible())
{
Handle(XCAFDoc_LayerTool) aLayerTool = XCAFDoc_DocumentTool::LayerTool (aLabel);
Handle(TColStd_HSequenceOfExtendedString) aLayerNames = new TColStd_HSequenceOfExtendedString();
aLayerNames = new TColStd_HSequenceOfExtendedString();
aLayerTool->GetLayers (aLabel, aLayerNames);
Standard_Integer aNbHidden = 0;
for (TColStd_HSequenceOfExtendedString::Iterator aLayerIter (*aLayerNames); aLayerIter.More(); aLayerIter.Next())
@@ -152,54 +177,38 @@ void XCAFPrs::CollectStyleSettings (const TDF_Label& theLabel,
++aNbHidden;
}
}
isVisible = aNbHidden == 0
|| aNbHidden != aLayerNames->Length();
aStyle.SetVisibility (aNbHidden == 0
|| aNbHidden != aLayerNames->Length());
}
if (!isVisible)
if (aColorTool->IsColorByLayer (aLabel))
{
aStyle.SetVisibility (Standard_False);
Quantity_ColorRGBA aLayerColor = theLayerColor;
if (aLayerNames.IsNull())
{
aLayerNames = new TColStd_HSequenceOfExtendedString();
aLayerTool->GetLayers (aLabel, aLayerNames);
}
if (aLayerNames->Length() == 1)
{
TDF_Label aLayer = aLayerTool->FindLayer (aLayerNames->First());
Quantity_ColorRGBA aColor;
if (aColorTool->GetColor (aLayer, XCAFDoc_ColorGen, aColor))
{
aLayerColor = aColor;
}
}
aStyle.SetColorCurv (aLayerColor.GetRGB());
aStyle.SetColorSurf (aLayerColor);
}
else
{
if (aColorTool->IsColorByLayer(aLabel))
{
Quantity_ColorRGBA aLayerColor = theLayerColor;
Handle(XCAFDoc_LayerTool) aLayerTool = XCAFDoc_DocumentTool::LayerTool (aLabel);
Handle(TColStd_HSequenceOfExtendedString) aLayerNames = new TColStd_HSequenceOfExtendedString();
aLayerTool->GetLayers (aLabel, aLayerNames);
if (aLayerNames->Length() == 1)
{
TDF_Label aLayer = aLayerTool->FindLayer (aLayerNames->First());
Quantity_ColorRGBA aColor;
if (aColorTool->GetColor (aLayer, XCAFDoc_ColorGen, aColor))
aLayerColor = aColor;
}
aStyle.SetColorCurv (aLayerColor.GetRGB());
aStyle.SetColorSurf (aLayerColor);
}
else
{
Quantity_ColorRGBA aColor;
if (aColorTool->GetColor (aLabel, XCAFDoc_ColorGen, aColor))
{
aStyle.SetColorCurv (aColor.GetRGB());
aStyle.SetColorSurf (aColor);
}
if (aColorTool->GetColor (aLabel, XCAFDoc_ColorSurf, aColor))
{
aStyle.SetColorSurf (aColor);
}
if (aColorTool->GetColor (aLabel, XCAFDoc_ColorCurv, aColor))
{
aStyle.SetColorCurv (aColor.GetRGB());
}
}
fillStyleColors (aStyle, aColorTool, aLabel);
}
// PTV try to set color from SHUO structure
Handle(XCAFDoc_ShapeTool) aShapeTool = aColorTool->ShapeTool();
const Handle(XCAFDoc_ShapeTool)& aShapeTool = aColorTool->ShapeTool();
if (aShapeTool->IsComponent (aLabel))
{
TDF_AttributeSequence aShuoAttribSeq;
@@ -222,31 +231,11 @@ void XCAFPrs::CollectStyleSettings (const TDF_Label& theLabel,
}
}
Quantity_ColorRGBA aColor;
XCAFPrs_Style aShuoStyle;
if (!aColorTool->IsVisible (aShuolab))
{
aShuoStyle.SetVisibility (Standard_False);
}
else
{
if (aColorTool->GetColor (aShuolab, XCAFDoc_ColorGen, aColor))
{
aShuoStyle.SetColorCurv (aColor.GetRGB());
aShuoStyle.SetColorSurf (aColor);
}
if (aColorTool->GetColor (aShuolab, XCAFDoc_ColorSurf, aColor))
{
aShuoStyle.SetColorSurf (aColor);
}
if (aColorTool->GetColor (aShuolab, XCAFDoc_ColorCurv, aColor))
{
aShuoStyle.SetColorCurv (aColor.GetRGB());
}
}
if (!aShuoStyle.IsSetColorCurv()
&& !aShuoStyle.IsSetColorSurf()
&& aShuoStyle.IsVisible())
aShuoStyle.SetMaterial (aMatTool->GetShapeMaterial (aShuolab));
aShuoStyle.SetVisibility(aColorTool->IsVisible (aShuolab));
fillStyleColors (aShuoStyle, aColorTool, aShuolab);
if (aShuoStyle.IsEmpty())
{
continue;
}
@@ -293,9 +282,7 @@ void XCAFPrs::CollectStyleSettings (const TDF_Label& theLabel,
}
}
if (!aStyle.IsSetColorCurv()
&& !aStyle.IsSetColorSurf()
&& aStyle.IsVisible())
if (aStyle.IsEmpty())
{
continue;
}

View File

@@ -21,6 +21,7 @@
#include <gp_Pnt.hxx>
#include <Graphic3d_AspectFillArea3d.hxx>
#include <Graphic3d_AspectLine3d.hxx>
#include <Graphic3d_Texture2Dmanual.hxx>
#include <Prs3d_Drawer.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <Prs3d_IsoAspect.hxx>
@@ -37,7 +38,6 @@
#include <XCAFPrs_DataMapIteratorOfIndexedDataMapOfShapeStyle.hxx>
#include <XCAFPrs_Style.hxx>
IMPLEMENT_STANDARD_RTTIEXT(XCAFPrs_AISObject,AIS_ColoredShape)
//=======================================================================
@@ -139,10 +139,7 @@ void XCAFPrs_AISObject::DispatchStyles (const Standard_Boolean theToSyncStyles)
// Getting default colors
XCAFPrs_Style aDefStyle;
DefaultStyle (aDefStyle);
Quantity_Color aColorCurv = aDefStyle.GetColorCurv();
Quantity_ColorRGBA aColorSurf = aDefStyle.GetColorSurfRGBA();
SetColors (myDrawer, aColorCurv, aColorSurf);
setStyleToDrawer (myDrawer, aDefStyle, aDefStyle, myDrawer->ShadingAspect()->Aspect()->FrontMaterial());
// collect sub-shapes with the same style into compounds
BRep_Builder aBuilder;
@@ -184,11 +181,17 @@ void XCAFPrs_AISObject::DispatchStyles (const Standard_Boolean theToSyncStyles)
myShapeColors.Bind (aShapeCur, aDrawer);
const XCAFPrs_Style& aStyle = aStyleGroupIter.Key();
aDrawer->SetHidden (!aStyle.IsVisible());
aColorCurv = aStyle.IsSetColorCurv() ? aStyle.GetColorCurv() : aDefStyle.GetColorCurv();
aColorSurf = aStyle.IsSetColorSurf() ? aStyle.GetColorSurfRGBA() : aDefStyle.GetColorSurfRGBA();
SetColors (aDrawer, aColorCurv, aColorSurf);
if (!aStyle.Material().IsNull()
&& !aStyle.Material()->IsEmpty())
{
aDrawer->SetOwnMaterial();
}
if (aStyle.IsSetColorSurf()
|| aStyle.IsSetColorCurv())
{
aDrawer->SetOwnColor (Quantity_Color());
}
setStyleToDrawer (aDrawer, aStyle, aDefStyle, myDrawer->ShadingAspect()->Aspect()->FrontMaterial());
}
aStyleGroups.Clear();
}
@@ -243,83 +246,48 @@ void XCAFPrs_AISObject::Compute (const Handle(PrsMgr_PresentationManager3d)& the
}
//=======================================================================
//function : SetColors
//function : setStyleToDrawer
//purpose :
//=======================================================================
void XCAFPrs_AISObject::SetColors (const Handle(Prs3d_Drawer)& theDrawer,
const Quantity_Color& theColorCurv,
const Quantity_ColorRGBA& theColorSurf)
void XCAFPrs_AISObject::setStyleToDrawer (const Handle(Prs3d_Drawer)& theDrawer,
const XCAFPrs_Style& theStyle,
const XCAFPrs_Style& theDefStyle,
const Graphic3d_MaterialAspect& theDefMaterial)
{
if (!theDrawer->HasOwnShadingAspect())
theDrawer->SetupOwnShadingAspect();
theDrawer->SetOwnLineAspects();
Quantity_ColorRGBA aSurfColor = theDefStyle.GetColorSurfRGBA();
Quantity_Color aCurvColor = theDefStyle.GetColorCurv();
Graphic3d_MaterialAspect aMaterial = theDefMaterial;
const Handle(XCAFDoc_VisMaterial)& anXMat = !theStyle.Material().IsNull() ? theStyle.Material() : theDefStyle.Material();
if (!anXMat.IsNull()
&& !anXMat->IsEmpty())
{
theDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
if (theDrawer->HasLink())
{
*theDrawer->ShadingAspect()->Aspect() = *theDrawer->Link()->ShadingAspect()->Aspect();
}
anXMat->FillAspect (theDrawer->ShadingAspect()->Aspect());
aMaterial = theDrawer->ShadingAspect()->Aspect()->FrontMaterial();
aSurfColor = Quantity_ColorRGBA (aMaterial.Color(), aMaterial.Alpha());
aCurvColor = aMaterial.Color();
}
if (!theDrawer->HasOwnLineAspect())
if (theStyle.IsSetColorSurf())
{
theDrawer->SetLineAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
if (theDrawer->HasLink())
{
*theDrawer->LineAspect()->Aspect() = *theDrawer->Link()->LineAspect()->Aspect();
}
aSurfColor = theStyle.GetColorSurfRGBA();
aMaterial.SetColor (aSurfColor.GetRGB());
aMaterial.SetAlpha (aSurfColor.Alpha());
}
if (!theDrawer->HasOwnWireAspect())
if (theStyle.IsSetColorCurv())
{
theDrawer->SetWireAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
if (theDrawer->HasLink())
{
*theDrawer->WireAspect()->Aspect() = *theDrawer->Link()->WireAspect()->Aspect();
}
}
if (!theDrawer->HasOwnUIsoAspect())
{
theDrawer->SetUIsoAspect (new Prs3d_IsoAspect (Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 0.5, 1));
if (theDrawer->HasLink())
{
*theDrawer->UIsoAspect()->Aspect() = *theDrawer->Link()->UIsoAspect()->Aspect();
theDrawer->UIsoAspect()->SetNumber (theDrawer->Link()->UIsoAspect()->Number());
}
}
if (!theDrawer->HasOwnVIsoAspect())
{
theDrawer->SetVIsoAspect (new Prs3d_IsoAspect (Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 0.5, 1));
if (theDrawer->HasLink())
{
*theDrawer->VIsoAspect()->Aspect() = *theDrawer->Link()->VIsoAspect()->Aspect();
theDrawer->VIsoAspect()->SetNumber (theDrawer->Link()->VIsoAspect()->Number());
}
}
if (!theDrawer->HasOwnFreeBoundaryAspect())
{
theDrawer->SetFreeBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
if (theDrawer->HasLink())
{
*theDrawer->FreeBoundaryAspect()->Aspect() = *theDrawer->Link()->FreeBoundaryAspect()->Aspect();
}
}
if (!theDrawer->HasOwnUnFreeBoundaryAspect())
{
theDrawer->SetUnFreeBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
if (theDrawer->HasLink())
{
*theDrawer->UnFreeBoundaryAspect()->Aspect() = *theDrawer->Link()->UnFreeBoundaryAspect()->Aspect();
}
aCurvColor = theStyle.GetColorCurv();
}
theDrawer->UnFreeBoundaryAspect()->SetColor (theColorCurv);
theDrawer->FreeBoundaryAspect()->SetColor (theColorCurv);
theDrawer->WireAspect()->SetColor (theColorCurv);
theDrawer->UnFreeBoundaryAspect()->SetColor (aCurvColor);
theDrawer->FreeBoundaryAspect()->SetColor (aCurvColor);
theDrawer->WireAspect()->SetColor (aCurvColor);
Graphic3d_MaterialAspect aMaterial = myDrawer->ShadingAspect()->Aspect()->FrontMaterial();
aMaterial.SetColor (theColorSurf.GetRGB());
aMaterial.SetAlpha (theColorSurf.Alpha());
theDrawer->ShadingAspect()->Aspect()->SetInteriorColor (theColorSurf);
theDrawer->ShadingAspect()->Aspect()->SetInteriorColor (aSurfColor);
theDrawer->ShadingAspect()->Aspect()->SetFrontMaterial (aMaterial);
theDrawer->UIsoAspect()->SetColor (theColorSurf.GetRGB());
theDrawer->VIsoAspect()->SetColor (theColorSurf.GetRGB());
theDrawer->UIsoAspect()->SetColor (aSurfColor.GetRGB());
theDrawer->VIsoAspect()->SetColor (aSurfColor.GetRGB());
}
//=======================================================================
@@ -341,17 +309,25 @@ void XCAFPrs_AISObject::SetMaterial (const Graphic3d_MaterialAspect& theMaterial
XCAFPrs_Style aDefStyle;
DefaultStyle (aDefStyle);
setMaterial (myDrawer, theMaterial, HasColor(), IsTransparent());
SetColors (myDrawer, aDefStyle.GetColorCurv(), aDefStyle.GetColorSurf());
setStyleToDrawer (myDrawer, aDefStyle, aDefStyle, myDrawer->ShadingAspect()->Aspect()->FrontMaterial());
for (AIS_DataMapOfShapeDrawer::Iterator anIter (myShapeColors); anIter.More(); anIter.Next())
{
const Handle(AIS_ColoredDrawer)& aDrawer = anIter.Value();
if (aDrawer->HasOwnMaterial())
{
continue;
}
// take current color
const Quantity_Color aColorCurv = aDrawer->WireAspect()->Aspect()->Color();
const Quantity_ColorRGBA aSurfColor = aDrawer->ShadingAspect()->Aspect()->InteriorColorRGBA();
// SetColors() will take the material from myDrawer
SetColors (aDrawer, aColorCurv, aSurfColor);
if (aDrawer->HasOwnShadingAspect())
{
// take current color
const Quantity_ColorRGBA aSurfColor = aDrawer->ShadingAspect()->Aspect()->InteriorColorRGBA();
Graphic3d_MaterialAspect aMaterial = myDrawer->ShadingAspect()->Aspect()->FrontMaterial();
aMaterial.SetColor (aSurfColor.GetRGB());
aMaterial.SetAlpha (aSurfColor.Alpha());
aDrawer->ShadingAspect()->Aspect()->SetInteriorColor (aSurfColor);
aDrawer->ShadingAspect()->Aspect()->SetFrontMaterial (aMaterial);
}
}
SynchronizeAspects();
}

View File

@@ -57,21 +57,19 @@ protected:
const Handle(Prs3d_Presentation)& thePresentation,
const Standard_Integer theMode) Standard_OVERRIDE;
//! Set colors to drawer
Standard_EXPORT void SetColors (const Handle(Prs3d_Drawer)& theDrawer,
const Quantity_Color& theColorCurv,
const Quantity_ColorRGBA& theColorSurf);
//! Set colors to drawer
void SetColors (const Handle(Prs3d_Drawer)& theDrawer,
const Quantity_Color& theColorCurv,
const Quantity_Color& theColorSurf) { SetColors (theDrawer, theColorCurv, Quantity_ColorRGBA (theColorSurf)); }
//! Fills out a default style object which is used when styles are
//! not explicitly defined in the document.
//! By default, the style uses white color for curves and surfaces.
Standard_EXPORT virtual void DefaultStyle (XCAFPrs_Style& theStyle) const;
protected:
//! Assign style to drawer.
static void setStyleToDrawer (const Handle(Prs3d_Drawer)& theDrawer,
const XCAFPrs_Style& theStyle,
const XCAFPrs_Style& theDefStyle,
const Graphic3d_MaterialAspect& theDefMaterial);
protected:
TDF_Label myLabel; //!< label pointing onto the shape

View File

@@ -20,6 +20,7 @@
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Quantity_ColorRGBAHasher.hxx>
#include <XCAFDoc_VisMaterial.hxx>
//! Represents a set of styling settings applicable to a (sub)shape
class XCAFPrs_Style
@@ -31,6 +32,21 @@ public:
//! Empty constructor - colors are unset, visibility is TRUE.
Standard_EXPORT XCAFPrs_Style();
//! Return TRUE if style is empty - does not override any properties.
Standard_Boolean IsEmpty() const
{
return !myHasColorSurf
&& !myHasColorCurv
&& myMaterial.IsNull()
&& myIsVisible;
}
//! Return material.
const Handle(XCAFDoc_VisMaterial)& Material() const { return myMaterial; }
//! Set material.
void SetMaterial (const Handle(XCAFDoc_VisMaterial)& theMaterial) { myMaterial = theMaterial; }
//! Return TRUE if surface color has been defined.
Standard_Boolean IsSetColorSurf() const { return myHasColorSurf; }
@@ -82,6 +98,7 @@ public:
return myHasColorSurf == theOther.myHasColorSurf
&& myHasColorCurv == theOther.myHasColorCurv
&& myMaterial == theOther.myMaterial
&& (!myHasColorSurf || myColorSurf == theOther.myColorSurf)
&& (!myHasColorCurv || myColorCurv == theOther.myColorCurv);
}
@@ -112,6 +129,10 @@ public:
{
aHashCode = aHashCode ^ Quantity_ColorHasher::HashCode (theStyle.myColorCurv, theUpperBound);
}
if (!theStyle.myMaterial.IsNull())
{
aHashCode = aHashCode ^ ::HashCode (theStyle.myMaterial, theUpperBound);
}
return ::HashCode (aHashCode, theUpperBound);
}
@@ -126,6 +147,7 @@ public:
protected:
Handle(XCAFDoc_VisMaterial) myMaterial;
Quantity_ColorRGBA myColorSurf;
Quantity_Color myColorCurv;
Standard_Boolean myHasColorSurf;

View File

@@ -0,0 +1,43 @@
// Copyright (c) 2019 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <XCAFPrs_Texture.hxx>
#include <Graphic3d_TextureParams.hxx>
IMPLEMENT_STANDARD_RTTIEXT(XCAFPrs_Texture, Graphic3d_Texture2Dmanual)
//=======================================================================
//function : XCAFPrs_Texture
//purpose :
//=======================================================================
XCAFPrs_Texture::XCAFPrs_Texture (const Image_Texture& theImageSource,
const Graphic3d_TextureUnit theUnit)
: Graphic3d_Texture2Dmanual (""),
myImageSource (theImageSource)
{
if (!myImageSource.TextureId().IsEmpty())
{
myTexId = myImageSource.TextureId();
}
myParams->SetTextureUnit (theUnit);
}
//=======================================================================
//function : GetImage
//purpose :
//=======================================================================
Handle(Image_PixMap) XCAFPrs_Texture::GetImage() const
{
return myImageSource.ReadImage();
}

View File

@@ -0,0 +1,45 @@
// Created on: 2000-08-11
// Created by: Andrey BETENEV
// Copyright (c) 2000-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _XCAFPrs_Texture_HeaderFile
#define _XCAFPrs_Texture_HeaderFile
#include <Graphic3d_Texture2Dmanual.hxx>
#include <Graphic3d_TextureUnit.hxx>
#include <Image_Texture.hxx>
//! Texture holder.
class XCAFPrs_Texture : public Graphic3d_Texture2Dmanual
{
DEFINE_STANDARD_RTTIEXT(XCAFPrs_Texture, Graphic3d_Texture2Dmanual)
public:
//! Constructor.
Standard_EXPORT explicit XCAFPrs_Texture (const Image_Texture& theImageSource,
const Graphic3d_TextureUnit theUnit);
//! Image reader.
Standard_EXPORT virtual Handle(Image_PixMap) GetImage() const Standard_OVERRIDE;
//! Return image source.
const Image_Texture& GetImageSource() const { return myImageSource; }
protected:
Image_Texture myImageSource;
};
#endif // _XCAFPrs_Texture_HeaderFile