summaryrefslogtreecommitdiffstats
path: root/kpovmodeler/pmwarp.h
blob: 15e86b65fdace31d204dae8e8a9803ed7d40187f (plain)
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
//-*-C++-*-
/*
**************************************************************************
                                 description
                             --------------------
    copyright            : (C) 2000-2002 by Luis Carvalho
    email                : lpassos@mail.telepac.pt
**************************************************************************

**************************************************************************
*                                                                        *
*  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 PMWARP_H
#define PMWARP_H

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include "pmobject.h"

/**
 * Class for Repeat Warps
 */

class PMWarp : public PMObject
{
   typedef PMObject Base;
public:
   enum PMWarpType { Repeat, BlackHole, Turbulence,
                     Cylindrical, Spherical, Toroidal, Planar };

   /**
    * Creates a PMWarp
    */
   PMWarp( PMPart* part );
   /**
    * Copy constructor
    */
   PMWarp( const PMWarp& w );
   /**
    * deletes the PMWarp
    */
   virtual ~PMWarp( );

   /** */
   virtual PMObject* copy( ) const { return new PMWarp( *this ); }
   /** */
   virtual TQString description( ) const;

   /** */
   virtual PMMetaObject* tqmetaObject( ) const;
   /** */
   virtual void cleanUp( ) const;

   /** */
   virtual void serialize( TQDomElement& e, TQDomDocument& doc ) const;
   /** */
   virtual void readAttributes( const PMXMLHelper& h );

   /**
    * Returns a new @ref PMWarpEdit
    */
   virtual PMDialogEditBase* editWidget( TQWidget* parent ) const;
   /**
    * Returns the name of the pixmap that is displayed in the tree view
    * and dialog view
    */
   virtual TQString pixmap( ) const { return TQString( "pmwarp" ); }

   PMWarpType warpType( ) const { return m_warpType; }
   void setWarpType( PMWarpType c );

   PMVector direction( ) const { return m_direction; }
   void setDirection( const PMVector& c );
   PMVector offset( ) const { return m_offset; }
   void setOffset( const PMVector& c );
   PMVector flip( ) const { return m_flip; }
   void setFlip( const PMVector& c );

   PMVector location( ) const { return m_location; }
   void setLocation( const PMVector& v );
   double radius( ) const { return m_radius; }
   void setRadius( double c );
   double strength( ) const { return m_strength; }
   void setStrength( double c );
   double falloff( ) const { return m_falloff; }
   void setFalloff( double c );
   bool inverse( ) const { return m_inverse; }
   void setInverse( bool c );
   PMVector repeat( ) const { return m_repeat; }
   void setRepeat( const PMVector& v );
   PMVector turbulence( ) const { return m_turbulence; }
   void setTurbulence( const PMVector& v );

   PMVector valueVector( ) const { return m_valueVector; }
   void setValueVector( const PMVector& v );
   int octaves( ) const { return m_octaves; }
   void setOctaves( int c );
   double omega( ) const { return m_omega; }
   void setOmega( double c );
   double lambda( ) const { return m_lambda; }
   void setLambda( double c );

   PMVector orientation( ) const { return m_orientation;}
   void setOrientation( const PMVector& v );
   double distExp( ) const { return m_distExp; }
   void setDistExp( double c );
   double majorRadius( ) const { return m_majorRadius; }
   void setMajorRadius( double c );


   /** */
   virtual void restoreMemento( PMMemento* s );
private:
   /**
    * IDs for @ref PMMementoData
    */
   enum PMWarpMementoID { PMWarpTypeID, PMDirectionID, PMOffsetID, PMFlipID,
                          PMLocationID, PMRadiusID, PMStrengthID, PMFalloffID,
                          PMInverseID, PMRepeatID, PMTurbulenceID,
                          PMValueVectorID, PMOctavesID, PMOmegaID, PMLambdaID,
                          PMOrientationID, PMDistExpID, PMMajorRadiusID };

   PMWarpType m_warpType;

   // Repeat variables
   PMVector m_direction;
   PMVector m_offset;
   PMVector m_flip;

   // Black Hole variables
   PMVector m_location;
   double m_radius;
   double m_strength;
   double m_falloff;
   bool m_inverse;
   PMVector m_repeat;
   PMVector m_turbulence;

   // Turbulence variables
   PMVector m_valueVector;
   int m_octaves;
   double m_omega;
   double m_lambda;

   // Mapping variables
   PMVector m_orientation;
   double m_distExp;
   double m_majorRadius;

   static PMMetaObject* s_pMetaObject;
};

#endif