1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
|
/*
**************************************************************************
description
--------------------
copyright : (C) 2001-2002 by Luis Carvalho
email : [email protected]
**************************************************************************
**************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
**************************************************************************/
#ifndef PMPATTERN_H
#define PMPATTERN_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "pmobject.h"
#include "pmvector.h"
#include "pmcolor.h"
#include <tqvaluelist.h>
#include <tqvaluestack.h>
/**
* Class for povray patterns.
*/
class PMPattern : public PMObject
{
typedef PMObject Base;
public:
/**
* The type of the pattern
*/
enum PMPatternType { PatternAgate, PatternAverage, PatternBoxed,
PatternBozo, PatternBumps, PatternCells,
PatternCrackle, PatternCylindrical, PatternDensity,
PatternDents, PatternGradient, PatternGranite,
PatternJulia, PatternLeopard, PatternMandel,
PatternMarble, PatternOnion, PatternPlanar,
PatternQuilted, PatternRadial, PatternRipples,
PatternSlope, PatternSpherical, PatternSpiral1,
PatternSpiral2, PatternSpotted, PatternWaves,
PatternWood, PatternWrinkles };
/**
* The noise generators
*/
enum PMNoiseType { GlobalSetting, Original, RangeCorrected, Perlin };
/**
* Creates a PMPattern
*/
PMPattern( PMPart* part );
/**
* Copy constructor
*/
PMPattern( const PMPattern& p );
/**
* deletes the PMPattern
*/
virtual ~PMPattern( );
/** */
virtual PMObject* copy( ) const { return new PMPattern( *this ); }
/** */
virtual TQString description( ) const;
/** */
virtual TQString pixmap( ) const { return TQString( "pmpattern" ); }
/** */
virtual PMMetaObject* metaObject( ) const;
/** */
virtual void cleanUp( ) const;
/** */
virtual void serialize( TQDomElement& e, TQDomDocument& doc ) const;
/** */
virtual void readAttributes( const PMXMLHelper& h );
/**
* Returns a new @ref PMPatternEdit
*/
virtual PMDialogEditBase* editWidget( TQWidget* parent ) const;
/**
* Gets the pattern type
*/
PMPatternType patternType( ) const { return m_patternType; }
/**
* Gets the agate Turbulence*/
double agateTurbulence( ) const { return m_agateTurbulence; }
/**
* Gets the crackle form
*/
PMVector crackleForm( ) const { return m_crackleForm; }
/**
* Gets the crackle metric
*/
int crackleMetric( ) const { return m_crackleMetric; }
/**
* Gets the crackle offset
*/
double crackleOffset( ) const { return m_crackleOffset; }
/**
* Gets the crackle solid flag
*/
bool crackleSolid( ) const { return m_crackleSolid; }
/**
* Gets the desity file name
*/
TQString densityFile( ) const { return m_densityFile; }
/**
* Gets the density interpolation
*/
int densityInterpolate( ) const { return m_densityInterpolate; }
/**
* Gets the gradint vector
*/
PMVector gradient( ) const { return m_gradient; }
/**
* Returns the Complex number for Julia Fractals
*/
PMVector juliaComplex( ) const { return m_juliaComplex; }
/**
* Returns true if where using tha magnet types of fractals
*/
bool fractalMagnet( ) const { return m_fractalMagnet; }
/**
* Returns the magnet type of a fractal
*/
int fractalMagnetType( ) const { return m_fractalMagnetType; }
/**
* Gets the number of Iterations for fractals
*/
int maxIterations( ) const { return m_maxIterations; }
/**
* Returns the exponent of a fractal
*/
int fractalExponent( ) const { return m_fractalExponent; }
/**
* Returns the exterior type of a fractal
*/
int fractalExtType( ) const { return m_fractalExtType; }
/**
* Return the exterior factor of a fractal
*/
double fractalExtFactor( ) const { return m_fractalExtFactor; }
/**
* Returns the interior type of a fractal
*/
int fractalIntType( ) const { return m_fractalIntType; }
/**
* Returns the interior factor of a fractal
*/
double fractalIntFactor( ) const { return m_fractalIntFactor; }
/**
* Gets control0 for Quilt
*/
double quiltControl0( ) const { return m_quiltControl0; }
/**
* Gets control1 for Quilt
*/
double quiltControl1( ) const { return m_quiltControl1; }
/**
* Returns the slope direction
*/
PMVector slopeDirection( ) const { return m_slopeDirection; }
/**
* Returns the low slope value
*/
double slopeLoSlope( ) const { return m_slopeLoSlope; }
/**
* Returns the high slope value
*/
double slopeHiSlope( ) const { return m_slopeHiSlope; }
/**
* Returns the slopes altitude flag
*/
bool slopeAltFlag( ) const { return m_slopeAltFlag; }
/**
* Returns the altitude for the slope
*/
PMVector slopeAltitude( ) const { return m_slopeAltitude; }
/**
* Returns the low altitude for slope
*/
double slopeLoAltitude( ) const { return m_slopeLoAlt; }
/**
* Returns the high altitude for slope
*/
double slopeHiAltitude( ) const { return m_slopeHiAlt; }
/**
* Gets the number of arms in spiral types 1 and 2
*/
int spiralNumberArms( ) const { return m_spiralNumberArms; }
/**
* Returns the noise generator
*/
PMNoiseType noiseGenerator( ) const { return m_noiseGenerator; };
/**
* Returns whether turbulence is enabled
*/
bool isTurbulenceEnabled( ) const { return m_enableTurbulence; }
/**
* Gets the Turbulence vector
*/
PMVector valueVector( ) const { return m_valueVector; }
/**
* Gets the turbulence octaves
*/
int octaves( ) const { return m_octaves; }
/**
* Gets the turbulence omega
*/
double omega( ) const { return m_omega; }
/**
* Gets the turbulence lambda
*/
double lambda( ) const { return m_lambda; }
/**
* Returns depth (only has meaning inside a normal)
*/
double depth( ) const { return m_depth; }
/**
* Sets the pattern type
*/
void setPatternType( PMPatternType l );
/**
* Sets agate turbulence
*/
void setAgateTurbulence( double c );
/**
* Sets the crackle form
*/
void setCrackleForm( const PMVector& v );
/**
* Sets the crackle metric
*/
void setCrackleMetric( int c );
/**
* Sets the crackle offset
*/
void setCrackleOffset( double c );
/**
* Sets the crackle solid flag
*/
void setCrackleSolid( bool c );
/**
* Sets the Density File Name
*/
void setDensityFile( const TQString& v );
/**
* Sets the density interpolation
*/
void setDensityInterpolate( int c );
/**
* sets gradient vector
*/
void setGradient( const PMVector& v );
/**
* Sets the complex number for Julia
*/
void setJuliaComplex( const PMVector& v );
/**
* Sets if where using magnet types of fractals
*/
void setFractalMagnet( bool c );
/**
* Sets the magnet type of a fractal
*/
void setFractalMagnetType( int c );
/**
* Sets the maximum iterations for fractals
*/
void setMaxIterations( int c );
/**
* Sets the exponent for fractals
*/
void setFractalExponent( int c );
/**
* Sets the exterior type of fractals
*/
void setFractalExtType( int c );
/**
* Sets the exterior factor of fractals
*/
void setFractalExtFactor( double c );
/**
* Sets the interior type of fractals
*/
void setFractalIntType( int c );
/**
* Sets the interior factor of fractals
*/
void setFractalIntFactor( double c );
/**
* Sets quilt control 0
*/
void setQuiltControl0( double c );
/**
* Sets quite control 1
*/
void setQuiltControl1( double c );
/**
* Sets the slope direction
*/
void setSlopeDirection( const PMVector& v );
/**
* Sets the low slope value
*/
void setSlopeLoSlope( double c );
/**
* Sets the high slope value
*/
void setSlopeHiSlope( double c );
/**
* Sets the slopes altitude flag
*/
void setSlopeAltFlag( bool c );
/**
* Sets the slopes alititude direction
*/
void setSlopeAltitude( const PMVector& v );
/**
* Sets the slopes low altitude
*/
void setSlopeLoAlt( double c );
/**
* Sets the slopes high altitude
*/
void setSlopeHiAlt( double c );
/**
* Sets the number of spiral arms
*/
void setSpiralNumberArms( int c );
/**
* Sets noise generator
*/
void setNoiseGenerator( PMNoiseType c );
/**
* Enables turbulence
*/
void enableTurbulence( bool c );
/**
* sets the turbulence vector
*/
void setValueVector( const PMVector& v );
/**
* Sets the turbulence octaves
*/
void setOctaves( int c );
/**
* Sets the turblence omega
*/
void setOmega( double c );
/**
* Sets the turbulence Lambda
*/
void setLambda( double c );
/**
* Sets the depth value (only inside normals)
*/
void setDepth( double c );
/** */
virtual void restoreMemento( PMMemento* s );
private:
/**
* IDs for @ref PMMementoData
*/
enum PMPatternMementoID { PMPatternTypeID, PMAgateTurbulenceID, PMCrackleFormID,
PMCrackleMetricID, PMCrackleOffsetID, PMCrackleSolidID,
PMDensityFileID, PMDensityInterpolateID, PMGradientID,
PMJuliaComplexID, PMFractalMagnetID, PMFractalMagnetTypeID,
PMMaxIterationsID, PMFractalExponentID, PMFractalExtTypeID,
PMFractalExtFactorID, PMFractalIntTypeID, PMFractalIntFactorID,
PMQuiltControl0ID, PMQuiltControl1ID, PMSlopeDirectionID,
PMSlopeLoSlopeID, PMSlopeHiSlopeID, PMSlopeAltFlagID,
PMSlopeAltitudeID, PMSlopeLoAltID, PMSlopeHiAltID,
PMSpiralNumberArmsID, PMNoiseGeneratorID, PMEnableTurbulenceID,
PMValueVectorID, PMOctavesID, PMOmegaID, PMLambdaID, PMDepthID };
/**
* Pattern type
*/
PMPatternType m_patternType;
// Extra values for Individual Patterns
// Agate
double m_agateTurbulence;
// crackle
PMVector m_crackleForm;
int m_crackleMetric;
double m_crackleOffset;
bool m_crackleSolid;
// density
TQString m_densityFile;
int m_densityInterpolate;
// gradient
PMVector m_gradient;
// Julia
PMVector m_juliaComplex;
// Fractal patterns Mandel and Julia
bool m_fractalMagnet;
int m_fractalMagnetType;
int m_maxIterations;
int m_fractalExponent;
int m_fractalExtType;
double m_fractalExtFactor;
int m_fractalIntType;
double m_fractalIntFactor;
// quilt
double m_quiltControl0;
double m_quiltControl1;
// slope
PMVector m_slopeDirection;
double m_slopeLoSlope;
double m_slopeHiSlope;
bool m_slopeAltFlag;
PMVector m_slopeAltitude;
double m_slopeLoAlt;
double m_slopeHiAlt;
// Spiral
int m_spiralNumberArms;
// noise generator type for Bozo, Bumps, Granite and Wrinkles.
PMNoiseType m_noiseGenerator;
// Turbulence available for all patterns
bool m_enableTurbulence;
PMVector m_valueVector;
int m_octaves;
double m_omega;
double m_lambda;
// depth when used with Normal
double m_depth;
static PMMetaObject* s_pMetaObject;
};
#endif
|