diff --git a/src/object/task/taskadvance.cpp b/src/object/task/taskadvance.cpp index d8573523..7f8adc93 100644 --- a/src/object/task/taskadvance.cpp +++ b/src/object/task/taskadvance.cpp @@ -97,7 +97,7 @@ Error CTaskAdvance::Start(float length) Error CTaskAdvance::IsEnded() { - Math::Vector pos; + glm::vec3 pos; float length; if ( m_engine->GetPause() ) return ERR_CONTINUE; diff --git a/src/object/task/taskadvance.h b/src/object/task/taskadvance.h index df8cb2b7..9377c6e8 100644 --- a/src/object/task/taskadvance.h +++ b/src/object/task/taskadvance.h @@ -42,7 +42,7 @@ protected: float m_advanceLength = 0.0f; float m_direction = 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_fixTime = 0.0f; bool m_bError = false; diff --git a/src/object/task/taskbuild.cpp b/src/object/task/taskbuild.cpp index 52d69e46..ac52bb85 100644 --- a/src/object/task/taskbuild.cpp +++ b/src/object/task/taskbuild.cpp @@ -86,7 +86,7 @@ CTaskBuild::~CTaskBuild() // 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; params.pos = pos; @@ -126,7 +126,7 @@ void CTaskBuild::CreateBuilding(Math::Vector pos, float angle, bool trainer) void CTaskBuild::CreateLight() { Gfx::Color color; - Math::Vector center, pos, dir; + glm::vec3 center, pos, dir; glm::vec2 c, p; float angle; int i; @@ -204,7 +204,7 @@ void CTaskBuild::BlackLight() bool CTaskBuild::EventProcess(const Event &event) { Math::Matrix* mat; - Math::Vector pos, dir, speed, pv, pm, tilt; + glm::vec3 pos, dir, speed, pv, pm, tilt; glm::vec2 dim; float a, g, cirSpeed, dist, linSpeed, diff; @@ -324,7 +324,7 @@ bool CTaskBuild::EventProcess(const Event &event) dim.y = dim.x; 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()) { case OBJECT_HUMAN: @@ -376,7 +376,7 @@ bool CTaskBuild::EventProcess(const Event &event) Error CTaskBuild::Start(ObjectType type) { - Math::Vector pos, speed, pv, pm; + glm::vec3 pos, speed, pv, pm; Error err; float iAngle, oAngle; @@ -439,7 +439,7 @@ Error CTaskBuild::IsEnded() { CAuto* automat; float angle, dist, time, diff; - Math::Vector pv, pm, tilt; + glm::vec3 pv, pm, tilt; if ( m_engine->GetPause() ) return ERR_CONTINUE; if ( m_bError ) return ERR_STOP; @@ -515,7 +515,7 @@ Error CTaskBuild::IsEnded() if (m_object->GetType() == OBJECT_HUMAN) { 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); } if (m_object->GetType() == OBJECT_MOBILEfb || @@ -563,7 +563,7 @@ Error CTaskBuild::IsEnded() m_metal = nullptr; 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_main->CreateShortcuts(); m_main->DisplayError(INFO_BUILD, m_buildingPos, 10.0f, 50.0f); @@ -588,7 +588,7 @@ Error CTaskBuild::IsEnded() if (m_object->GetType() == OBJECT_HUMAN) { 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); } else @@ -628,7 +628,7 @@ Error CTaskBuild::IsEnded() // Place gun back 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_physics->SetMotorSpeedX(0.0f); @@ -664,7 +664,7 @@ bool CTaskBuild::Abort() Error CTaskBuild::FlatFloor() { ObjectType type; - Math::Vector center, pos, bPos; + glm::vec3 center, pos, bPos; glm::vec2 c, p; float radius, max, bRadius = 0.0f, angle, dist; bool bLittleFlat, bBase; @@ -713,7 +713,7 @@ Error CTaskBuild::FlatFloor() type = pObj->GetType(); if ( type == OBJECT_BASE ) { - Math::Vector oPos = pObj->GetPosition(); + glm::vec3 oPos = pObj->GetPosition(); dist = Math::Distance(center, oPos)-80.0f; if ( dist < max ) { @@ -727,7 +727,7 @@ Error CTaskBuild::FlatFloor() { for (const auto& crashSphere : pObj->GetAllCrashSpheres()) { - Math::Vector oPos = crashSphere.sphere.pos; + glm::vec3 oPos = crashSphere.sphere.pos; float oRadius = crashSphere.sphere.radius; dist = Math::Distance(center, oPos)-oRadius; @@ -779,7 +779,7 @@ Error CTaskBuild::FlatFloor() { for (const auto& crashSphere : pObj->GetAllCrashSpheres()) { - Math::Vector oPos = crashSphere.sphere.pos; + glm::vec3 oPos = crashSphere.sphere.pos; float oRadius = crashSphere.sphere.radius; dist = Math::Distance(center, oPos)-oRadius; @@ -808,7 +808,7 @@ CObject* CTaskBuild::SearchMetalObject(float &angle, float dMin, float dMax, float aLimit, Error &err) { CObject *pBest; - Math::Vector iPos, oPos; + glm::vec3 iPos, oPos; ObjectType type; float min, iAngle, a, aa, aBest, distance, magic; bool bMetal; @@ -870,7 +870,7 @@ CObject* CTaskBuild::SearchMetalObject(float &angle, float dMin, float dMax, // Destroys all the close marks. -void CTaskBuild::DeleteMark(Math::Vector pos, float radius) +void CTaskBuild::DeleteMark(glm::vec3 pos, float radius) { std::vector objectsToDelete; @@ -885,7 +885,7 @@ void CTaskBuild::DeleteMark(Math::Vector pos, float radius) type != OBJECT_MARKKEYd && type != OBJECT_MARKPOWER ) continue; - Math::Vector oPos = obj->GetPosition(); + glm::vec3 oPos = obj->GetPosition(); float distance = Math::Distance(oPos, pos); if ( distance <= radius ) { diff --git a/src/object/task/taskbuild.h b/src/object/task/taskbuild.h index 28378e7f..a2866d11 100644 --- a/src/object/task/taskbuild.h +++ b/src/object/task/taskbuild.h @@ -61,11 +61,11 @@ public: protected: Error FlatFloor(); - void CreateBuilding(Math::Vector pos, float angle, bool trainer); + void CreateBuilding(glm::vec3 pos, float angle, bool trainer); void CreateLight(); void BlackLight(); 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: ObjectType m_type = OBJECT_NULL; // type of construction @@ -82,7 +82,7 @@ protected: float m_speed = 0.0f; // speed of progression float m_angleY = 0.0f; // rotation angle of the vehicle 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 int m_lightRank[TBMAXLIGHT] = {}; // lights for the effects int m_soundChannel = 0; diff --git a/src/object/task/taskfire.cpp b/src/object/task/taskfire.cpp index ff0aeac2..4b7a471d 100644 --- a/src/object/task/taskfire.cpp +++ b/src/object/task/taskfire.cpp @@ -64,7 +64,7 @@ bool CTaskFire::EventProcess(const Event &event) { CPhysics* physics; Math::Matrix* mat; - Math::Vector pos, speed, dir, vib; + glm::vec3 pos, speed, dir, vib; ObjectType type; glm::vec2 dim; float energy, fire; @@ -100,10 +100,10 @@ bool CTaskFire::EventProcess(const Event &event) 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); - speed = Math::Vector(200.0f, 0.0f, 0.0f); + speed = glm::vec3(200.0f, 0.0f, 0.0f); physics = m_object->GetPhysics(); if ( physics != nullptr ) @@ -130,12 +130,12 @@ bool CTaskFire::EventProcess(const Event &event) 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.z += (rand()%3-1)*1.5f; 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.y += (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); 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.y += (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 ) { - pos = Math::Vector(0.0f, 0.0f, 0.0f); + pos = glm::vec3(0.0f, 0.0f, 0.0f); } 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.z += (Math::Rand()-0.5f)*1.0f; 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(); if ( physics != nullptr ) @@ -212,12 +212,12 @@ bool CTaskFire::EventProcess(const Event &event) if ( type != OBJECT_MOBILErc && 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.z += (Math::Rand()-0.5f)*0.4f; 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.y += (Math::Rand()-0.2f)*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 ) { 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) { - Math::Vector pos, goal, speed; + glm::vec3 pos, goal, speed; float energy, fire; ObjectType type; @@ -373,9 +373,9 @@ Error CTaskFire::IsEnded() bool CTaskFire::Abort() { - m_object->SetTilt(Math::Vector(0.0f, 0.0f, 0.0f)); - m_object->SetCirVibration(Math::Vector(0.0f, 0.0f, 0.0f)); - m_object->SetLinVibration(Math::Vector(0.0f, 0.0f, 0.0f)); + m_object->SetTilt(glm::vec3(0.0f, 0.0f, 0.0f)); + m_object->SetCirVibration(glm::vec3(0.0f, 0.0f, 0.0f)); + m_object->SetLinVibration(glm::vec3(0.0f, 0.0f, 0.0f)); if ( m_soundChannel != -1 ) { diff --git a/src/object/task/taskfireant.cpp b/src/object/task/taskfireant.cpp index 3a3aa2b5..1685af29 100644 --- a/src/object/task/taskfireant.cpp +++ b/src/object/task/taskfireant.cpp @@ -53,7 +53,7 @@ CTaskFireAnt::~CTaskFireAnt() bool CTaskFireAnt::EventProcess(const Event &event) { - Math::Vector dir, vib; + glm::vec3 dir, vib; float a, g, cirSpeed; if ( m_engine->GetPause() ) return true; @@ -86,9 +86,9 @@ bool CTaskFireAnt::EventProcess(const Event &event) // 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; m_impact = impact; @@ -102,7 +102,7 @@ Error CTaskFireAnt::Start(Math::Vector impact) // Insect on its back? if ( dynamic_cast(*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(); 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() { Math::Matrix* mat; - Math::Vector pos, speed; + glm::vec3 pos, speed; glm::vec2 dim; float angle, dist; int i, channel; @@ -168,7 +168,7 @@ Error CTaskFireAnt::IsEnded() 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); pos = Math::Transform(*mat, pos); dist = Math::Distance(pos, m_impact); diff --git a/src/object/task/taskfireant.h b/src/object/task/taskfireant.h index 854dd232..f9057041 100644 --- a/src/object/task/taskfireant.h +++ b/src/object/task/taskfireant.h @@ -44,14 +44,14 @@ public: bool EventProcess(const Event &event) override; - Error Start(Math::Vector impact); + Error Start(glm::vec3 impact); Error IsEnded() override; bool Abort() override; protected: protected: - Math::Vector m_impact; + glm::vec3 m_impact = { 0, 0, 0 }; TaskFireAnt m_phase = TFA_NULL; float m_progress = 0.0f; float m_speed = 0.0f; diff --git a/src/object/task/taskflag.cpp b/src/object/task/taskflag.cpp index 50789ed7..eff8bc12 100644 --- a/src/object/task/taskflag.cpp +++ b/src/object/task/taskflag.cpp @@ -88,7 +88,7 @@ bool CTaskFlag::EventProcess(const Event &event) Error CTaskFlag::Start(TaskFlagOrder order, int rank) { - Math::Vector pos, speed; + glm::vec3 pos, speed; Error err; m_order = order; @@ -195,7 +195,7 @@ bool CTaskFlag::Abort() // 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 types; if(type == OBJECT_NULL) @@ -249,16 +249,16 @@ Error CTaskFlag::CreateFlag(int rank) }; Math::Matrix* mat = m_object->GetWorldMatrix(0); - Math::Vector pos; + glm::vec3 pos; switch ( m_object->GetType() ) { case OBJECT_HUMAN: 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; default: - pos = Transform(*mat, Math::Vector(6.0f, 0.0f, 0.0f)); + pos = Transform(*mat, glm::vec3(6.0f, 0.0f, 0.0f)); break; } @@ -293,7 +293,7 @@ Error CTaskFlag::CreateFlag(int rank) Error CTaskFlag::DeleteFlag() { CObject* pObj; - Math::Vector iPos, oPos; + glm::vec3 iPos, oPos; float iAngle, angle, aLimit, dist; iPos = m_object->GetPosition(); diff --git a/src/object/task/taskflag.h b/src/object/task/taskflag.h index 3e546660..eadcd050 100644 --- a/src/object/task/taskflag.h +++ b/src/object/task/taskflag.h @@ -51,7 +51,7 @@ public: protected: Error CreateFlag(int rank); Error DeleteFlag(); - CObject* SearchNearest(Math::Vector pos, ObjectType type); + CObject* SearchNearest(glm::vec3 pos, ObjectType type); int CountObject(ObjectType type); protected: diff --git a/src/object/task/taskgoto.cpp b/src/object/task/taskgoto.cpp index 58b610da..95eb1f71 100644 --- a/src/object/task/taskgoto.cpp +++ b/src/object/task/taskgoto.cpp @@ -76,7 +76,7 @@ CTaskGoto::~CTaskGoto() bool CTaskGoto::EventProcess(const Event &event) { - Math::Vector pos, goal; + glm::vec3 pos, goal; glm::vec2 rot, repulse; float a, g, dist, linSpeed, cirSpeed, h, hh, factor, dir; Error ret; @@ -85,7 +85,7 @@ bool CTaskGoto::EventProcess(const Event &event) if (m_engine->GetDebugGoto()) { - auto AdjustPoint = [&](Math::Vector p) -> Math::Vector + auto AdjustPoint = [&](glm::vec3 p) -> glm::vec3 { m_terrain->AdjustToFloor(p); p.y += 2.0f; @@ -543,9 +543,9 @@ bool CTaskGoto::EventProcess(const Event &event) // 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; CObject* best = nullptr; @@ -606,7 +606,7 @@ CObject* CTaskGoto::WormSearch(Math::Vector &impact) 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); if (distance < min) { @@ -625,7 +625,7 @@ CObject* CTaskGoto::WormSearch(Math::Vector &impact) void CTaskGoto::WormFrame(float rTime) { CObject* pObj; - Math::Vector impact, pos; + glm::vec3 impact, pos; float dist; m_wormLastTime += rTime; @@ -652,10 +652,10 @@ void CTaskGoto::WormFrame(float rTime) // Assigns the goal was achieved. // "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) { - Math::Vector pos; + glm::vec3 pos; CObject* target; ObjectType type; float dist; @@ -809,7 +809,7 @@ Error CTaskGoto::Start(Math::Vector goal, float altitude, Error CTaskGoto::IsEnded() { - Math::Vector pos; + glm::vec3 pos; float limit, angle = 0.0f, h, level; volatile float dist; //fix for issue #844 @@ -1080,7 +1080,7 @@ Error CTaskGoto::IsEnded() // 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); @@ -1110,7 +1110,7 @@ CObject* CTaskGoto::SearchTarget(Math::Vector pos, float margin) if ( !pObj->GetActive() ) continue; if ( IsObjectBeingTransported(pObj) ) continue; // object transtorted? - Math::Vector oPos = pObj->GetPosition(); + glm::vec3 oPos = pObj->GetPosition(); float dist = Math::DistanceProjected(pos, oPos); 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. // 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; Math::Matrix* mat; - Math::Vector goal; + glm::vec3 goal; float dist, suppl; 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), // 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()) { if ( !obj->GetActive() ) continue; if (IsObjectBeingTransported(obj)) continue; - Math::Vector oPos; + glm::vec3 oPos; float suppl = 0.0f; if ( !GetHotPoint(obj, oPos, false, 0.0f, suppl) ) continue; 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. -bool CTaskGoto::GetHotPoint(CObject *pObj, Math::Vector &pos, +bool CTaskGoto::GetHotPoint(CObject *pObj, glm::vec3 &pos, bool bTake, float distance, float &suppl) { ObjectType type; Math::Matrix* mat; - pos = Math::Vector(0.0f, 0.0f, 0.0f); + pos = glm::vec3(0.0f, 0.0f, 0.0f); suppl = 0.0f; type = pObj->GetType(); @@ -1373,7 +1373,7 @@ bool CTaskGoto::GetHotPoint(CObject *pObj, Math::Vector &pos, // 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? @@ -1436,7 +1436,7 @@ void CTaskGoto::ComputeRepulse(glm::vec2&dir) if ( iType == OBJECT_WORM || iType == OBJECT_CONTROLLER ) return; auto firstCrashSphere = m_object->GetFirstCrashSphere(); - Math::Vector iPos = firstCrashSphere.sphere.pos; + glm::vec3 iPos = firstCrashSphere.sphere.pos; float iRadius = firstCrashSphere.sphere.radius; gDist = Math::Distance(iPos, m_goal); @@ -1545,7 +1545,7 @@ void CTaskGoto::ComputeRepulse(glm::vec2&dir) for (const auto& crashSphere : pObj->GetAllCrashSpheres()) { - Math::Vector oPos = crashSphere.sphere.pos; + glm::vec3 oPos = crashSphere.sphere.pos; float oRadius = crashSphere.sphere.radius; if ( oPos.y-oRadius > iPos.y+iRadius ) continue; @@ -1580,7 +1580,7 @@ void CTaskGoto::ComputeRepulse(glm::vec2&dir) void CTaskGoto::ComputeFlyingRepulse(float &dir) { auto firstCrashSphere = m_object->GetFirstCrashSphere(); - Math::Vector iPos = firstCrashSphere.sphere.pos; + glm::vec3 iPos = firstCrashSphere.sphere.pos; float iRadius = firstCrashSphere.sphere.radius; float add = 0.0f; @@ -1598,7 +1598,7 @@ void CTaskGoto::ComputeFlyingRepulse(float &dir) for (const auto& crashSphere : pObj->GetAllCrashSpheres()) { - Math::Vector oPos = crashSphere.sphere.pos; + glm::vec3 oPos = crashSphere.sphere.pos; float oRadius = crashSphere.sphere.radius; oRadius += iRadius+add; @@ -1644,7 +1644,7 @@ int CTaskGoto::BeamShortcut() void CTaskGoto::BeamStart() { - Math::Vector min, max; + glm::vec3 min, max; BitmapOpen(); BitmapObject(); @@ -1694,7 +1694,7 @@ void CTaskGoto::BeamInit() // ERR_CONTINUE if not done yet // 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 step, len; @@ -1720,12 +1720,12 @@ Error CTaskGoto::BeamSearch(const Math::Vector &start, const Math::Vector &goal, // i number of recursions made // 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, - const Math::Vector &goalPos, float goalRadius, +Error CTaskGoto::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 newPos; + glm::vec3 newPos; Error ret; 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" // from the point "start" and an angle "angle" with the right. -Math::Vector CTaskGoto::BeamPoint(const Math::Vector &startPoint, - const Math::Vector &goalPoint, +glm::vec3 CTaskGoto::BeamPoint(const glm::vec3 &startPoint, + const glm::vec3 &goalPoint, float angle, float step) { - Math::Vector resPoint; + glm::vec3 resPoint; float goalAngle; 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. -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) { - Math::Vector pos, inc; + glm::vec3 pos, inc; float dist, step; float distNoB2; int i, max, x, y; @@ -1913,7 +1913,7 @@ void CTaskGoto::BitmapObject() for (const auto& crashSphere : pObj->GetAllCrashSpheres()) { - Math::Vector oPos = crashSphere.sphere.pos; + glm::vec3 oPos = crashSphere.sphere.pos; float oRadius = crashSphere.sphere.radius; 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. -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; @@ -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) { ObjectType type; - Math::Vector p; + glm::vec3 p; float aLimit, angle, h; int x, y; bool bAcceptWater, bFly; @@ -2118,7 +2118,7 @@ bool CTaskGoto::BitmapClose() // 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; int cx, cy, ix, iy; @@ -2140,7 +2140,7 @@ void CTaskGoto::BitmapSetCircle(const Math::Vector &pos, float radius) // Removes a circle in the bitmap. //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; int cx, cy, ix, iy; diff --git a/src/object/task/taskgoto.h b/src/object/task/taskgoto.h index f2d81b42..46ed6e92 100644 --- a/src/object/task/taskgoto.h +++ b/src/object/task/taskgoto.h @@ -82,42 +82,42 @@ public: 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; protected: - CObject* WormSearch(Math::Vector &impact); + CObject* WormSearch(glm::vec3 &impact); void WormFrame(float rTime); - CObject* SearchTarget(Math::Vector pos, float margin); - bool AdjustTarget(CObject* pObj, Math::Vector &pos, float &distance); - bool AdjustBuilding(Math::Vector &pos, float margin, float &distance); - bool GetHotPoint(CObject *pObj, Math::Vector &pos, bool bTake, float distance, float &suppl); - bool LeakSearch(Math::Vector &pos, float &delay); + CObject* SearchTarget(glm::vec3 pos, float margin); + bool AdjustTarget(CObject* pObj, glm::vec3 &pos, float &distance); + bool AdjustBuilding(glm::vec3 &pos, float margin, float &distance); + bool GetHotPoint(CObject *pObj, glm::vec3 &pos, bool bTake, float distance, float &suppl); + bool LeakSearch(glm::vec3 &pos, float &delay); void ComputeRepulse(glm::vec2& dir); void ComputeFlyingRepulse(float &dir); int BeamShortcut(); void BeamStart(); void BeamInit(); - Error BeamSearch(const Math::Vector &start, const Math::Vector &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); - Math::Vector BeamPoint(const Math::Vector &startPoint, const Math::Vector &goalPoint, float angle, float step); + Error BeamSearch(const glm::vec3 &start, const glm::vec3 &goal, float goalRadius); + 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); + 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 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); bool BitmapOpen(); bool BitmapClose(); - void BitmapSetCircle(const Math::Vector &pos, float radius); - void BitmapClearCircle(const Math::Vector &pos, float radius); + void BitmapSetCircle(const glm::vec3 &pos, float radius); + void BitmapClearCircle(const glm::vec3 &pos, float radius); void BitmapSetDot(int rank, int x, int y); void BitmapClearDot(int rank, int x, int y); bool BitmapTestDot(int rank, int x, int y); protected: - Math::Vector m_goal; - Math::Vector m_goalObject; + glm::vec3 m_goal = { 0, 0, 0 }; + glm::vec3 m_goalObject = { 0, 0, 0 }; float m_angle = 0.0f; float m_altitude = 0.0f; TaskGotoCrash m_crashMode = TGC_DEFAULT; @@ -128,7 +128,7 @@ protected: bool m_bTake = false; float m_stopLength = 0.0f; // braking distance float m_time = 0.0f; - Math::Vector m_pos; + glm::vec3 m_pos = { 0, 0, 0 }; bool m_bWorm = false; bool m_bApprox = false; float m_wormLastTime = 0.0f; @@ -143,18 +143,18 @@ protected: int m_bmMaxX = 0, m_bmMaxY = 0; int m_bmTotal = 0; // number of points 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] = {}; int m_bmIterCounter = 0; CObject* m_bmCargoObject = nullptr; float m_bmFinalMove = 0.0f; // final advance distance 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; int m_bmStep = 0; - Math::Vector m_bmWatchDogPos; + glm::vec3 m_bmWatchDogPos = { 0, 0, 0 }; 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_leakTime = 0.0f; bool m_bLeakRecede = false; diff --git a/src/object/task/taskinfo.cpp b/src/object/task/taskinfo.cpp index f26f16a3..13729f33 100644 --- a/src/object/task/taskinfo.cpp +++ b/src/object/task/taskinfo.cpp @@ -95,7 +95,7 @@ Error CTaskInfo::Start(const char *name, float value, float power, bool send) exchangePost->GetAuto()->Start(op); - Math::Vector pos, goal; + glm::vec3 pos, goal; if (op == 0) // transmission? { pos = exchangePost->GetPosition(); diff --git a/src/object/task/taskmanip.cpp b/src/object/task/taskmanip.cpp index 6a522806..61e20bd7 100644 --- a/src/object/task/taskmanip.cpp +++ b/src/object/task/taskmanip.cpp @@ -72,7 +72,7 @@ CTaskManip::~CTaskManip() bool CTaskManip::EventProcess(const Event &event) { - Math::Vector pos; + glm::vec3 pos; float angle, a, g, cirSpeed, progress; int i; @@ -271,7 +271,7 @@ Error CTaskManip::Start(TaskManipOrder order, TaskManipArm arm) CObject *front, *other; float iAngle, dist, len; float fDist, fAngle, oDist, oAngle, oHeight; - Math::Vector pos, fPos, oPos; + glm::vec3 pos, fPos, oPos; m_arm = arm; m_height = 0.0f; @@ -290,7 +290,7 @@ Error CTaskManip::Start(TaskManipOrder order, TaskManipArm arm) m_arm != TMA_POWER && 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(); if ( type == OBJECT_BEE ) // bee? @@ -306,7 +306,7 @@ Error CTaskManip::Start(TaskManipOrder order, TaskManipArm arm) m_object->SetCargo(other); // takes the ball dynamic_cast(*other).SetTransporter(m_object); dynamic_cast(*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 { @@ -447,12 +447,12 @@ Error CTaskManip::Start(TaskManipOrder order, TaskManipArm arm) } 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 ( !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 ) { @@ -514,7 +514,7 @@ Error CTaskManip::Start(TaskManipOrder order, TaskManipArm arm) Error CTaskManip::IsEnded() { CObject* cargo; - Math::Vector pos; + glm::vec3 pos; float angle, dist; int i; @@ -695,10 +695,10 @@ bool CTaskManip::Abort() // 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; - Math::Vector iPos, oPos; + glm::vec3 iPos, oPos; float min, distance; iPos = m_object->GetPosition(); @@ -731,11 +731,11 @@ CObject* CTaskManip::SearchTakeUnderObject(Math::Vector &pos, float dLimit) // 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) { CObject *pBest; - Math::Vector iPos, oPos; + glm::vec3 iPos, oPos; float min, iAngle, bAngle, aLimit, dLimit, f; iPos = m_object->GetPosition(); @@ -799,11 +799,11 @@ CObject* CTaskManip::SearchTakeFrontObject(bool bAdvance, Math::Vector &pos, // 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) { CObject *pBest; - Math::Vector iPos, oPos; + glm::vec3 iPos, oPos; float min, iAngle, bAngle, aLimit, dLimit, f; 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. -CObject* CTaskManip::SearchOtherObject(bool bAdvance, Math::Vector &pos, +CObject* CTaskManip::SearchOtherObject(bool bAdvance, glm::vec3 &pos, float &distance, float &angle, float &height) { @@ -880,7 +880,7 @@ CObject* CTaskManip::SearchOtherObject(bool bAdvance, Math::Vector &pos, 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 = Math::NormAngle(iAngle); // 0..2*Math::PI @@ -911,7 +911,7 @@ CObject* CTaskManip::SearchOtherObject(bool bAdvance, Math::Vector &pos, } mat = pObj->GetWorldMatrix(0); - Math::Vector oPos = Transform(*mat, dynamic_cast(*pObj).GetPowerPosition()); + glm::vec3 oPos = Transform(*mat, dynamic_cast(*pObj).GetPowerPosition()); oAngle = pObj->GetRotationY(); 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 ! if ( Math::TestAngle(angle, iAngle-aLimit, iAngle+aLimit) ) { - Math::Vector powerPos = dynamic_cast(*pObj).GetPowerPosition(); + glm::vec3 powerPos = dynamic_cast(*pObj).GetPowerPosition(); height = powerPos.y; pos = oPos; return pObj; @@ -977,7 +977,7 @@ bool CTaskManip::TransporterTakeObject() dynamic_cast(*cargo).SetTransporter(m_object); dynamic_cast(*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->SetRotationX(0.0f); cargo->SetRotationZ(0.8f); @@ -987,7 +987,7 @@ bool CTaskManip::TransporterTakeObject() dynamic_cast(*cargo).SetTransporter(m_object); dynamic_cast(*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->SetRotationX(0.0f); cargo->SetRotationY(0.0f); @@ -998,7 +998,7 @@ bool CTaskManip::TransporterTakeObject() dynamic_cast(*cargo).SetTransporter(m_object); dynamic_cast(*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->SetRotationX(0.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? { - Math::Vector pos; + glm::vec3 pos; float dist = 0.0f, angle = 0.0f; CObject* cargo = SearchTakeFrontObject(false, pos, dist, angle); if (cargo == nullptr) return false; // nothing to take? @@ -1023,7 +1023,7 @@ bool CTaskManip::TransporterTakeObject() dynamic_cast(*cargo).SetTransporter(m_object); dynamic_cast(*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->SetRotationX(0.0f); cargo->SetRotationY(0.0f); @@ -1034,7 +1034,7 @@ bool CTaskManip::TransporterTakeObject() dynamic_cast(*cargo).SetTransporter(m_object); dynamic_cast(*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->SetRotationX(0.0f); cargo->SetRotationZ(Math::PI/2.0f); @@ -1046,7 +1046,7 @@ bool CTaskManip::TransporterTakeObject() if (m_arm == TMA_FBACK) // takes on the ground behind? { - Math::Vector pos; + glm::vec3 pos; float dist = 0.0f, angle = 0.0f; CObject* cargo = SearchTakeBackObject(false, pos, dist, angle); if (cargo == nullptr) return false; // nothing to take? @@ -1057,7 +1057,7 @@ bool CTaskManip::TransporterTakeObject() dynamic_cast(*cargo).SetTransporter(m_object); dynamic_cast(*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->SetRotationX(0.0f); cargo->SetRotationZ(Math::PI/2.0f); @@ -1075,7 +1075,7 @@ bool CTaskManip::TransporterTakeObject() 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->SetRotationX(0.0f); cargo->SetRotationZ(Math::PI/2.0f); @@ -1088,7 +1088,7 @@ bool CTaskManip::TransporterTakeObject() if (m_arm == TMA_OTHER) // battery takes from friend? { - Math::Vector pos; + glm::vec3 pos; float dist = 0.0f, angle = 0.0f; CObject* other = SearchOtherObject(false, pos, dist, angle, m_height); if (other == nullptr) return false; @@ -1104,7 +1104,7 @@ bool CTaskManip::TransporterTakeObject() dynamic_cast(*cargo).SetTransporter(m_object); dynamic_cast(*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->SetRotationX(0.0f); cargo->SetRotationZ(Math::PI/2.0f); @@ -1129,7 +1129,7 @@ bool CTaskManip::TransporterDeposeObject() m_cargoType = cargo->GetType(); 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); cargo->SetPosition(pos); cargo->SetRotationY(m_object->GetRotationY()+Math::PI/2.0f); @@ -1150,7 +1150,7 @@ bool CTaskManip::TransporterDeposeObject() m_cargoType = cargo->GetType(); 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); cargo->SetPosition(pos); 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? { - Math::Vector pos; + glm::vec3 pos; float angle = 0.0f, dist = 0.0f; 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. -bool CTaskManip::IsFreeDeposeObject(Math::Vector pos) +bool CTaskManip::IsFreeDeposeObject(glm::vec3 pos) { 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()) { diff --git a/src/object/task/taskmanip.h b/src/object/task/taskmanip.h index 6326caf2..abb74a1d 100644 --- a/src/object/task/taskmanip.h +++ b/src/object/task/taskmanip.h @@ -70,13 +70,13 @@ public: protected: void InitAngle(); - CObject* SearchTakeUnderObject(Math::Vector &pos, float dLimit); - CObject* SearchTakeFrontObject(bool bAdvance, Math::Vector &pos, float &distance, float &angle); - CObject* SearchTakeBackObject(bool bAdvance, Math::Vector &pos, float &distance, float &angle); - CObject* SearchOtherObject(bool bAdvance, Math::Vector &pos, float &distance, float &angle, float &height); + CObject* SearchTakeUnderObject(glm::vec3 &pos, float dLimit); + CObject* SearchTakeFrontObject(bool bAdvance, glm::vec3 &pos, float &distance, float &angle); + CObject* SearchTakeBackObject(bool bAdvance, glm::vec3 &pos, float &distance, float &angle); + CObject* SearchOtherObject(bool bAdvance, glm::vec3 &pos, float &distance, float &angle, float &height); bool TransporterTakeObject(); bool TransporterDeposeObject(); - bool IsFreeDeposeObject(Math::Vector pos); + bool IsFreeDeposeObject(glm::vec3 pos); void SoundManip(float time, float amplitude=1.0f, float frequency=1.0f); protected: @@ -97,7 +97,7 @@ protected: bool m_bBee = false; float m_angle = 0.0f; float m_move = 0.0f; - Math::Vector m_targetPos; + glm::vec3 m_targetPos = { 0, 0, 0 }; float m_timeLimit = 0.0f; ObjectType m_cargoType = OBJECT_NULL; }; diff --git a/src/object/task/taskpen.cpp b/src/object/task/taskpen.cpp index 3e54d765..7d07c126 100644 --- a/src/object/task/taskpen.cpp +++ b/src/object/task/taskpen.cpp @@ -47,7 +47,7 @@ CTaskPen::~CTaskPen() bool CTaskPen::EventProcess(const Event &event) { - Math::Vector pos, speed; + glm::vec3 pos, speed; glm::vec2 dim; int i; @@ -133,7 +133,7 @@ bool CTaskPen::EventProcess(const Event &event) Error CTaskPen::Start(bool bDown, TraceColor color) { - Math::Vector pos; + glm::vec3 pos; Math::Matrix* mat; ObjectType type; int i; @@ -180,7 +180,7 @@ Error CTaskPen::Start(bool bDown, TraceColor color) } 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 m_supportPos = pos; diff --git a/src/object/task/taskpen.h b/src/object/task/taskpen.h index 0d3965ad..24e0a158 100644 --- a/src/object/task/taskpen.h +++ b/src/object/task/taskpen.h @@ -60,7 +60,7 @@ protected: float m_delay = 0.0f; float m_time = 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_oldAngle = 0.0f; diff --git a/src/object/task/taskrecover.cpp b/src/object/task/taskrecover.cpp index 359ae441..5059fd26 100644 --- a/src/object/task/taskrecover.cpp +++ b/src/object/task/taskrecover.cpp @@ -62,7 +62,7 @@ CTaskRecover::~CTaskRecover() bool CTaskRecover::EventProcess(const Event &event) { - Math::Vector pos, speed; + glm::vec3 pos, speed; glm::vec2 dim; 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; 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 m_recoverPos = pos; @@ -206,8 +206,8 @@ Error CTaskRecover::Start() if ( m_ruin == nullptr ) return ERR_RECOVER_NULL; m_ruin->SetLock(true); // ruin no longer usable - Math::Vector iPos = m_object->GetPosition(); - Math::Vector oPos = m_ruin->GetPosition(); + glm::vec3 iPos = m_object->GetPosition(); + glm::vec3 oPos = m_ruin->GetPosition(); m_angle = Math::RotateAngle(oPos.x-iPos.x, iPos.z-oPos.z); // CW ! m_metal = nullptr; @@ -229,7 +229,7 @@ Error CTaskRecover::Start() Error CTaskRecover::IsEnded() { Math::Matrix* mat; - Math::Vector pos, speed, goal; + glm::vec3 pos, speed, goal; glm::vec2 dim; float angle, dist, time; int i; @@ -273,7 +273,7 @@ Error CTaskRecover::IsEnded() m_physics->SetMotorSpeedX(0.0f); 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 m_recoverPos = pos; @@ -309,9 +309,9 @@ Error CTaskRecover::IsEnded() m_metal->SetScale(0.0f); 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); - goal = Math::Vector(RECOVER_DIST, 3.1f, -3.9f); + goal = glm::vec3(RECOVER_DIST, 3.1f, -3.9f); goal = Transform(*mat, goal); m_particle->CreateRay(pos, goal, Gfx::PARTIRAY2, { 2.0f, 2.0f }, 8.0f); diff --git a/src/object/task/taskrecover.h b/src/object/task/taskrecover.h index 17dba3f3..0d64e6cf 100644 --- a/src/object/task/taskrecover.h +++ b/src/object/task/taskrecover.h @@ -62,6 +62,6 @@ protected: bool m_bError = false; CObject* m_ruin = nullptr; CObject* m_metal = nullptr; - Math::Vector m_recoverPos; + glm::vec3 m_recoverPos = { 0, 0, 0 }; int m_soundChannel = 0; }; diff --git a/src/object/task/tasksearch.cpp b/src/object/task/tasksearch.cpp index 225e0bbe..48eac704 100644 --- a/src/object/task/tasksearch.cpp +++ b/src/object/task/tasksearch.cpp @@ -54,7 +54,7 @@ CTaskSearch::~CTaskSearch() bool CTaskSearch::EventProcess(const Event &event) { Math::Matrix* mat; - Math::Vector pos, speed; + glm::vec3 pos, speed; glm::vec2 dim; float angle; int i; @@ -83,7 +83,7 @@ bool CTaskSearch::EventProcess(const Event &event) m_lastParticle = m_time; 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 speed.x = (Math::Rand()-0.5f)*20.0f; @@ -129,7 +129,7 @@ void CTaskSearch::InitAngle() Error CTaskSearch::Start() { ObjectType type; - Math::Vector speed; + glm::vec3 speed; int i; m_bError = true; @@ -240,7 +240,7 @@ bool CTaskSearch::Abort() bool CTaskSearch::CreateMark() { 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 Gfx::TerrainRes res = m_terrain->GetResource(pos); diff --git a/src/object/task/taskshield.cpp b/src/object/task/taskshield.cpp index 11792a3e..7347cde8 100644 --- a/src/object/task/taskshield.cpp +++ b/src/object/task/taskshield.cpp @@ -72,7 +72,7 @@ bool CTaskShield::EventProcess(const Event &event) { Math::Matrix* mat; Math::Matrix matrix; - Math::Vector pos, speed, goal, angle; + glm::vec3 pos, speed, goal, angle; Gfx::Color color; glm::vec2 dim; float energy; @@ -86,7 +86,7 @@ bool CTaskShield::EventProcess(const Event &event) m_delay -= event.rTime; 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 m_shieldPos = pos; @@ -180,7 +180,7 @@ bool CTaskShield::EventProcess(const Event &event) angle.y = 0.0f; angle.z = (Math::Rand()-0.5f)*Math::PI*1.2f; 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; 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 ) { - Math::Vector pos; + glm::vec3 pos; glm::vec2 dim; pos.x = 7.0f; @@ -272,12 +272,12 @@ Error CTaskShield::Start(TaskShieldMode mode, float delay) m_object->SetPartPosition(3, pos); 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 m_shieldPos = pos; 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.y = dim.x; 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; 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 m_shieldPos = pos; @@ -381,7 +381,7 @@ Error CTaskShield::Stop() Error CTaskShield::IsEnded() { - Math::Vector pos, speed; + glm::vec3 pos, speed; glm::vec2 dim; float energy; @@ -424,7 +424,7 @@ Error CTaskShield::IsEnded() m_object->SetPartPosition(3, pos); 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.y = dim.x; 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() { - Math::Vector pos; + glm::vec3 pos; pos.x = 7.0f; pos.y = 4.5f; @@ -515,7 +515,7 @@ bool CTaskShield::Abort() // Creates the light to accompany a pyrotechnic effect. -bool CTaskShield::CreateLight(Math::Vector pos) +bool CTaskShield::CreateLight(glm::vec3 pos) { Gfx::Light light; @@ -525,7 +525,7 @@ bool CTaskShield::CreateLight(Math::Vector pos) light.ambient = Gfx::Color(0.0f, 0.0f, 0.0f); light.diffuse = Gfx::Color(0.0f, 1.0f, 2.0f); 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.attenuation0 = 1.0f; light.attenuation1 = 0.0f; @@ -552,7 +552,7 @@ void CTaskShield::IncreaseShield() CShieldedObject* shielded = dynamic_cast(obj); 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); if ( dist <= GetRadius()+10.0f ) { diff --git a/src/object/task/taskshield.h b/src/object/task/taskshield.h index 4fc1cc39..b4ca9859 100644 --- a/src/object/task/taskshield.h +++ b/src/object/task/taskshield.h @@ -68,7 +68,7 @@ public: protected: Error Stop(); - bool CreateLight(Math::Vector pos); + bool CreateLight(glm::vec3 pos); void IncreaseShield(); float GetRadius(); @@ -84,7 +84,7 @@ protected: float m_lastIncrease = 0.0f; float m_energyUsed = 0.0f; bool m_bError = false; - Math::Vector m_shieldPos; + glm::vec3 m_shieldPos = { 0, 0, 0 }; int m_rankSphere = 0; int m_soundChannel = 0; int m_effectLight = 0; diff --git a/src/object/task/tasktake.cpp b/src/object/task/tasktake.cpp index a586e17d..38431cf5 100644 --- a/src/object/task/tasktake.cpp +++ b/src/object/task/tasktake.cpp @@ -83,7 +83,7 @@ bool CTaskTake::EventProcess(const Event &event) 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; } @@ -104,7 +104,7 @@ Error CTaskTake::Start() m_bError = true; // operation impossible if ( !m_physics->GetLand() ) { - Math::Vector pos = m_object->GetPosition(); + glm::vec3 pos = m_object->GetPosition(); float h = m_water->GetLevel(m_object); if ( pos.y < h ) return ERR_MANIP_WATER; // impossible under water return ERR_MANIP_FLY; @@ -114,7 +114,7 @@ Error CTaskTake::Start() if ( type != OBJECT_HUMAN && 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()) m_order = TTO_DEPOSE; @@ -124,7 +124,7 @@ Error CTaskTake::Start() if ( m_order == TTO_TAKE ) { - Math::Vector pos = m_object->GetPosition(); + glm::vec3 pos = m_object->GetPosition(); float h = m_water->GetLevel(m_object); if ( pos.y < h ) return ERR_MANIP_WATER; // impossible under water @@ -168,7 +168,7 @@ Error CTaskTake::Start() } 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_arm = TTA_FFRONT; } @@ -290,7 +290,7 @@ CObject* CTaskTake::SearchTakeObject(float &angle, float dLimit, float aLimit) { CObject *pBest; - Math::Vector iPos, oPos; + glm::vec3 iPos, oPos; float min, iAngle, bAngle, a, distance; iPos = m_object->GetPosition(); @@ -339,7 +339,7 @@ CObject* CTaskTake::SearchFriendObject(float &angle, if (m_object->GetCrashSphereCount() == 0) return nullptr; auto crashSphere = m_object->GetFirstCrashSphere(); - Math::Vector iPos = crashSphere.sphere.pos; + glm::vec3 iPos = crashSphere.sphere.pos; float iRad = crashSphere.sphere.radius; float iAngle = m_object->GetRotationY(); @@ -398,7 +398,7 @@ CObject* CTaskTake::SearchFriendObject(float &angle, } Math::Matrix* mat = pObj->GetWorldMatrix(0); - Math::Vector oPos = Math::Transform(*mat, dynamic_cast(*pObj).GetPowerPosition()); + glm::vec3 oPos = Math::Transform(*mat, dynamic_cast(*pObj).GetPowerPosition()); float distance = fabs(Math::Distance(oPos, iPos) - (iRad+1.0f)); if ( distance <= dLimit ) @@ -406,7 +406,7 @@ CObject* CTaskTake::SearchFriendObject(float &angle, angle = Math::RotateAngle(oPos.x-iPos.x, iPos.z-oPos.z); // CW ! if ( Math::TestAngle(angle, iAngle-aLimit, iAngle+aLimit) ) { - Math::Vector powerPos = dynamic_cast(*pObj).GetPowerPosition(); + glm::vec3 powerPos = dynamic_cast(*pObj).GetPowerPosition(); m_height = powerPos.y; return pObj; } @@ -433,8 +433,8 @@ bool CTaskTake::TransporterTakeObject() dynamic_cast(*cargo).SetTransporter(m_object); dynamic_cast(*cargo).SetTransporterPart(4); // takes with the hand -//? cargo->SetPosition(Math::Vector(2.2f, -1.0f, 1.1f)); - cargo->SetPosition(Math::Vector(1.7f, -0.5f, 1.1f)); +//? cargo->SetPosition(glm::vec3(2.2f, -1.0f, 1.1f)); + cargo->SetPosition(glm::vec3(1.7f, -0.5f, 1.1f)); cargo->SetRotationY(0.1f); cargo->SetRotationX(0.0f); cargo->SetRotationZ(0.8f); @@ -459,8 +459,8 @@ bool CTaskTake::TransporterTakeObject() dynamic_cast(*cargo).SetTransporter(m_object); dynamic_cast(*cargo).SetTransporterPart(4); // takes with the hand -//? cargo->SetPosition(Math::Vector(2.2f, -1.0f, 1.1f)); - cargo->SetPosition(Math::Vector(1.7f, -0.5f, 1.1f)); +//? cargo->SetPosition(glm::vec3(2.2f, -1.0f, 1.1f)); + cargo->SetPosition(glm::vec3(1.7f, -0.5f, 1.1f)); cargo->SetRotationY(0.1f); cargo->SetRotationX(0.0f); cargo->SetRotationZ(0.8f); @@ -484,7 +484,7 @@ bool CTaskTake::TransporterDeposeObject() m_cargoType = cargo->GetType(); 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); cargo->SetPosition(pos); 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. -bool CTaskTake::IsFreeDeposeObject(Math::Vector pos) +bool CTaskTake::IsFreeDeposeObject(glm::vec3 pos) { 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()) { diff --git a/src/object/task/tasktake.h b/src/object/task/tasktake.h index 2948987a..31b2ef3b 100644 --- a/src/object/task/tasktake.h +++ b/src/object/task/tasktake.h @@ -60,7 +60,7 @@ protected: CObject* SearchFriendObject(float &angle, float dLimit, float aLimit); bool TransporterTakeObject(); bool TransporterDeposeObject(); - bool IsFreeDeposeObject(Math::Vector pos); + bool IsFreeDeposeObject(glm::vec3 pos); protected: TaskTakeOrder m_order = TTO_TAKE; diff --git a/src/object/task/taskterraform.cpp b/src/object/task/taskterraform.cpp index ff0193ae..f0a856e1 100644 --- a/src/object/task/taskterraform.cpp +++ b/src/object/task/taskterraform.cpp @@ -70,7 +70,7 @@ bool CTaskTerraform::EventProcess(const Event &event) { CObject* power; Math::Matrix* mat; - Math::Vector pos, dir, speed; + glm::vec3 pos, dir, speed; glm::vec2 dim; float energy; @@ -148,7 +148,7 @@ bool CTaskTerraform::EventProcess(const Event &event) if ( m_phase == TTP_CHARGE ) { // 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.z += (Math::Rand()-0.5f)*1.0f; pos = Math::Transform(*mat, pos); @@ -163,7 +163,7 @@ bool CTaskTerraform::EventProcess(const Event &event) if ( m_phase != TTP_CHARGE ) { // 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.z += (Math::Rand()-0.5f)*1.0f; 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); // 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.z += (Math::Rand()-0.5f)*1.0f; pos = Math::Transform(*mat, pos); @@ -202,7 +202,7 @@ Error CTaskTerraform::Start() { CObject* power; Math::Matrix* mat; - Math::Vector pos, speed; + glm::vec3 pos, speed; float energy; ObjectType type; @@ -223,7 +223,7 @@ Error CTaskTerraform::Start() speed.z != 0.0f ) return ERR_MANIP_MOTOR; 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 m_terraPos = pos; @@ -243,7 +243,7 @@ Error CTaskTerraform::Start() Error CTaskTerraform::IsEnded() { CObject* power; - Math::Vector pos, speed; + glm::vec3 pos, speed; glm::vec2 dim; float dist, duration; int i, max; @@ -266,7 +266,7 @@ Error CTaskTerraform::IsEnded() { 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); power = m_object->GetPower(); @@ -283,7 +283,7 @@ Error CTaskTerraform::IsEnded() pos.y = m_terraPos.y; m_terrain->AdjustToFloor(pos); 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.y = dim.x; m_particle->CreateParticle(pos, speed, dim, Gfx::PARTICRASH, 2.0f); @@ -330,9 +330,9 @@ bool CTaskTerraform::Abort() m_soundChannel = -1; } - m_object->SetPartPosition(2, Math::Vector(9.0f, 4.0f, 0.0f)); - m_object->SetTilt(Math::Vector(0.0f, 0.0f, 0.0f)); - m_object->SetCirVibration(Math::Vector(0.0f, 0.0f, 0.0f)); + m_object->SetPartPosition(2, glm::vec3(9.0f, 4.0f, 0.0f)); + m_object->SetTilt(glm::vec3(0.0f, 0.0f, 0.0f)); + m_object->SetCirVibration(glm::vec3(0.0f, 0.0f, 0.0f)); m_object->SetScale(1.0f); power = m_object->GetPower(); diff --git a/src/object/task/taskterraform.h b/src/object/task/taskterraform.h index 03b8d926..fb20c4bd 100644 --- a/src/object/task/taskterraform.h +++ b/src/object/task/taskterraform.h @@ -58,5 +58,5 @@ protected: float m_lastParticle = 0.0f; int m_soundChannel = 0; bool m_bError = false; - Math::Vector m_terraPos; + glm::vec3 m_terraPos = { 0, 0, 0 }; };