Refactored Math::Vector to glm::vec3 in object task classes

dev
Tomasz Kapuściński 2022-01-04 01:18:46 +01:00
parent ffe1815ec9
commit d5e8cfd4ba
25 changed files with 213 additions and 213 deletions

View File

@ -97,7 +97,7 @@ Error CTaskAdvance::Start(float length)
Error CTaskAdvance::IsEnded() Error CTaskAdvance::IsEnded()
{ {
Math::Vector pos; glm::vec3 pos;
float length; float length;
if ( m_engine->GetPause() ) return ERR_CONTINUE; if ( m_engine->GetPause() ) return ERR_CONTINUE;

View File

@ -42,7 +42,7 @@ protected:
float m_advanceLength = 0.0f; float m_advanceLength = 0.0f;
float m_direction = 0.0f; float m_direction = 0.0f;
float m_timeLimit = 0.0f; float m_timeLimit = 0.0f;
Math::Vector m_startPos; glm::vec3 m_startPos = { 0, 0, 0 };
float m_lastDist = 0.0f; float m_lastDist = 0.0f;
float m_fixTime = 0.0f; float m_fixTime = 0.0f;
bool m_bError = false; bool m_bError = false;

View File

@ -86,7 +86,7 @@ CTaskBuild::~CTaskBuild()
// Creates a building. // Creates a building.
void CTaskBuild::CreateBuilding(Math::Vector pos, float angle, bool trainer) void CTaskBuild::CreateBuilding(glm::vec3 pos, float angle, bool trainer)
{ {
ObjectCreateParams params; ObjectCreateParams params;
params.pos = pos; params.pos = pos;
@ -126,7 +126,7 @@ void CTaskBuild::CreateBuilding(Math::Vector pos, float angle, bool trainer)
void CTaskBuild::CreateLight() void CTaskBuild::CreateLight()
{ {
Gfx::Color color; Gfx::Color color;
Math::Vector center, pos, dir; glm::vec3 center, pos, dir;
glm::vec2 c, p; glm::vec2 c, p;
float angle; float angle;
int i; int i;
@ -204,7 +204,7 @@ void CTaskBuild::BlackLight()
bool CTaskBuild::EventProcess(const Event &event) bool CTaskBuild::EventProcess(const Event &event)
{ {
Math::Matrix* mat; Math::Matrix* mat;
Math::Vector pos, dir, speed, pv, pm, tilt; glm::vec3 pos, dir, speed, pv, pm, tilt;
glm::vec2 dim; glm::vec2 dim;
float a, g, cirSpeed, dist, linSpeed, diff; float a, g, cirSpeed, dist, linSpeed, diff;
@ -324,7 +324,7 @@ bool CTaskBuild::EventProcess(const Event &event)
dim.y = dim.x; dim.y = dim.x;
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIFIRE); m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIFIRE);
pos = Math::Vector(0.0f, 0.5f, 0.0f); pos = glm::vec3(0.0f, 0.5f, 0.0f);
switch(m_object->GetType()) switch(m_object->GetType())
{ {
case OBJECT_HUMAN: case OBJECT_HUMAN:
@ -376,7 +376,7 @@ bool CTaskBuild::EventProcess(const Event &event)
Error CTaskBuild::Start(ObjectType type) Error CTaskBuild::Start(ObjectType type)
{ {
Math::Vector pos, speed, pv, pm; glm::vec3 pos, speed, pv, pm;
Error err; Error err;
float iAngle, oAngle; float iAngle, oAngle;
@ -439,7 +439,7 @@ Error CTaskBuild::IsEnded()
{ {
CAuto* automat; CAuto* automat;
float angle, dist, time, diff; float angle, dist, time, diff;
Math::Vector pv, pm, tilt; glm::vec3 pv, pm, tilt;
if ( m_engine->GetPause() ) return ERR_CONTINUE; if ( m_engine->GetPause() ) return ERR_CONTINUE;
if ( m_bError ) return ERR_STOP; if ( m_bError ) return ERR_STOP;
@ -515,7 +515,7 @@ Error CTaskBuild::IsEnded()
if (m_object->GetType() == OBJECT_HUMAN) if (m_object->GetType() == OBJECT_HUMAN)
{ {
m_object->SetObjectParent(14, 4); m_object->SetObjectParent(14, 4);
m_object->SetPartPosition(14, Math::Vector(0.6f, 0.1f, 0.3f)); m_object->SetPartPosition(14, glm::vec3(0.6f, 0.1f, 0.3f));
m_object->SetPartRotationZ(14, 0.0f); m_object->SetPartRotationZ(14, 0.0f);
} }
if (m_object->GetType() == OBJECT_MOBILEfb || if (m_object->GetType() == OBJECT_MOBILEfb ||
@ -563,7 +563,7 @@ Error CTaskBuild::IsEnded()
m_metal = nullptr; m_metal = nullptr;
m_building->SetScale(1.0f); m_building->SetScale(1.0f);
m_building->SetCirVibration(Math::Vector(0.0f, 0.0f, 0.0f)); m_building->SetCirVibration(glm::vec3(0.0f, 0.0f, 0.0f));
m_building->SetLock(false); // building usable m_building->SetLock(false); // building usable
m_main->CreateShortcuts(); m_main->CreateShortcuts();
m_main->DisplayError(INFO_BUILD, m_buildingPos, 10.0f, 50.0f); m_main->DisplayError(INFO_BUILD, m_buildingPos, 10.0f, 50.0f);
@ -588,7 +588,7 @@ Error CTaskBuild::IsEnded()
if (m_object->GetType() == OBJECT_HUMAN) if (m_object->GetType() == OBJECT_HUMAN)
{ {
m_object->SetObjectParent(14, 0); m_object->SetObjectParent(14, 0);
m_object->SetPartPosition(14, Math::Vector(-1.5f, 0.3f, -1.35f)); m_object->SetPartPosition(14, glm::vec3(-1.5f, 0.3f, -1.35f));
m_object->SetPartRotationZ(14, Math::PI); m_object->SetPartRotationZ(14, Math::PI);
} }
else else
@ -628,7 +628,7 @@ Error CTaskBuild::IsEnded()
// Place gun back // Place gun back
m_object->SetObjectParent(14, 0); m_object->SetObjectParent(14, 0);
m_object->SetPartPosition(14, Math::Vector(-1.5f, 0.3f, -1.35f)); m_object->SetPartPosition(14, glm::vec3(-1.5f, 0.3f, -1.35f));
m_object->SetPartRotationZ(14, Math::PI); m_object->SetPartRotationZ(14, Math::PI);
m_physics->SetMotorSpeedX(0.0f); m_physics->SetMotorSpeedX(0.0f);
@ -664,7 +664,7 @@ bool CTaskBuild::Abort()
Error CTaskBuild::FlatFloor() Error CTaskBuild::FlatFloor()
{ {
ObjectType type; ObjectType type;
Math::Vector center, pos, bPos; glm::vec3 center, pos, bPos;
glm::vec2 c, p; glm::vec2 c, p;
float radius, max, bRadius = 0.0f, angle, dist; float radius, max, bRadius = 0.0f, angle, dist;
bool bLittleFlat, bBase; bool bLittleFlat, bBase;
@ -713,7 +713,7 @@ Error CTaskBuild::FlatFloor()
type = pObj->GetType(); type = pObj->GetType();
if ( type == OBJECT_BASE ) if ( type == OBJECT_BASE )
{ {
Math::Vector oPos = pObj->GetPosition(); glm::vec3 oPos = pObj->GetPosition();
dist = Math::Distance(center, oPos)-80.0f; dist = Math::Distance(center, oPos)-80.0f;
if ( dist < max ) if ( dist < max )
{ {
@ -727,7 +727,7 @@ Error CTaskBuild::FlatFloor()
{ {
for (const auto& crashSphere : pObj->GetAllCrashSpheres()) for (const auto& crashSphere : pObj->GetAllCrashSpheres())
{ {
Math::Vector oPos = crashSphere.sphere.pos; glm::vec3 oPos = crashSphere.sphere.pos;
float oRadius = crashSphere.sphere.radius; float oRadius = crashSphere.sphere.radius;
dist = Math::Distance(center, oPos)-oRadius; dist = Math::Distance(center, oPos)-oRadius;
@ -779,7 +779,7 @@ Error CTaskBuild::FlatFloor()
{ {
for (const auto& crashSphere : pObj->GetAllCrashSpheres()) for (const auto& crashSphere : pObj->GetAllCrashSpheres())
{ {
Math::Vector oPos = crashSphere.sphere.pos; glm::vec3 oPos = crashSphere.sphere.pos;
float oRadius = crashSphere.sphere.radius; float oRadius = crashSphere.sphere.radius;
dist = Math::Distance(center, oPos)-oRadius; dist = Math::Distance(center, oPos)-oRadius;
@ -808,7 +808,7 @@ CObject* CTaskBuild::SearchMetalObject(float &angle, float dMin, float dMax,
float aLimit, Error &err) float aLimit, Error &err)
{ {
CObject *pBest; CObject *pBest;
Math::Vector iPos, oPos; glm::vec3 iPos, oPos;
ObjectType type; ObjectType type;
float min, iAngle, a, aa, aBest, distance, magic; float min, iAngle, a, aa, aBest, distance, magic;
bool bMetal; bool bMetal;
@ -870,7 +870,7 @@ CObject* CTaskBuild::SearchMetalObject(float &angle, float dMin, float dMax,
// Destroys all the close marks. // Destroys all the close marks.
void CTaskBuild::DeleteMark(Math::Vector pos, float radius) void CTaskBuild::DeleteMark(glm::vec3 pos, float radius)
{ {
std::vector<CObject*> objectsToDelete; std::vector<CObject*> objectsToDelete;
@ -885,7 +885,7 @@ void CTaskBuild::DeleteMark(Math::Vector pos, float radius)
type != OBJECT_MARKKEYd && type != OBJECT_MARKKEYd &&
type != OBJECT_MARKPOWER ) continue; type != OBJECT_MARKPOWER ) continue;
Math::Vector oPos = obj->GetPosition(); glm::vec3 oPos = obj->GetPosition();
float distance = Math::Distance(oPos, pos); float distance = Math::Distance(oPos, pos);
if ( distance <= radius ) if ( distance <= radius )
{ {

View File

@ -61,11 +61,11 @@ public:
protected: protected:
Error FlatFloor(); Error FlatFloor();
void CreateBuilding(Math::Vector pos, float angle, bool trainer); void CreateBuilding(glm::vec3 pos, float angle, bool trainer);
void CreateLight(); void CreateLight();
void BlackLight(); void BlackLight();
CObject* SearchMetalObject(float &angle, float dMin, float dMax, float aLimit, Error &err); CObject* SearchMetalObject(float &angle, float dMin, float dMax, float aLimit, Error &err);
void DeleteMark(Math::Vector pos, float radius); void DeleteMark(glm::vec3 pos, float radius);
protected: protected:
ObjectType m_type = OBJECT_NULL; // type of construction ObjectType m_type = OBJECT_NULL; // type of construction
@ -82,7 +82,7 @@ protected:
float m_speed = 0.0f; // speed of progression float m_speed = 0.0f; // speed of progression
float m_angleY = 0.0f; // rotation angle of the vehicle float m_angleY = 0.0f; // rotation angle of the vehicle
float m_angleZ = 0.0f; // angle of rotation of the gun float m_angleZ = 0.0f; // angle of rotation of the gun
Math::Vector m_buildingPos; // initial position of the building glm::vec3 m_buildingPos = { 0, 0, 0 }; // initial position of the building
float m_buildingHeight = 0.0f; // height of the building float m_buildingHeight = 0.0f; // height of the building
int m_lightRank[TBMAXLIGHT] = {}; // lights for the effects int m_lightRank[TBMAXLIGHT] = {}; // lights for the effects
int m_soundChannel = 0; int m_soundChannel = 0;

View File

@ -64,7 +64,7 @@ bool CTaskFire::EventProcess(const Event &event)
{ {
CPhysics* physics; CPhysics* physics;
Math::Matrix* mat; Math::Matrix* mat;
Math::Vector pos, speed, dir, vib; glm::vec3 pos, speed, dir, vib;
ObjectType type; ObjectType type;
glm::vec2 dim; glm::vec2 dim;
float energy, fire; float energy, fire;
@ -100,10 +100,10 @@ bool CTaskFire::EventProcess(const Event &event)
for ( i=0 ; i<6 ; i++ ) for ( i=0 ; i<6 ; i++ )
{ {
pos = Math::Vector(0.0f, 2.5f, 0.0f); pos = glm::vec3(0.0f, 2.5f, 0.0f);
pos = Math::Transform(*mat, pos); pos = Math::Transform(*mat, pos);
speed = Math::Vector(200.0f, 0.0f, 0.0f); speed = glm::vec3(200.0f, 0.0f, 0.0f);
physics = m_object->GetPhysics(); physics = m_object->GetPhysics();
if ( physics != nullptr ) if ( physics != nullptr )
@ -130,12 +130,12 @@ bool CTaskFire::EventProcess(const Event &event)
for ( i=0 ; i<4 ; i++ ) for ( i=0 ; i<4 ; i++ )
{ {
pos = Math::Vector(4.0f, 0.0f, 0.0f); pos = glm::vec3(4.0f, 0.0f, 0.0f);
pos.y += (rand()%3-1)*1.5f; pos.y += (rand()%3-1)*1.5f;
pos.z += (rand()%3-1)*1.5f; pos.z += (rand()%3-1)*1.5f;
pos = Math::Transform(*mat, pos); pos = Math::Transform(*mat, pos);
speed = Math::Vector(200.0f, 0.0f, 0.0f); speed = glm::vec3(200.0f, 0.0f, 0.0f);
speed.x += (Math::Rand()-0.5f)*6.0f; speed.x += (Math::Rand()-0.5f)*6.0f;
speed.y += (Math::Rand()-0.5f)*12.0f; speed.y += (Math::Rand()-0.5f)*12.0f;
speed.z += (Math::Rand()-0.5f)*12.0f; speed.z += (Math::Rand()-0.5f)*12.0f;
@ -148,7 +148,7 @@ bool CTaskFire::EventProcess(const Event &event)
2.0f, 200.0f, 0.5f, 1.0f); 2.0f, 200.0f, 0.5f, 1.0f);
m_particle->SetObjectFather(channel, m_object); m_particle->SetObjectFather(channel, m_object);
speed = Math::Vector(5.0f, 0.0f, 0.0f); speed = glm::vec3(5.0f, 0.0f, 0.0f);
speed.x += (Math::Rand()-0.5f)*1.0f; speed.x += (Math::Rand()-0.5f)*1.0f;
speed.y += (Math::Rand()-0.5f)*2.0f; speed.y += (Math::Rand()-0.5f)*2.0f;
speed.z += (Math::Rand()-0.5f)*2.0f; speed.z += (Math::Rand()-0.5f)*2.0f;
@ -178,17 +178,17 @@ bool CTaskFire::EventProcess(const Event &event)
{ {
if ( type == OBJECT_MOBILErc ) if ( type == OBJECT_MOBILErc )
{ {
pos = Math::Vector(0.0f, 0.0f, 0.0f); pos = glm::vec3(0.0f, 0.0f, 0.0f);
} }
else else
{ {
pos = Math::Vector(3.0f, 1.0f, 0.0f); pos = glm::vec3(3.0f, 1.0f, 0.0f);
} }
pos.y += (Math::Rand()-0.5f)*1.0f; pos.y += (Math::Rand()-0.5f)*1.0f;
pos.z += (Math::Rand()-0.5f)*1.0f; pos.z += (Math::Rand()-0.5f)*1.0f;
pos = Math::Transform(*mat, pos); pos = Math::Transform(*mat, pos);
speed = Math::Vector(200.0f, 0.0f, 0.0f); speed = glm::vec3(200.0f, 0.0f, 0.0f);
physics = m_object->GetPhysics(); physics = m_object->GetPhysics();
if ( physics != nullptr ) if ( physics != nullptr )
@ -212,12 +212,12 @@ bool CTaskFire::EventProcess(const Event &event)
if ( type != OBJECT_MOBILErc && if ( type != OBJECT_MOBILErc &&
m_progress > 0.3f ) m_progress > 0.3f )
{ {
pos = Math::Vector(-1.0f, 1.0f, 0.0f); pos = glm::vec3(-1.0f, 1.0f, 0.0f);
pos.y += (Math::Rand()-0.5f)*0.4f; pos.y += (Math::Rand()-0.5f)*0.4f;
pos.z += (Math::Rand()-0.5f)*0.4f; pos.z += (Math::Rand()-0.5f)*0.4f;
pos = Math::Transform(*mat, pos); pos = Math::Transform(*mat, pos);
speed = Math::Vector(-4.0f, 0.0f, 0.0f); speed = glm::vec3(-4.0f, 0.0f, 0.0f);
speed.x += (Math::Rand()-0.5f)*2.0f; speed.x += (Math::Rand()-0.5f)*2.0f;
speed.y += (Math::Rand()-0.2f)*4.0f; speed.y += (Math::Rand()-0.2f)*4.0f;
speed.z += (Math::Rand()-0.5f)*4.0f; speed.z += (Math::Rand()-0.5f)*4.0f;
@ -232,7 +232,7 @@ bool CTaskFire::EventProcess(const Event &event)
} }
} }
dir = Math::Vector(0.0f, 0.0f, 0.0f); dir = glm::vec3(0.0f, 0.0f, 0.0f);
if ( m_progress < 0.1f ) if ( m_progress < 0.1f )
{ {
dir.z = (Math::PI*0.04f)*(m_progress*10.0f); dir.z = (Math::PI*0.04f)*(m_progress*10.0f);
@ -272,7 +272,7 @@ bool CTaskFire::EventProcess(const Event &event)
Error CTaskFire::Start(float delay) Error CTaskFire::Start(float delay)
{ {
Math::Vector pos, goal, speed; glm::vec3 pos, goal, speed;
float energy, fire; float energy, fire;
ObjectType type; ObjectType type;
@ -373,9 +373,9 @@ Error CTaskFire::IsEnded()
bool CTaskFire::Abort() bool CTaskFire::Abort()
{ {
m_object->SetTilt(Math::Vector(0.0f, 0.0f, 0.0f)); m_object->SetTilt(glm::vec3(0.0f, 0.0f, 0.0f));
m_object->SetCirVibration(Math::Vector(0.0f, 0.0f, 0.0f)); m_object->SetCirVibration(glm::vec3(0.0f, 0.0f, 0.0f));
m_object->SetLinVibration(Math::Vector(0.0f, 0.0f, 0.0f)); m_object->SetLinVibration(glm::vec3(0.0f, 0.0f, 0.0f));
if ( m_soundChannel != -1 ) if ( m_soundChannel != -1 )
{ {

View File

@ -53,7 +53,7 @@ CTaskFireAnt::~CTaskFireAnt()
bool CTaskFireAnt::EventProcess(const Event &event) bool CTaskFireAnt::EventProcess(const Event &event)
{ {
Math::Vector dir, vib; glm::vec3 dir, vib;
float a, g, cirSpeed; float a, g, cirSpeed;
if ( m_engine->GetPause() ) return true; if ( m_engine->GetPause() ) return true;
@ -86,9 +86,9 @@ bool CTaskFireAnt::EventProcess(const Event &event)
// Assigns the goal was achieved. // Assigns the goal was achieved.
Error CTaskFireAnt::Start(Math::Vector impact) Error CTaskFireAnt::Start(glm::vec3 impact)
{ {
Math::Vector pos; glm::vec3 pos;
ObjectType type; ObjectType type;
m_impact = impact; m_impact = impact;
@ -102,7 +102,7 @@ Error CTaskFireAnt::Start(Math::Vector impact)
// Insect on its back? // Insect on its back?
if ( dynamic_cast<CBaseAlien&>(*m_object).GetFixed() ) return ERR_WRONG_BOT; if ( dynamic_cast<CBaseAlien&>(*m_object).GetFixed() ) return ERR_WRONG_BOT;
m_physics->SetMotorSpeed(Math::Vector(0.0f, 0.0f, 0.0f)); m_physics->SetMotorSpeed(glm::vec3(0.0f, 0.0f, 0.0f));
pos = m_object->GetPosition(); pos = m_object->GetPosition();
m_angle = Math::RotateAngle(m_impact.x-pos.x, pos.z-m_impact.z); // CW ! m_angle = Math::RotateAngle(m_impact.x-pos.x, pos.z-m_impact.z); // CW !
@ -123,7 +123,7 @@ Error CTaskFireAnt::Start(Math::Vector impact)
Error CTaskFireAnt::IsEnded() Error CTaskFireAnt::IsEnded()
{ {
Math::Matrix* mat; Math::Matrix* mat;
Math::Vector pos, speed; glm::vec3 pos, speed;
glm::vec2 dim; glm::vec2 dim;
float angle, dist; float angle, dist;
int i, channel; int i, channel;
@ -168,7 +168,7 @@ Error CTaskFireAnt::IsEnded()
for ( i=0 ; i<20 ; i++ ) for ( i=0 ; i<20 ; i++ )
{ {
pos = Math::Vector(-2.5f, -0.7f, 0.0f); pos = glm::vec3(-2.5f, -0.7f, 0.0f);
mat = m_object->GetWorldMatrix(2); mat = m_object->GetWorldMatrix(2);
pos = Math::Transform(*mat, pos); pos = Math::Transform(*mat, pos);
dist = Math::Distance(pos, m_impact); dist = Math::Distance(pos, m_impact);

View File

@ -44,14 +44,14 @@ public:
bool EventProcess(const Event &event) override; bool EventProcess(const Event &event) override;
Error Start(Math::Vector impact); Error Start(glm::vec3 impact);
Error IsEnded() override; Error IsEnded() override;
bool Abort() override; bool Abort() override;
protected: protected:
protected: protected:
Math::Vector m_impact; glm::vec3 m_impact = { 0, 0, 0 };
TaskFireAnt m_phase = TFA_NULL; TaskFireAnt m_phase = TFA_NULL;
float m_progress = 0.0f; float m_progress = 0.0f;
float m_speed = 0.0f; float m_speed = 0.0f;

View File

@ -88,7 +88,7 @@ bool CTaskFlag::EventProcess(const Event &event)
Error CTaskFlag::Start(TaskFlagOrder order, int rank) Error CTaskFlag::Start(TaskFlagOrder order, int rank)
{ {
Math::Vector pos, speed; glm::vec3 pos, speed;
Error err; Error err;
m_order = order; m_order = order;
@ -195,7 +195,7 @@ bool CTaskFlag::Abort()
// Returns the closest object to a given position. // Returns the closest object to a given position.
CObject* CTaskFlag::SearchNearest(Math::Vector pos, ObjectType type) CObject* CTaskFlag::SearchNearest(glm::vec3 pos, ObjectType type)
{ {
std::vector<ObjectType> types; std::vector<ObjectType> types;
if(type == OBJECT_NULL) if(type == OBJECT_NULL)
@ -249,16 +249,16 @@ Error CTaskFlag::CreateFlag(int rank)
}; };
Math::Matrix* mat = m_object->GetWorldMatrix(0); Math::Matrix* mat = m_object->GetWorldMatrix(0);
Math::Vector pos; glm::vec3 pos;
switch ( m_object->GetType() ) switch ( m_object->GetType() )
{ {
case OBJECT_HUMAN: case OBJECT_HUMAN:
case OBJECT_TECH: case OBJECT_TECH:
pos = Transform(*mat, Math::Vector(4.0f, 0.0f, 0.0f)); pos = Transform(*mat, glm::vec3(4.0f, 0.0f, 0.0f));
break; break;
default: default:
pos = Transform(*mat, Math::Vector(6.0f, 0.0f, 0.0f)); pos = Transform(*mat, glm::vec3(6.0f, 0.0f, 0.0f));
break; break;
} }
@ -293,7 +293,7 @@ Error CTaskFlag::CreateFlag(int rank)
Error CTaskFlag::DeleteFlag() Error CTaskFlag::DeleteFlag()
{ {
CObject* pObj; CObject* pObj;
Math::Vector iPos, oPos; glm::vec3 iPos, oPos;
float iAngle, angle, aLimit, dist; float iAngle, angle, aLimit, dist;
iPos = m_object->GetPosition(); iPos = m_object->GetPosition();

View File

@ -51,7 +51,7 @@ public:
protected: protected:
Error CreateFlag(int rank); Error CreateFlag(int rank);
Error DeleteFlag(); Error DeleteFlag();
CObject* SearchNearest(Math::Vector pos, ObjectType type); CObject* SearchNearest(glm::vec3 pos, ObjectType type);
int CountObject(ObjectType type); int CountObject(ObjectType type);
protected: protected:

View File

@ -76,7 +76,7 @@ CTaskGoto::~CTaskGoto()
bool CTaskGoto::EventProcess(const Event &event) bool CTaskGoto::EventProcess(const Event &event)
{ {
Math::Vector pos, goal; glm::vec3 pos, goal;
glm::vec2 rot, repulse; glm::vec2 rot, repulse;
float a, g, dist, linSpeed, cirSpeed, h, hh, factor, dir; float a, g, dist, linSpeed, cirSpeed, h, hh, factor, dir;
Error ret; Error ret;
@ -85,7 +85,7 @@ bool CTaskGoto::EventProcess(const Event &event)
if (m_engine->GetDebugGoto()) if (m_engine->GetDebugGoto())
{ {
auto AdjustPoint = [&](Math::Vector p) -> Math::Vector auto AdjustPoint = [&](glm::vec3 p) -> glm::vec3
{ {
m_terrain->AdjustToFloor(p); m_terrain->AdjustToFloor(p);
p.y += 2.0f; p.y += 2.0f;
@ -543,9 +543,9 @@ bool CTaskGoto::EventProcess(const Event &event)
// Sought a target for the worm. // Sought a target for the worm.
CObject* CTaskGoto::WormSearch(Math::Vector &impact) CObject* CTaskGoto::WormSearch(glm::vec3 &impact)
{ {
Math::Vector iPos = m_object->GetPosition(); glm::vec3 iPos = m_object->GetPosition();
float min = 1000000.0f; float min = 1000000.0f;
CObject* best = nullptr; CObject* best = nullptr;
@ -606,7 +606,7 @@ CObject* CTaskGoto::WormSearch(Math::Vector &impact)
if (obj->GetCrashSphereCount() == 0) continue; if (obj->GetCrashSphereCount() == 0) continue;
Math::Vector oPos = obj->GetFirstCrashSphere().sphere.pos; glm::vec3 oPos = obj->GetFirstCrashSphere().sphere.pos;
float distance = Math::DistanceProjected(oPos, iPos); float distance = Math::DistanceProjected(oPos, iPos);
if (distance < min) if (distance < min)
{ {
@ -625,7 +625,7 @@ CObject* CTaskGoto::WormSearch(Math::Vector &impact)
void CTaskGoto::WormFrame(float rTime) void CTaskGoto::WormFrame(float rTime)
{ {
CObject* pObj; CObject* pObj;
Math::Vector impact, pos; glm::vec3 impact, pos;
float dist; float dist;
m_wormLastTime += rTime; m_wormLastTime += rTime;
@ -652,10 +652,10 @@ void CTaskGoto::WormFrame(float rTime)
// Assigns the goal was achieved. // Assigns the goal was achieved.
// "dist" is the distance that needs to go far to make a deposit or object. // "dist" is the distance that needs to go far to make a deposit or object.
Error CTaskGoto::Start(Math::Vector goal, float altitude, Error CTaskGoto::Start(glm::vec3 goal, float altitude,
TaskGotoGoal goalMode, TaskGotoCrash crashMode) TaskGotoGoal goalMode, TaskGotoCrash crashMode)
{ {
Math::Vector pos; glm::vec3 pos;
CObject* target; CObject* target;
ObjectType type; ObjectType type;
float dist; float dist;
@ -809,7 +809,7 @@ Error CTaskGoto::Start(Math::Vector goal, float altitude,
Error CTaskGoto::IsEnded() Error CTaskGoto::IsEnded()
{ {
Math::Vector pos; glm::vec3 pos;
float limit, angle = 0.0f, h, level; float limit, angle = 0.0f, h, level;
volatile float dist; //fix for issue #844 volatile float dist; //fix for issue #844
@ -1080,7 +1080,7 @@ Error CTaskGoto::IsEnded()
// Tries the object is the target position. // Tries the object is the target position.
CObject* CTaskGoto::SearchTarget(Math::Vector pos, float margin) CObject* CTaskGoto::SearchTarget(glm::vec3 pos, float margin)
{ {
//return CObjectManager::GetInstancePointer()->FindNearest(nullptr, pos, OBJECT_NULL, margin/g_unit); //return CObjectManager::GetInstancePointer()->FindNearest(nullptr, pos, OBJECT_NULL, margin/g_unit);
@ -1110,7 +1110,7 @@ CObject* CTaskGoto::SearchTarget(Math::Vector pos, float margin)
if ( !pObj->GetActive() ) continue; if ( !pObj->GetActive() ) continue;
if ( IsObjectBeingTransported(pObj) ) continue; // object transtorted? if ( IsObjectBeingTransported(pObj) ) continue; // object transtorted?
Math::Vector oPos = pObj->GetPosition(); glm::vec3 oPos = pObj->GetPosition();
float dist = Math::DistanceProjected(pos, oPos); float dist = Math::DistanceProjected(pos, oPos);
if ( dist <= margin && dist <= min ) if ( dist <= margin && dist <= min )
@ -1126,11 +1126,11 @@ CObject* CTaskGoto::SearchTarget(Math::Vector pos, float margin)
// Adjusts the target as a function of the object. // Adjusts the target as a function of the object.
// Returns true if it is cargo laying on the ground, which can be approached from any site. // Returns true if it is cargo laying on the ground, which can be approached from any site.
bool CTaskGoto::AdjustTarget(CObject* pObj, Math::Vector &pos, float &distance) bool CTaskGoto::AdjustTarget(CObject* pObj, glm::vec3 &pos, float &distance)
{ {
ObjectType type; ObjectType type;
Math::Matrix* mat; Math::Matrix* mat;
Math::Vector goal; glm::vec3 goal;
float dist, suppl; float dist, suppl;
type = m_object->GetType(); type = m_object->GetType();
@ -1224,14 +1224,14 @@ bool CTaskGoto::AdjustTarget(CObject* pObj, Math::Vector &pos, float &distance)
// If you are on an object produced by a building (ore produced by derrick), // If you are on an object produced by a building (ore produced by derrick),
// changes the position by report the building. // changes the position by report the building.
bool CTaskGoto::AdjustBuilding(Math::Vector &pos, float margin, float &distance) bool CTaskGoto::AdjustBuilding(glm::vec3 &pos, float margin, float &distance)
{ {
for (CObject* obj : CObjectManager::GetInstancePointer()->GetAllObjects()) for (CObject* obj : CObjectManager::GetInstancePointer()->GetAllObjects())
{ {
if ( !obj->GetActive() ) continue; if ( !obj->GetActive() ) continue;
if (IsObjectBeingTransported(obj)) continue; if (IsObjectBeingTransported(obj)) continue;
Math::Vector oPos; glm::vec3 oPos;
float suppl = 0.0f; float suppl = 0.0f;
if ( !GetHotPoint(obj, oPos, false, 0.0f, suppl) ) continue; if ( !GetHotPoint(obj, oPos, false, 0.0f, suppl) ) continue;
float dist = Math::DistanceProjected(pos, oPos); float dist = Math::DistanceProjected(pos, oPos);
@ -1247,13 +1247,13 @@ bool CTaskGoto::AdjustBuilding(Math::Vector &pos, float margin, float &distance)
// Returns the item or product or pose is something on a building. // Returns the item or product or pose is something on a building.
bool CTaskGoto::GetHotPoint(CObject *pObj, Math::Vector &pos, bool CTaskGoto::GetHotPoint(CObject *pObj, glm::vec3 &pos,
bool bTake, float distance, float &suppl) bool bTake, float distance, float &suppl)
{ {
ObjectType type; ObjectType type;
Math::Matrix* mat; Math::Matrix* mat;
pos = Math::Vector(0.0f, 0.0f, 0.0f); pos = glm::vec3(0.0f, 0.0f, 0.0f);
suppl = 0.0f; suppl = 0.0f;
type = pObj->GetType(); type = pObj->GetType();
@ -1373,7 +1373,7 @@ bool CTaskGoto::GetHotPoint(CObject *pObj, Math::Vector &pos,
// Seeks an object too close that he must flee. // Seeks an object too close that he must flee.
bool CTaskGoto::LeakSearch(Math::Vector &pos, float &delay) bool CTaskGoto::LeakSearch(glm::vec3 &pos, float &delay)
{ {
if (!m_physics->GetLand()) return false; // in flight? if (!m_physics->GetLand()) return false; // in flight?
@ -1436,7 +1436,7 @@ void CTaskGoto::ComputeRepulse(glm::vec2&dir)
if ( iType == OBJECT_WORM || iType == OBJECT_CONTROLLER ) return; if ( iType == OBJECT_WORM || iType == OBJECT_CONTROLLER ) return;
auto firstCrashSphere = m_object->GetFirstCrashSphere(); auto firstCrashSphere = m_object->GetFirstCrashSphere();
Math::Vector iPos = firstCrashSphere.sphere.pos; glm::vec3 iPos = firstCrashSphere.sphere.pos;
float iRadius = firstCrashSphere.sphere.radius; float iRadius = firstCrashSphere.sphere.radius;
gDist = Math::Distance(iPos, m_goal); gDist = Math::Distance(iPos, m_goal);
@ -1545,7 +1545,7 @@ void CTaskGoto::ComputeRepulse(glm::vec2&dir)
for (const auto& crashSphere : pObj->GetAllCrashSpheres()) for (const auto& crashSphere : pObj->GetAllCrashSpheres())
{ {
Math::Vector oPos = crashSphere.sphere.pos; glm::vec3 oPos = crashSphere.sphere.pos;
float oRadius = crashSphere.sphere.radius; float oRadius = crashSphere.sphere.radius;
if ( oPos.y-oRadius > iPos.y+iRadius ) continue; if ( oPos.y-oRadius > iPos.y+iRadius ) continue;
@ -1580,7 +1580,7 @@ void CTaskGoto::ComputeRepulse(glm::vec2&dir)
void CTaskGoto::ComputeFlyingRepulse(float &dir) void CTaskGoto::ComputeFlyingRepulse(float &dir)
{ {
auto firstCrashSphere = m_object->GetFirstCrashSphere(); auto firstCrashSphere = m_object->GetFirstCrashSphere();
Math::Vector iPos = firstCrashSphere.sphere.pos; glm::vec3 iPos = firstCrashSphere.sphere.pos;
float iRadius = firstCrashSphere.sphere.radius; float iRadius = firstCrashSphere.sphere.radius;
float add = 0.0f; float add = 0.0f;
@ -1598,7 +1598,7 @@ void CTaskGoto::ComputeFlyingRepulse(float &dir)
for (const auto& crashSphere : pObj->GetAllCrashSpheres()) for (const auto& crashSphere : pObj->GetAllCrashSpheres())
{ {
Math::Vector oPos = crashSphere.sphere.pos; glm::vec3 oPos = crashSphere.sphere.pos;
float oRadius = crashSphere.sphere.radius; float oRadius = crashSphere.sphere.radius;
oRadius += iRadius+add; oRadius += iRadius+add;
@ -1644,7 +1644,7 @@ int CTaskGoto::BeamShortcut()
void CTaskGoto::BeamStart() void CTaskGoto::BeamStart()
{ {
Math::Vector min, max; glm::vec3 min, max;
BitmapOpen(); BitmapOpen();
BitmapObject(); BitmapObject();
@ -1694,7 +1694,7 @@ void CTaskGoto::BeamInit()
// ERR_CONTINUE if not done yet // ERR_CONTINUE if not done yet
// goalRadius: distance at which we must approach the goal // goalRadius: distance at which we must approach the goal
Error CTaskGoto::BeamSearch(const Math::Vector &start, const Math::Vector &goal, Error CTaskGoto::BeamSearch(const glm::vec3 &start, const glm::vec3 &goal,
float goalRadius) float goalRadius)
{ {
float step, len; float step, len;
@ -1720,12 +1720,12 @@ Error CTaskGoto::BeamSearch(const Math::Vector &start, const Math::Vector &goal,
// i number of recursions made // i number of recursions made
// nbIter maximum number of iterations you have the right to make before temporarily interrupt // nbIter maximum number of iterations you have the right to make before temporarily interrupt
Error CTaskGoto::BeamExplore(const Math::Vector &prevPos, const Math::Vector &curPos, Error CTaskGoto::BeamExplore(const glm::vec3 &prevPos, const glm::vec3 &curPos,
const Math::Vector &goalPos, float goalRadius, const glm::vec3 &goalPos, float goalRadius,
float angle, int nbDiv, float step, float angle, int nbDiv, float step,
int i, int nbIter) int i, int nbIter)
{ {
Math::Vector newPos; glm::vec3 newPos;
Error ret; Error ret;
int iDiv, iClear, iLar; int iDiv, iClear, iLar;
@ -1813,11 +1813,11 @@ Error CTaskGoto::BeamExplore(const Math::Vector &prevPos, const Math::Vector &cu
// Is a right "start-goal". Calculates the point located at the distance "step" // Is a right "start-goal". Calculates the point located at the distance "step"
// from the point "start" and an angle "angle" with the right. // from the point "start" and an angle "angle" with the right.
Math::Vector CTaskGoto::BeamPoint(const Math::Vector &startPoint, glm::vec3 CTaskGoto::BeamPoint(const glm::vec3 &startPoint,
const Math::Vector &goalPoint, const glm::vec3 &goalPoint,
float angle, float step) float angle, float step)
{ {
Math::Vector resPoint; glm::vec3 resPoint;
float goalAngle; float goalAngle;
goalAngle = Math::RotateAngle(goalPoint.x-startPoint.x, goalPoint.z-startPoint.z); goalAngle = Math::RotateAngle(goalPoint.x-startPoint.x, goalPoint.z-startPoint.z);
@ -1831,10 +1831,10 @@ Math::Vector CTaskGoto::BeamPoint(const Math::Vector &startPoint,
// Tests if a path along a straight line is possible. // Tests if a path along a straight line is possible.
bool CTaskGoto::BitmapTestLine(const Math::Vector &start, const Math::Vector &goal, bool CTaskGoto::BitmapTestLine(const glm::vec3 &start, const glm::vec3 &goal,
float stepAngle, bool bSecond) float stepAngle, bool bSecond)
{ {
Math::Vector pos, inc; glm::vec3 pos, inc;
float dist, step; float dist, step;
float distNoB2; float distNoB2;
int i, max, x, y; int i, max, x, y;
@ -1913,7 +1913,7 @@ void CTaskGoto::BitmapObject()
for (const auto& crashSphere : pObj->GetAllCrashSpheres()) for (const auto& crashSphere : pObj->GetAllCrashSpheres())
{ {
Math::Vector oPos = crashSphere.sphere.pos; glm::vec3 oPos = crashSphere.sphere.pos;
float oRadius = crashSphere.sphere.radius; float oRadius = crashSphere.sphere.radius;
if ( m_object->Implements(ObjectInterfaceType::Flying) && m_altitude > 0.0f ) // flying? if ( m_object->Implements(ObjectInterfaceType::Flying) && m_altitude > 0.0f ) // flying?
@ -1934,7 +1934,7 @@ void CTaskGoto::BitmapObject()
// Adds a section of land in the bitmap. // Adds a section of land in the bitmap.
void CTaskGoto::BitmapTerrain(const Math::Vector &min, const Math::Vector &max) void CTaskGoto::BitmapTerrain(const glm::vec3 &min, const glm::vec3 &max)
{ {
int minx, miny, maxx, maxy; int minx, miny, maxx, maxy;
@ -1951,7 +1951,7 @@ void CTaskGoto::BitmapTerrain(const Math::Vector &min, const Math::Vector &max)
void CTaskGoto::BitmapTerrain(int minx, int miny, int maxx, int maxy) void CTaskGoto::BitmapTerrain(int minx, int miny, int maxx, int maxy)
{ {
ObjectType type; ObjectType type;
Math::Vector p; glm::vec3 p;
float aLimit, angle, h; float aLimit, angle, h;
int x, y; int x, y;
bool bAcceptWater, bFly; bool bAcceptWater, bFly;
@ -2118,7 +2118,7 @@ bool CTaskGoto::BitmapClose()
// Puts a circle in the bitmap. // Puts a circle in the bitmap.
void CTaskGoto::BitmapSetCircle(const Math::Vector &pos, float radius) void CTaskGoto::BitmapSetCircle(const glm::vec3 &pos, float radius)
{ {
float d, r; float d, r;
int cx, cy, ix, iy; int cx, cy, ix, iy;
@ -2140,7 +2140,7 @@ void CTaskGoto::BitmapSetCircle(const Math::Vector &pos, float radius)
// Removes a circle in the bitmap. // Removes a circle in the bitmap.
//TODO this method is almost same as above one //TODO this method is almost same as above one
void CTaskGoto::BitmapClearCircle(const Math::Vector &pos, float radius) void CTaskGoto::BitmapClearCircle(const glm::vec3 &pos, float radius)
{ {
float d, r; float d, r;
int cx, cy, ix, iy; int cx, cy, ix, iy;

View File

@ -82,42 +82,42 @@ public:
bool EventProcess(const Event &event) override; bool EventProcess(const Event &event) override;
Error Start(Math::Vector goal, float altitude, TaskGotoGoal goalMode, TaskGotoCrash crashMode); Error Start(glm::vec3 goal, float altitude, TaskGotoGoal goalMode, TaskGotoCrash crashMode);
Error IsEnded() override; Error IsEnded() override;
protected: protected:
CObject* WormSearch(Math::Vector &impact); CObject* WormSearch(glm::vec3 &impact);
void WormFrame(float rTime); void WormFrame(float rTime);
CObject* SearchTarget(Math::Vector pos, float margin); CObject* SearchTarget(glm::vec3 pos, float margin);
bool AdjustTarget(CObject* pObj, Math::Vector &pos, float &distance); bool AdjustTarget(CObject* pObj, glm::vec3 &pos, float &distance);
bool AdjustBuilding(Math::Vector &pos, float margin, float &distance); bool AdjustBuilding(glm::vec3 &pos, float margin, float &distance);
bool GetHotPoint(CObject *pObj, Math::Vector &pos, bool bTake, float distance, float &suppl); bool GetHotPoint(CObject *pObj, glm::vec3 &pos, bool bTake, float distance, float &suppl);
bool LeakSearch(Math::Vector &pos, float &delay); bool LeakSearch(glm::vec3 &pos, float &delay);
void ComputeRepulse(glm::vec2& dir); void ComputeRepulse(glm::vec2& dir);
void ComputeFlyingRepulse(float &dir); void ComputeFlyingRepulse(float &dir);
int BeamShortcut(); int BeamShortcut();
void BeamStart(); void BeamStart();
void BeamInit(); void BeamInit();
Error BeamSearch(const Math::Vector &start, const Math::Vector &goal, float goalRadius); Error BeamSearch(const glm::vec3 &start, const glm::vec3 &goal, float goalRadius);
Error BeamExplore(const Math::Vector &prevPos, const Math::Vector &curPos, const Math::Vector &goalPos, float goalRadius, float angle, int nbDiv, float step, int i, int nbIter); Error BeamExplore(const glm::vec3 &prevPos, const glm::vec3 &curPos, const glm::vec3 &goalPos, float goalRadius, float angle, int nbDiv, float step, int i, int nbIter);
Math::Vector BeamPoint(const Math::Vector &startPoint, const Math::Vector &goalPoint, float angle, float step); glm::vec3 BeamPoint(const glm::vec3 &startPoint, const glm::vec3 &goalPoint, float angle, float step);
bool BitmapTestLine(const Math::Vector &start, const Math::Vector &goal, float stepAngle, bool bSecond); bool BitmapTestLine(const glm::vec3 &start, const glm::vec3 &goal, float stepAngle, bool bSecond);
void BitmapObject(); void BitmapObject();
void BitmapTerrain(const Math::Vector &min, const Math::Vector &max); void BitmapTerrain(const glm::vec3 &min, const glm::vec3 &max);
void BitmapTerrain(int minx, int miny, int maxx, int maxy); void BitmapTerrain(int minx, int miny, int maxx, int maxy);
bool BitmapOpen(); bool BitmapOpen();
bool BitmapClose(); bool BitmapClose();
void BitmapSetCircle(const Math::Vector &pos, float radius); void BitmapSetCircle(const glm::vec3 &pos, float radius);
void BitmapClearCircle(const Math::Vector &pos, float radius); void BitmapClearCircle(const glm::vec3 &pos, float radius);
void BitmapSetDot(int rank, int x, int y); void BitmapSetDot(int rank, int x, int y);
void BitmapClearDot(int rank, int x, int y); void BitmapClearDot(int rank, int x, int y);
bool BitmapTestDot(int rank, int x, int y); bool BitmapTestDot(int rank, int x, int y);
protected: protected:
Math::Vector m_goal; glm::vec3 m_goal = { 0, 0, 0 };
Math::Vector m_goalObject; glm::vec3 m_goalObject = { 0, 0, 0 };
float m_angle = 0.0f; float m_angle = 0.0f;
float m_altitude = 0.0f; float m_altitude = 0.0f;
TaskGotoCrash m_crashMode = TGC_DEFAULT; TaskGotoCrash m_crashMode = TGC_DEFAULT;
@ -128,7 +128,7 @@ protected:
bool m_bTake = false; bool m_bTake = false;
float m_stopLength = 0.0f; // braking distance float m_stopLength = 0.0f; // braking distance
float m_time = 0.0f; float m_time = 0.0f;
Math::Vector m_pos; glm::vec3 m_pos = { 0, 0, 0 };
bool m_bWorm = false; bool m_bWorm = false;
bool m_bApprox = false; bool m_bApprox = false;
float m_wormLastTime = 0.0f; float m_wormLastTime = 0.0f;
@ -143,18 +143,18 @@ protected:
int m_bmMaxX = 0, m_bmMaxY = 0; int m_bmMaxX = 0, m_bmMaxY = 0;
int m_bmTotal = 0; // number of points in m_bmPoints int m_bmTotal = 0; // number of points in m_bmPoints
int m_bmIndex = 0; // index in m_bmPoints int m_bmIndex = 0; // index in m_bmPoints
Math::Vector m_bmPoints[MAXPOINTS+2]; glm::vec3 m_bmPoints[MAXPOINTS+2];
signed char m_bmIter[MAXPOINTS+2] = {}; signed char m_bmIter[MAXPOINTS+2] = {};
int m_bmIterCounter = 0; int m_bmIterCounter = 0;
CObject* m_bmCargoObject = nullptr; CObject* m_bmCargoObject = nullptr;
float m_bmFinalMove = 0.0f; // final advance distance float m_bmFinalMove = 0.0f; // final advance distance
float m_bmFinalDist = 0.0f; // effective distance to advance float m_bmFinalDist = 0.0f; // effective distance to advance
Math::Vector m_bmFinalPos; // initial position before advance glm::vec3 m_bmFinalPos = { 0, 0, 0 }; // initial position before advance
float m_bmTimeLimit = 0.0f; float m_bmTimeLimit = 0.0f;
int m_bmStep = 0; int m_bmStep = 0;
Math::Vector m_bmWatchDogPos; glm::vec3 m_bmWatchDogPos = { 0, 0, 0 };
float m_bmWatchDogTime = 0.0f; float m_bmWatchDogTime = 0.0f;
Math::Vector m_leakPos; // initial position leak glm::vec3 m_leakPos = { 0, 0, 0 }; // initial position leak
float m_leakDelay = 0.0f; float m_leakDelay = 0.0f;
float m_leakTime = 0.0f; float m_leakTime = 0.0f;
bool m_bLeakRecede = false; bool m_bLeakRecede = false;

View File

@ -95,7 +95,7 @@ Error CTaskInfo::Start(const char *name, float value, float power, bool send)
exchangePost->GetAuto()->Start(op); exchangePost->GetAuto()->Start(op);
Math::Vector pos, goal; glm::vec3 pos, goal;
if (op == 0) // transmission? if (op == 0) // transmission?
{ {
pos = exchangePost->GetPosition(); pos = exchangePost->GetPosition();

View File

@ -72,7 +72,7 @@ CTaskManip::~CTaskManip()
bool CTaskManip::EventProcess(const Event &event) bool CTaskManip::EventProcess(const Event &event)
{ {
Math::Vector pos; glm::vec3 pos;
float angle, a, g, cirSpeed, progress; float angle, a, g, cirSpeed, progress;
int i; int i;
@ -271,7 +271,7 @@ Error CTaskManip::Start(TaskManipOrder order, TaskManipArm arm)
CObject *front, *other; CObject *front, *other;
float iAngle, dist, len; float iAngle, dist, len;
float fDist, fAngle, oDist, oAngle, oHeight; float fDist, fAngle, oDist, oAngle, oHeight;
Math::Vector pos, fPos, oPos; glm::vec3 pos, fPos, oPos;
m_arm = arm; m_arm = arm;
m_height = 0.0f; m_height = 0.0f;
@ -290,7 +290,7 @@ Error CTaskManip::Start(TaskManipOrder order, TaskManipArm arm)
m_arm != TMA_POWER && m_arm != TMA_POWER &&
m_arm != TMA_GRAB ) return ERR_WRONG_BOT; m_arm != TMA_GRAB ) return ERR_WRONG_BOT;
m_physics->SetMotorSpeed(Math::Vector(0.0f, 0.0f, 0.0f)); m_physics->SetMotorSpeed(glm::vec3(0.0f, 0.0f, 0.0f));
type = m_object->GetType(); type = m_object->GetType();
if ( type == OBJECT_BEE ) // bee? if ( type == OBJECT_BEE ) // bee?
@ -306,7 +306,7 @@ Error CTaskManip::Start(TaskManipOrder order, TaskManipArm arm)
m_object->SetCargo(other); // takes the ball m_object->SetCargo(other); // takes the ball
dynamic_cast<CTransportableObject&>(*other).SetTransporter(m_object); dynamic_cast<CTransportableObject&>(*other).SetTransporter(m_object);
dynamic_cast<CTransportableObject&>(*other).SetTransporterPart(0); // taken with the base dynamic_cast<CTransportableObject&>(*other).SetTransporterPart(0); // taken with the base
other->SetPosition(Math::Vector(0.0f, -3.0f, 0.0f)); other->SetPosition(glm::vec3(0.0f, -3.0f, 0.0f));
} }
else else
{ {
@ -447,12 +447,12 @@ Error CTaskManip::Start(TaskManipOrder order, TaskManipArm arm)
} }
else else
{ {
if ( !IsFreeDeposeObject(Math::Vector(TAKE_DIST, 0.0f, 0.0f)) ) return ERR_MANIP_OCC; if ( !IsFreeDeposeObject(glm::vec3(TAKE_DIST, 0.0f, 0.0f)) ) return ERR_MANIP_OCC;
} }
} }
if ( m_arm == TMA_FBACK ) if ( m_arm == TMA_FBACK )
{ {
if ( !IsFreeDeposeObject(Math::Vector(-TAKE_DIST, 0.0f, 0.0f)) ) return ERR_MANIP_OCC; if ( !IsFreeDeposeObject(glm::vec3(-TAKE_DIST, 0.0f, 0.0f)) ) return ERR_MANIP_OCC;
} }
if ( m_arm == TMA_POWER ) if ( m_arm == TMA_POWER )
{ {
@ -514,7 +514,7 @@ Error CTaskManip::Start(TaskManipOrder order, TaskManipArm arm)
Error CTaskManip::IsEnded() Error CTaskManip::IsEnded()
{ {
CObject* cargo; CObject* cargo;
Math::Vector pos; glm::vec3 pos;
float angle, dist; float angle, dist;
int i; int i;
@ -695,10 +695,10 @@ bool CTaskManip::Abort()
// Seeks the object below to take (for bees). // Seeks the object below to take (for bees).
CObject* CTaskManip::SearchTakeUnderObject(Math::Vector &pos, float dLimit) CObject* CTaskManip::SearchTakeUnderObject(glm::vec3 &pos, float dLimit)
{ {
CObject *pBest; CObject *pBest;
Math::Vector iPos, oPos; glm::vec3 iPos, oPos;
float min, distance; float min, distance;
iPos = m_object->GetPosition(); iPos = m_object->GetPosition();
@ -731,11 +731,11 @@ CObject* CTaskManip::SearchTakeUnderObject(Math::Vector &pos, float dLimit)
// Seeks the object in front to take. // Seeks the object in front to take.
CObject* CTaskManip::SearchTakeFrontObject(bool bAdvance, Math::Vector &pos, CObject* CTaskManip::SearchTakeFrontObject(bool bAdvance, glm::vec3 &pos,
float &distance, float &angle) float &distance, float &angle)
{ {
CObject *pBest; CObject *pBest;
Math::Vector iPos, oPos; glm::vec3 iPos, oPos;
float min, iAngle, bAngle, aLimit, dLimit, f; float min, iAngle, bAngle, aLimit, dLimit, f;
iPos = m_object->GetPosition(); iPos = m_object->GetPosition();
@ -799,11 +799,11 @@ CObject* CTaskManip::SearchTakeFrontObject(bool bAdvance, Math::Vector &pos,
// Seeks the object back to take. // Seeks the object back to take.
CObject* CTaskManip::SearchTakeBackObject(bool bAdvance, Math::Vector &pos, CObject* CTaskManip::SearchTakeBackObject(bool bAdvance, glm::vec3 &pos,
float &distance, float &angle) float &distance, float &angle)
{ {
CObject *pBest; CObject *pBest;
Math::Vector iPos, oPos; glm::vec3 iPos, oPos;
float min, iAngle, bAngle, aLimit, dLimit, f; float min, iAngle, bAngle, aLimit, dLimit, f;
iPos = m_object->GetPosition(); iPos = m_object->GetPosition();
@ -866,7 +866,7 @@ CObject* CTaskManip::SearchTakeBackObject(bool bAdvance, Math::Vector &pos,
// Seeks the robot or building on which it wants to put a battery or or other object. // Seeks the robot or building on which it wants to put a battery or or other object.
CObject* CTaskManip::SearchOtherObject(bool bAdvance, Math::Vector &pos, CObject* CTaskManip::SearchOtherObject(bool bAdvance, glm::vec3 &pos,
float &distance, float &angle, float &distance, float &angle,
float &height) float &height)
{ {
@ -880,7 +880,7 @@ CObject* CTaskManip::SearchOtherObject(bool bAdvance, Math::Vector &pos,
if (m_object->GetCrashSphereCount() == 0) return nullptr; if (m_object->GetCrashSphereCount() == 0) return nullptr;
Math::Vector iPos = m_object->GetFirstCrashSphere().sphere.pos; glm::vec3 iPos = m_object->GetFirstCrashSphere().sphere.pos;
iAngle = m_object->GetRotationY(); iAngle = m_object->GetRotationY();
iAngle = Math::NormAngle(iAngle); // 0..2*Math::PI iAngle = Math::NormAngle(iAngle); // 0..2*Math::PI
@ -911,7 +911,7 @@ CObject* CTaskManip::SearchOtherObject(bool bAdvance, Math::Vector &pos,
} }
mat = pObj->GetWorldMatrix(0); mat = pObj->GetWorldMatrix(0);
Math::Vector oPos = Transform(*mat, dynamic_cast<CPoweredObject&>(*pObj).GetPowerPosition()); glm::vec3 oPos = Transform(*mat, dynamic_cast<CPoweredObject&>(*pObj).GetPowerPosition());
oAngle = pObj->GetRotationY(); oAngle = pObj->GetRotationY();
if ( type == OBJECT_TOWER || if ( type == OBJECT_TOWER ||
@ -946,7 +946,7 @@ CObject* CTaskManip::SearchOtherObject(bool bAdvance, Math::Vector &pos,
angle = Math::RotateAngle(oPos.x-iPos.x, iPos.z-oPos.z); // CW ! angle = Math::RotateAngle(oPos.x-iPos.x, iPos.z-oPos.z); // CW !
if ( Math::TestAngle(angle, iAngle-aLimit, iAngle+aLimit) ) if ( Math::TestAngle(angle, iAngle-aLimit, iAngle+aLimit) )
{ {
Math::Vector powerPos = dynamic_cast<CPoweredObject&>(*pObj).GetPowerPosition(); glm::vec3 powerPos = dynamic_cast<CPoweredObject&>(*pObj).GetPowerPosition();
height = powerPos.y; height = powerPos.y;
pos = oPos; pos = oPos;
return pObj; return pObj;
@ -977,7 +977,7 @@ bool CTaskManip::TransporterTakeObject()
dynamic_cast<CTransportableObject&>(*cargo).SetTransporter(m_object); dynamic_cast<CTransportableObject&>(*cargo).SetTransporter(m_object);
dynamic_cast<CTransportableObject&>(*cargo).SetTransporterPart(4); // takes with the hand dynamic_cast<CTransportableObject&>(*cargo).SetTransporterPart(4); // takes with the hand
cargo->SetPosition(Math::Vector(1.7f, -0.5f, 1.1f)); cargo->SetPosition(glm::vec3(1.7f, -0.5f, 1.1f));
cargo->SetRotationY(0.1f); cargo->SetRotationY(0.1f);
cargo->SetRotationX(0.0f); cargo->SetRotationX(0.0f);
cargo->SetRotationZ(0.8f); cargo->SetRotationZ(0.8f);
@ -987,7 +987,7 @@ bool CTaskManip::TransporterTakeObject()
dynamic_cast<CTransportableObject&>(*cargo).SetTransporter(m_object); dynamic_cast<CTransportableObject&>(*cargo).SetTransporter(m_object);
dynamic_cast<CTransportableObject&>(*cargo).SetTransporterPart(2); // takes with the right claw dynamic_cast<CTransportableObject&>(*cargo).SetTransporterPart(2); // takes with the right claw
Math::Vector pos = Math::Vector(1.1f, -1.0f, 1.0f); // relative glm::vec3 pos = glm::vec3(1.1f, -1.0f, 1.0f); // relative
cargo->SetPosition(pos); cargo->SetPosition(pos);
cargo->SetRotationX(0.0f); cargo->SetRotationX(0.0f);
cargo->SetRotationY(0.0f); cargo->SetRotationY(0.0f);
@ -998,7 +998,7 @@ bool CTaskManip::TransporterTakeObject()
dynamic_cast<CTransportableObject&>(*cargo).SetTransporter(m_object); dynamic_cast<CTransportableObject&>(*cargo).SetTransporter(m_object);
dynamic_cast<CTransportableObject&>(*cargo).SetTransporterPart(3); // takes with the hand dynamic_cast<CTransportableObject&>(*cargo).SetTransporterPart(3); // takes with the hand
Math::Vector pos = Math::Vector(4.7f, 0.0f, 0.0f); // relative to the hand (lem4) glm::vec3 pos = glm::vec3(4.7f, 0.0f, 0.0f); // relative to the hand (lem4)
cargo->SetPosition(pos); cargo->SetPosition(pos);
cargo->SetRotationX(0.0f); cargo->SetRotationX(0.0f);
cargo->SetRotationZ(Math::PI/2.0f); cargo->SetRotationZ(Math::PI/2.0f);
@ -1010,7 +1010,7 @@ bool CTaskManip::TransporterTakeObject()
if (m_arm == TMA_FFRONT) // takes on the ground in front? if (m_arm == TMA_FFRONT) // takes on the ground in front?
{ {
Math::Vector pos; glm::vec3 pos;
float dist = 0.0f, angle = 0.0f; float dist = 0.0f, angle = 0.0f;
CObject* cargo = SearchTakeFrontObject(false, pos, dist, angle); CObject* cargo = SearchTakeFrontObject(false, pos, dist, angle);
if (cargo == nullptr) return false; // nothing to take? if (cargo == nullptr) return false; // nothing to take?
@ -1023,7 +1023,7 @@ bool CTaskManip::TransporterTakeObject()
dynamic_cast<CTransportableObject&>(*cargo).SetTransporter(m_object); dynamic_cast<CTransportableObject&>(*cargo).SetTransporter(m_object);
dynamic_cast<CTransportableObject&>(*cargo).SetTransporterPart(2); // takes with the right claw dynamic_cast<CTransportableObject&>(*cargo).SetTransporterPart(2); // takes with the right claw
pos = Math::Vector(1.1f, -1.0f, 1.0f); // relative pos = glm::vec3(1.1f, -1.0f, 1.0f); // relative
cargo->SetPosition(pos); cargo->SetPosition(pos);
cargo->SetRotationX(0.0f); cargo->SetRotationX(0.0f);
cargo->SetRotationY(0.0f); cargo->SetRotationY(0.0f);
@ -1034,7 +1034,7 @@ bool CTaskManip::TransporterTakeObject()
dynamic_cast<CTransportableObject&>(*cargo).SetTransporter(m_object); dynamic_cast<CTransportableObject&>(*cargo).SetTransporter(m_object);
dynamic_cast<CTransportableObject&>(*cargo).SetTransporterPart(3); // takes with the hand dynamic_cast<CTransportableObject&>(*cargo).SetTransporterPart(3); // takes with the hand
pos = Math::Vector(4.7f, 0.0f, 0.0f); // relative to the hand (lem4) pos = glm::vec3(4.7f, 0.0f, 0.0f); // relative to the hand (lem4)
cargo->SetPosition(pos); cargo->SetPosition(pos);
cargo->SetRotationX(0.0f); cargo->SetRotationX(0.0f);
cargo->SetRotationZ(Math::PI/2.0f); cargo->SetRotationZ(Math::PI/2.0f);
@ -1046,7 +1046,7 @@ bool CTaskManip::TransporterTakeObject()
if (m_arm == TMA_FBACK) // takes on the ground behind? if (m_arm == TMA_FBACK) // takes on the ground behind?
{ {
Math::Vector pos; glm::vec3 pos;
float dist = 0.0f, angle = 0.0f; float dist = 0.0f, angle = 0.0f;
CObject* cargo = SearchTakeBackObject(false, pos, dist, angle); CObject* cargo = SearchTakeBackObject(false, pos, dist, angle);
if (cargo == nullptr) return false; // nothing to take? if (cargo == nullptr) return false; // nothing to take?
@ -1057,7 +1057,7 @@ bool CTaskManip::TransporterTakeObject()
dynamic_cast<CTransportableObject&>(*cargo).SetTransporter(m_object); dynamic_cast<CTransportableObject&>(*cargo).SetTransporter(m_object);
dynamic_cast<CTransportableObject&>(*cargo).SetTransporterPart(3); // takes with the hand dynamic_cast<CTransportableObject&>(*cargo).SetTransporterPart(3); // takes with the hand
pos = Math::Vector(4.7f, 0.0f, 0.0f); // relative to the hand (lem4) pos = glm::vec3(4.7f, 0.0f, 0.0f); // relative to the hand (lem4)
cargo->SetPosition(pos); cargo->SetPosition(pos);
cargo->SetRotationX(0.0f); cargo->SetRotationX(0.0f);
cargo->SetRotationZ(Math::PI/2.0f); cargo->SetRotationZ(Math::PI/2.0f);
@ -1075,7 +1075,7 @@ bool CTaskManip::TransporterTakeObject()
m_cargoType = cargo->GetType(); m_cargoType = cargo->GetType();
Math::Vector pos = Math::Vector(4.7f, 0.0f, 0.0f); // relative to the hand (lem4) glm::vec3 pos = glm::vec3(4.7f, 0.0f, 0.0f); // relative to the hand (lem4)
cargo->SetPosition(pos); cargo->SetPosition(pos);
cargo->SetRotationX(0.0f); cargo->SetRotationX(0.0f);
cargo->SetRotationZ(Math::PI/2.0f); cargo->SetRotationZ(Math::PI/2.0f);
@ -1088,7 +1088,7 @@ bool CTaskManip::TransporterTakeObject()
if (m_arm == TMA_OTHER) // battery takes from friend? if (m_arm == TMA_OTHER) // battery takes from friend?
{ {
Math::Vector pos; glm::vec3 pos;
float dist = 0.0f, angle = 0.0f; float dist = 0.0f, angle = 0.0f;
CObject* other = SearchOtherObject(false, pos, dist, angle, m_height); CObject* other = SearchOtherObject(false, pos, dist, angle, m_height);
if (other == nullptr) return false; if (other == nullptr) return false;
@ -1104,7 +1104,7 @@ bool CTaskManip::TransporterTakeObject()
dynamic_cast<CTransportableObject&>(*cargo).SetTransporter(m_object); dynamic_cast<CTransportableObject&>(*cargo).SetTransporter(m_object);
dynamic_cast<CTransportableObject&>(*cargo).SetTransporterPart(3); // takes with the hand dynamic_cast<CTransportableObject&>(*cargo).SetTransporterPart(3); // takes with the hand
pos = Math::Vector(4.7f, 0.0f, 0.0f); // relative to the hand (lem4) pos = glm::vec3(4.7f, 0.0f, 0.0f); // relative to the hand (lem4)
cargo->SetPosition(pos); cargo->SetPosition(pos);
cargo->SetRotationX(0.0f); cargo->SetRotationX(0.0f);
cargo->SetRotationZ(Math::PI/2.0f); cargo->SetRotationZ(Math::PI/2.0f);
@ -1129,7 +1129,7 @@ bool CTaskManip::TransporterDeposeObject()
m_cargoType = cargo->GetType(); m_cargoType = cargo->GetType();
Math::Matrix* mat = cargo->GetWorldMatrix(0); Math::Matrix* mat = cargo->GetWorldMatrix(0);
Math::Vector pos = Transform(*mat, Math::Vector(0.0f, 1.0f, 0.0f)); glm::vec3 pos = Transform(*mat, glm::vec3(0.0f, 1.0f, 0.0f));
m_terrain->AdjustToFloor(pos); m_terrain->AdjustToFloor(pos);
cargo->SetPosition(pos); cargo->SetPosition(pos);
cargo->SetRotationY(m_object->GetRotationY()+Math::PI/2.0f); cargo->SetRotationY(m_object->GetRotationY()+Math::PI/2.0f);
@ -1150,7 +1150,7 @@ bool CTaskManip::TransporterDeposeObject()
m_cargoType = cargo->GetType(); m_cargoType = cargo->GetType();
Math::Matrix* mat = cargo->GetWorldMatrix(0); Math::Matrix* mat = cargo->GetWorldMatrix(0);
Math::Vector pos = Transform(*mat, Math::Vector(0.0f, 1.0f, 0.0f)); glm::vec3 pos = Transform(*mat, glm::vec3(0.0f, 1.0f, 0.0f));
m_terrain->AdjustToFloor(pos); m_terrain->AdjustToFloor(pos);
cargo->SetPosition(pos); cargo->SetPosition(pos);
cargo->SetRotationY(m_object->GetRotationY()+Math::PI/2.0f); cargo->SetRotationY(m_object->GetRotationY()+Math::PI/2.0f);
@ -1186,7 +1186,7 @@ bool CTaskManip::TransporterDeposeObject()
if (m_arm == TMA_OTHER) // deposits battery on friend? if (m_arm == TMA_OTHER) // deposits battery on friend?
{ {
Math::Vector pos; glm::vec3 pos;
float angle = 0.0f, dist = 0.0f; float angle = 0.0f, dist = 0.0f;
CObject* other = SearchOtherObject(false, pos, dist, angle, m_height); CObject* other = SearchOtherObject(false, pos, dist, angle, m_height);
@ -1219,10 +1219,10 @@ bool CTaskManip::TransporterDeposeObject()
// Seeks if a location allows to deposit an object. // Seeks if a location allows to deposit an object.
bool CTaskManip::IsFreeDeposeObject(Math::Vector pos) bool CTaskManip::IsFreeDeposeObject(glm::vec3 pos)
{ {
Math::Matrix* mat = m_object->GetWorldMatrix(0); Math::Matrix* mat = m_object->GetWorldMatrix(0);
Math::Vector iPos = Transform(*mat, pos); glm::vec3 iPos = Transform(*mat, pos);
for (CObject* obj : CObjectManager::GetInstancePointer()->GetAllObjects()) for (CObject* obj : CObjectManager::GetInstancePointer()->GetAllObjects())
{ {

View File

@ -70,13 +70,13 @@ public:
protected: protected:
void InitAngle(); void InitAngle();
CObject* SearchTakeUnderObject(Math::Vector &pos, float dLimit); CObject* SearchTakeUnderObject(glm::vec3 &pos, float dLimit);
CObject* SearchTakeFrontObject(bool bAdvance, Math::Vector &pos, float &distance, float &angle); CObject* SearchTakeFrontObject(bool bAdvance, glm::vec3 &pos, float &distance, float &angle);
CObject* SearchTakeBackObject(bool bAdvance, Math::Vector &pos, float &distance, float &angle); CObject* SearchTakeBackObject(bool bAdvance, glm::vec3 &pos, float &distance, float &angle);
CObject* SearchOtherObject(bool bAdvance, Math::Vector &pos, float &distance, float &angle, float &height); CObject* SearchOtherObject(bool bAdvance, glm::vec3 &pos, float &distance, float &angle, float &height);
bool TransporterTakeObject(); bool TransporterTakeObject();
bool TransporterDeposeObject(); bool TransporterDeposeObject();
bool IsFreeDeposeObject(Math::Vector pos); bool IsFreeDeposeObject(glm::vec3 pos);
void SoundManip(float time, float amplitude=1.0f, float frequency=1.0f); void SoundManip(float time, float amplitude=1.0f, float frequency=1.0f);
protected: protected:
@ -97,7 +97,7 @@ protected:
bool m_bBee = false; bool m_bBee = false;
float m_angle = 0.0f; float m_angle = 0.0f;
float m_move = 0.0f; float m_move = 0.0f;
Math::Vector m_targetPos; glm::vec3 m_targetPos = { 0, 0, 0 };
float m_timeLimit = 0.0f; float m_timeLimit = 0.0f;
ObjectType m_cargoType = OBJECT_NULL; ObjectType m_cargoType = OBJECT_NULL;
}; };

View File

@ -47,7 +47,7 @@ CTaskPen::~CTaskPen()
bool CTaskPen::EventProcess(const Event &event) bool CTaskPen::EventProcess(const Event &event)
{ {
Math::Vector pos, speed; glm::vec3 pos, speed;
glm::vec2 dim; glm::vec2 dim;
int i; int i;
@ -133,7 +133,7 @@ bool CTaskPen::EventProcess(const Event &event)
Error CTaskPen::Start(bool bDown, TraceColor color) Error CTaskPen::Start(bool bDown, TraceColor color)
{ {
Math::Vector pos; glm::vec3 pos;
Math::Matrix* mat; Math::Matrix* mat;
ObjectType type; ObjectType type;
int i; int i;
@ -180,7 +180,7 @@ Error CTaskPen::Start(bool bDown, TraceColor color)
} }
mat = m_object->GetWorldMatrix(0); mat = m_object->GetWorldMatrix(0);
pos = Math::Vector(-3.0f, 7.0f, 0.0f); pos = glm::vec3(-3.0f, 7.0f, 0.0f);
pos = Math::Transform(*mat, pos); // position of carousel pos = Math::Transform(*mat, pos); // position of carousel
m_supportPos = pos; m_supportPos = pos;

View File

@ -60,7 +60,7 @@ protected:
float m_delay = 0.0f; float m_delay = 0.0f;
float m_time = 0.0f; float m_time = 0.0f;
float m_lastParticle = 0.0f; float m_lastParticle = 0.0f;
Math::Vector m_supportPos; glm::vec3 m_supportPos = { 0, 0, 0 };
float m_timeUp = 0.0f; float m_timeUp = 0.0f;
float m_oldAngle = 0.0f; float m_oldAngle = 0.0f;

View File

@ -62,7 +62,7 @@ CTaskRecover::~CTaskRecover()
bool CTaskRecover::EventProcess(const Event &event) bool CTaskRecover::EventProcess(const Event &event)
{ {
Math::Vector pos, speed; glm::vec3 pos, speed;
glm::vec2 dim; glm::vec2 dim;
float a, g, cirSpeed, angle, energy, dist, linSpeed; float a, g, cirSpeed, angle, energy, dist, linSpeed;
@ -198,7 +198,7 @@ Error CTaskRecover::Start()
if ( energy < ENERGY_RECOVER+0.05f ) return ERR_RECOVER_ENERGY; if ( energy < ENERGY_RECOVER+0.05f ) return ERR_RECOVER_ENERGY;
Math::Matrix* mat = m_object->GetWorldMatrix(0); Math::Matrix* mat = m_object->GetWorldMatrix(0);
Math::Vector pos = Math::Vector(RECOVER_DIST, 3.3f, 0.0f); glm::vec3 pos = glm::vec3(RECOVER_DIST, 3.3f, 0.0f);
pos = Transform(*mat, pos); // position in front pos = Transform(*mat, pos); // position in front
m_recoverPos = pos; m_recoverPos = pos;
@ -206,8 +206,8 @@ Error CTaskRecover::Start()
if ( m_ruin == nullptr ) return ERR_RECOVER_NULL; if ( m_ruin == nullptr ) return ERR_RECOVER_NULL;
m_ruin->SetLock(true); // ruin no longer usable m_ruin->SetLock(true); // ruin no longer usable
Math::Vector iPos = m_object->GetPosition(); glm::vec3 iPos = m_object->GetPosition();
Math::Vector oPos = m_ruin->GetPosition(); glm::vec3 oPos = m_ruin->GetPosition();
m_angle = Math::RotateAngle(oPos.x-iPos.x, iPos.z-oPos.z); // CW ! m_angle = Math::RotateAngle(oPos.x-iPos.x, iPos.z-oPos.z); // CW !
m_metal = nullptr; m_metal = nullptr;
@ -229,7 +229,7 @@ Error CTaskRecover::Start()
Error CTaskRecover::IsEnded() Error CTaskRecover::IsEnded()
{ {
Math::Matrix* mat; Math::Matrix* mat;
Math::Vector pos, speed, goal; glm::vec3 pos, speed, goal;
glm::vec2 dim; glm::vec2 dim;
float angle, dist, time; float angle, dist, time;
int i; int i;
@ -273,7 +273,7 @@ Error CTaskRecover::IsEnded()
m_physics->SetMotorSpeedX(0.0f); m_physics->SetMotorSpeedX(0.0f);
mat = m_object->GetWorldMatrix(0); mat = m_object->GetWorldMatrix(0);
pos = Math::Vector(RECOVER_DIST, 3.3f, 0.0f); pos = glm::vec3(RECOVER_DIST, 3.3f, 0.0f);
pos = Transform(*mat, pos); // position in front pos = Transform(*mat, pos); // position in front
m_recoverPos = pos; m_recoverPos = pos;
@ -309,9 +309,9 @@ Error CTaskRecover::IsEnded()
m_metal->SetScale(0.0f); m_metal->SetScale(0.0f);
mat = m_object->GetWorldMatrix(0); mat = m_object->GetWorldMatrix(0);
pos = Math::Vector(RECOVER_DIST, 3.1f, 3.9f); pos = glm::vec3(RECOVER_DIST, 3.1f, 3.9f);
pos = Transform(*mat, pos); pos = Transform(*mat, pos);
goal = Math::Vector(RECOVER_DIST, 3.1f, -3.9f); goal = glm::vec3(RECOVER_DIST, 3.1f, -3.9f);
goal = Transform(*mat, goal); goal = Transform(*mat, goal);
m_particle->CreateRay(pos, goal, Gfx::PARTIRAY2, m_particle->CreateRay(pos, goal, Gfx::PARTIRAY2,
{ 2.0f, 2.0f }, 8.0f); { 2.0f, 2.0f }, 8.0f);

View File

@ -62,6 +62,6 @@ protected:
bool m_bError = false; bool m_bError = false;
CObject* m_ruin = nullptr; CObject* m_ruin = nullptr;
CObject* m_metal = nullptr; CObject* m_metal = nullptr;
Math::Vector m_recoverPos; glm::vec3 m_recoverPos = { 0, 0, 0 };
int m_soundChannel = 0; int m_soundChannel = 0;
}; };

View File

@ -54,7 +54,7 @@ CTaskSearch::~CTaskSearch()
bool CTaskSearch::EventProcess(const Event &event) bool CTaskSearch::EventProcess(const Event &event)
{ {
Math::Matrix* mat; Math::Matrix* mat;
Math::Vector pos, speed; glm::vec3 pos, speed;
glm::vec2 dim; glm::vec2 dim;
float angle; float angle;
int i; int i;
@ -83,7 +83,7 @@ bool CTaskSearch::EventProcess(const Event &event)
m_lastParticle = m_time; m_lastParticle = m_time;
mat = m_object->GetWorldMatrix(0); mat = m_object->GetWorldMatrix(0);
pos = Math::Vector(6.5f, 0.2f, 0.0f); pos = glm::vec3(6.5f, 0.2f, 0.0f);
pos = Math::Transform(*mat, pos); // sensor position pos = Math::Transform(*mat, pos); // sensor position
speed.x = (Math::Rand()-0.5f)*20.0f; speed.x = (Math::Rand()-0.5f)*20.0f;
@ -129,7 +129,7 @@ void CTaskSearch::InitAngle()
Error CTaskSearch::Start() Error CTaskSearch::Start()
{ {
ObjectType type; ObjectType type;
Math::Vector speed; glm::vec3 speed;
int i; int i;
m_bError = true; m_bError = true;
@ -240,7 +240,7 @@ bool CTaskSearch::Abort()
bool CTaskSearch::CreateMark() bool CTaskSearch::CreateMark()
{ {
Math::Matrix* mat = m_object->GetWorldMatrix(0); Math::Matrix* mat = m_object->GetWorldMatrix(0);
Math::Vector pos = Math::Vector(7.5f, 0.0f, 0.0f); glm::vec3 pos = glm::vec3(7.5f, 0.0f, 0.0f);
pos = Math::Transform(*mat, pos); // sensor position pos = Math::Transform(*mat, pos); // sensor position
Gfx::TerrainRes res = m_terrain->GetResource(pos); Gfx::TerrainRes res = m_terrain->GetResource(pos);

View File

@ -72,7 +72,7 @@ bool CTaskShield::EventProcess(const Event &event)
{ {
Math::Matrix* mat; Math::Matrix* mat;
Math::Matrix matrix; Math::Matrix matrix;
Math::Vector pos, speed, goal, angle; glm::vec3 pos, speed, goal, angle;
Gfx::Color color; Gfx::Color color;
glm::vec2 dim; glm::vec2 dim;
float energy; float energy;
@ -86,7 +86,7 @@ bool CTaskShield::EventProcess(const Event &event)
m_delay -= event.rTime; m_delay -= event.rTime;
mat = m_object->GetWorldMatrix(0); mat = m_object->GetWorldMatrix(0);
pos = Math::Vector(7.0f, 15.0f, 0.0f); pos = glm::vec3(7.0f, 15.0f, 0.0f);
pos = Math::Transform(*mat, pos); // sphere position pos = Math::Transform(*mat, pos); // sphere position
m_shieldPos = pos; m_shieldPos = pos;
@ -180,7 +180,7 @@ bool CTaskShield::EventProcess(const Event &event)
angle.y = 0.0f; angle.y = 0.0f;
angle.z = (Math::Rand()-0.5f)*Math::PI*1.2f; angle.z = (Math::Rand()-0.5f)*Math::PI*1.2f;
Math::LoadRotationXZYMatrix(matrix, angle); Math::LoadRotationXZYMatrix(matrix, angle);
goal = Math::Transform(matrix, Math::Vector(0.0f, GetRadius()-dim.x, 0.0f)); goal = Math::Transform(matrix, glm::vec3(0.0f, GetRadius()-dim.x, 0.0f));
goal += pos; goal += pos;
m_particle->CreateRay(pos, goal, Gfx::PARTIRAY2, dim, 0.3f); m_particle->CreateRay(pos, goal, Gfx::PARTIRAY2, dim, 0.3f);
} }
@ -258,7 +258,7 @@ Error CTaskShield::Start(TaskShieldMode mode, float delay)
if ( mode == TSM_START ) if ( mode == TSM_START )
{ {
Math::Vector pos; glm::vec3 pos;
glm::vec2 dim; glm::vec2 dim;
pos.x = 7.0f; pos.x = 7.0f;
@ -272,12 +272,12 @@ Error CTaskShield::Start(TaskShieldMode mode, float delay)
m_object->SetPartPosition(3, pos); m_object->SetPartPosition(3, pos);
Math::Matrix* mat = m_object->GetWorldMatrix(0); Math::Matrix* mat = m_object->GetWorldMatrix(0);
pos = Math::Vector(7.0f, 15.0f, 0.0f); pos = glm::vec3(7.0f, 15.0f, 0.0f);
pos = Transform(*mat, pos); // sphere position pos = Transform(*mat, pos); // sphere position
m_shieldPos = pos; m_shieldPos = pos;
pos = m_shieldPos; pos = m_shieldPos;
Math::Vector speed = Math::Vector(0.0f, 0.0f, 0.0f); glm::vec3 speed = glm::vec3(0.0f, 0.0f, 0.0f);
dim.x = GetRadius(); dim.x = GetRadius();
dim.y = dim.x; dim.y = dim.x;
m_rankSphere = m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISPHERE3, 2.0f, 0.0f, 0.0f); m_rankSphere = m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISPHERE3, 2.0f, 0.0f, 0.0f);
@ -313,7 +313,7 @@ Error CTaskShield::Start(TaskShieldMode mode, float delay)
if ( energy == 0.0f ) return ERR_SHIELD_ENERGY; if ( energy == 0.0f ) return ERR_SHIELD_ENERGY;
Math::Matrix* mat = m_object->GetWorldMatrix(0); Math::Matrix* mat = m_object->GetWorldMatrix(0);
Math::Vector pos = Math::Vector(7.0f, 15.0f, 0.0f); glm::vec3 pos = glm::vec3(7.0f, 15.0f, 0.0f);
pos = Transform(*mat, pos); // sphere position pos = Transform(*mat, pos); // sphere position
m_shieldPos = pos; m_shieldPos = pos;
@ -381,7 +381,7 @@ Error CTaskShield::Stop()
Error CTaskShield::IsEnded() Error CTaskShield::IsEnded()
{ {
Math::Vector pos, speed; glm::vec3 pos, speed;
glm::vec2 dim; glm::vec2 dim;
float energy; float energy;
@ -424,7 +424,7 @@ Error CTaskShield::IsEnded()
m_object->SetPartPosition(3, pos); m_object->SetPartPosition(3, pos);
pos = m_shieldPos; pos = m_shieldPos;
speed = Math::Vector(0.0f, 0.0f, 0.0f); speed = glm::vec3(0.0f, 0.0f, 0.0f);
dim.x = GetRadius(); dim.x = GetRadius();
dim.y = dim.x; dim.y = dim.x;
m_rankSphere = m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISPHERE3, 2.0f, 0.0f, 0.0f); m_rankSphere = m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISPHERE3, 2.0f, 0.0f, 0.0f);
@ -477,7 +477,7 @@ bool CTaskShield::IsBusy()
bool CTaskShield::Abort() bool CTaskShield::Abort()
{ {
Math::Vector pos; glm::vec3 pos;
pos.x = 7.0f; pos.x = 7.0f;
pos.y = 4.5f; pos.y = 4.5f;
@ -515,7 +515,7 @@ bool CTaskShield::Abort()
// Creates the light to accompany a pyrotechnic effect. // Creates the light to accompany a pyrotechnic effect.
bool CTaskShield::CreateLight(Math::Vector pos) bool CTaskShield::CreateLight(glm::vec3 pos)
{ {
Gfx::Light light; Gfx::Light light;
@ -525,7 +525,7 @@ bool CTaskShield::CreateLight(Math::Vector pos)
light.ambient = Gfx::Color(0.0f, 0.0f, 0.0f); light.ambient = Gfx::Color(0.0f, 0.0f, 0.0f);
light.diffuse = Gfx::Color(0.0f, 1.0f, 2.0f); light.diffuse = Gfx::Color(0.0f, 1.0f, 2.0f);
light.position = pos; light.position = pos;
light.direction = Math::Vector(0.0f, -1.0f, 0.0f); // against the bottom light.direction = glm::vec3(0.0f, -1.0f, 0.0f); // against the bottom
light.spotIntensity = 128; light.spotIntensity = 128;
light.attenuation0 = 1.0f; light.attenuation0 = 1.0f;
light.attenuation1 = 0.0f; light.attenuation1 = 0.0f;
@ -552,7 +552,7 @@ void CTaskShield::IncreaseShield()
CShieldedObject* shielded = dynamic_cast<CShieldedObject*>(obj); CShieldedObject* shielded = dynamic_cast<CShieldedObject*>(obj);
if (!shielded->IsRepairable()) continue; // NOTE: Looks like the original code forgot to check that if (!shielded->IsRepairable()) continue; // NOTE: Looks like the original code forgot to check that
Math::Vector oPos = obj->GetPosition(); glm::vec3 oPos = obj->GetPosition();
float dist = Math::Distance(oPos, m_shieldPos); float dist = Math::Distance(oPos, m_shieldPos);
if ( dist <= GetRadius()+10.0f ) if ( dist <= GetRadius()+10.0f )
{ {

View File

@ -68,7 +68,7 @@ public:
protected: protected:
Error Stop(); Error Stop();
bool CreateLight(Math::Vector pos); bool CreateLight(glm::vec3 pos);
void IncreaseShield(); void IncreaseShield();
float GetRadius(); float GetRadius();
@ -84,7 +84,7 @@ protected:
float m_lastIncrease = 0.0f; float m_lastIncrease = 0.0f;
float m_energyUsed = 0.0f; float m_energyUsed = 0.0f;
bool m_bError = false; bool m_bError = false;
Math::Vector m_shieldPos; glm::vec3 m_shieldPos = { 0, 0, 0 };
int m_rankSphere = 0; int m_rankSphere = 0;
int m_soundChannel = 0; int m_soundChannel = 0;
int m_effectLight = 0; int m_effectLight = 0;

View File

@ -83,7 +83,7 @@ bool CTaskTake::EventProcess(const Event &event)
m_progress += event.rTime*m_speed; // others advance m_progress += event.rTime*m_speed; // others advance
m_physics->SetMotorSpeed(Math::Vector(0.0f, 0.0f, 0.0f)); // immobile! m_physics->SetMotorSpeed(glm::vec3(0.0f, 0.0f, 0.0f)); // immobile!
return true; return true;
} }
@ -104,7 +104,7 @@ Error CTaskTake::Start()
m_bError = true; // operation impossible m_bError = true; // operation impossible
if ( !m_physics->GetLand() ) if ( !m_physics->GetLand() )
{ {
Math::Vector pos = m_object->GetPosition(); glm::vec3 pos = m_object->GetPosition();
float h = m_water->GetLevel(m_object); float h = m_water->GetLevel(m_object);
if ( pos.y < h ) return ERR_MANIP_WATER; // impossible under water if ( pos.y < h ) return ERR_MANIP_WATER; // impossible under water
return ERR_MANIP_FLY; return ERR_MANIP_FLY;
@ -114,7 +114,7 @@ Error CTaskTake::Start()
if ( type != OBJECT_HUMAN && if ( type != OBJECT_HUMAN &&
type != OBJECT_TECH ) return ERR_WRONG_BOT; type != OBJECT_TECH ) return ERR_WRONG_BOT;
m_physics->SetMotorSpeed(Math::Vector(0.0f, 0.0f, 0.0f)); m_physics->SetMotorSpeed(glm::vec3(0.0f, 0.0f, 0.0f));
if (m_object->IsCarryingCargo()) if (m_object->IsCarryingCargo())
m_order = TTO_DEPOSE; m_order = TTO_DEPOSE;
@ -124,7 +124,7 @@ Error CTaskTake::Start()
if ( m_order == TTO_TAKE ) if ( m_order == TTO_TAKE )
{ {
Math::Vector pos = m_object->GetPosition(); glm::vec3 pos = m_object->GetPosition();
float h = m_water->GetLevel(m_object); float h = m_water->GetLevel(m_object);
if ( pos.y < h ) return ERR_MANIP_WATER; // impossible under water if ( pos.y < h ) return ERR_MANIP_WATER; // impossible under water
@ -168,7 +168,7 @@ Error CTaskTake::Start()
} }
else else
{ {
if ( !IsFreeDeposeObject(Math::Vector(2.5f, 0.0f, 0.0f)) ) return ERR_MANIP_OCC; if ( !IsFreeDeposeObject(glm::vec3(2.5f, 0.0f, 0.0f)) ) return ERR_MANIP_OCC;
//? m_camera->StartCentering(m_object, Math::PI*0.3f, 99.9f, 0.0f, 0.8f); //? m_camera->StartCentering(m_object, Math::PI*0.3f, 99.9f, 0.0f, 0.8f);
m_arm = TTA_FFRONT; m_arm = TTA_FFRONT;
} }
@ -290,7 +290,7 @@ CObject* CTaskTake::SearchTakeObject(float &angle,
float dLimit, float aLimit) float dLimit, float aLimit)
{ {
CObject *pBest; CObject *pBest;
Math::Vector iPos, oPos; glm::vec3 iPos, oPos;
float min, iAngle, bAngle, a, distance; float min, iAngle, bAngle, a, distance;
iPos = m_object->GetPosition(); iPos = m_object->GetPosition();
@ -339,7 +339,7 @@ CObject* CTaskTake::SearchFriendObject(float &angle,
if (m_object->GetCrashSphereCount() == 0) return nullptr; if (m_object->GetCrashSphereCount() == 0) return nullptr;
auto crashSphere = m_object->GetFirstCrashSphere(); auto crashSphere = m_object->GetFirstCrashSphere();
Math::Vector iPos = crashSphere.sphere.pos; glm::vec3 iPos = crashSphere.sphere.pos;
float iRad = crashSphere.sphere.radius; float iRad = crashSphere.sphere.radius;
float iAngle = m_object->GetRotationY(); float iAngle = m_object->GetRotationY();
@ -398,7 +398,7 @@ CObject* CTaskTake::SearchFriendObject(float &angle,
} }
Math::Matrix* mat = pObj->GetWorldMatrix(0); Math::Matrix* mat = pObj->GetWorldMatrix(0);
Math::Vector oPos = Math::Transform(*mat, dynamic_cast<CPoweredObject&>(*pObj).GetPowerPosition()); glm::vec3 oPos = Math::Transform(*mat, dynamic_cast<CPoweredObject&>(*pObj).GetPowerPosition());
float distance = fabs(Math::Distance(oPos, iPos) - (iRad+1.0f)); float distance = fabs(Math::Distance(oPos, iPos) - (iRad+1.0f));
if ( distance <= dLimit ) if ( distance <= dLimit )
@ -406,7 +406,7 @@ CObject* CTaskTake::SearchFriendObject(float &angle,
angle = Math::RotateAngle(oPos.x-iPos.x, iPos.z-oPos.z); // CW ! angle = Math::RotateAngle(oPos.x-iPos.x, iPos.z-oPos.z); // CW !
if ( Math::TestAngle(angle, iAngle-aLimit, iAngle+aLimit) ) if ( Math::TestAngle(angle, iAngle-aLimit, iAngle+aLimit) )
{ {
Math::Vector powerPos = dynamic_cast<CPoweredObject&>(*pObj).GetPowerPosition(); glm::vec3 powerPos = dynamic_cast<CPoweredObject&>(*pObj).GetPowerPosition();
m_height = powerPos.y; m_height = powerPos.y;
return pObj; return pObj;
} }
@ -433,8 +433,8 @@ bool CTaskTake::TransporterTakeObject()
dynamic_cast<CTransportableObject&>(*cargo).SetTransporter(m_object); dynamic_cast<CTransportableObject&>(*cargo).SetTransporter(m_object);
dynamic_cast<CTransportableObject&>(*cargo).SetTransporterPart(4); // takes with the hand dynamic_cast<CTransportableObject&>(*cargo).SetTransporterPart(4); // takes with the hand
//? cargo->SetPosition(Math::Vector(2.2f, -1.0f, 1.1f)); //? cargo->SetPosition(glm::vec3(2.2f, -1.0f, 1.1f));
cargo->SetPosition(Math::Vector(1.7f, -0.5f, 1.1f)); cargo->SetPosition(glm::vec3(1.7f, -0.5f, 1.1f));
cargo->SetRotationY(0.1f); cargo->SetRotationY(0.1f);
cargo->SetRotationX(0.0f); cargo->SetRotationX(0.0f);
cargo->SetRotationZ(0.8f); cargo->SetRotationZ(0.8f);
@ -459,8 +459,8 @@ bool CTaskTake::TransporterTakeObject()
dynamic_cast<CTransportableObject&>(*cargo).SetTransporter(m_object); dynamic_cast<CTransportableObject&>(*cargo).SetTransporter(m_object);
dynamic_cast<CTransportableObject&>(*cargo).SetTransporterPart(4); // takes with the hand dynamic_cast<CTransportableObject&>(*cargo).SetTransporterPart(4); // takes with the hand
//? cargo->SetPosition(Math::Vector(2.2f, -1.0f, 1.1f)); //? cargo->SetPosition(glm::vec3(2.2f, -1.0f, 1.1f));
cargo->SetPosition(Math::Vector(1.7f, -0.5f, 1.1f)); cargo->SetPosition(glm::vec3(1.7f, -0.5f, 1.1f));
cargo->SetRotationY(0.1f); cargo->SetRotationY(0.1f);
cargo->SetRotationX(0.0f); cargo->SetRotationX(0.0f);
cargo->SetRotationZ(0.8f); cargo->SetRotationZ(0.8f);
@ -484,7 +484,7 @@ bool CTaskTake::TransporterDeposeObject()
m_cargoType = cargo->GetType(); m_cargoType = cargo->GetType();
Math::Matrix* mat = cargo->GetWorldMatrix(0); Math::Matrix* mat = cargo->GetWorldMatrix(0);
Math::Vector pos = Transform(*mat, Math::Vector(-0.5f, 1.0f, 0.0f)); glm::vec3 pos = Transform(*mat, glm::vec3(-0.5f, 1.0f, 0.0f));
m_terrain->AdjustToFloor(pos); m_terrain->AdjustToFloor(pos);
cargo->SetPosition(pos); cargo->SetPosition(pos);
cargo->SetRotationY(m_object->GetRotationY()+Math::PI/2.0f); cargo->SetRotationY(m_object->GetRotationY()+Math::PI/2.0f);
@ -528,10 +528,10 @@ bool CTaskTake::TransporterDeposeObject()
// Seeks if a location allows to deposit an object. // Seeks if a location allows to deposit an object.
bool CTaskTake::IsFreeDeposeObject(Math::Vector pos) bool CTaskTake::IsFreeDeposeObject(glm::vec3 pos)
{ {
Math::Matrix* mat = m_object->GetWorldMatrix(0); Math::Matrix* mat = m_object->GetWorldMatrix(0);
Math::Vector iPos = Transform(*mat, pos); glm::vec3 iPos = Transform(*mat, pos);
for (CObject* pObj : CObjectManager::GetInstancePointer()->GetAllObjects()) for (CObject* pObj : CObjectManager::GetInstancePointer()->GetAllObjects())
{ {

View File

@ -60,7 +60,7 @@ protected:
CObject* SearchFriendObject(float &angle, float dLimit, float aLimit); CObject* SearchFriendObject(float &angle, float dLimit, float aLimit);
bool TransporterTakeObject(); bool TransporterTakeObject();
bool TransporterDeposeObject(); bool TransporterDeposeObject();
bool IsFreeDeposeObject(Math::Vector pos); bool IsFreeDeposeObject(glm::vec3 pos);
protected: protected:
TaskTakeOrder m_order = TTO_TAKE; TaskTakeOrder m_order = TTO_TAKE;

View File

@ -70,7 +70,7 @@ bool CTaskTerraform::EventProcess(const Event &event)
{ {
CObject* power; CObject* power;
Math::Matrix* mat; Math::Matrix* mat;
Math::Vector pos, dir, speed; glm::vec3 pos, dir, speed;
glm::vec2 dim; glm::vec2 dim;
float energy; float energy;
@ -148,7 +148,7 @@ bool CTaskTerraform::EventProcess(const Event &event)
if ( m_phase == TTP_CHARGE ) if ( m_phase == TTP_CHARGE )
{ {
// Battery. // Battery.
pos = Math::Vector(-6.0f, 5.5f+2.0f*m_progress, 0.0f); pos = glm::vec3(-6.0f, 5.5f+2.0f*m_progress, 0.0f);
pos.x += (Math::Rand()-0.5f)*1.0f; pos.x += (Math::Rand()-0.5f)*1.0f;
pos.z += (Math::Rand()-0.5f)*1.0f; pos.z += (Math::Rand()-0.5f)*1.0f;
pos = Math::Transform(*mat, pos); pos = Math::Transform(*mat, pos);
@ -163,7 +163,7 @@ bool CTaskTerraform::EventProcess(const Event &event)
if ( m_phase != TTP_CHARGE ) if ( m_phase != TTP_CHARGE )
{ {
// Left grid. // Left grid.
pos = Math::Vector(-1.0f, 5.8f, 3.5f); pos = glm::vec3(-1.0f, 5.8f, 3.5f);
pos.x += (Math::Rand()-0.5f)*1.0f; pos.x += (Math::Rand()-0.5f)*1.0f;
pos.z += (Math::Rand()-0.5f)*1.0f; pos.z += (Math::Rand()-0.5f)*1.0f;
pos = Math::Transform(*mat, pos); pos = Math::Transform(*mat, pos);
@ -177,7 +177,7 @@ bool CTaskTerraform::EventProcess(const Event &event)
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISMOKE1, 3.0f); m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISMOKE1, 3.0f);
// Right grid. // Right grid.
pos = Math::Vector(-1.0f, 5.8f, -3.5f); pos = glm::vec3(-1.0f, 5.8f, -3.5f);
pos.x += (Math::Rand()-0.5f)*1.0f; pos.x += (Math::Rand()-0.5f)*1.0f;
pos.z += (Math::Rand()-0.5f)*1.0f; pos.z += (Math::Rand()-0.5f)*1.0f;
pos = Math::Transform(*mat, pos); pos = Math::Transform(*mat, pos);
@ -202,7 +202,7 @@ Error CTaskTerraform::Start()
{ {
CObject* power; CObject* power;
Math::Matrix* mat; Math::Matrix* mat;
Math::Vector pos, speed; glm::vec3 pos, speed;
float energy; float energy;
ObjectType type; ObjectType type;
@ -223,7 +223,7 @@ Error CTaskTerraform::Start()
speed.z != 0.0f ) return ERR_MANIP_MOTOR; speed.z != 0.0f ) return ERR_MANIP_MOTOR;
mat = m_object->GetWorldMatrix(0); mat = m_object->GetWorldMatrix(0);
pos = Math::Vector(9.0f, 0.0f, 0.0f); pos = glm::vec3(9.0f, 0.0f, 0.0f);
pos = Math::Transform(*mat, pos); // battery position pos = Math::Transform(*mat, pos); // battery position
m_terraPos = pos; m_terraPos = pos;
@ -243,7 +243,7 @@ Error CTaskTerraform::Start()
Error CTaskTerraform::IsEnded() Error CTaskTerraform::IsEnded()
{ {
CObject* power; CObject* power;
Math::Vector pos, speed; glm::vec3 pos, speed;
glm::vec2 dim; glm::vec2 dim;
float dist, duration; float dist, duration;
int i, max; int i, max;
@ -266,7 +266,7 @@ Error CTaskTerraform::IsEnded()
{ {
Terraform(); // changes the terrain. Terraform(); // changes the terrain.
m_object->SetCirVibration(Math::Vector(0.0f, 0.0f, 0.0f)); m_object->SetCirVibration(glm::vec3(0.0f, 0.0f, 0.0f));
m_object->SetScale(1.0f); m_object->SetScale(1.0f);
power = m_object->GetPower(); power = m_object->GetPower();
@ -283,7 +283,7 @@ Error CTaskTerraform::IsEnded()
pos.y = m_terraPos.y; pos.y = m_terraPos.y;
m_terrain->AdjustToFloor(pos); m_terrain->AdjustToFloor(pos);
dist = Math::Distance(pos, m_terraPos); dist = Math::Distance(pos, m_terraPos);
speed = Math::Vector(0.0f, 0.0f, 0.0f); speed = glm::vec3(0.0f, 0.0f, 0.0f);
dim.x = 2.0f+(40.0f-dist)/(1.0f+Math::Rand()*4.0f); dim.x = 2.0f+(40.0f-dist)/(1.0f+Math::Rand()*4.0f);
dim.y = dim.x; dim.y = dim.x;
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTICRASH, 2.0f); m_particle->CreateParticle(pos, speed, dim, Gfx::PARTICRASH, 2.0f);
@ -330,9 +330,9 @@ bool CTaskTerraform::Abort()
m_soundChannel = -1; m_soundChannel = -1;
} }
m_object->SetPartPosition(2, Math::Vector(9.0f, 4.0f, 0.0f)); m_object->SetPartPosition(2, glm::vec3(9.0f, 4.0f, 0.0f));
m_object->SetTilt(Math::Vector(0.0f, 0.0f, 0.0f)); m_object->SetTilt(glm::vec3(0.0f, 0.0f, 0.0f));
m_object->SetCirVibration(Math::Vector(0.0f, 0.0f, 0.0f)); m_object->SetCirVibration(glm::vec3(0.0f, 0.0f, 0.0f));
m_object->SetScale(1.0f); m_object->SetScale(1.0f);
power = m_object->GetPower(); power = m_object->GetPower();

View File

@ -58,5 +58,5 @@ protected:
float m_lastParticle = 0.0f; float m_lastParticle = 0.0f;
int m_soundChannel = 0; int m_soundChannel = 0;
bool m_bError = false; bool m_bError = false;
Math::Vector m_terraPos; glm::vec3 m_terraPos = { 0, 0, 0 };
}; };