7fd59977 |
1 | // File: VrmlData_Material.hxx |
2 | // Created: 25.05.06 15:39:22 |
3 | // Author: Alexander GRIGORIEV |
4 | // Copyright: Open Cascade 2006 |
5 | |
6 | |
7 | #ifndef VrmlData_Material_HeaderFile |
8 | #define VrmlData_Material_HeaderFile |
9 | |
10 | #include <VrmlData_Node.hxx> |
11 | #include <Quantity_Color.hxx> |
12 | |
13 | /** |
14 | * Implementation of the Material node |
15 | */ |
16 | class VrmlData_Material : public VrmlData_Node |
17 | { |
18 | public: |
19 | // ---------- PUBLIC METHODS ---------- |
20 | |
21 | /** |
22 | * Empty constructor |
23 | */ |
24 | Standard_EXPORT VrmlData_Material (); |
25 | |
26 | /** |
27 | * Constructor |
28 | */ |
29 | Standard_EXPORT VrmlData_Material |
30 | (const VrmlData_Scene& theScene, |
31 | const char * theName, |
32 | const Standard_Real theAmbientIntensity = -1., |
33 | const Standard_Real theShininess = -1., |
34 | const Standard_Real theTransparency = -1.); |
35 | |
36 | /** |
37 | * Query the Ambient Intensity value |
38 | */ |
39 | inline Standard_Real |
40 | AmbientIntensity() const { return myAmbientIntensity; } |
41 | |
42 | /** |
43 | * Query the Shininess value |
44 | */ |
45 | inline Standard_Real |
46 | Shininess () const { return myShininess; } |
47 | |
48 | /** |
49 | * Query the Transparency value |
50 | */ |
51 | inline Standard_Real |
52 | Transparency () const { return myTransparency; } |
53 | |
54 | /** |
55 | * Query the Diffuse color |
56 | */ |
57 | inline const Quantity_Color& |
58 | DiffuseColor () const { return myDiffuseColor; } |
59 | |
60 | /** |
61 | * Query the Emissive color |
62 | */ |
63 | inline const Quantity_Color& |
64 | EmissiveColor () const { return myEmissiveColor; } |
65 | |
66 | /** |
67 | * Query the Specular color |
68 | */ |
69 | inline const Quantity_Color& |
70 | SpecularColor () const { return mySpecularColor; } |
71 | |
72 | /** |
73 | * Set the Ambient Intensity value |
74 | */ |
75 | inline void SetAmbientIntensity |
76 | (const Standard_Real theAmbientIntensity) |
77 | { myAmbientIntensity = theAmbientIntensity; } |
78 | |
79 | /** |
80 | * Set the Shininess value |
81 | */ |
82 | inline void SetShininess (const Standard_Real theShininess) |
83 | { myShininess = theShininess; } |
84 | |
85 | /** |
86 | * Set the Transparency value |
87 | */ |
88 | inline void SetTransparency (const Standard_Real theTransparency) |
89 | { myTransparency = theTransparency; } |
90 | |
91 | /** |
92 | * Query the Diffuse color |
93 | */ |
94 | inline void SetDiffuseColor (const Quantity_Color& theColor) |
95 | { myDiffuseColor = theColor; } |
96 | |
97 | /** |
98 | * Query the Emissive color |
99 | */ |
100 | inline void SetEmissiveColor (const Quantity_Color& theColor) |
101 | { myEmissiveColor = theColor; } |
102 | |
103 | /** |
104 | * Query the Specular color |
105 | */ |
106 | inline void SetSpecularColor (const Quantity_Color& theColor) |
107 | { mySpecularColor = theColor; } |
108 | |
109 | /** |
110 | * Create a copy of this node. |
111 | * If the parameter is null, a new copied node is created. Otherwise new node |
112 | * is not created, but rather the given one is modified. |
113 | */ |
114 | Standard_EXPORT virtual Handle(VrmlData_Node) |
115 | Clone (const Handle(VrmlData_Node)& theOther)const; |
116 | |
117 | /** |
118 | * Read the Node from input stream. |
119 | */ |
120 | Standard_EXPORT virtual VrmlData_ErrorStatus |
121 | Read (VrmlData_InBuffer& theBuffer); |
122 | |
123 | /** |
124 | * Write the Node to the Scene output. |
125 | */ |
126 | Standard_EXPORT virtual VrmlData_ErrorStatus |
127 | Write (const char * thePrefix) const; |
128 | |
129 | /** |
130 | * Returns True if the node is default, so that it should not be written. |
131 | */ |
132 | Standard_EXPORT virtual Standard_Boolean |
133 | IsDefault () const; |
134 | |
135 | protected: |
136 | // ---------- PROTECTED METHODS ---------- |
137 | |
138 | private: |
139 | // ---------- PRIVATE FIELDS ---------- |
140 | |
141 | Standard_Real myAmbientIntensity; |
142 | Standard_Real myShininess; |
143 | Standard_Real myTransparency; |
144 | Quantity_Color myDiffuseColor; |
145 | Quantity_Color myEmissiveColor; |
146 | Quantity_Color mySpecularColor; |
147 | |
148 | public: |
149 | // Declaration of CASCADE RTTI |
150 | DEFINE_STANDARD_RTTI (VrmlData_Material) |
151 | }; |
152 | |
153 | // Definition of HANDLE object using Standard_DefineHandle.hxx |
154 | DEFINE_STANDARD_HANDLE (VrmlData_Material, VrmlData_Node) |
155 | |
156 | |
157 | #endif |