123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- #include "ugeentity.h"
-
- UGEEntity::UGEEntity(QObject *parent)
- : QObject(parent)
- , _visible(true)
- {
- }
-
- UGEEntity::~UGEEntity()
- {
- }
-
- Vector3D UGEEntity::getPosition() const
- {
- return _position;
- }
-
- void UGEEntity::setPosition(const Vector3D &position)
- {
- _position = position;
- }
-
- void UGEEntity::move(const Vector3D &move)
- {
- _position += move;
- }
-
- Vector3D UGEEntity::getSpeed() const
- {
- return _speed;
- }
-
- void UGEEntity::setSpeed(const Vector3D &speed)
- {
- _speed = speed;
- }
-
- void UGEEntity::accelerate(const Vector3D &speed)
- {
- _speed += speed;
- }
-
- Vector3D UGEEntity::getRotation() const
- {
- return _rotation;
- }
-
- void UGEEntity::setRotation(const Vector3D &rotation)
- {
- _rotation = rotation;
- }
-
- void UGEEntity::rotate(const Vector3D &rotation)
- {
- _rotation += rotation;
- }
-
- Vector3D UGEEntity::getScale() const
- {
- return _scale;
- }
-
- void UGEEntity::setScale(const Vector3D &scale)
- {
- _scale = scale;
- }
-
- void UGEEntity::scale(const Vector3D &scale)
- {
- _scale += scale;
- }
- bool UGEEntity::isVisible() const
- {
- return _visible;
- }
-
- void UGEEntity::setVisible(bool visible)
- {
- _visible = visible;
- }
-
- void UGEEntity::show()
- {
- _visible = true;
- }
-
- void UGEEntity::hide()
- {
- _visible = false;
- }
-
- Vector3D UGEEntity::getRealPoint(const Vector3D &pos)
- {
- return pos + _position;
- }
-
- ColorVector3D UGEEntity::getRealPoint(const ColorVector3D &pos)
- {
- return ColorVector3D(pos.getColor(), getRealPoint((Vector3D)pos));
- }
-
- void UGEEntity::drawPoint(AbstractRenderDevice *device, const ColorVector3D &point)
- {
- device->drawPoint(getRealPoint(point));
- }
-
- void UGEEntity::drawLine(AbstractRenderDevice *device, const ColorVector3D &begin, const ColorVector3D &end, double width)
- {
- device->drawLine(getRealPoint(begin), getRealPoint(end), width);
- }
-
- void UGEEntity::drawPolygon(AbstractRenderDevice *device, QList<ColorVector3D> points)
- {
- for (int i = 0; i < points.size(); ++i) {
- points[i] = getRealPoint(points[i]);
- }
- device->drawPolygon(points);
- }
|