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_POLYCUBE_H__
11 #define __MayaDM_POLYCUBE_H__
12 #include "MayaDMTypes.h"
13 #include "MayaDMConnectables.h"
14 #include "MayaDMPolyPrimitive.h"
15 namespace MayaDM
16 {
17 class PolyCube : public PolyPrimitive
18 {
19 public:
20 public:
21 
PolyCube()22 	PolyCube():PolyPrimitive(){}
23 	PolyCube(FILE* file,const std::string& name,const std::string& parent="",bool shared=false,bool create=true)
24 		:PolyPrimitive(file, name, parent, "polyCube", shared, create){}
~PolyCube()25 	virtual ~PolyCube(){}
26 
setWidth(double w)27 	void setWidth(double w)
28 	{
29 		if(w == 1) return;
30 		fprintf(mFile,"\tsetAttr \".w\" %f;\n", w);
31 	}
setHeight(double h)32 	void setHeight(double h)
33 	{
34 		if(h == 1) return;
35 		fprintf(mFile,"\tsetAttr \".h\" %f;\n", h);
36 	}
setDepth(double d)37 	void setDepth(double d)
38 	{
39 		if(d == 1) return;
40 		fprintf(mFile,"\tsetAttr \".d\" %f;\n", d);
41 	}
setSubdivisionsWidth(int sw)42 	void setSubdivisionsWidth(int sw)
43 	{
44 		if(sw == 1) return;
45 		fprintf(mFile,"\tsetAttr \".sw\" %i;\n", sw);
46 	}
setSubdivisionsHeight(int sh)47 	void setSubdivisionsHeight(int sh)
48 	{
49 		if(sh == 1) return;
50 		fprintf(mFile,"\tsetAttr \".sh\" %i;\n", sh);
51 	}
setSubdivisionsDepth(int sd)52 	void setSubdivisionsDepth(int sd)
53 	{
54 		if(sd == 1) return;
55 		fprintf(mFile,"\tsetAttr \".sd\" %i;\n", sd);
56 	}
setTexture(unsigned int tx)57 	void setTexture(unsigned int tx)
58 	{
59 		if(tx == 1) return;
60 		fprintf(mFile,"\tsetAttr \".tx\" %i;\n", tx);
61 	}
setCreateUVs(unsigned int cuv)62 	void setCreateUVs(unsigned int cuv)
63 	{
64 		if(cuv == 3) return;
65 		fprintf(mFile,"\tsetAttr \".cuv\" %i;\n", cuv);
66 	}
getWidth()67 	void getWidth()const
68 	{
69 		fprintf(mFile,"\"%s.w\"",mName.c_str());
70 	}
getHeight()71 	void getHeight()const
72 	{
73 		fprintf(mFile,"\"%s.h\"",mName.c_str());
74 	}
getDepth()75 	void getDepth()const
76 	{
77 		fprintf(mFile,"\"%s.d\"",mName.c_str());
78 	}
getSubdivisionsWidth()79 	void getSubdivisionsWidth()const
80 	{
81 		fprintf(mFile,"\"%s.sw\"",mName.c_str());
82 	}
getSubdivisionsHeight()83 	void getSubdivisionsHeight()const
84 	{
85 		fprintf(mFile,"\"%s.sh\"",mName.c_str());
86 	}
getSubdivisionsDepth()87 	void getSubdivisionsDepth()const
88 	{
89 		fprintf(mFile,"\"%s.sd\"",mName.c_str());
90 	}
getTexture()91 	void getTexture()const
92 	{
93 		fprintf(mFile,"\"%s.tx\"",mName.c_str());
94 	}
getCreateUVs()95 	void getCreateUVs()const
96 	{
97 		fprintf(mFile,"\"%s.cuv\"",mName.c_str());
98 	}
99 protected:
100 	PolyCube(FILE* file,const std::string& name,const std::string& parent,const std::string& nodeType,bool shared=false,bool create=true)
PolyPrimitive(file,name,parent,nodeType,shared,create)101 		:PolyPrimitive(file, name, parent, nodeType, shared, create) {}
102 
103 };
104 }//namespace MayaDM
105 #endif//__MayaDM_POLYCUBE_H__
106