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

« back to all changes in this revision

Viewing changes to Externals/MayaDataModel/include/MayaDMRemapColor.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_REMAPCOLOR_H__
 
11
#define __MayaDM_REMAPCOLOR_H__
 
12
#include "MayaDMTypes.h"
 
13
#include "MayaDMConnectables.h"
 
14
#include "MayaDMDependNode.h"
 
15
namespace MayaDM
 
16
{
 
17
class RemapColor : public DependNode
 
18
{
 
19
public:
 
20
        struct Red{
 
21
                float red_Position;
 
22
                float red_FloatValue;
 
23
                unsigned int red_Interp;
 
24
                void write(FILE* file) const
 
25
                {
 
26
                        fprintf(file,"%f ", red_Position);
 
27
                        fprintf(file,"%f ", red_FloatValue);
 
28
                        fprintf(file,"%i", red_Interp);
 
29
                }
 
30
        };
 
31
        struct Green{
 
32
                float green_Position;
 
33
                float green_FloatValue;
 
34
                unsigned int green_Interp;
 
35
                void write(FILE* file) const
 
36
                {
 
37
                        fprintf(file,"%f ", green_Position);
 
38
                        fprintf(file,"%f ", green_FloatValue);
 
39
                        fprintf(file,"%i", green_Interp);
 
40
                }
 
41
        };
 
42
        struct Blue{
 
43
                float blue_Position;
 
44
                float blue_FloatValue;
 
45
                unsigned int blue_Interp;
 
46
                void write(FILE* file) const
 
47
                {
 
48
                        fprintf(file,"%f ", blue_Position);
 
49
                        fprintf(file,"%f ", blue_FloatValue);
 
50
                        fprintf(file,"%i", blue_Interp);
 
51
                }
 
52
        };
 
53
public:
 
54
 
 
55
        RemapColor():DependNode(){}
 
56
        RemapColor(FILE* file,const std::string& name,const std::string& parent="",bool shared=false,bool create=true)
 
57
                :DependNode(file, name, parent, "remapColor", shared, create){}
 
58
        virtual ~RemapColor(){}
 
59
 
 
60
        void setColor(const float3& cl)
 
61
        {
 
62
                fprintf(mFile,"\tsetAttr \".cl\" -type \"float3\" ");
 
63
                cl.write(mFile);
 
64
                fprintf(mFile,";\n");
 
65
        }
 
66
        void setColorR(float cr)
 
67
        {
 
68
                if(cr == 0.5) return;
 
69
                fprintf(mFile,"\tsetAttr \".cl.cr\" %f;\n", cr);
 
70
        }
 
71
        void setColorG(float cg)
 
72
        {
 
73
                if(cg == 0.5) return;
 
74
                fprintf(mFile,"\tsetAttr \".cl.cg\" %f;\n", cg);
 
75
        }
 
76
        void setColorB(float cb)
 
77
        {
 
78
                if(cb == 0.5) return;
 
79
                fprintf(mFile,"\tsetAttr \".cl.cb\" %f;\n", cb);
 
80
        }
 
81
        void setInputMin(float imn)
 
82
        {
 
83
                if(imn == 0) return;
 
84
                fprintf(mFile,"\tsetAttr \".imn\" %f;\n", imn);
 
85
        }
 
86
        void setInputMax(float imx)
 
87
        {
 
88
                if(imx == 1) return;
 
89
                fprintf(mFile,"\tsetAttr \".imx\" %f;\n", imx);
 
90
        }
 
91
        void setOutputMin(float omn)
 
92
        {
 
93
                if(omn == 0) return;
 
94
                fprintf(mFile,"\tsetAttr \".omn\" %f;\n", omn);
 
95
        }
 
96
        void setOutputMax(float omx)
 
97
        {
 
98
                if(omx == 1) return;
 
99
                fprintf(mFile,"\tsetAttr \".omx\" %f;\n", omx);
 
100
        }
 
101
        void setRed(size_t r_i,const Red& r)
 
102
        {
 
103
                fprintf(mFile,"\tsetAttr \".r[%i]\" ",r_i);
 
104
                r.write(mFile);
 
105
                fprintf(mFile,";\n");
 
106
        }
 
107
        void setRed(size_t r_start,size_t r_end,Red* r)
 
108
        {
 
109
                fprintf(mFile,"\tsetAttr \".r[%i:%i]\" ", r_start,r_end);
 
110
                size_t size = (r_end-r_start)*1+1;
 
111
                for(size_t i=0;i<size;++i)
 
112
                {
 
113
                        r[i].write(mFile);
 
114
                        fprintf(mFile,"\n");
 
115
                }
 
116
                fprintf(mFile,";\n");
 
117
        }
 
118
        void startRed(size_t r_start,size_t r_end)const
 
119
        {
 
120
                fprintf(mFile,"\tsetAttr \".r[%i:%i]\"",r_start,r_end);
 
121
                fprintf(mFile," -type \"Red\" ");
 
122
        }
 
123
        void appendRed(const Red& r)const
 
124
        {
 
125
                fprintf(mFile," ");
 
126
                r.write(mFile);
 
127
        }
 
128
        void endRed()const
 
129
        {
 
130
                fprintf(mFile,";\n");
 
131
        }
 
132
        void setRed_Position(size_t r_i,float rp)
 
133
        {
 
134
                if(rp == 0.0) return;
 
135
                fprintf(mFile,"\tsetAttr \".r[%i].rp\" %f;\n", r_i,rp);
 
136
        }
 
137
        void setRed_FloatValue(size_t r_i,float rfv)
 
138
        {
 
139
                if(rfv == 0.0) return;
 
140
                fprintf(mFile,"\tsetAttr \".r[%i].rfv\" %f;\n", r_i,rfv);
 
141
        }
 
142
        void setRed_Interp(size_t r_i,unsigned int ri)
 
143
        {
 
144
                if(ri == 0) return;
 
145
                fprintf(mFile,"\tsetAttr \".r[%i].ri\" %i;\n", r_i,ri);
 
146
        }
 
147
        void setGreen(size_t g_i,const Green& g)
 
148
        {
 
149
                fprintf(mFile,"\tsetAttr \".g[%i]\" ",g_i);
 
150
                g.write(mFile);
 
151
                fprintf(mFile,";\n");
 
152
        }
 
153
        void setGreen(size_t g_start,size_t g_end,Green* g)
 
154
        {
 
155
                fprintf(mFile,"\tsetAttr \".g[%i:%i]\" ", g_start,g_end);
 
156
                size_t size = (g_end-g_start)*1+1;
 
157
                for(size_t i=0;i<size;++i)
 
158
                {
 
159
                        g[i].write(mFile);
 
160
                        fprintf(mFile,"\n");
 
161
                }
 
162
                fprintf(mFile,";\n");
 
163
        }
 
164
        void startGreen(size_t g_start,size_t g_end)const
 
165
        {
 
166
                fprintf(mFile,"\tsetAttr \".g[%i:%i]\"",g_start,g_end);
 
167
                fprintf(mFile," -type \"Green\" ");
 
168
        }
 
169
        void appendGreen(const Green& g)const
 
170
        {
 
171
                fprintf(mFile," ");
 
172
                g.write(mFile);
 
173
        }
 
174
        void endGreen()const
 
175
        {
 
176
                fprintf(mFile,";\n");
 
177
        }
 
178
        void setGreen_Position(size_t g_i,float gp)
 
179
        {
 
180
                if(gp == 0.0) return;
 
181
                fprintf(mFile,"\tsetAttr \".g[%i].gp\" %f;\n", g_i,gp);
 
182
        }
 
183
        void setGreen_FloatValue(size_t g_i,float gfv)
 
184
        {
 
185
                if(gfv == 0.0) return;
 
186
                fprintf(mFile,"\tsetAttr \".g[%i].gfv\" %f;\n", g_i,gfv);
 
187
        }
 
188
        void setGreen_Interp(size_t g_i,unsigned int gi)
 
189
        {
 
190
                if(gi == 0) return;
 
191
                fprintf(mFile,"\tsetAttr \".g[%i].gi\" %i;\n", g_i,gi);
 
192
        }
 
193
        void setBlue(size_t b_i,const Blue& b)
 
194
        {
 
195
                fprintf(mFile,"\tsetAttr \".b[%i]\" ",b_i);
 
196
                b.write(mFile);
 
197
                fprintf(mFile,";\n");
 
198
        }
 
199
        void setBlue(size_t b_start,size_t b_end,Blue* b)
 
200
        {
 
201
                fprintf(mFile,"\tsetAttr \".b[%i:%i]\" ", b_start,b_end);
 
202
                size_t size = (b_end-b_start)*1+1;
 
203
                for(size_t i=0;i<size;++i)
 
204
                {
 
205
                        b[i].write(mFile);
 
206
                        fprintf(mFile,"\n");
 
207
                }
 
208
                fprintf(mFile,";\n");
 
209
        }
 
210
        void startBlue(size_t b_start,size_t b_end)const
 
211
        {
 
212
                fprintf(mFile,"\tsetAttr \".b[%i:%i]\"",b_start,b_end);
 
213
                fprintf(mFile," -type \"Blue\" ");
 
214
        }
 
215
        void appendBlue(const Blue& b)const
 
216
        {
 
217
                fprintf(mFile," ");
 
218
                b.write(mFile);
 
219
        }
 
220
        void endBlue()const
 
221
        {
 
222
                fprintf(mFile,";\n");
 
223
        }
 
224
        void setBlue_Position(size_t b_i,float bp)
 
225
        {
 
226
                if(bp == 0.0) return;
 
227
                fprintf(mFile,"\tsetAttr \".b[%i].bp\" %f;\n", b_i,bp);
 
228
        }
 
229
        void setBlue_FloatValue(size_t b_i,float bfv)
 
230
        {
 
231
                if(bfv == 0.0) return;
 
232
                fprintf(mFile,"\tsetAttr \".b[%i].bfv\" %f;\n", b_i,bfv);
 
233
        }
 
234
        void setBlue_Interp(size_t b_i,unsigned int bi)
 
235
        {
 
236
                if(bi == 0) return;
 
237
                fprintf(mFile,"\tsetAttr \".b[%i].bi\" %i;\n", b_i,bi);
 
238
        }
 
239
        void getColor()const
 
240
        {
 
241
                fprintf(mFile,"\"%s.cl\"",mName.c_str());
 
242
        }
 
243
        void getColorR()const
 
244
        {
 
245
                fprintf(mFile,"\"%s.cl.cr\"",mName.c_str());
 
246
        }
 
247
        void getColorG()const
 
248
        {
 
249
                fprintf(mFile,"\"%s.cl.cg\"",mName.c_str());
 
250
        }
 
251
        void getColorB()const
 
252
        {
 
253
                fprintf(mFile,"\"%s.cl.cb\"",mName.c_str());
 
254
        }
 
255
        void getInputMin()const
 
256
        {
 
257
                fprintf(mFile,"\"%s.imn\"",mName.c_str());
 
258
        }
 
259
        void getInputMax()const
 
260
        {
 
261
                fprintf(mFile,"\"%s.imx\"",mName.c_str());
 
262
        }
 
263
        void getOutputMin()const
 
264
        {
 
265
                fprintf(mFile,"\"%s.omn\"",mName.c_str());
 
266
        }
 
267
        void getOutputMax()const
 
268
        {
 
269
                fprintf(mFile,"\"%s.omx\"",mName.c_str());
 
270
        }
 
271
        void getRed(size_t r_i)const
 
272
        {
 
273
                fprintf(mFile,"\"%s.r[%i]\"",mName.c_str(),r_i);
 
274
        }
 
275
        void getRed()const
 
276
        {
 
277
 
 
278
                fprintf(mFile,"\"%s.r\"",mName.c_str());
 
279
        }
 
280
        void getRed_Position(size_t r_i)const
 
281
        {
 
282
                fprintf(mFile,"\"%s.r[%i].rp\"",mName.c_str(),r_i);
 
283
        }
 
284
        void getRed_Position()const
 
285
        {
 
286
 
 
287
                fprintf(mFile,"\"%s.r.rp\"",mName.c_str());
 
288
        }
 
289
        void getRed_FloatValue(size_t r_i)const
 
290
        {
 
291
                fprintf(mFile,"\"%s.r[%i].rfv\"",mName.c_str(),r_i);
 
292
        }
 
293
        void getRed_FloatValue()const
 
294
        {
 
295
 
 
296
                fprintf(mFile,"\"%s.r.rfv\"",mName.c_str());
 
297
        }
 
298
        void getRed_Interp(size_t r_i)const
 
299
        {
 
300
                fprintf(mFile,"\"%s.r[%i].ri\"",mName.c_str(),r_i);
 
301
        }
 
302
        void getRed_Interp()const
 
303
        {
 
304
 
 
305
                fprintf(mFile,"\"%s.r.ri\"",mName.c_str());
 
306
        }
 
307
        void getGreen(size_t g_i)const
 
308
        {
 
309
                fprintf(mFile,"\"%s.g[%i]\"",mName.c_str(),g_i);
 
310
        }
 
311
        void getGreen()const
 
312
        {
 
313
 
 
314
                fprintf(mFile,"\"%s.g\"",mName.c_str());
 
315
        }
 
316
        void getGreen_Position(size_t g_i)const
 
317
        {
 
318
                fprintf(mFile,"\"%s.g[%i].gp\"",mName.c_str(),g_i);
 
319
        }
 
320
        void getGreen_Position()const
 
321
        {
 
322
 
 
323
                fprintf(mFile,"\"%s.g.gp\"",mName.c_str());
 
324
        }
 
325
        void getGreen_FloatValue(size_t g_i)const
 
326
        {
 
327
                fprintf(mFile,"\"%s.g[%i].gfv\"",mName.c_str(),g_i);
 
328
        }
 
329
        void getGreen_FloatValue()const
 
330
        {
 
331
 
 
332
                fprintf(mFile,"\"%s.g.gfv\"",mName.c_str());
 
333
        }
 
334
        void getGreen_Interp(size_t g_i)const
 
335
        {
 
336
                fprintf(mFile,"\"%s.g[%i].gi\"",mName.c_str(),g_i);
 
337
        }
 
338
        void getGreen_Interp()const
 
339
        {
 
340
 
 
341
                fprintf(mFile,"\"%s.g.gi\"",mName.c_str());
 
342
        }
 
343
        void getBlue(size_t b_i)const
 
344
        {
 
345
                fprintf(mFile,"\"%s.b[%i]\"",mName.c_str(),b_i);
 
346
        }
 
347
        void getBlue()const
 
348
        {
 
349
 
 
350
                fprintf(mFile,"\"%s.b\"",mName.c_str());
 
351
        }
 
352
        void getBlue_Position(size_t b_i)const
 
353
        {
 
354
                fprintf(mFile,"\"%s.b[%i].bp\"",mName.c_str(),b_i);
 
355
        }
 
356
        void getBlue_Position()const
 
357
        {
 
358
 
 
359
                fprintf(mFile,"\"%s.b.bp\"",mName.c_str());
 
360
        }
 
361
        void getBlue_FloatValue(size_t b_i)const
 
362
        {
 
363
                fprintf(mFile,"\"%s.b[%i].bfv\"",mName.c_str(),b_i);
 
364
        }
 
365
        void getBlue_FloatValue()const
 
366
        {
 
367
 
 
368
                fprintf(mFile,"\"%s.b.bfv\"",mName.c_str());
 
369
        }
 
370
        void getBlue_Interp(size_t b_i)const
 
371
        {
 
372
                fprintf(mFile,"\"%s.b[%i].bi\"",mName.c_str(),b_i);
 
373
        }
 
374
        void getBlue_Interp()const
 
375
        {
 
376
 
 
377
                fprintf(mFile,"\"%s.b.bi\"",mName.c_str());
 
378
        }
 
379
        void getOutColor()const
 
380
        {
 
381
                fprintf(mFile,"\"%s.oc\"",mName.c_str());
 
382
        }
 
383
        void getOutColorR()const
 
384
        {
 
385
                fprintf(mFile,"\"%s.oc.ocr\"",mName.c_str());
 
386
        }
 
387
        void getOutColorG()const
 
388
        {
 
389
                fprintf(mFile,"\"%s.oc.ocg\"",mName.c_str());
 
390
        }
 
391
        void getOutColorB()const
 
392
        {
 
393
                fprintf(mFile,"\"%s.oc.ocb\"",mName.c_str());
 
394
        }
 
395
protected:
 
396
        RemapColor(FILE* file,const std::string& name,const std::string& parent,const std::string& nodeType,bool shared=false,bool create=true)
 
397
                :DependNode(file, name, parent, nodeType, shared, create) {}
 
398
 
 
399
};
 
400
}//namespace MayaDM
 
401
#endif//__MayaDM_REMAPCOLOR_H__