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

« back to all changes in this revision

Viewing changes to Externals/MayaDataModel/include/MayaDMStroke.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_STROKE_H__
 
11
#define __MayaDM_STROKE_H__
 
12
#include "MayaDMTypes.h"
 
13
#include "MayaDMConnectables.h"
 
14
#include "MayaDMPfxGeometry.h"
 
15
namespace MayaDM
 
16
{
 
17
class Stroke : public PfxGeometry
 
18
{
 
19
public:
 
20
        struct PathCurve{
 
21
                int samples;
 
22
                bool opposite;
 
23
                void write(FILE* file) const
 
24
                {
 
25
                        fprintf(file,"%i ", samples);
 
26
                        fprintf(file,"%i", opposite);
 
27
                }
 
28
        };
 
29
        struct PressureScale{
 
30
                float pressureScale_Position;
 
31
                float pressureScale_FloatValue;
 
32
                unsigned int pressureScale_Interp;
 
33
                void write(FILE* file) const
 
34
                {
 
35
                        fprintf(file,"%f ", pressureScale_Position);
 
36
                        fprintf(file,"%f ", pressureScale_FloatValue);
 
37
                        fprintf(file,"%i", pressureScale_Interp);
 
38
                }
 
39
        };
 
40
public:
 
41
 
 
42
        Stroke():PfxGeometry(){}
 
43
        Stroke(FILE* file,const std::string& name,const std::string& parent="",bool shared=false,bool create=true)
 
44
                :PfxGeometry(file, name, parent, "stroke", shared, create){}
 
45
        virtual ~Stroke(){}
 
46
 
 
47
        void setSampleDensity(double sdn)
 
48
        {
 
49
                if(sdn == 1.0) return;
 
50
                fprintf(mFile,"\tsetAttr \".sdn\" %f;\n", sdn);
 
51
        }
 
52
        void setSmoothing(double smo)
 
53
        {
 
54
                if(smo == 0.0) return;
 
55
                fprintf(mFile,"\tsetAttr \".smo\" %f;\n", smo);
 
56
        }
 
57
        void setPerspective(bool per)
 
58
        {
 
59
                if(per == 1) return;
 
60
                fprintf(mFile,"\tsetAttr \".per\" %i;\n", per);
 
61
        }
 
62
        void setUseNormal(bool usn)
 
63
        {
 
64
                if(usn == 0) return;
 
65
                fprintf(mFile,"\tsetAttr \".usn\" %i;\n", usn);
 
66
        }
 
67
        void setNormal(const double3& nml)
 
68
        {
 
69
                fprintf(mFile,"\tsetAttr \".nml\" -type \"double3\" ");
 
70
                nml.write(mFile);
 
71
                fprintf(mFile,";\n");
 
72
        }
 
73
        void setNormalX(double nmx)
 
74
        {
 
75
                if(nmx == 0.0) return;
 
76
                fprintf(mFile,"\tsetAttr \".nml.nmx\" %f;\n", nmx);
 
77
        }
 
78
        void setNormalY(double nmy)
 
79
        {
 
80
                if(nmy == 0.0) return;
 
81
                fprintf(mFile,"\tsetAttr \".nml.nmy\" %f;\n", nmy);
 
82
        }
 
83
        void setNormalZ(double nmz)
 
84
        {
 
85
                if(nmz == 1.0) return;
 
86
                fprintf(mFile,"\tsetAttr \".nml.nmz\" %f;\n", nmz);
 
87
        }
 
88
        void setMinClip(double mnc)
 
89
        {
 
90
                if(mnc == 0.0) return;
 
91
                fprintf(mFile,"\tsetAttr \".mnc\" %f;\n", mnc);
 
92
        }
 
93
        void setMaxClip(double mxc)
 
94
        {
 
95
                if(mxc == 1.0) return;
 
96
                fprintf(mFile,"\tsetAttr \".mxc\" %f;\n", mxc);
 
97
        }
 
98
        void setPathCurve(size_t pcv_i,const PathCurve& pcv)
 
99
        {
 
100
                fprintf(mFile,"\tsetAttr \".pcv[%i]\" ",pcv_i);
 
101
                pcv.write(mFile);
 
102
                fprintf(mFile,";\n");
 
103
        }
 
104
        void setPathCurve(size_t pcv_start,size_t pcv_end,PathCurve* pcv)
 
105
        {
 
106
                fprintf(mFile,"\tsetAttr \".pcv[%i:%i]\" ", pcv_start,pcv_end);
 
107
                size_t size = (pcv_end-pcv_start)*1+1;
 
108
                for(size_t i=0;i<size;++i)
 
109
                {
 
110
                        pcv[i].write(mFile);
 
111
                        fprintf(mFile,"\n");
 
112
                }
 
113
                fprintf(mFile,";\n");
 
114
        }
 
115
        void startPathCurve(size_t pcv_start,size_t pcv_end)const
 
116
        {
 
117
                fprintf(mFile,"\tsetAttr \".pcv[%i:%i]\"",pcv_start,pcv_end);
 
118
                fprintf(mFile," -type \"PathCurve\" ");
 
119
        }
 
120
        void appendPathCurve(const PathCurve& pcv)const
 
121
        {
 
122
                fprintf(mFile," ");
 
123
                pcv.write(mFile);
 
124
        }
 
125
        void endPathCurve()const
 
126
        {
 
127
                fprintf(mFile,";\n");
 
128
        }
 
129
        void setSamples(size_t pcv_i,int smp)
 
130
        {
 
131
                if(smp == 0) return;
 
132
                fprintf(mFile,"\tsetAttr \".pcv[%i].smp\" %i;\n", pcv_i,smp);
 
133
        }
 
134
        void setOpposite(size_t pcv_i,bool opp)
 
135
        {
 
136
                if(opp == false) return;
 
137
                fprintf(mFile,"\tsetAttr \".pcv[%i].opp\" %i;\n", pcv_i,opp);
 
138
        }
 
139
        void setOutPoint(size_t opt_i,const double3& opt)
 
140
        {
 
141
                fprintf(mFile,"\tsetAttr \".opt[%i]\" -type \"double3\" ",opt_i);
 
142
                opt.write(mFile);
 
143
                fprintf(mFile,";\n");
 
144
        }
 
145
        void setOutPoint(size_t opt_start,size_t opt_end,double* opt)
 
146
        {
 
147
                fprintf(mFile,"\tsetAttr \".opt[%i:%i]\" ", opt_start,opt_end);
 
148
                size_t size = (opt_end-opt_start)*3+3;
 
149
                for(size_t i=0;i<size;++i)
 
150
                {
 
151
                        fprintf(mFile,"%f",opt[i]);
 
152
                        if(i+1<size) fprintf(mFile," ");
 
153
                }
 
154
                fprintf(mFile,";\n");
 
155
        }
 
156
        void startOutPoint(size_t opt_start,size_t opt_end)const
 
157
        {
 
158
                fprintf(mFile,"\tsetAttr \".opt[%i:%i]\"",opt_start,opt_end);
 
159
        }
 
160
        void appendOutPoint(double opt)const
 
161
        {
 
162
                fprintf(mFile," %f",opt);
 
163
        }
 
164
        void endOutPoint()const
 
165
        {
 
166
                fprintf(mFile,";\n");
 
167
        }
 
168
        void setOutPointX(size_t opt_i,double ox)
 
169
        {
 
170
                if(ox == 0.0) return;
 
171
                fprintf(mFile,"\tsetAttr \".opt[%i].ox\" %f;\n", opt_i,ox);
 
172
        }
 
173
        void setOutPointY(size_t opt_i,double oy)
 
174
        {
 
175
                if(oy == 0.0) return;
 
176
                fprintf(mFile,"\tsetAttr \".opt[%i].oy\" %f;\n", opt_i,oy);
 
177
        }
 
178
        void setOutPointZ(size_t opt_i,double oz)
 
179
        {
 
180
                if(oz == 0.0) return;
 
181
                fprintf(mFile,"\tsetAttr \".opt[%i].oz\" %f;\n", opt_i,oz);
 
182
        }
 
183
        void setPressureMap1(unsigned int spm1)
 
184
        {
 
185
                if(spm1 == 0) return;
 
186
                fprintf(mFile,"\tsetAttr \".spm1\" %i;\n", spm1);
 
187
        }
 
188
        void setPressureMin1(double ps1)
 
189
        {
 
190
                if(ps1 == 0.0) return;
 
191
                fprintf(mFile,"\tsetAttr \".ps1\" %f;\n", ps1);
 
192
        }
 
193
        void setPressureMax1(double px1)
 
194
        {
 
195
                if(px1 == 1.0) return;
 
196
                fprintf(mFile,"\tsetAttr \".px1\" %f;\n", px1);
 
197
        }
 
198
        void setPressureMap2(unsigned int spm2)
 
199
        {
 
200
                if(spm2 == 0) return;
 
201
                fprintf(mFile,"\tsetAttr \".spm2\" %i;\n", spm2);
 
202
        }
 
203
        void setPressureMin2(double ps2)
 
204
        {
 
205
                if(ps2 == 0.0) return;
 
206
                fprintf(mFile,"\tsetAttr \".ps2\" %f;\n", ps2);
 
207
        }
 
208
        void setPressureMax2(double px2)
 
209
        {
 
210
                if(px2 == 1.0) return;
 
211
                fprintf(mFile,"\tsetAttr \".px2\" %f;\n", px2);
 
212
        }
 
213
        void setPressureMap3(unsigned int spm3)
 
214
        {
 
215
                if(spm3 == 0) return;
 
216
                fprintf(mFile,"\tsetAttr \".spm3\" %i;\n", spm3);
 
217
        }
 
218
        void setPressureMin3(double ps3)
 
219
        {
 
220
                if(ps3 == 0.0) return;
 
221
                fprintf(mFile,"\tsetAttr \".ps3\" %f;\n", ps3);
 
222
        }
 
223
        void setPressureMax3(double px3)
 
224
        {
 
225
                if(px3 == 1.0) return;
 
226
                fprintf(mFile,"\tsetAttr \".px3\" %f;\n", px3);
 
227
        }
 
228
        void setPressureScale(size_t psc_i,const PressureScale& psc)
 
229
        {
 
230
                fprintf(mFile,"\tsetAttr \".psc[%i]\" ",psc_i);
 
231
                psc.write(mFile);
 
232
                fprintf(mFile,";\n");
 
233
        }
 
234
        void setPressureScale(size_t psc_start,size_t psc_end,PressureScale* psc)
 
235
        {
 
236
                fprintf(mFile,"\tsetAttr \".psc[%i:%i]\" ", psc_start,psc_end);
 
237
                size_t size = (psc_end-psc_start)*1+1;
 
238
                for(size_t i=0;i<size;++i)
 
239
                {
 
240
                        psc[i].write(mFile);
 
241
                        fprintf(mFile,"\n");
 
242
                }
 
243
                fprintf(mFile,";\n");
 
244
        }
 
245
        void startPressureScale(size_t psc_start,size_t psc_end)const
 
246
        {
 
247
                fprintf(mFile,"\tsetAttr \".psc[%i:%i]\"",psc_start,psc_end);
 
248
                fprintf(mFile," -type \"PressureScale\" ");
 
249
        }
 
250
        void appendPressureScale(const PressureScale& psc)const
 
251
        {
 
252
                fprintf(mFile," ");
 
253
                psc.write(mFile);
 
254
        }
 
255
        void endPressureScale()const
 
256
        {
 
257
                fprintf(mFile,";\n");
 
258
        }
 
259
        void setPressureScale_Position(size_t psc_i,float pscp)
 
260
        {
 
261
                if(pscp == 0.0) return;
 
262
                fprintf(mFile,"\tsetAttr \".psc[%i].pscp\" %f;\n", psc_i,pscp);
 
263
        }
 
264
        void setPressureScale_FloatValue(size_t psc_i,float pscfv)
 
265
        {
 
266
                if(pscfv == 0.0) return;
 
267
                fprintf(mFile,"\tsetAttr \".psc[%i].pscfv\" %f;\n", psc_i,pscfv);
 
268
        }
 
269
        void setPressureScale_Interp(size_t psc_i,unsigned int psci)
 
270
        {
 
271
                if(psci == 0) return;
 
272
                fprintf(mFile,"\tsetAttr \".psc[%i].psci\" %i;\n", psc_i,psci);
 
273
        }
 
274
        void setPressure(size_t psr_i,double psr)
 
275
        {
 
276
                if(psr == 0.0) return;
 
277
                fprintf(mFile,"\tsetAttr \".psr[%i]\" %f;\n", psr_i,psr);
 
278
        }
 
279
        void setPressure(size_t psr_start,size_t psr_end,double* psr)
 
280
        {
 
281
                fprintf(mFile,"\tsetAttr \".psr[%i:%i]\" ", psr_start,psr_end);
 
282
                size_t size = (psr_end-psr_start)*1+1;
 
283
                for(size_t i=0;i<size;++i)
 
284
                {
 
285
                        fprintf(mFile,"%f",psr[i]);
 
286
                        if(i+1<size) fprintf(mFile," ");
 
287
                }
 
288
                fprintf(mFile,";\n");
 
289
        }
 
290
        void startPressure(size_t psr_start,size_t psr_end)const
 
291
        {
 
292
                fprintf(mFile,"\tsetAttr \".psr[%i:%i]\"",psr_start,psr_end);
 
293
        }
 
294
        void appendPressure(double psr)const
 
295
        {
 
296
                fprintf(mFile," %f",psr);
 
297
        }
 
298
        void endPressure()const
 
299
        {
 
300
                fprintf(mFile,";\n");
 
301
        }
 
302
        void getSampleDensity()const
 
303
        {
 
304
                fprintf(mFile,"\"%s.sdn\"",mName.c_str());
 
305
        }
 
306
        void getSmoothing()const
 
307
        {
 
308
                fprintf(mFile,"\"%s.smo\"",mName.c_str());
 
309
        }
 
310
        void getPerspective()const
 
311
        {
 
312
                fprintf(mFile,"\"%s.per\"",mName.c_str());
 
313
        }
 
314
        void getUseNormal()const
 
315
        {
 
316
                fprintf(mFile,"\"%s.usn\"",mName.c_str());
 
317
        }
 
318
        void getNormal()const
 
319
        {
 
320
                fprintf(mFile,"\"%s.nml\"",mName.c_str());
 
321
        }
 
322
        void getNormalX()const
 
323
        {
 
324
                fprintf(mFile,"\"%s.nml.nmx\"",mName.c_str());
 
325
        }
 
326
        void getNormalY()const
 
327
        {
 
328
                fprintf(mFile,"\"%s.nml.nmy\"",mName.c_str());
 
329
        }
 
330
        void getNormalZ()const
 
331
        {
 
332
                fprintf(mFile,"\"%s.nml.nmz\"",mName.c_str());
 
333
        }
 
334
        void getMinClip()const
 
335
        {
 
336
                fprintf(mFile,"\"%s.mnc\"",mName.c_str());
 
337
        }
 
338
        void getMaxClip()const
 
339
        {
 
340
                fprintf(mFile,"\"%s.mxc\"",mName.c_str());
 
341
        }
 
342
        void getPathCurve(size_t pcv_i)const
 
343
        {
 
344
                fprintf(mFile,"\"%s.pcv[%i]\"",mName.c_str(),pcv_i);
 
345
        }
 
346
        void getPathCurve()const
 
347
        {
 
348
 
 
349
                fprintf(mFile,"\"%s.pcv\"",mName.c_str());
 
350
        }
 
351
        void getCurve(size_t pcv_i)const
 
352
        {
 
353
                fprintf(mFile,"\"%s.pcv[%i].crv\"",mName.c_str(),pcv_i);
 
354
        }
 
355
        void getCurve()const
 
356
        {
 
357
 
 
358
                fprintf(mFile,"\"%s.pcv.crv\"",mName.c_str());
 
359
        }
 
360
        void getSamples(size_t pcv_i)const
 
361
        {
 
362
                fprintf(mFile,"\"%s.pcv[%i].smp\"",mName.c_str(),pcv_i);
 
363
        }
 
364
        void getSamples()const
 
365
        {
 
366
 
 
367
                fprintf(mFile,"\"%s.pcv.smp\"",mName.c_str());
 
368
        }
 
369
        void getOpposite(size_t pcv_i)const
 
370
        {
 
371
                fprintf(mFile,"\"%s.pcv[%i].opp\"",mName.c_str(),pcv_i);
 
372
        }
 
373
        void getOpposite()const
 
374
        {
 
375
 
 
376
                fprintf(mFile,"\"%s.pcv.opp\"",mName.c_str());
 
377
        }
 
378
        void getOutPoint(size_t opt_i)const
 
379
        {
 
380
                fprintf(mFile,"\"%s.opt[%i]\"",mName.c_str(),opt_i);
 
381
        }
 
382
        void getOutPoint()const
 
383
        {
 
384
 
 
385
                fprintf(mFile,"\"%s.opt\"",mName.c_str());
 
386
        }
 
387
        void getOutPointX(size_t opt_i)const
 
388
        {
 
389
                fprintf(mFile,"\"%s.opt[%i].ox\"",mName.c_str(),opt_i);
 
390
        }
 
391
        void getOutPointX()const
 
392
        {
 
393
 
 
394
                fprintf(mFile,"\"%s.opt.ox\"",mName.c_str());
 
395
        }
 
396
        void getOutPointY(size_t opt_i)const
 
397
        {
 
398
                fprintf(mFile,"\"%s.opt[%i].oy\"",mName.c_str(),opt_i);
 
399
        }
 
400
        void getOutPointY()const
 
401
        {
 
402
 
 
403
                fprintf(mFile,"\"%s.opt.oy\"",mName.c_str());
 
404
        }
 
405
        void getOutPointZ(size_t opt_i)const
 
406
        {
 
407
                fprintf(mFile,"\"%s.opt[%i].oz\"",mName.c_str(),opt_i);
 
408
        }
 
409
        void getOutPointZ()const
 
410
        {
 
411
 
 
412
                fprintf(mFile,"\"%s.opt.oz\"",mName.c_str());
 
413
        }
 
414
        void getOutNormal(size_t onm_i)const
 
415
        {
 
416
                fprintf(mFile,"\"%s.onm[%i]\"",mName.c_str(),onm_i);
 
417
        }
 
418
        void getOutNormal()const
 
419
        {
 
420
 
 
421
                fprintf(mFile,"\"%s.onm\"",mName.c_str());
 
422
        }
 
423
        void getOutNormalX(size_t onm_i)const
 
424
        {
 
425
                fprintf(mFile,"\"%s.onm[%i].onx\"",mName.c_str(),onm_i);
 
426
        }
 
427
        void getOutNormalX()const
 
428
        {
 
429
 
 
430
                fprintf(mFile,"\"%s.onm.onx\"",mName.c_str());
 
431
        }
 
432
        void getOutNormalY(size_t onm_i)const
 
433
        {
 
434
                fprintf(mFile,"\"%s.onm[%i].ony\"",mName.c_str(),onm_i);
 
435
        }
 
436
        void getOutNormalY()const
 
437
        {
 
438
 
 
439
                fprintf(mFile,"\"%s.onm.ony\"",mName.c_str());
 
440
        }
 
441
        void getOutNormalZ(size_t onm_i)const
 
442
        {
 
443
                fprintf(mFile,"\"%s.onm[%i].onz\"",mName.c_str(),onm_i);
 
444
        }
 
445
        void getOutNormalZ()const
 
446
        {
 
447
 
 
448
                fprintf(mFile,"\"%s.onm.onz\"",mName.c_str());
 
449
        }
 
450
        void getPressureMap1()const
 
451
        {
 
452
                fprintf(mFile,"\"%s.spm1\"",mName.c_str());
 
453
        }
 
454
        void getPressureMin1()const
 
455
        {
 
456
                fprintf(mFile,"\"%s.ps1\"",mName.c_str());
 
457
        }
 
458
        void getPressureMax1()const
 
459
        {
 
460
                fprintf(mFile,"\"%s.px1\"",mName.c_str());
 
461
        }
 
462
        void getPressureMap2()const
 
463
        {
 
464
                fprintf(mFile,"\"%s.spm2\"",mName.c_str());
 
465
        }
 
466
        void getPressureMin2()const
 
467
        {
 
468
                fprintf(mFile,"\"%s.ps2\"",mName.c_str());
 
469
        }
 
470
        void getPressureMax2()const
 
471
        {
 
472
                fprintf(mFile,"\"%s.px2\"",mName.c_str());
 
473
        }
 
474
        void getPressureMap3()const
 
475
        {
 
476
                fprintf(mFile,"\"%s.spm3\"",mName.c_str());
 
477
        }
 
478
        void getPressureMin3()const
 
479
        {
 
480
                fprintf(mFile,"\"%s.ps3\"",mName.c_str());
 
481
        }
 
482
        void getPressureMax3()const
 
483
        {
 
484
                fprintf(mFile,"\"%s.px3\"",mName.c_str());
 
485
        }
 
486
        void getPressureScale(size_t psc_i)const
 
487
        {
 
488
                fprintf(mFile,"\"%s.psc[%i]\"",mName.c_str(),psc_i);
 
489
        }
 
490
        void getPressureScale()const
 
491
        {
 
492
 
 
493
                fprintf(mFile,"\"%s.psc\"",mName.c_str());
 
494
        }
 
495
        void getPressureScale_Position(size_t psc_i)const
 
496
        {
 
497
                fprintf(mFile,"\"%s.psc[%i].pscp\"",mName.c_str(),psc_i);
 
498
        }
 
499
        void getPressureScale_Position()const
 
500
        {
 
501
 
 
502
                fprintf(mFile,"\"%s.psc.pscp\"",mName.c_str());
 
503
        }
 
504
        void getPressureScale_FloatValue(size_t psc_i)const
 
505
        {
 
506
                fprintf(mFile,"\"%s.psc[%i].pscfv\"",mName.c_str(),psc_i);
 
507
        }
 
508
        void getPressureScale_FloatValue()const
 
509
        {
 
510
 
 
511
                fprintf(mFile,"\"%s.psc.pscfv\"",mName.c_str());
 
512
        }
 
513
        void getPressureScale_Interp(size_t psc_i)const
 
514
        {
 
515
                fprintf(mFile,"\"%s.psc[%i].psci\"",mName.c_str(),psc_i);
 
516
        }
 
517
        void getPressureScale_Interp()const
 
518
        {
 
519
 
 
520
                fprintf(mFile,"\"%s.psc.psci\"",mName.c_str());
 
521
        }
 
522
        void getPressure(size_t psr_i)const
 
523
        {
 
524
                fprintf(mFile,"\"%s.psr[%i]\"",mName.c_str(),psr_i);
 
525
        }
 
526
        void getPressure()const
 
527
        {
 
528
 
 
529
                fprintf(mFile,"\"%s.psr\"",mName.c_str());
 
530
        }
 
531
        void getUvSetName(size_t uvsetn_i)const
 
532
        {
 
533
                fprintf(mFile,"\"%s.uvsetn[%i]\"",mName.c_str(),uvsetn_i);
 
534
        }
 
535
        void getUvSetName()const
 
536
        {
 
537
 
 
538
                fprintf(mFile,"\"%s.uvsetn\"",mName.c_str());
 
539
        }
 
540
protected:
 
541
        Stroke(FILE* file,const std::string& name,const std::string& parent,const std::string& nodeType,bool shared=false,bool create=true)
 
542
                :PfxGeometry(file, name, parent, nodeType, shared, create) {}
 
543
 
 
544
};
 
545
}//namespace MayaDM
 
546
#endif//__MayaDM_STROKE_H__