1 /*
2     Copyright (c) 2008-2009 NetAllied Systems GmbH
3 
4     This file is part of MayaDataModel.
5 
6     Licensed under the MIT Open Source License,
7     for details please see LICENSE file or the website
8     http://www.opensource.org/licenses/mit-license.php
9 */
10 #ifndef __MayaDM_HWRENDERGLOBALS_H__
11 #define __MayaDM_HWRENDERGLOBALS_H__
12 #include "MayaDMTypes.h"
13 #include "MayaDMConnectables.h"
14 #include "MayaDMDependNode.h"
15 namespace MayaDM
16 {
17 class HwRenderGlobals : public DependNode
18 {
19 public:
20 public:
21 
HwRenderGlobals()22 	HwRenderGlobals():DependNode(){}
23 	HwRenderGlobals(FILE* file,const std::string& name,const std::string& parent="",bool shared=false,bool create=true)
24 		:DependNode(file, name, parent, "hwRenderGlobals", shared, create){}
~HwRenderGlobals()25 	virtual ~HwRenderGlobals(){}
26 
setRenderPasses(unsigned int rp)27 	void setRenderPasses(unsigned int rp)
28 	{
29 		if(rp == 0) return;
30 		fprintf(mFile,"\tsetAttr \".rp\" %i;\n", rp);
31 	}
setCameraIcons(bool cai)32 	void setCameraIcons(bool cai)
33 	{
34 		if(cai == false) return;
35 		fprintf(mFile,"\tsetAttr \".cai\" %i;\n", cai);
36 	}
setCollisionIcons(bool coi)37 	void setCollisionIcons(bool coi)
38 	{
39 		if(coi == false) return;
40 		fprintf(mFile,"\tsetAttr \".coi\" %i;\n", coi);
41 	}
setBackgroundColor(const float3 & bc)42 	void setBackgroundColor(const float3& bc)
43 	{
44 		if(bc == float3(0.0f,0.0f,0.0f)) return;
45 		fprintf(mFile,"\tsetAttr \".bc\" -type \"float3\" ");
46 		bc.write(mFile);
47 		fprintf(mFile,";\n");
48 	}
setBackgroundColorR(float bcr)49 	void setBackgroundColorR(float bcr)
50 	{
51 		if(bcr == 0.0) return;
52 		fprintf(mFile,"\tsetAttr \".bc.bcr\" %f;\n", bcr);
53 	}
setBackgroundColorG(float bcg)54 	void setBackgroundColorG(float bcg)
55 	{
56 		if(bcg == 0.0) return;
57 		fprintf(mFile,"\tsetAttr \".bc.bcg\" %f;\n", bcg);
58 	}
setBackgroundColorB(float bcb)59 	void setBackgroundColorB(float bcb)
60 	{
61 		if(bcb == 0.0) return;
62 		fprintf(mFile,"\tsetAttr \".bc.bcb\" %f;\n", bcb);
63 	}
setEmitterIcons(bool ei)64 	void setEmitterIcons(bool ei)
65 	{
66 		if(ei == false) return;
67 		fprintf(mFile,"\tsetAttr \".ei\" %i;\n", ei);
68 	}
setExtension(unsigned int ex)69 	void setExtension(unsigned int ex)
70 	{
71 		if(ex == 3) return;
72 		fprintf(mFile,"\tsetAttr \".ex\" %i;\n", ex);
73 	}
setEdgeSmoothing(float es)74 	void setEdgeSmoothing(float es)
75 	{
76 		if(es == 1.0) return;
77 		fprintf(mFile,"\tsetAttr \".es\" %f;\n", es);
78 	}
setEndFrame(int ef)79 	void setEndFrame(int ef)
80 	{
81 		if(ef == 10) return;
82 		fprintf(mFile,"\tsetAttr \".ef\" %i;\n", ef);
83 	}
setByFrame(int bf)84 	void setByFrame(int bf)
85 	{
86 		if(bf == 1) return;
87 		fprintf(mFile,"\tsetAttr \".bf\" %i;\n", bf);
88 	}
setFieldIcons(bool fii)89 	void setFieldIcons(bool fii)
90 	{
91 		if(fii == false) return;
92 		fprintf(mFile,"\tsetAttr \".fii\" %i;\n", fii);
93 	}
setStartFrame(int sf)94 	void setStartFrame(int sf)
95 	{
96 		if(sf == 1) return;
97 		fprintf(mFile,"\tsetAttr \".sf\" %i;\n", sf);
98 	}
setGrid(bool gr)99 	void setGrid(bool gr)
100 	{
101 		if(gr == false) return;
102 		fprintf(mFile,"\tsetAttr \".gr\" %i;\n", gr);
103 	}
setLightIcons(bool li)104 	void setLightIcons(bool li)
105 	{
106 		if(li == false) return;
107 		fprintf(mFile,"\tsetAttr \".li\" %i;\n", li);
108 	}
setLineSmoothing(bool ls)109 	void setLineSmoothing(bool ls)
110 	{
111 		if(ls == false) return;
112 		fprintf(mFile,"\tsetAttr \".ls\" %i;\n", ls);
113 	}
setMotionBlur(float mb)114 	void setMotionBlur(float mb)
115 	{
116 		if(mb == 0.0) return;
117 		fprintf(mFile,"\tsetAttr \".mb\" %f;\n", mb);
118 	}
setTransformIcons(bool ti)119 	void setTransformIcons(bool ti)
120 	{
121 		if(ti == false) return;
122 		fprintf(mFile,"\tsetAttr \".ti\" %i;\n", ti);
123 	}
setTexturing(bool txt)124 	void setTexturing(bool txt)
125 	{
126 		if(txt == true) return;
127 		fprintf(mFile,"\tsetAttr \".txt\" %i;\n", txt);
128 	}
setMultiPassRendering(bool mpr)129 	void setMultiPassRendering(bool mpr)
130 	{
131 		if(mpr == false) return;
132 		fprintf(mFile,"\tsetAttr \".mpr\" %i;\n", mpr);
133 	}
setWriteZDepth(bool wzd)134 	void setWriteZDepth(bool wzd)
135 	{
136 		if(wzd == false) return;
137 		fprintf(mFile,"\tsetAttr \".wzd\" %i;\n", wzd);
138 	}
setFilename(const string & fn)139 	void setFilename(const string& fn)
140 	{
141 		if(fn == "NULL") return;
142 		fprintf(mFile,"\tsetAttr \".fn\" -type \"string\" ");
143 		fn.write(mFile);
144 		fprintf(mFile,";\n");
145 	}
setImageFormat(unsigned int if_)146 	void setImageFormat(unsigned int if_)
147 	{
148 		if(if_ == 0) return;
149 		fprintf(mFile,"\tsetAttr \".if\" %i;\n", if_);
150 	}
setResolution(const string & res)151 	void setResolution(const string& res)
152 	{
153 		if(res == "NULL") return;
154 		fprintf(mFile,"\tsetAttr \".res\" -type \"string\" ");
155 		res.write(mFile);
156 		fprintf(mFile,";\n");
157 	}
setAlphaSource(unsigned int as)158 	void setAlphaSource(unsigned int as)
159 	{
160 		if(as == 0) return;
161 		fprintf(mFile,"\tsetAttr \".as\" %i;\n", as);
162 	}
setDrawStyle(unsigned int ds)163 	void setDrawStyle(unsigned int ds)
164 	{
165 		if(ds == 3) return;
166 		fprintf(mFile,"\tsetAttr \".ds\" %i;\n", ds);
167 	}
setLightingMode(unsigned int lm)168 	void setLightingMode(unsigned int lm)
169 	{
170 		if(lm == 0) return;
171 		fprintf(mFile,"\tsetAttr \".lm\" %i;\n", lm);
172 	}
setFullImageResolution(bool fir)173 	void setFullImageResolution(bool fir)
174 	{
175 		if(fir == false) return;
176 		fprintf(mFile,"\tsetAttr \".fir\" %i;\n", fir);
177 	}
setAntiAliasPolygons(bool aap)178 	void setAntiAliasPolygons(bool aap)
179 	{
180 		if(aap == false) return;
181 		fprintf(mFile,"\tsetAttr \".aap\" %i;\n", aap);
182 	}
setGeometryMask(bool gh)183 	void setGeometryMask(bool gh)
184 	{
185 		if(gh == false) return;
186 		fprintf(mFile,"\tsetAttr \".gh\" %i;\n", gh);
187 	}
setDisplayShadows(bool sd)188 	void setDisplayShadows(bool sd)
189 	{
190 		if(sd == false) return;
191 		fprintf(mFile,"\tsetAttr \".sd\" %i;\n", sd);
192 	}
getRenderPasses()193 	void getRenderPasses()const
194 	{
195 		fprintf(mFile,"\"%s.rp\"",mName.c_str());
196 	}
getCameraIcons()197 	void getCameraIcons()const
198 	{
199 		fprintf(mFile,"\"%s.cai\"",mName.c_str());
200 	}
getCollisionIcons()201 	void getCollisionIcons()const
202 	{
203 		fprintf(mFile,"\"%s.coi\"",mName.c_str());
204 	}
getBackgroundColor()205 	void getBackgroundColor()const
206 	{
207 		fprintf(mFile,"\"%s.bc\"",mName.c_str());
208 	}
getBackgroundColorR()209 	void getBackgroundColorR()const
210 	{
211 		fprintf(mFile,"\"%s.bc.bcr\"",mName.c_str());
212 	}
getBackgroundColorG()213 	void getBackgroundColorG()const
214 	{
215 		fprintf(mFile,"\"%s.bc.bcg\"",mName.c_str());
216 	}
getBackgroundColorB()217 	void getBackgroundColorB()const
218 	{
219 		fprintf(mFile,"\"%s.bc.bcb\"",mName.c_str());
220 	}
getEmitterIcons()221 	void getEmitterIcons()const
222 	{
223 		fprintf(mFile,"\"%s.ei\"",mName.c_str());
224 	}
getExtension()225 	void getExtension()const
226 	{
227 		fprintf(mFile,"\"%s.ex\"",mName.c_str());
228 	}
getEdgeSmoothing()229 	void getEdgeSmoothing()const
230 	{
231 		fprintf(mFile,"\"%s.es\"",mName.c_str());
232 	}
getEndFrame()233 	void getEndFrame()const
234 	{
235 		fprintf(mFile,"\"%s.ef\"",mName.c_str());
236 	}
getByFrame()237 	void getByFrame()const
238 	{
239 		fprintf(mFile,"\"%s.bf\"",mName.c_str());
240 	}
getFieldIcons()241 	void getFieldIcons()const
242 	{
243 		fprintf(mFile,"\"%s.fii\"",mName.c_str());
244 	}
getStartFrame()245 	void getStartFrame()const
246 	{
247 		fprintf(mFile,"\"%s.sf\"",mName.c_str());
248 	}
getGrid()249 	void getGrid()const
250 	{
251 		fprintf(mFile,"\"%s.gr\"",mName.c_str());
252 	}
getLightIcons()253 	void getLightIcons()const
254 	{
255 		fprintf(mFile,"\"%s.li\"",mName.c_str());
256 	}
getLineSmoothing()257 	void getLineSmoothing()const
258 	{
259 		fprintf(mFile,"\"%s.ls\"",mName.c_str());
260 	}
getMotionBlur()261 	void getMotionBlur()const
262 	{
263 		fprintf(mFile,"\"%s.mb\"",mName.c_str());
264 	}
getTransformIcons()265 	void getTransformIcons()const
266 	{
267 		fprintf(mFile,"\"%s.ti\"",mName.c_str());
268 	}
getTexturing()269 	void getTexturing()const
270 	{
271 		fprintf(mFile,"\"%s.txt\"",mName.c_str());
272 	}
getMultiPassRendering()273 	void getMultiPassRendering()const
274 	{
275 		fprintf(mFile,"\"%s.mpr\"",mName.c_str());
276 	}
getWriteZDepth()277 	void getWriteZDepth()const
278 	{
279 		fprintf(mFile,"\"%s.wzd\"",mName.c_str());
280 	}
getFilename()281 	void getFilename()const
282 	{
283 		fprintf(mFile,"\"%s.fn\"",mName.c_str());
284 	}
getImageFormat()285 	void getImageFormat()const
286 	{
287 		fprintf(mFile,"\"%s.if\"",mName.c_str());
288 	}
getResolution()289 	void getResolution()const
290 	{
291 		fprintf(mFile,"\"%s.res\"",mName.c_str());
292 	}
getAlphaSource()293 	void getAlphaSource()const
294 	{
295 		fprintf(mFile,"\"%s.as\"",mName.c_str());
296 	}
getDrawStyle()297 	void getDrawStyle()const
298 	{
299 		fprintf(mFile,"\"%s.ds\"",mName.c_str());
300 	}
getLightingMode()301 	void getLightingMode()const
302 	{
303 		fprintf(mFile,"\"%s.lm\"",mName.c_str());
304 	}
getFullImageResolution()305 	void getFullImageResolution()const
306 	{
307 		fprintf(mFile,"\"%s.fir\"",mName.c_str());
308 	}
getAntiAliasPolygons()309 	void getAntiAliasPolygons()const
310 	{
311 		fprintf(mFile,"\"%s.aap\"",mName.c_str());
312 	}
getGeometryMask()313 	void getGeometryMask()const
314 	{
315 		fprintf(mFile,"\"%s.gh\"",mName.c_str());
316 	}
getDisplayShadows()317 	void getDisplayShadows()const
318 	{
319 		fprintf(mFile,"\"%s.sd\"",mName.c_str());
320 	}
321 protected:
322 	HwRenderGlobals(FILE* file,const std::string& name,const std::string& parent,const std::string& nodeType,bool shared=false,bool create=true)
DependNode(file,name,parent,nodeType,shared,create)323 		:DependNode(file, name, parent, nodeType, shared, create) {}
324 
325 };
326 }//namespace MayaDM
327 #endif//__MayaDM_HWRENDERGLOBALS_H__
328