You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ugeentity.h 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. #ifndef UGEENTITY_H
  2. #define UGEENTITY_H
  3. #include <QObject>
  4. #include <QPoint>
  5. #include <QSharedPointer>
  6. #include "utils/vector3d.h"
  7. #include "utils/matrix3x3.h"
  8. #include "engine/abstractrenderdevice.h"
  9. class UGEEntity : public QObject
  10. {
  11. Q_OBJECT
  12. public:
  13. explicit UGEEntity(QObject *parent = 0);
  14. virtual ~UGEEntity();
  15. Vector3D getPosition() const;
  16. void setPosition(const Vector3D& position);
  17. void move(const Vector3D& move);
  18. // Vector3D getSpeed() const;
  19. // void setSpeed(const Vector3D& speed);
  20. // void accelerate(const Vector3D& speed);
  21. Vector3D getRotation() const;
  22. void setRotation(const Vector3D& rotation);
  23. void rotate(const Vector3D& rotation);
  24. Vector3D getScale() const;
  25. void setScale(const Vector3D& scale);
  26. void scale(const Vector3D& scale);
  27. bool isVisible() const;
  28. void setVisible(bool visible);
  29. void show();
  30. void hide();
  31. QColor getColor() const;
  32. void setColor(const QColor &color);
  33. Vector3D getRealPoint(const Vector3D& pos);
  34. ColorVector3D getRealPoint(const ColorVector3D& pos);
  35. TextureVector3D getRealPoint(const TextureVector3D& pos);
  36. Matrix3x3 getTransformationMatrix() const;
  37. Matrix3x3 getScaleMatrix() const;
  38. Matrix3x3 getRotationMatrix() const;
  39. virtual void drawPoint(AbstractRenderDevice* device, const ColorVector3D& point);
  40. virtual void drawLine(AbstractRenderDevice* device, const ColorVector3D& begin, const ColorVector3D& end, double width = 1.0);
  41. virtual void drawPolygon(AbstractRenderDevice* device, QList<ColorVector3D> points);
  42. virtual void drawPolygonTexture(AbstractRenderDevice *device, QList<TextureVector3D> points, const QVariant& textureId);
  43. virtual void draw(AbstractRenderDevice* device) = 0;
  44. signals:
  45. void positionChanged();
  46. void positionChanged(const Vector3D& position);
  47. void rotationChanged();
  48. void rotationChanged(const Vector3D& rotation);
  49. void scaleChanged();
  50. void scaleChanged(const Vector3D& scale);
  51. void visibilityChanged();
  52. void visibilityChanged(bool visible);
  53. void colorChanged();
  54. void colorChanged(QColor color);
  55. private:
  56. Vector3D _position;
  57. // Vector3D _speed;
  58. Vector3D _rotation;
  59. Vector3D _scale;
  60. bool _visible;
  61. QColor _color;
  62. };
  63. #endif // UGEENTITY_H