File Orientation.h¶
File List > Amplitude > Math > Orientation.h
Go to the documentation of this file
// Copyright (c) 2024-present Sparky Studios. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#ifndef _AM_MATH_ORIENTATION_H
#define _AM_MATH_ORIENTATION_H
#include <SparkyStudios/Audio/Amplitude/Math/LinearAlgebra.h>
namespace SparkyStudios::Audio::Amplitude
{
struct AM_API_PUBLIC Orientation
{
static Orientation Zero();
Orientation(AmReal32 yaw, AmReal32 pitch, AmReal32 roll);
Orientation(AmVector3 forward, AmVector3 up);
Orientation(AmQuaternion quaternion);
[[nodiscard]] AM_INLINE AmReal32 GetYaw() const
{
return _yaw;
}
[[nodiscard]] AM_INLINE AmReal32 GetPitch() const
{
return _pitch;
}
[[nodiscard]] AM_INLINE AmReal32 GetRoll() const
{
return _roll;
}
[[nodiscard]] AM_INLINE const AmVector3& GetForward() const
{
return _forward;
}
[[nodiscard]] AM_INLINE const AmVector3& GetUp() const
{
return _up;
}
[[nodiscard]] AM_INLINE AmReal32 GetAlpha() const
{
return _alpha;
}
[[nodiscard]] AM_INLINE AmReal32 GetBeta() const
{
return _beta;
}
[[nodiscard]] AM_INLINE AmReal32 GetGamma() const
{
return _gamma;
}
[[nodiscard]] AM_INLINE const AmQuaternion& GetQuaternion() const
{
return _quaternion;
}
[[nodiscard]] AmMatrix3 GetRotationMatrix() const;
[[nodiscard]] AmMatrix4 GetLookAtMatrix(AmVector3 eye) const;
private:
void ComputeForwardAndUpVectors();
void ComputeZYXAngles();
void ComputeZYZAngles();
void ComputeQuaternion();
AmVector3 _forward;
AmReal32 _yaw;
AmVector3 _up;
AmReal32 _pitch;
AmReal32 _roll;
AmReal32 _alpha;
AmReal32 _beta;
AmReal32 _gamma;
AmQuaternion _quaternion;
};
} // namespace SparkyStudios::Audio::Amplitude
#endif // _AM_MATH_ORIENTATION_H