diff --git a/src/Core/Crawl/defaultlight.cpp b/src/Core/Crawl/defaultlight.cpp index e13fb94..51538ce 100644 --- a/src/Core/Crawl/defaultlight.cpp +++ b/src/Core/Crawl/defaultlight.cpp @@ -12,7 +12,7 @@ namespace CRAWL { DefaultLight::DefaultLight(): IWorldLight(AUTO_CLASS_NAME) { setColor("#fff8e7"); setposition({10000, 0, 10000}); - setRatation(QQuaternion::fromEulerAngles({-90,0,0})); + setRotation(QQuaternion::fromEulerAngles({-90,0,0})); setLightForce(110); } diff --git a/src/Core/Crawl/groupobject.cpp b/src/Core/Crawl/groupobject.cpp index d641dec..f263066 100644 --- a/src/Core/Crawl/groupobject.cpp +++ b/src/Core/Crawl/groupobject.cpp @@ -23,7 +23,7 @@ void GroupObject::render(unsigned int tbfMsec) { if (LocalPropertyes *props = getLocalPropertyes(object->guiId())) { if (!props->_rotation.isNull()) - object->setRatation(_this->ratation() * props->_rotation); + object->setRotation(_this->rotation() * props->_rotation); object->setposition(_this->position() + props->_position); } diff --git a/src/Core/Crawl/groupobject.h b/src/Core/Crawl/groupobject.h index 55212a8..2857eeb 100644 --- a/src/Core/Crawl/groupobject.h +++ b/src/Core/Crawl/groupobject.h @@ -24,15 +24,15 @@ struct LocalPropertyes { }; /** - * @brief The GroupObject class is extansion with group object behavior. - * ### Requeried functions: IWorldItem + * @brief The GroupObject class is extension with group object behavior. + * ### Requried child classes: IWorldItem * - * This class have implementation of the render method that move all child object on selected local positions in parent object. + * This class have implementation of the render method that move all child objects on selected local positions on parent object. * * ## Example of use * * ### For what this object uses - * This object will be very convinent wher you want to create a difecly claster object with multiple subobjects that should contains in the parrent root object. + *This object will be very convenient where you want to create a directly cluster object with multiple sub objects that should contains in the parent root object. * For example : weapon of the player. * * ### Example of use diff --git a/src/Core/Crawl/guiobject.cpp b/src/Core/Crawl/guiobject.cpp index e9dc911..6ebddec 100644 --- a/src/Core/Crawl/guiobject.cpp +++ b/src/Core/Crawl/guiobject.cpp @@ -17,7 +17,7 @@ GuiObject::GuiObject(const QString &name, const QString &viewTempalte, QObject * _viewTemplate = viewTempalte; _className = name; generateId(); - setRatation(QQuaternion::fromEulerAngles({0,0,0})); + setRotation(QQuaternion::fromEulerAngles({0,0,0})); } const QString& GuiObject::color() const { @@ -173,15 +173,15 @@ void GuiObject::setSize(const QVector3D &newSize) { emit sizeChanged(); } -const QQuaternion &GuiObject::ratation() const { - return _ratation; +const QQuaternion &GuiObject::rotation() const { + return _rotation; } -void GuiObject::setRatation(const QQuaternion &newRatation) { - if (_ratation == newRatation) +void GuiObject::setRotation(const QQuaternion &newRotation) { + if (_rotation == newRotation) return; - _ratation = newRatation; - emit ratationChanged(); + _rotation = newRotation; + emit rotationChanged(); } const QString &GuiObject::mash() const { diff --git a/src/Core/Crawl/guiobject.h b/src/Core/Crawl/guiobject.h index b307b27..df47721 100644 --- a/src/Core/Crawl/guiobject.h +++ b/src/Core/Crawl/guiobject.h @@ -30,7 +30,7 @@ namespace CRAWL { * * The gui objct contains base properties for drow objects on scane * * position - * * ratation + * * rotation * * mash * * and map textures * @@ -66,7 +66,7 @@ class CRAWL_EXPORT GuiObject: public QObject, virtual public IRender { Q_PROPERTY(QVector3D position READ position WRITE setposition NOTIFY positionChanged) Q_PROPERTY(QVector3D size READ size WRITE setSize NOTIFY sizeChanged) - Q_PROPERTY(QQuaternion ratation READ ratation WRITE setRatation NOTIFY ratationChanged) + Q_PROPERTY(QQuaternion rotation READ rotation WRITE setRotation NOTIFY rotationChanged) Q_PROPERTY(QString mash READ mash WRITE setMash NOTIFY mashChanged) @@ -133,8 +133,8 @@ public: const QVector3D &size() const; void setSize(const QVector3D &newSize); - const QQuaternion &ratation() const; - void setRatation(const QQuaternion &newRatation); + const QQuaternion &rotation() const; + void setRotation(const QQuaternion &newRotation); const QString &mash() const; void setMash(const QString &newMash); @@ -171,7 +171,7 @@ signals: void positionChanged(); void sizeChanged(); - void ratationChanged(); + void rotationChanged(); void mashChanged(); @@ -217,7 +217,7 @@ private: QVector3D _position; QVector3D _size; - QQuaternion _ratation; + QQuaternion _rotation; QString _mash; QString _className; bool _visible = true; diff --git a/src/Core/Crawl/iworld.cpp b/src/Core/Crawl/iworld.cpp index b991e52..995c55d 100644 --- a/src/Core/Crawl/iworld.cpp +++ b/src/Core/Crawl/iworld.cpp @@ -353,15 +353,15 @@ void IWorld::updateWorld() { } } -const QQuaternion &IWorld::cameraRatation() const { - return _cameraRatation; +const QQuaternion &IWorld::cameraRotation() const { + return _cameraRotation; } -void IWorld::setCameraRatation(const QQuaternion &newCameraRatation) { - if (_cameraRatation == newCameraRatation) +void IWorld::setCameraRotation(const QQuaternion &newCameraRotation) { + if (_cameraRotation == newCameraRotation) return; - _cameraRatation = newCameraRatation; - emit cameraRatationChanged(); + _cameraRotation = newCameraRotation; + emit cameraRotationChanged(); } IAI *IWorld::backgroundAI() const { diff --git a/src/Core/Crawl/iworld.h b/src/Core/Crawl/iworld.h index d6e0384..f6559f8 100644 --- a/src/Core/Crawl/iworld.h +++ b/src/Core/Crawl/iworld.h @@ -49,7 +49,7 @@ class CRAWL_EXPORT IWorld : public QObject, public IRender { Q_OBJECT Q_PROPERTY(QVector3D cameraReleativePosition READ cameraReleativePosition NOTIFY cameraReleativePositionChanged) - Q_PROPERTY(QQuaternion cameraRatation READ cameraRatation NOTIFY cameraRatationChanged) + Q_PROPERTY(QQuaternion cameraRotation READ cameraRotation NOTIFY cameraRotationChanged) Q_PROPERTY(QObject * player READ player WRITE setPlayer NOTIFY playerChanged) Q_PROPERTY(QString hdr READ hdr NOTIFY hdrChanged) @@ -210,10 +210,10 @@ public: IAI *backgroundAI() const; /** - * @brief cameraRatation This method return curent camera ratation. - * @return Quaternion of camera ratation + * @brief cameraRotation This method return curent camera rotation. + * @return Quaternion of camera rotation */ - const QQuaternion &cameraRatation() const; + const QQuaternion &cameraRotation() const; /** * @brief player This method return player object @@ -263,9 +263,9 @@ signals: void worldStatusChanged(); /** - * @brief cameraRatationChanged This method emited when ratation of the camera cahnged + * @brief cameraRotationChanged This method emited when rotation of the camera cahnged */ - void cameraRatationChanged(); + void cameraRotationChanged(); /** * @brief playerChanged This signal eited when player are changed. @@ -320,10 +320,10 @@ protected: void setCameraReleativePosition(const QVector3D &newCameraReleativePosition); /** - * @brief setCameraRatation This method sets new ratation of the camera. - * @param newCameraRatation new ratation of the camera. + * @brief setCameraRotation This method sets new rotation of the camera. + * @param newCameraRotation new rotation of the camera. */ - void setCameraRatation(const QQuaternion &newCameraRatation); + void setCameraRotation(const QQuaternion &newCameraRotation); /** * @brief targetFps This method return current targetFps; @@ -488,7 +488,7 @@ private: mutable QMutex _ItemsMutex; QVector3D _cameraReleativePosition; - QQuaternion _cameraRatation; + QQuaternion _cameraRotation; QString _hdrMap; WorldRule *_worldRules = nullptr; diff --git a/src/Core/Crawl/snakeitem.cpp b/src/Core/Crawl/snakeitem.cpp index e3b39e3..65ce3ef 100644 --- a/src/Core/Crawl/snakeitem.cpp +++ b/src/Core/Crawl/snakeitem.cpp @@ -27,15 +27,15 @@ void SnakeItem::render(unsigned int tbfMsec) { return; } - auto ratationVector = (_prevObject->position() - position()); + auto rotationVector = (_prevObject->position() - position()); if (auto claster = static_cast(parentClaster())) { - float ratationLength = ratationVector.length(); + float rotationLength = rotationVector.length(); - if (ratationLength > lengthBetwinItems() * 10) { + if (rotationLength > lengthBetwinItems() * 10) { setposition(_prevObject->position()); - } else if (ratationLength > lengthBetwinItems()) { - setMovableVector(ratationVector.normalized() * claster->currentMovableVector().length()); + } else if (rotationLength > lengthBetwinItems()) { + setMovableVector(rotationVector.normalized() * claster->currentMovableVector().length()); } } diff --git a/src/Core/CrawlModule/DayLight.qml b/src/Core/CrawlModule/DayLight.qml index 550a8d4..5fe77b8 100644 --- a/src/Core/CrawlModule/DayLight.qml +++ b/src/Core/CrawlModule/DayLight.qml @@ -34,7 +34,7 @@ Node { } } - rotation: (model)? model.ratation: Qt.quaternion(0, 0, 0, 0) + rotation: (model)? model.rotation: Qt.quaternion(0, 0, 0, 0) scale: (model)? model.size: Qt.vector3d(0, 0, 0); position: (model) ? model.position: Qt.vector3d(0,0,0); visible: sun.brightness diff --git a/src/Core/CrawlModule/GraphicItem.qml b/src/Core/CrawlModule/GraphicItem.qml index 0a447d1..af312be 100644 --- a/src/Core/CrawlModule/GraphicItem.qml +++ b/src/Core/CrawlModule/GraphicItem.qml @@ -65,7 +65,7 @@ Model { (fMapColor)? objMaterial: defaultMaterial ] - rotation: (model)? model.ratation: Qt.quaternion(0, 0, 0, 0) + rotation: (model)? model.rotation: Qt.quaternion(0, 0, 0, 0) scale: (model)? model.size: Qt.vector3d(0, 0, 0); source: (model)? model.mash: "#Cube"; position: (model) ? model.position: Qt.vector3d(0,0,0); diff --git a/src/Core/CrawlModule/Light.qml b/src/Core/CrawlModule/Light.qml index 4bc1d45..fbaec42 100644 --- a/src/Core/CrawlModule/Light.qml +++ b/src/Core/CrawlModule/Light.qml @@ -26,7 +26,7 @@ Node { } - rotation: (model)? model.ratation: Qt.quaternion(0, 0, 0, 0) + rotation: (model)? model.rotation: Qt.quaternion(0, 0, 0, 0) scale: (model)? model.size: Qt.vector3d(0, 0, 0); position: (model) ? model.position: Qt.vector3d(0,0,0); diff --git a/src/Core/CrawlModule/Scene.qml b/src/Core/CrawlModule/Scene.qml index 346e06c..c0eadf7 100644 --- a/src/Core/CrawlModule/Scene.qml +++ b/src/Core/CrawlModule/Scene.qml @@ -23,7 +23,7 @@ View3D { : Qt.vector3d(0,0,100) - rotation: (privateRoot.world)? privateRoot.world.cameraRatation: Qt.quaternion(0,0,0,0) + rotation: (privateRoot.world)? privateRoot.world.cameraRotation: Qt.quaternion(0,0,0,0) } diff --git a/src/Core/Extensions/basemotion.cpp b/src/Core/Extensions/basemotion.cpp index 2e7704c..14458b2 100644 --- a/src/Core/Extensions/basemotion.cpp +++ b/src/Core/Extensions/basemotion.cpp @@ -26,7 +26,7 @@ void BaseMotion::setStaticRotation(const QQuaternion &newStaticRotation) { void BaseMotion::render(unsigned int tbfMsec) { if (auto _this = checkminimumRequariedType()) { renderPosition(_this, tbfMsec); - renderRatation(_this, tbfMsec); + renderRotation(_this, tbfMsec); } } } diff --git a/src/Core/Extensions/basemotion.h b/src/Core/Extensions/basemotion.h index 73d0b50..2752458 100644 --- a/src/Core/Extensions/basemotion.h +++ b/src/Core/Extensions/basemotion.h @@ -21,7 +21,7 @@ class GuiObject; * @brief The BaseMotion class contains base functions of the motion. * For Create your own motion alghoritm you need to override two methods: * * renderPosition - * * renderRatation + * * renderRotation */ class CRAWL_EXPORT BaseMotion : public virtual IRender { @@ -49,14 +49,14 @@ public: protected: /** - * @brief renderRatation This method recalc raration for an @a object. The Default do nothing. + * @brief renderRotation This method recalc raration for an @a object. The Default do nothing. * @param object This is provessing object. Usually @a an object is casted pointer of this to GuiObject type. * @param tbfMsec This is time betwin frames argument. soame as in the IRender::render function. */ - virtual void renderRatation(GuiObject* object, unsigned int tbfMsec) = 0; + virtual void renderRotation(GuiObject* object, unsigned int tbfMsec) = 0; /** - * @brief renderRatation This method recalc position for an @a object. + * @brief renderRotation This method recalc position for an @a object. * @param object This is provessing object. Usually @a an object is casted pointer of this to GuiObject type. * @param tbfMsec This is time betwin frames argument. soame as in the IRender::render function. */ diff --git a/src/Core/Extensions/circularmotion.cpp b/src/Core/Extensions/circularmotion.cpp index 733d08e..c52197b 100644 --- a/src/Core/Extensions/circularmotion.cpp +++ b/src/Core/Extensions/circularmotion.cpp @@ -20,7 +20,7 @@ void CircularMotion::render(unsigned int tbfMsec) { if (auto _this = checkminimumRequariedType()) { renderPosition(_this, tbfMsec); - renderRatation(_this, tbfMsec); + renderRotation(_this, tbfMsec); } } @@ -56,9 +56,9 @@ void CircularMotion::setAnglePosition(double newAngle) { _angle = newAngle; } -void CircularMotion::renderRatation(GuiObject *object, +void CircularMotion::renderRotation(GuiObject *object, unsigned int ) { - object->setRatation(QQuaternion::rotationTo({1.0f, 0.0, 0.0}, *_center) * staticRotation()); + object->setRotation(QQuaternion::rotationTo({1.0f, 0.0, 0.0}, *_center) * staticRotation()); } void CircularMotion::renderPosition(GuiObject *object, diff --git a/src/Core/Extensions/circularmotion.h b/src/Core/Extensions/circularmotion.h index ac78b01..7c6b7a7 100644 --- a/src/Core/Extensions/circularmotion.h +++ b/src/Core/Extensions/circularmotion.h @@ -80,14 +80,14 @@ public: protected: /** - * @brief renderRatation This method recalc raration for an @a object. The Default implementation rotate object to center. + * @brief renderRotation This method recalc raration for an @a object. The Default implementation rotate object to center. * @param object This is provessing object. Usually @a an object is casted pointer of this to GuiObject type. * @param tbfMsec This is time betwin frames argument. soame as in the IRender::render function. */ - void renderRatation(GuiObject* object, unsigned int) override; + void renderRotation(GuiObject* object, unsigned int) override; /** - * @brief renderRatation This method recalc position for an @a object. The Default implementation move the current object around center. + * @brief renderRotation This method recalc position for an @a object. The Default implementation move the current object around center. * @param object This is provessing object. Usually @a an object is casted pointer of this to GuiObject type. * @param tbfMsec This is time betwin frames argument. soame as in the IRender::render function. */ diff --git a/src/Core/Extensions/movableobject.cpp b/src/Core/Extensions/movableobject.cpp index 18cd5e4..2c42ad1 100644 --- a/src/Core/Extensions/movableobject.cpp +++ b/src/Core/Extensions/movableobject.cpp @@ -21,7 +21,7 @@ void MovableObject::render(unsigned int tbfMsec) { if (auto _this = checkminimumRequariedType()) { renderPosition(_this, tbfMsec); - renderRatation(_this, tbfMsec); + renderRotation(_this, tbfMsec); } } @@ -49,9 +49,9 @@ void MovableObject::setBreakingForce(float newBreakingForce) { _breakingForce = newBreakingForce; } -void MovableObject::renderRatation(GuiObject *object, unsigned int) { +void MovableObject::renderRotation(GuiObject *object, unsigned int) { if (_currentMovableVector.length() > 0) { - object->setRatation(QQuaternion::rotationTo({1.0f, 0.0, 0.0}, _currentMovableVector) * staticRotation()); + object->setRotation(QQuaternion::rotationTo({1.0f, 0.0, 0.0}, _currentMovableVector) * staticRotation()); } } diff --git a/src/Core/Extensions/movableobject.h b/src/Core/Extensions/movableobject.h index 0691c72..bd23bd6 100644 --- a/src/Core/Extensions/movableobject.h +++ b/src/Core/Extensions/movableobject.h @@ -89,14 +89,14 @@ public: protected: /** - * @brief renderRatation This method recalc raration for an @a object. The Default implementation converts movableVector to ratation of an @a object. + * @brief renderRotation This method recalc raration for an @a object. The Default implementation converts movableVector to rotation of an @a object. * @param object This is provessing object. Usually @a an object is casted pointer of this to GuiObject type. * @param tbfMsec This is time betwin frames argument. soame as in the IRender::render function. */ - void renderRatation(GuiObject* object, unsigned int tbfMsec) override; + void renderRotation(GuiObject* object, unsigned int tbfMsec) override; /** - * @brief renderRatation This method recalc position for an @a object. The Default implementation move the current movable vector to setts movable vector. For example if you invoke the MovableObject::setMovableVector method then object change current movable vector with spead MovableObject::angularVelocity. If you sets + * @brief renderRotation This method recalc position for an @a object. The Default implementation move the current movable vector to setts movable vector. For example if you invoke the MovableObject::setMovableVector method then object change current movable vector with spead MovableObject::angularVelocity. If you sets * @param object This is provessing object. Usually @a an object is casted pointer of this to GuiObject type. * @param tbfMsec This is time betwin frames argument. soame as in the IRender::render function. */ diff --git a/src/CrawlAbstractLvl/private/abslvlcontrol.h b/src/CrawlAbstractLvl/private/abslvlcontrol.h index e44ff9f..875440e 100644 --- a/src/CrawlAbstractLvl/private/abslvlcontrol.h +++ b/src/CrawlAbstractLvl/private/abslvlcontrol.h @@ -12,7 +12,7 @@ namespace AbstractLvl { /** - * @brief The AbsLvlControl class This controll support custom camera-ratation functions. + * @brief The AbsLvlControl class This controll support custom camera-rotation functions. */ class AbsLvlControl: public CRAWL::DefaultControl { diff --git a/src/CrawlAbstractLvl/private/abslvlworld.cpp b/src/CrawlAbstractLvl/private/abslvlworld.cpp index 2fd1def..0e286c9 100644 --- a/src/CrawlAbstractLvl/private/abslvlworld.cpp +++ b/src/CrawlAbstractLvl/private/abslvlworld.cpp @@ -20,7 +20,7 @@ namespace AbstractLvl { AbsLvlWorld::AbsLvlWorld() { setCameraReleativePosition({20,0,100}); - setCameraRatation(QQuaternion::fromEulerAngles({0,0,0})); + setCameraRotation(QQuaternion::fromEulerAngles({0,0,0})); } CRAWL::IPlayer *AbsLvlWorld::initPlayer() const { diff --git a/src/CrawlTestLvl/private/box.cpp b/src/CrawlTestLvl/private/box.cpp index 491d739..1d49667 100644 --- a/src/CrawlTestLvl/private/box.cpp +++ b/src/CrawlTestLvl/private/box.cpp @@ -16,7 +16,7 @@ Box::Box(): IWorldItem("Box") { setSize({2,2,2}); setColor(QColor::fromRgb(rand()).name()); - setRatation(QQuaternion::fromEulerAngles( + setRotation(QQuaternion::fromEulerAngles( rand() % 360 , rand() % 360, rand() % 360)); diff --git a/src/CrawlTestLvl/private/testcontrol.h b/src/CrawlTestLvl/private/testcontrol.h index 59a6fba..589f3b7 100644 --- a/src/CrawlTestLvl/private/testcontrol.h +++ b/src/CrawlTestLvl/private/testcontrol.h @@ -12,7 +12,7 @@ namespace TestLvl { /** - * @brief The TestControl class This controll support custom camera-ratation functions. + * @brief The TestControl class This controll support custom camera-rotation functions. */ class TestControl: public CRAWL::DefaultControl { diff --git a/src/CrawlTestLvl/private/world.cpp b/src/CrawlTestLvl/private/world.cpp index 5ff8f03..5d45fad 100644 --- a/src/CrawlTestLvl/private/world.cpp +++ b/src/CrawlTestLvl/private/world.cpp @@ -22,7 +22,7 @@ namespace TestLvl { World::World() { setCameraReleativePosition({50,0,100}); - setCameraRatation(QQuaternion::fromEulerAngles({0,0,0})); + setCameraRotation(QQuaternion::fromEulerAngles({0,0,0})); } CRAWL::WorldRule *World::initWorldRules() { @@ -77,14 +77,14 @@ CRAWL::IAI *World::initBackGroundAI() const { } void World::handleXViewChanged(double dx) { - auto eilorRatation = cameraRatation().toEulerAngles(); - eilorRatation.setX(eilorRatation.x() + dx); - setCameraRatation(QQuaternion::fromEulerAngles(eilorRatation)); + auto eilorRotation = cameraRotation().toEulerAngles(); + eilorRotation.setX(eilorRotation.x() + dx); + setCameraRotation(QQuaternion::fromEulerAngles(eilorRotation)); } void World::handleYViewChanged(double dy) { - auto eilorRatation = cameraRatation().toEulerAngles(); - eilorRatation.setY(eilorRatation.y() + dy ); - setCameraRatation(QQuaternion::fromEulerAngles(eilorRatation)); + auto eilorRotation = cameraRotation().toEulerAngles(); + eilorRotation.setY(eilorRotation.y() + dy ); + setCameraRotation(QQuaternion::fromEulerAngles(eilorRotation)); } } diff --git a/src/JungleLvl/private/egg.cpp b/src/JungleLvl/private/egg.cpp index ed558e0..35f1485 100644 --- a/src/JungleLvl/private/egg.cpp +++ b/src/JungleLvl/private/egg.cpp @@ -18,7 +18,7 @@ Egg::Egg(const QString name): CRAWL::IWorldItem(name) setMash(mashes[rand() % mashes.size()]); setSize({1,1,1}); - setRatation(QQuaternion::fromEulerAngles({0,0, static_cast(rand() % 360)})); + setRotation(QQuaternion::fromEulerAngles({0,0, static_cast(rand() % 360)})); } void Egg::onIntersects(const IWorldItem *) { diff --git a/src/JungleLvl/private/grees.cpp b/src/JungleLvl/private/grees.cpp index d449234..67a2457 100644 --- a/src/JungleLvl/private/grees.cpp +++ b/src/JungleLvl/private/grees.cpp @@ -13,7 +13,7 @@ Grees::Grees(): CRAWL::IWorldItem(AUTO_CLASS_NAME) { setMash("qrc:/mesh/meshes/Plant/Grass.mesh"); setBaseColorMap("qrc:/mesh/meshes/Plant/Grass_Base.jpg"); setSize({1,1,1}); - setRatation(QQuaternion::fromEulerAngles({0,0, static_cast(rand() % 360)})); + setRotation(QQuaternion::fromEulerAngles({0,0, static_cast(rand() % 360)})); } diff --git a/src/JungleLvl/private/ivy.cpp b/src/JungleLvl/private/ivy.cpp index e355dc8..34963ea 100644 --- a/src/JungleLvl/private/ivy.cpp +++ b/src/JungleLvl/private/ivy.cpp @@ -18,7 +18,7 @@ Ivy::Ivy(): CRAWL::IWorldItem(AUTO_CLASS_NAME) { setBaseColorMap("qrc:/mesh/meshes/Plant/Ivy_Base.jpg"); setSize({1,1,1}); - setRatation(QQuaternion::fromEulerAngles({0,0, static_cast(rand() % 360)})); + setRotation(QQuaternion::fromEulerAngles({0,0, static_cast(rand() % 360)})); } void Ivy::onIntersects(const IWorldItem *) { diff --git a/src/JungleLvl/private/longgress.cpp b/src/JungleLvl/private/longgress.cpp index b21c59c..06fc34b 100644 --- a/src/JungleLvl/private/longgress.cpp +++ b/src/JungleLvl/private/longgress.cpp @@ -12,7 +12,7 @@ LongGress::LongGress(): CRAWL::IWorldItem(AUTO_CLASS_NAME) { setMash("qrc:/mesh/meshes/Plant/Long_grass.mesh"); setBaseColorMap("qrc:/mesh/meshes/Plant/LongGrass_Base.jpg"); setSize({1,1,1}); - setRatation(QQuaternion::fromEulerAngles({0,0, static_cast(rand() % 360)})); + setRotation(QQuaternion::fromEulerAngles({0,0, static_cast(rand() % 360)})); } void LongGress::onIntersects(const IWorldItem *) { diff --git a/src/JungleLvl/private/plant.cpp b/src/JungleLvl/private/plant.cpp index 909555b..d95ee8b 100644 --- a/src/JungleLvl/private/plant.cpp +++ b/src/JungleLvl/private/plant.cpp @@ -20,7 +20,7 @@ Plant::Plant(): CRAWL::IWorldItem(AUTO_CLASS_NAME) { setBaseColorMap("qrc:/mesh/meshes/Plant/Plant_Base.jpg"); setSize({1,1,1}); - setRatation(QQuaternion::fromEulerAngles({0,0, static_cast(rand() % 360)})); + setRotation(QQuaternion::fromEulerAngles({0,0, static_cast(rand() % 360)})); } void Plant::onIntersects(const IWorldItem *) { diff --git a/src/JungleLvl/private/stone.cpp b/src/JungleLvl/private/stone.cpp index b20a37a..b822f5f 100644 --- a/src/JungleLvl/private/stone.cpp +++ b/src/JungleLvl/private/stone.cpp @@ -25,7 +25,7 @@ Stone::Stone(): CRAWL::IWorldItem(AUTO_CLASS_NAME) setNormalMap("qrc:/mesh/meshes/Stone/Stone_Normal.jpg"); setSize({1,1,1}); - setRatation(QQuaternion::fromEulerAngles({0,0, static_cast(rand() % 360)})); + setRotation(QQuaternion::fromEulerAngles({0,0, static_cast(rand() % 360)})); } void Stone::onIntersects(const IWorldItem *) { diff --git a/src/JungleLvl/private/tree.cpp b/src/JungleLvl/private/tree.cpp index 50647be..5e6fa45 100644 --- a/src/JungleLvl/private/tree.cpp +++ b/src/JungleLvl/private/tree.cpp @@ -23,7 +23,7 @@ Tree::Tree(): CRAWL::IWorldItem(AUTO_CLASS_NAME) { setMash(mashes[rand() % mashes.size()]); setBaseColorMap("qrc:/mesh/meshes/Plant/Tree_Base.jpg"); setSize({1,1,1}); - setRatation(QQuaternion::fromEulerAngles({static_cast(rand() % 60 - 30), + setRotation(QQuaternion::fromEulerAngles({static_cast(rand() % 60 - 30), static_cast(rand() % 60 - 30), static_cast(rand() % 360)})); diff --git a/src/JungleLvl/private/wood.cpp b/src/JungleLvl/private/wood.cpp index 8b1906a..fea73ed 100644 --- a/src/JungleLvl/private/wood.cpp +++ b/src/JungleLvl/private/wood.cpp @@ -28,7 +28,7 @@ Wood::Wood(): CRAWL::IWorldItem(AUTO_CLASS_NAME) { setNormalMap("qrc:/mesh/meshes/Wood/Wood_Normal.jpg"); setRoughnessMap("qrc:/mesh/meshes/Wood/Wood_Roughness.jpg"); setSize({1,1,1}); - setRatation(QQuaternion::fromEulerAngles({0,0, static_cast(rand() % 360)})); + setRotation(QQuaternion::fromEulerAngles({0,0, static_cast(rand() % 360)})); } void Wood::onIntersects(const IWorldItem *) { diff --git a/src/JungleLvl/private/world.cpp b/src/JungleLvl/private/world.cpp index 8a462ba..62db223 100644 --- a/src/JungleLvl/private/world.cpp +++ b/src/JungleLvl/private/world.cpp @@ -30,7 +30,7 @@ namespace JungleLvl { World::World() { setCameraReleativePosition({50,0,100}); - setCameraRatation(QQuaternion::fromEulerAngles({0,0,0})); + setCameraRotation(QQuaternion::fromEulerAngles({0,0,0})); } CRAWL::WorldRule *World::initWorldRules() { @@ -117,15 +117,15 @@ CRAWL::IAI *World::initBackGroundAI() const { } void World::handleXViewChanged(double dx) { - auto eilorRatation = cameraRatation().toEulerAngles(); - eilorRatation.setX(eilorRatation.x() + dx); - setCameraRatation(QQuaternion::fromEulerAngles(eilorRatation)); + auto eilorRotation = cameraRotation().toEulerAngles(); + eilorRotation.setX(eilorRotation.x() + dx); + setCameraRotation(QQuaternion::fromEulerAngles(eilorRotation)); } void World::handleYViewChanged(double dy) { - auto eilorRatation = cameraRatation().toEulerAngles(); - eilorRatation.setY(eilorRatation.y() + dy ); - setCameraRatation(QQuaternion::fromEulerAngles(eilorRatation)); + auto eilorRotation = cameraRotation().toEulerAngles(); + eilorRotation.setY(eilorRotation.y() + dy ); + setCameraRotation(QQuaternion::fromEulerAngles(eilorRotation)); } } diff --git a/tests/tstMain.cpp b/tests/tstMain.cpp index fca3ef9..9645aaa 100644 --- a/tests/tstMain.cpp +++ b/tests/tstMain.cpp @@ -7,6 +7,7 @@ #include #include "clasterstest.h" +#include "groupobjecttest.h" // Use This macros for initialize your own test classes. // Check exampletests @@ -33,6 +34,7 @@ private slots: // BEGIN TESTS CASES TestCase(clastersTest, ClastersTest) + TestCase(groupObjectTest, GroupObjectTest) // END TEST CASES diff --git a/tests/units/groupobjecttest.cpp b/tests/units/groupobjecttest.cpp new file mode 100644 index 0000000..c79f31d --- /dev/null +++ b/tests/units/groupobjecttest.cpp @@ -0,0 +1,95 @@ +//# +//# Copyright (C) 2021-2021 QuasarApp. +//# Distributed under the GPLv3 software license, see the accompanying +//# Everyone is permitted to copy and distribute verbatim copies +//# of this license document, but changing it is not allowed. +//# + + +#include "groupobjecttest.h" +#include "Crawl/groupobject.h" + +#include + +class TestGroupObject: public CRAWL::IWorldItem, public CRAWL::GroupObject { + +public: + + // IWorldItem interface + TestGroupObject(): CRAWL::IWorldItem(AUTO_CLASS_NAME) { + + } +protected: + void onIntersects(const IWorldItem *) override {}; + + // IRender interface + void render(unsigned int tbfMsec) override { + GroupObject::render(tbfMsec); + }; + + void init() override {}; + + friend GroupObjectTest; +}; + +class TestGroupObjectItem: public CRAWL::ClasterItem { + +public: + // IWorldItem interface + + TestGroupObjectItem(): CRAWL::ClasterItem(AUTO_CLASS_NAME) { + + } +protected: + void onIntersects(const IWorldItem *) override {}; +}; + +GroupObjectTest::GroupObjectTest() { + +} + +void GroupObjectTest::test() { + testBehavior(); +} + +void GroupObjectTest::testBehavior() const { + TestGroupObject object; + TestGroupObjectItem item; + + object.setposition({100, 100, 0}); + object.setRotation(QQuaternion::fromEulerAngles(100,0,0)); + + object.installObject(&item); + + // check if added object after install into claster or not + QVERIFY(object.objects().size() == 1); + + // The rotation and position of the main and child classes should be defferent + QVERIFY(item.position() != object.position()); + QVERIFY(item.rotation() != object.rotation()); + + object.render(0); + + // after invoke the render function all positions and rotations should be changed + QVERIFY(item.position() == object.position()); + QVERIFY(item.rotation() == object.rotation()); + + QVector3D localPosition = {10,0,0}; + QQuaternion localRotation = QQuaternion::fromEulerAngles(0,5,0); + + object.updatePosition(item.guiId(), localPosition); + object.updateRotation(item.guiId(), localRotation); + + object.render(0); + + // after invoke the render function all positions and rotations should be changed + QVERIFY(item.position() == (object.position() + localPosition)); + QVERIFY(item.rotation() == (object.rotation() * localRotation)); + + + object.remove(&item); + + QVERIFY(object.objects().size() == 0); + + +} diff --git a/tests/units/groupobjecttest.h b/tests/units/groupobjecttest.h new file mode 100644 index 0000000..04b9efa --- /dev/null +++ b/tests/units/groupobjecttest.h @@ -0,0 +1,31 @@ +//# +//# Copyright (C) 2021-2021 QuasarApp. +//# Distributed under the GPLv3 software license, see the accompanying +//# Everyone is permitted to copy and distribute verbatim copies +//# of this license document, but changing it is not allowed. +//# + +#include "test.h" +#include "testutils.h" + + +#ifndef GROUPOBJECTTEST_H +#define GROUPOBJECTTEST_H + +/** + * @brief The GroupObjectTest class will be tests the CRAWL::GroupObject class from the core library. + */ +class GroupObjectTest: public Test, protected TestUtils +{ +public: + GroupObjectTest(); + void test(); + +private: + /** + * @brief testBehavior This method check the install objects on the main object. + */ + void testBehavior() const; +}; + +#endif // GROUPOBJECTTEST_H diff --git a/tests/units/test.h b/tests/units/test.h index 6ff83d9..bd677f3 100644 --- a/tests/units/test.h +++ b/tests/units/test.h @@ -5,6 +5,7 @@ //# of this license document, but changing it is not allowed. //# +#include #ifndef TEST_H #define TEST_H