ref #79 Added abstract level namespace, load new obj mesh.

This commit is contained in:
IgorekLoschinin 2021-07-24 17:38:10 +03:00
parent a0e96f3f53
commit 705486f2f2
19 changed files with 110 additions and 27 deletions

View File

@ -10,7 +10,7 @@
#include <QQmlContext>
#include <Crawl/clientapp.h>
#include <testlevel.h>
#include <abstractlvl.h>
#include <abstractlevel.h>
#include <quasarapp.h>
#include <jungle.h>
@ -43,7 +43,7 @@ int main(int argc, char *argv[])
client.registerLevel<TestLevel>();
#endif
client.registerLevel<AbstractLvl>();
client.registerLevel<AbstractLevel>();
client.registerLevel<Jungle>();
if (!client.init(&engine)) {

@ -1 +1 @@
Subproject commit 07295d0e4ea37e7e17b1eca717b6ab6d1f5c8c60
Subproject commit f6554cb8c46e82f876961a0be781f06de42b0034

View File

@ -5,14 +5,14 @@
//# of this license document, but changing it is not allowed.
//#
#include "abstractlvl.h"
#include "abstractlevel.h"
#include "abslvlworld.h"
AbstractLvl::AbstractLvl() {
AbstractLevel::AbstractLevel() {
}
CRAWL::IWorld *AbstractLvl::world() {
CRAWL::IWorld *AbstractLevel::world() {
initAbstractLvlResources();
return new AbsLvlWorld();
return new AbstractLvl::AbsLvlWorld();
}

View File

@ -5,24 +5,24 @@
//# of this license document, but changing it is not allowed.
//#
#ifndef ABSTRACTLVL_H
#define ABSTRACTLVL_H
#ifndef ABSTRACTLEVEL_H
#define ABSTRACTLEVEL_H
#include <Crawl/ilevel.h>
#include "abstractlvl_global.h"
inline void initAbstractLvlResources() { Q_INIT_RESOURCE(AbstractLvl);
inline void initAbstractLvlResources() { Q_INIT_RESOURCE(abstractLevel);
Q_INIT_RESOURCE(absLvlRes);}
/**
* @brief The AbstractLvl class This is test lvlv wraper of the crawl
*/
class CRAWL_ABSTRACT_LEVEL_EXPORT AbstractLvl: public CRAWL::ILevel {
class CRAWL_ABSTRACT_LEVEL_EXPORT AbstractLevel: public CRAWL::ILevel {
public:
AbstractLvl();
AbstractLevel();
// ILevel interface
public:
CRAWL::IWorld *world() override;
};
#endif // ABSTRACTLVL_H
#endif // ABSTRACTLEVEL_H

View File

@ -7,6 +7,8 @@
#include "abslvlcontrol.h"
namespace AbstractLvl {
AbsLvlControl::AbsLvlControl() {
}
@ -14,3 +16,5 @@ AbsLvlControl::AbsLvlControl() {
QString AbsLvlControl::initQmlView() const {
return "qrc:/qml/AbsLvlControl.qml";
}
}

View File

@ -9,6 +9,8 @@
#define ABSLVLCONTROL_H
#include "Crawl/defaultcontrol.h"
namespace AbstractLvl {
/**
* @brief The AbsLvlControl class This controll support custom camera-ratation functions.
*/
@ -21,4 +23,6 @@ public:
};
}
#endif // ABSLVLCONTROL_H

View File

@ -8,12 +8,24 @@
#include "abslvlsnake.h"
#include "abslvlsnakeitem.h"
AbsLvlSnake::AbsLvlSnake(): Snake("Snake") {
namespace AbstractLvl {
AbsLvlSnake::AbsLvlSnake(): Snake(AUTO_CLASS_NAME) {
setBreakingForce(50);
setAngularVelocity(100);
setColor("#90faaa");
setMash("qrc:/mesh/meshes/SnakePatternHead.mesh");
setSize({2,1,1});
setStaticRotation(QQuaternion::fromEulerAngles(0,0,90));
setSize({1,1,1});
setScales({{0, 0.9},
{0.6, 1},
{1, 0.5}});
setLengthBetwinItemsMap({{0, 3},
{0.001, 0.9},
{0.6, 1},
{1, 0.5}});
registerItemType<AbsLvlSnakeItem>();
}
@ -21,3 +33,5 @@ AbsLvlSnake::AbsLvlSnake(): Snake("Snake") {
void AbsLvlSnake::onIntersects(const IWorldItem *item) {
Q_UNUSED(item);
}
}

View File

@ -10,6 +10,8 @@
#include "Crawl/snake.h"
namespace AbstractLvl {
class AbsLvlSnake : public CRAWL::Snake {
Q_OBJECT
@ -23,4 +25,6 @@ protected:
};
}
#endif // ABSLVLSNAKE_H

View File

@ -7,7 +7,9 @@
#include "abslvlsnakeitem.h"
AbsLvlSnakeItem::AbsLvlSnakeItem():CRAWL::SnakeItem("AbstractSnakeItem") {
namespace AbstractLvl {
AbsLvlSnakeItem::AbsLvlSnakeItem():CRAWL::SnakeItem(AUTO_CLASS_NAME) {
setMash("qrc:/mesh/meshes/SnakePatternBody.mesh");
setColor("#20aa9a");
setSize({1,1,1});
@ -17,3 +19,5 @@ void AbsLvlSnakeItem::onIntersects(const IWorldItem *item) {
Q_UNUSED(item);
}
}

View File

@ -10,6 +10,8 @@
#include "Crawl/snakeitem.h"
namespace AbstractLvl {
class AbsLvlSnakeItem: public CRAWL::SnakeItem {
Q_OBJECT
@ -22,4 +24,6 @@ protected:
void onIntersects(const IWorldItem *item) override;
};
}
#endif // ABSLVLSNAKEITEM_H

View File

@ -13,9 +13,10 @@
#include <abslvlsnake.h>
#include "Crawl/iworlditem.h"
namespace AbstractLvl {
AbsLvlWorld::AbsLvlWorld() {
setCameraReleativePosition({50,0,100});
setCameraReleativePosition({50,0,150});
setCameraRatation(QQuaternion::fromEulerAngles({0,0,0}));
}
@ -25,14 +26,30 @@ CRAWL::IPlayer *AbsLvlWorld::initPlayer() const {
CRAWL::WorldRule *AbsLvlWorld::initWorldRules() {
return new CRAWL::WorldRule {
{10, {{registerObject<Baff>(), 1}}},
{10, {{registerObject<ObstacleBlue>(), 1}}},
{10, {{registerObject<ObstacleRed>(), 1}}}
{0,
{
{registerObject<Baff>(), 1}
}
},
{200,
{
{registerObject<ObstacleBlue>(), 1}
}
},
{300,
{
{registerObject<ObstacleRed>(), 4}
}
}
};
}
QString AbsLvlWorld::initHdrBackGround() const {
return "qrc:/hdr/hdr/plate_absLvl.hdr";
return "qrc:/hdr/hdr/testHDR.hdr";
}
QString AbsLvlWorld::description() const {
@ -59,3 +76,5 @@ CRAWL::IControl *AbsLvlWorld::initUserInterface() const {
void AbsLvlWorld::initPlayerControl(CRAWL::IControl *control) {
return IWorld::initPlayerControl(control);
}
}

View File

@ -10,6 +10,8 @@
#include "Crawl/iworld.h"
namespace AbstractLvl {
class AbsLvlWorld : public CRAWL::IWorld {
// IWorld interface
@ -29,4 +31,6 @@ public:
};
}
#endif // ABSLEVELWORLD_H

View File

@ -7,12 +7,18 @@
#include "baff.h"
Baff::Baff() : IWorldItem("Baff") {
namespace AbstractLvl {
Baff::Baff() : IWorldItem(AUTO_CLASS_NAME) {
setMash("qrc:/mesh/meshes/Baff.mesh");
setSize({1,1,1});
setSize({2,2,2});
setColor("#00ff00");
setposition({200, 0, 200});
setZ(0);
}
void Baff::onIntersects(const IWorldItem *item) {
Q_UNUSED(item);
}
}

View File

@ -9,6 +9,7 @@
#define OBJBAFF_H
#include "Crawl/iworlditem.h"
namespace AbstractLvl {
class Baff: public CRAWL::IWorldItem {
public:
@ -19,4 +20,6 @@ protected:
void onIntersects(const IWorldItem *item) override;
};
}
#endif // OBJBAFF_H

View File

@ -6,13 +6,18 @@
//#
#include "obstacleblue.h"
namespace AbstractLvl {
ObstacleBlue::ObstacleBlue() : IWorldItem("OstacleBlue") {
ObstacleBlue::ObstacleBlue() : IWorldItem(AUTO_CLASS_NAME) {
setMash("qrc:/mesh/meshes/ObstacleBlue.mesh");
setSize({1,1,1});
setSize({2,2,2});
setColor("#00bfff");
setposition({250, 0, 200});
setZ(0);
}
void ObstacleBlue::onIntersects(const IWorldItem *item) {
Q_UNUSED(item);
}
}

View File

@ -9,6 +9,7 @@
#define OBJOBSTACLEBLUE_H
#include "Crawl/iworlditem.h"
namespace AbstractLvl {
class ObstacleBlue: public CRAWL::IWorldItem {
public:
@ -19,4 +20,6 @@ protected:
void onIntersects(const IWorldItem *item) override;
};
}
#endif // OBJOBSTACLEBLUE_H

View File

@ -7,12 +7,18 @@
#include "obstaclered.h"
ObstacleRed::ObstacleRed() : IWorldItem("ObstacleRed") {
namespace AbstractLvl {
ObstacleRed::ObstacleRed() : IWorldItem(AUTO_CLASS_NAME) {
setMash("qrc:/mesh/meshes/ObstacleRed.mesh");
setSize({1,1,1});
setSize({2,2,2});
setColor("#ff1927");
setposition({300, 0, 200});
setZ(0);
}
void ObstacleRed::onIntersects(const IWorldItem *item) {
Q_UNUSED(item);
}
}

View File

@ -9,6 +9,7 @@
#define OBJOBSTACLERED_H
#include "Crawl/iworlditem.h"
namespace AbstractLvl {
class ObstacleRed: public CRAWL::IWorldItem {
public:
@ -19,4 +20,6 @@ protected:
void onIntersects(const IWorldItem *item) override;
};
}
#endif // OBJOBSTACLERED_H