1 // Copyright (c) 2019 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
14 #ifndef _XCAFDoc_VisMaterialPBR_HeaderFile
15 #define _XCAFDoc_VisMaterialPBR_HeaderFile
17 #include <Graphic3d_AlphaMode.hxx>
18 #include <Graphic3d_Vec.hxx>
19 #include <Image_Texture.hxx>
20 #include <Quantity_ColorRGBA.hxx>
22 //! Metallic-roughness PBR material definition.
23 struct XCAFDoc_VisMaterialPBR
25 Handle(Image_Texture) BaseColorTexture; //!< RGB texture for the base color
26 Handle(Image_Texture) MetallicRoughnessTexture; //!< RG texture packing the metallic and roughness properties together
27 Handle(Image_Texture) EmissiveTexture; //!< RGB emissive map controls the color and intensity of the light being emitted by the material
28 Handle(Image_Texture) OcclusionTexture; //!< R occlusion map indicating areas of indirect lighting
29 Handle(Image_Texture) NormalTexture; //!< normal map
30 Quantity_ColorRGBA BaseColor; //!< base color (or scale factor to the texture); [1.0, 1.0, 1.0, 1.0] by default
31 Graphic3d_Vec3 EmissiveFactor; //!< emissive color; [0.0, 0.0, 0.0] by default
32 Standard_ShortReal Metallic; //!< metalness (or scale factor to the texture) within range [0.0, 1.0]; 1.0 by default
33 Standard_ShortReal Roughness; //!< roughness (or scale factor to the texture) within range [0.0, 1.0]; 1.0 by default
34 Standard_ShortReal RefractionIndex; //!< IOR (index of refraction) within range [1.0, 3.0]; 1.5 by default
35 Standard_Boolean IsDefined; //!< defined flag; FALSE by default
37 //! Empty constructor.
38 XCAFDoc_VisMaterialPBR()
39 : BaseColor (1.0f, 1.0f, 1.0f, 1.0f),
40 EmissiveFactor (0.0f, 0.0f, 0.0f),
43 RefractionIndex (1.5f),
44 IsDefined (Standard_False) {}
46 //! Compare two materials.
47 Standard_Boolean IsEqual (const XCAFDoc_VisMaterialPBR& theOther) const
49 if (&theOther == this)
53 else if (theOther.IsDefined != IsDefined)
62 return theOther.BaseColorTexture == BaseColorTexture
63 && theOther.MetallicRoughnessTexture == MetallicRoughnessTexture
64 && theOther.EmissiveTexture == EmissiveTexture
65 && theOther.OcclusionTexture == OcclusionTexture
66 && theOther.NormalTexture == NormalTexture
67 && theOther.BaseColor == BaseColor
68 && theOther.EmissiveFactor == EmissiveFactor
69 && theOther.Metallic == Metallic
70 && theOther.Roughness == Roughness
71 && theOther.RefractionIndex == RefractionIndex;
75 #endif // _XCAFDoc_VisMaterialPBR_HeaderFile