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_SOLIDFRACTAL_H__
11 #define __MayaDM_SOLIDFRACTAL_H__
12 #include "MayaDMTypes.h"
13 #include "MayaDMConnectables.h"
14 #include "MayaDMTexture3d.h"
15 namespace MayaDM
16 {
17 class SolidFractal : public Texture3d
18 {
19 public:
20 public:
21 
SolidFractal()22 	SolidFractal():Texture3d(){}
23 	SolidFractal(FILE* file,const std::string& name,const std::string& parent="",bool shared=false,bool create=true)
24 		:Texture3d(file, name, parent, "solidFractal", shared, create){}
~SolidFractal()25 	virtual ~SolidFractal(){}
26 
setXPixelAngle(float xpa)27 	void setXPixelAngle(float xpa)
28 	{
29 		if(xpa == 0.002053) return;
30 		fprintf(mFile,"\tsetAttr \".xpa\" %f;\n", xpa);
31 	}
setAmplitude(float a)32 	void setAmplitude(float a)
33 	{
34 		if(a == 1.0) return;
35 		fprintf(mFile,"\tsetAttr \".a\" %f;\n", a);
36 	}
setRatio(float ra)37 	void setRatio(float ra)
38 	{
39 		if(ra == 0.707) return;
40 		fprintf(mFile,"\tsetAttr \".ra\" %f;\n", ra);
41 	}
setThreshold(float th)42 	void setThreshold(float th)
43 	{
44 		if(th == 0.0) return;
45 		fprintf(mFile,"\tsetAttr \".th\" %f;\n", th);
46 	}
setRipples(const float3 & r)47 	void setRipples(const float3& r)
48 	{
49 		if(r == float3(1.0f,1.0f,1.0f)) return;
50 		fprintf(mFile,"\tsetAttr \".r\" -type \"float3\" ");
51 		r.write(mFile);
52 		fprintf(mFile,";\n");
53 	}
setRipplesX(float rx)54 	void setRipplesX(float rx)
55 	{
56 		if(rx == 0.0) return;
57 		fprintf(mFile,"\tsetAttr \".r.rx\" %f;\n", rx);
58 	}
setRipplesY(float ry)59 	void setRipplesY(float ry)
60 	{
61 		if(ry == 0.0) return;
62 		fprintf(mFile,"\tsetAttr \".r.ry\" %f;\n", ry);
63 	}
setRipplesZ(float rz)64 	void setRipplesZ(float rz)
65 	{
66 		if(rz == 0.0) return;
67 		fprintf(mFile,"\tsetAttr \".r.rz\" %f;\n", rz);
68 	}
setDepth(const float2 & d)69 	void setDepth(const float2& d)
70 	{
71 		if(d == float2(0.0f,8.0f)) return;
72 		fprintf(mFile,"\tsetAttr \".d\" -type \"float2\" ");
73 		d.write(mFile);
74 		fprintf(mFile,";\n");
75 	}
setDepthMin(float dmn)76 	void setDepthMin(float dmn)
77 	{
78 		if(dmn == 0.0) return;
79 		fprintf(mFile,"\tsetAttr \".d.dmn\" %f;\n", dmn);
80 	}
setDepthMax(float dmx)81 	void setDepthMax(float dmx)
82 	{
83 		if(dmx == 0.0) return;
84 		fprintf(mFile,"\tsetAttr \".d.dmx\" %f;\n", dmx);
85 	}
setFrequencyRatio(float fr)86 	void setFrequencyRatio(float fr)
87 	{
88 		if(fr == 2.0) return;
89 		fprintf(mFile,"\tsetAttr \".fr\" %f;\n", fr);
90 	}
setBias(float bs)91 	void setBias(float bs)
92 	{
93 		if(bs == 0.0) return;
94 		fprintf(mFile,"\tsetAttr \".bs\" %f;\n", bs);
95 	}
setInflection(bool in)96 	void setInflection(bool in)
97 	{
98 		if(in == false) return;
99 		fprintf(mFile,"\tsetAttr \".in\" %i;\n", in);
100 	}
setAnimated(bool an)101 	void setAnimated(bool an)
102 	{
103 		if(an == false) return;
104 		fprintf(mFile,"\tsetAttr \".an\" %i;\n", an);
105 	}
setTimeRatio(float tr)106 	void setTimeRatio(float tr)
107 	{
108 		if(tr == 2.0) return;
109 		fprintf(mFile,"\tsetAttr \".tr\" %f;\n", tr);
110 	}
setTime(float ti)111 	void setTime(float ti)
112 	{
113 		if(ti == 0.0) return;
114 		fprintf(mFile,"\tsetAttr \".ti\" %f;\n", ti);
115 	}
getXPixelAngle()116 	void getXPixelAngle()const
117 	{
118 		fprintf(mFile,"\"%s.xpa\"",mName.c_str());
119 	}
getRefPointObj()120 	void getRefPointObj()const
121 	{
122 		fprintf(mFile,"\"%s.rpo\"",mName.c_str());
123 	}
getRefPointObjX()124 	void getRefPointObjX()const
125 	{
126 		fprintf(mFile,"\"%s.rpo.rox\"",mName.c_str());
127 	}
getRefPointObjY()128 	void getRefPointObjY()const
129 	{
130 		fprintf(mFile,"\"%s.rpo.roy\"",mName.c_str());
131 	}
getRefPointObjZ()132 	void getRefPointObjZ()const
133 	{
134 		fprintf(mFile,"\"%s.rpo.roz\"",mName.c_str());
135 	}
getRefPointCamera()136 	void getRefPointCamera()const
137 	{
138 		fprintf(mFile,"\"%s.rpc\"",mName.c_str());
139 	}
getRefPointCameraX()140 	void getRefPointCameraX()const
141 	{
142 		fprintf(mFile,"\"%s.rpc.rcx\"",mName.c_str());
143 	}
getRefPointCameraY()144 	void getRefPointCameraY()const
145 	{
146 		fprintf(mFile,"\"%s.rpc.rcy\"",mName.c_str());
147 	}
getRefPointCameraZ()148 	void getRefPointCameraZ()const
149 	{
150 		fprintf(mFile,"\"%s.rpc.rcz\"",mName.c_str());
151 	}
getAmplitude()152 	void getAmplitude()const
153 	{
154 		fprintf(mFile,"\"%s.a\"",mName.c_str());
155 	}
getRatio()156 	void getRatio()const
157 	{
158 		fprintf(mFile,"\"%s.ra\"",mName.c_str());
159 	}
getThreshold()160 	void getThreshold()const
161 	{
162 		fprintf(mFile,"\"%s.th\"",mName.c_str());
163 	}
getRipples()164 	void getRipples()const
165 	{
166 		fprintf(mFile,"\"%s.r\"",mName.c_str());
167 	}
getRipplesX()168 	void getRipplesX()const
169 	{
170 		fprintf(mFile,"\"%s.r.rx\"",mName.c_str());
171 	}
getRipplesY()172 	void getRipplesY()const
173 	{
174 		fprintf(mFile,"\"%s.r.ry\"",mName.c_str());
175 	}
getRipplesZ()176 	void getRipplesZ()const
177 	{
178 		fprintf(mFile,"\"%s.r.rz\"",mName.c_str());
179 	}
getDepth()180 	void getDepth()const
181 	{
182 		fprintf(mFile,"\"%s.d\"",mName.c_str());
183 	}
getDepthMin()184 	void getDepthMin()const
185 	{
186 		fprintf(mFile,"\"%s.d.dmn\"",mName.c_str());
187 	}
getDepthMax()188 	void getDepthMax()const
189 	{
190 		fprintf(mFile,"\"%s.d.dmx\"",mName.c_str());
191 	}
getFrequencyRatio()192 	void getFrequencyRatio()const
193 	{
194 		fprintf(mFile,"\"%s.fr\"",mName.c_str());
195 	}
getBias()196 	void getBias()const
197 	{
198 		fprintf(mFile,"\"%s.bs\"",mName.c_str());
199 	}
getInflection()200 	void getInflection()const
201 	{
202 		fprintf(mFile,"\"%s.in\"",mName.c_str());
203 	}
getAnimated()204 	void getAnimated()const
205 	{
206 		fprintf(mFile,"\"%s.an\"",mName.c_str());
207 	}
getTimeRatio()208 	void getTimeRatio()const
209 	{
210 		fprintf(mFile,"\"%s.tr\"",mName.c_str());
211 	}
getTime()212 	void getTime()const
213 	{
214 		fprintf(mFile,"\"%s.ti\"",mName.c_str());
215 	}
216 protected:
217 	SolidFractal(FILE* file,const std::string& name,const std::string& parent,const std::string& nodeType,bool shared=false,bool create=true)
Texture3d(file,name,parent,nodeType,shared,create)218 		:Texture3d(file, name, parent, nodeType, shared, create) {}
219 
220 };
221 }//namespace MayaDM
222 #endif//__MayaDM_SOLIDFRACTAL_H__
223