From: Mathias Froehlich Date: Sun, 25 Nov 2012 21:25:27 +0000 (+0100) Subject: fgai: Use HLACartesianLocation instead of an own implementation. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=5fea5240e8fce573f6c0ae466bab3a06ffa12e62;p=flightgear.git fgai: Use HLACartesianLocation instead of an own implementation. --- diff --git a/utils/fgai/HLASceneObject.cxx b/utils/fgai/HLASceneObject.cxx index 83cd793f1..30dd7ab7a 100644 --- a/utils/fgai/HLASceneObject.cxx +++ b/utils/fgai/HLASceneObject.cxx @@ -27,65 +27,6 @@ namespace fgai { -class HLASceneObject::Location : public simgear::HLAAbstractLocation { -public: - Location() : - _position(SGVec3d::zeros()), - _imag(SGVec3d::zeros()), - _angularVelocity(SGVec3d::zeros()), - _linearVelocity(SGVec3d::zeros()) - { } - - virtual SGLocationd getLocation() const - { return SGLocationd(_position, SGQuatd::fromPositiveRealImag(_imag)); } - virtual void setLocation(const SGLocationd& location) - { - _position = location.getPosition(); - _imag = location.getOrientation().getPositiveRealImag(); - } - - virtual SGVec3d getCartPosition() const - { return _position; } - virtual void setCartPosition(const SGVec3d& position) - { _position = position; } - - virtual SGQuatd getCartOrientation() const - { return SGQuatd::fromPositiveRealImag(_imag); } - virtual void setCartOrientation(const SGQuatd& orientation) - { _imag = orientation.getPositiveRealImag(); } - - virtual SGVec3d getAngularBodyVelocity() const - { return _angularVelocity; } - virtual void setAngularBodyVelocity(const SGVec3d& angularVelocity) - { _angularVelocity = angularVelocity; } - - virtual SGVec3d getLinearBodyVelocity() const - { return _linearVelocity; } - virtual void setLinearBodyVelocity(const SGVec3d& linearVelocity) - { _linearVelocity = linearVelocity; } - - virtual double getTimeDifference(const SGTimeStamp& timeStamp) const - { return _position.getDataElement()->getTimeDifference(timeStamp); } - - simgear::HLADataElement* getPositionDataElement() - { return _position.getDataElement(); } - simgear::HLADataElement* getOrientationDataElement() - { return _imag.getDataElement(); } - - simgear::HLADataElement* getAngularVelocityDataElement() - { return _angularVelocity.getDataElement(); } - simgear::HLADataElement* getLinearVelocityDataElement() - { return _linearVelocity.getDataElement(); } - -private: - simgear::HLAVec3dData _position; - simgear::HLAVec3dData _imag; - - simgear::HLAVec3dData _angularVelocity; - simgear::HLAVec3dData _linearVelocity; -}; - - HLASceneObject::HLASceneObject(HLASceneObjectClass* objectClass) : HLAObjectInstance(objectClass) { @@ -104,7 +45,7 @@ HLASceneObject::createAttributeDataElements() assert(dynamic_cast(getObjectClass().get())); HLASceneObjectClass& objectClass = static_cast(*getObjectClass()); - Location* location = new Location; + simgear::HLACartesianLocation* location = new simgear::HLACartesianLocation; setAttributeDataElement(objectClass.getPositionIndex(), location->getPositionDataElement()); setAttributeDataElement(objectClass.getOrientationIndex(), location->getOrientationDataElement()); setAttributeDataElement(objectClass.getAngularVelocityIndex(), location->getAngularVelocityDataElement()); diff --git a/utils/fgai/HLASceneObject.hxx b/utils/fgai/HLASceneObject.hxx index aed2c1066..5b1e8a3b3 100644 --- a/utils/fgai/HLASceneObject.hxx +++ b/utils/fgai/HLASceneObject.hxx @@ -36,8 +36,6 @@ public: void setLocation(const AIPhysics& physics); private: - /// Currently we have our own location. FIXME Extend Cartesian location at some point. - class Location; // The location of this object SGSharedPtr _location; };