b311480e |
1 | // Created on: 2006-05-25 |
2 | // Created by: Alexander GRIGORIEV |
973c2be1 |
3 | // Copyright (c) 2006-2014 OPEN CASCADE SAS |
b311480e |
4 | // |
973c2be1 |
5 | // This file is part of Open CASCADE Technology software library. |
b311480e |
6 | // |
d5f74e42 |
7 | // This library is free software; you can redistribute it and/or modify it under |
8 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
9 | // by the Free Software Foundation, with special exception defined in the file |
10 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
11 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
12 | // |
973c2be1 |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
7fd59977 |
15 | |
16 | #ifndef VrmlData_Material_HeaderFile |
17 | #define VrmlData_Material_HeaderFile |
18 | |
19 | #include <VrmlData_Node.hxx> |
20 | #include <Quantity_Color.hxx> |
21 | |
22 | /** |
23 | * Implementation of the Material node |
24 | */ |
25 | class VrmlData_Material : public VrmlData_Node |
26 | { |
27 | public: |
28 | // ---------- PUBLIC METHODS ---------- |
29 | |
30 | /** |
31 | * Empty constructor |
32 | */ |
33 | Standard_EXPORT VrmlData_Material (); |
34 | |
35 | /** |
36 | * Constructor |
37 | */ |
38 | Standard_EXPORT VrmlData_Material |
39 | (const VrmlData_Scene& theScene, |
40 | const char * theName, |
41 | const Standard_Real theAmbientIntensity = -1., |
42 | const Standard_Real theShininess = -1., |
43 | const Standard_Real theTransparency = -1.); |
44 | |
45 | /** |
46 | * Query the Ambient Intensity value |
47 | */ |
48 | inline Standard_Real |
49 | AmbientIntensity() const { return myAmbientIntensity; } |
50 | |
51 | /** |
52 | * Query the Shininess value |
53 | */ |
54 | inline Standard_Real |
55 | Shininess () const { return myShininess; } |
56 | |
57 | /** |
58 | * Query the Transparency value |
59 | */ |
60 | inline Standard_Real |
61 | Transparency () const { return myTransparency; } |
62 | |
63 | /** |
64 | * Query the Diffuse color |
65 | */ |
66 | inline const Quantity_Color& |
67 | DiffuseColor () const { return myDiffuseColor; } |
68 | |
69 | /** |
70 | * Query the Emissive color |
71 | */ |
72 | inline const Quantity_Color& |
73 | EmissiveColor () const { return myEmissiveColor; } |
74 | |
75 | /** |
76 | * Query the Specular color |
77 | */ |
78 | inline const Quantity_Color& |
79 | SpecularColor () const { return mySpecularColor; } |
80 | |
81 | /** |
82 | * Set the Ambient Intensity value |
83 | */ |
84 | inline void SetAmbientIntensity |
85 | (const Standard_Real theAmbientIntensity) |
86 | { myAmbientIntensity = theAmbientIntensity; } |
87 | |
88 | /** |
89 | * Set the Shininess value |
90 | */ |
91 | inline void SetShininess (const Standard_Real theShininess) |
92 | { myShininess = theShininess; } |
93 | |
94 | /** |
95 | * Set the Transparency value |
96 | */ |
97 | inline void SetTransparency (const Standard_Real theTransparency) |
98 | { myTransparency = theTransparency; } |
99 | |
100 | /** |
101 | * Query the Diffuse color |
102 | */ |
103 | inline void SetDiffuseColor (const Quantity_Color& theColor) |
104 | { myDiffuseColor = theColor; } |
105 | |
106 | /** |
107 | * Query the Emissive color |
108 | */ |
109 | inline void SetEmissiveColor (const Quantity_Color& theColor) |
110 | { myEmissiveColor = theColor; } |
111 | |
112 | /** |
113 | * Query the Specular color |
114 | */ |
115 | inline void SetSpecularColor (const Quantity_Color& theColor) |
116 | { mySpecularColor = theColor; } |
117 | |
118 | /** |
119 | * Create a copy of this node. |
120 | * If the parameter is null, a new copied node is created. Otherwise new node |
121 | * is not created, but rather the given one is modified. |
122 | */ |
123 | Standard_EXPORT virtual Handle(VrmlData_Node) |
79104795 |
124 | Clone (const Handle(VrmlData_Node)& theOther)const Standard_OVERRIDE; |
7fd59977 |
125 | |
126 | /** |
127 | * Read the Node from input stream. |
128 | */ |
129 | Standard_EXPORT virtual VrmlData_ErrorStatus |
79104795 |
130 | Read (VrmlData_InBuffer& theBuffer) Standard_OVERRIDE; |
7fd59977 |
131 | |
132 | /** |
133 | * Write the Node to the Scene output. |
134 | */ |
135 | Standard_EXPORT virtual VrmlData_ErrorStatus |
79104795 |
136 | Write (const char * thePrefix) const Standard_OVERRIDE; |
7fd59977 |
137 | |
138 | /** |
139 | * Returns True if the node is default, so that it should not be written. |
140 | */ |
141 | Standard_EXPORT virtual Standard_Boolean |
79104795 |
142 | IsDefault () const Standard_OVERRIDE; |
7fd59977 |
143 | |
144 | protected: |
145 | // ---------- PROTECTED METHODS ---------- |
146 | |
147 | private: |
148 | // ---------- PRIVATE FIELDS ---------- |
149 | |
150 | Standard_Real myAmbientIntensity; |
151 | Standard_Real myShininess; |
152 | Standard_Real myTransparency; |
153 | Quantity_Color myDiffuseColor; |
154 | Quantity_Color myEmissiveColor; |
155 | Quantity_Color mySpecularColor; |
156 | |
157 | public: |
158 | // Declaration of CASCADE RTTI |
ec357c5c |
159 | DEFINE_STANDARD_RTTI (VrmlData_Material, VrmlData_Node) |
7fd59977 |
160 | }; |
161 | |
162 | // Definition of HANDLE object using Standard_DefineHandle.hxx |
163 | DEFINE_STANDARD_HANDLE (VrmlData_Material, VrmlData_Node) |
164 | |
165 | |
166 | #endif |