~ubuntu-branches/ubuntu/wily/opencollada/wily-proposed

« back to all changes in this revision

Viewing changes to Externals/MayaDataModel/include/MayaDMCluster.h

  • Committer: Package Import Robot
  • Author(s): Matteo F. Vescovi
  • Date: 2015-05-14 17:23:27 UTC
  • Revision ID: package-import@ubuntu.com-20150514172327-f862u8envms01fra
Tags: upstream-0.1.0~20140703.ddf8f47+dfsg1
ImportĀ upstreamĀ versionĀ 0.1.0~20140703.ddf8f47+dfsg1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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_CLUSTER_H__
 
11
#define __MayaDM_CLUSTER_H__
 
12
#include "MayaDMTypes.h"
 
13
#include "MayaDMConnectables.h"
 
14
#include "MayaDMWeightGeometryFilter.h"
 
15
namespace MayaDM
 
16
{
 
17
class Cluster : public WeightGeometryFilter
 
18
{
 
19
public:
 
20
        struct ClusterXforms{
 
21
                void write(FILE* file) const
 
22
                {
 
23
                }
 
24
        };
 
25
public:
 
26
 
 
27
        Cluster():WeightGeometryFilter(){}
 
28
        Cluster(FILE* file,const std::string& name,const std::string& parent="",bool shared=false,bool create=true)
 
29
                :WeightGeometryFilter(file, name, parent, "cluster", shared, create){}
 
30
        virtual ~Cluster(){}
 
31
 
 
32
        void setPercentResolution(float ptr)
 
33
        {
 
34
                if(ptr == 5) return;
 
35
                fprintf(mFile,"\tsetAttr \".ptr\" %f;\n", ptr);
 
36
        }
 
37
        void setUsePartialResolution(unsigned int upr)
 
38
        {
 
39
                if(upr == 0) return;
 
40
                fprintf(mFile,"\tsetAttr \".upr\" %i;\n", upr);
 
41
        }
 
42
        void setRelative(bool rel)
 
43
        {
 
44
                if(rel == false) return;
 
45
                fprintf(mFile,"\tsetAttr \".rel\" %i;\n", rel);
 
46
        }
 
47
        void setWeightedCompensationMatrix(const matrix& wcm)
 
48
        {
 
49
                if(wcm == identity) return;
 
50
                fprintf(mFile,"\tsetAttr \".wcm\" -type \"matrix\" ");
 
51
                wcm.write(mFile);
 
52
                fprintf(mFile,";\n");
 
53
        }
 
54
        void setGeomMatrix(size_t gm_i,const matrix& gm)
 
55
        {
 
56
                if(gm == identity) return;
 
57
                fprintf(mFile,"\tsetAttr \".gm[%i]\" -type \"matrix\" ",gm_i);
 
58
                gm.write(mFile);
 
59
                fprintf(mFile,";\n");
 
60
        }
 
61
        void setGeomMatrix(size_t gm_start,size_t gm_end,matrix* gm)
 
62
        {
 
63
                fprintf(mFile,"\tsetAttr \".gm[%i:%i]\" ", gm_start,gm_end);
 
64
                size_t size = (gm_end-gm_start)*1+1;
 
65
                for(size_t i=0;i<size;++i)
 
66
                {
 
67
                        gm[i].write(mFile);
 
68
                        fprintf(mFile,"\n");
 
69
                }
 
70
                fprintf(mFile,";\n");
 
71
        }
 
72
        void startGeomMatrix(size_t gm_start,size_t gm_end)const
 
73
        {
 
74
                fprintf(mFile,"\tsetAttr \".gm[%i:%i]\"",gm_start,gm_end);
 
75
                fprintf(mFile," -type \"matrix\" ");
 
76
        }
 
77
        void appendGeomMatrix(const matrix& gm)const
 
78
        {
 
79
                fprintf(mFile," ");
 
80
                gm.write(mFile);
 
81
        }
 
82
        void endGeomMatrix()const
 
83
        {
 
84
                fprintf(mFile,";\n");
 
85
        }
 
86
        void setMatrix(const matrix& ma)
 
87
        {
 
88
                if(ma == identity) return;
 
89
                fprintf(mFile,"\tsetAttr \".ma\" -type \"matrix\" ");
 
90
                ma.write(mFile);
 
91
                fprintf(mFile,";\n");
 
92
        }
 
93
        void setBindPreMatrix(const matrix& pm)
 
94
        {
 
95
                if(pm == identity) return;
 
96
                fprintf(mFile,"\tsetAttr \".pm\" -type \"matrix\" ");
 
97
                pm.write(mFile);
 
98
                fprintf(mFile,";\n");
 
99
        }
 
100
        void setAngleInterpolation(unsigned int ait)
 
101
        {
 
102
                if(ait == 0) return;
 
103
                fprintf(mFile,"\tsetAttr \".ait\" %i;\n", ait);
 
104
        }
 
105
        void getUsePartialResolution()const
 
106
        {
 
107
                fprintf(mFile,"\"%s.upr\"",mName.c_str());
 
108
        }
 
109
        void getRelative()const
 
110
        {
 
111
                fprintf(mFile,"\"%s.rel\"",mName.c_str());
 
112
        }
 
113
        void getClusterXforms()const
 
114
        {
 
115
                fprintf(mFile,"\"%s.x\"",mName.c_str());
 
116
        }
 
117
        void getPreMatrix()const
 
118
        {
 
119
                fprintf(mFile,"\"%s.x.pre\"",mName.c_str());
 
120
        }
 
121
        void getWeightedMatrix()const
 
122
        {
 
123
                fprintf(mFile,"\"%s.x.wt\"",mName.c_str());
 
124
        }
 
125
        void getPostMatrix()const
 
126
        {
 
127
                fprintf(mFile,"\"%s.x.post\"",mName.c_str());
 
128
        }
 
129
        void getWeightedCompensationMatrix()const
 
130
        {
 
131
                fprintf(mFile,"\"%s.wcm\"",mName.c_str());
 
132
        }
 
133
        void getGeomMatrix(size_t gm_i)const
 
134
        {
 
135
                fprintf(mFile,"\"%s.gm[%i]\"",mName.c_str(),gm_i);
 
136
        }
 
137
        void getGeomMatrix()const
 
138
        {
 
139
 
 
140
                fprintf(mFile,"\"%s.gm\"",mName.c_str());
 
141
        }
 
142
        void getMatrix()const
 
143
        {
 
144
                fprintf(mFile,"\"%s.ma\"",mName.c_str());
 
145
        }
 
146
        void getBindPreMatrix()const
 
147
        {
 
148
                fprintf(mFile,"\"%s.pm\"",mName.c_str());
 
149
        }
 
150
        void getBindState()const
 
151
        {
 
152
                fprintf(mFile,"\"%s.bs\"",mName.c_str());
 
153
        }
 
154
        void getPostCompensationMatrix()const
 
155
        {
 
156
                fprintf(mFile,"\"%s.psc\"",mName.c_str());
 
157
        }
 
158
        void getPreCompensationMatrix()const
 
159
        {
 
160
                fprintf(mFile,"\"%s.prc\"",mName.c_str());
 
161
        }
 
162
        void getAngleInterpolation()const
 
163
        {
 
164
                fprintf(mFile,"\"%s.ait\"",mName.c_str());
 
165
        }
 
166
protected:
 
167
        Cluster(FILE* file,const std::string& name,const std::string& parent,const std::string& nodeType,bool shared=false,bool create=true)
 
168
                :WeightGeometryFilter(file, name, parent, nodeType, shared, create) {}
 
169
 
 
170
};
 
171
}//namespace MayaDM
 
172
#endif//__MayaDM_CLUSTER_H__