a4815d55 |
1 | // Copyright (c) 2019 OPEN CASCADE SAS |
2 | // |
3 | // This file is part of Open CASCADE Technology software library. |
4 | // |
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. |
10 | // |
11 | // Alternatively, this file may be used under the terms of Open CASCADE |
12 | // commercial license or contractual agreement. |
13 | |
14 | #ifndef _XCAFDoc_VisMaterialPBR_HeaderFile |
15 | #define _XCAFDoc_VisMaterialPBR_HeaderFile |
16 | |
17 | #include <Graphic3d_AlphaMode.hxx> |
18 | #include <Graphic3d_Vec.hxx> |
19 | #include <Image_Texture.hxx> |
20 | #include <Quantity_ColorRGBA.hxx> |
21 | |
22 | //! Metallic-roughness PBR material definition. |
23 | struct XCAFDoc_VisMaterialPBR |
24 | { |
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 |
0858125f |
34 | Standard_ShortReal RefractionIndex; //!< IOR (index of refraction) within range [1.0, 3.0]; 1.5 by default |
a4815d55 |
35 | Standard_Boolean IsDefined; //!< defined flag; FALSE by default |
36 | |
37 | //! Empty constructor. |
38 | XCAFDoc_VisMaterialPBR() |
39 | : BaseColor (1.0f, 1.0f, 1.0f, 1.0f), |
40 | EmissiveFactor (0.0f, 0.0f, 0.0f), |
41 | Metallic (1.0f), |
42 | Roughness (1.0f), |
0858125f |
43 | RefractionIndex (1.5f), |
a4815d55 |
44 | IsDefined (Standard_False) {} |
45 | |
46 | //! Compare two materials. |
47 | Standard_Boolean IsEqual (const XCAFDoc_VisMaterialPBR& theOther) const |
48 | { |
49 | if (&theOther == this) |
50 | { |
51 | return true; |
52 | } |
53 | else if (theOther.IsDefined != IsDefined) |
54 | { |
55 | return false; |
56 | } |
57 | else if (!IsDefined) |
58 | { |
59 | return true; |
60 | } |
61 | |
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 |
0858125f |
70 | && theOther.Roughness == Roughness |
71 | && theOther.RefractionIndex == RefractionIndex; |
a4815d55 |
72 | } |
73 | }; |
74 | |
75 | #endif // _XCAFDoc_VisMaterialPBR_HeaderFile |