wobject.h
1 /********************************************************************************
2  * WorldSim -- library for robot simulations *
3  * Copyright (C) 2008-2013 Gianluca Massera <emmegian@yahoo.it> *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the Free Software *
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
18  ********************************************************************************/
19 
20 #ifndef WOBJECT_H
21 #define WOBJECT_H
22 
23 #include "worldsimconfig.h"
24 #include "ownable.h"
25 #include "wmatrix.h"
26 #include "wvector.h"
27 
28 #include <QString>
29 #include <QColor>
30 
31 namespace farsa {
32 
33 class World;
34 
39 class FARSA_WSIM_API WObject : public QObject, public Ownable {
40  Q_OBJECT
41 public:
53  WObject( World* world, QString name="unamed", const wMatrix& tm = wMatrix::identity(), bool addToWorld = true );
55  virtual ~WObject();
57  const wMatrix& matrix() const;
59  void setPosition( const wVector& newpos );
61  void setPosition( real x, real y, real z );
63  World* world();
65  const World* world() const;
67  QString name() const;
69  void setTexture( QString textureName );
71  QString texture() const;
77  void setColor( QColor c );
79  void setAlpha( int alpha );
81  QColor color() const;
83  bool useColorTextureOfOwner() const;
85  void setUseColorTextureOfOwner( bool b );
90  virtual void preUpdate();
95  virtual void postUpdate();
97  void setMatrix( const wMatrix& newm );
99  bool isInvisible();
104  void setInvisible( bool b );
105 protected:
107  virtual void changedMatrix();
113  QString namev;
115  QString texturev;
117  QColor colorv;
119  bool invisible;
122 };
123 
124 } // end namespace farsa
125 
126 #endif