Some cleanup

This commit is contained in:
2024-09-29 22:47:56 -04:00
parent f8ea24ec95
commit b56078be62
4 changed files with 15 additions and 7 deletions

View File

@@ -25,7 +25,7 @@
#ifndef NDEBUG
#define FGL_ASSUME( ... ) \
FGL_ASSERT( ( __VA_ARGS__ ), "FGL_ASSUME: Check failed!" ); \
[[gnu::assume( __VA_ARGS__ )]]
[[gnu::assume( __VA_ARGS__ )]];
#else
#define FGL_ASSUME( ... ) [[gnu::assume( __VA_ARGS__ )]]
#endif

View File

@@ -24,7 +24,13 @@ namespace fgl::engine
Local,
//! Object moves in relation to the world
Global
} m_mode;
} m_mode { Global };
ComponentTransform() = default;
ComponentTransform( const WorldCoordinate position_i, const Scale scale_i, const Rotation rotation_i ) :
TransformComponent( position_i, scale_i, rotation_i )
{}
};
struct GameObjectComponentBase : public ComponentEditorInterface, public ComponentEngineInterface

View File

@@ -24,6 +24,8 @@ namespace fgl::engine
namespace fgl::engine
{
//TODO: Add in ability to use `operator+=` on return values for xAngle for local and world rotations
struct Rotation : private glm::quat
{
Rotation();
@@ -60,7 +62,7 @@ namespace fgl::engine
void addZWorld( float );
// internal
inline glm::quat internal_quat() const { return static_cast< glm::quat >( *this ); }
inline glm::quat internal_quat() const { return *this; }
bool operator==( const Rotation& rot ) const
{

View File

@@ -20,14 +20,14 @@ namespace fgl::engine
class Vector;
inline constexpr float length( glm::vec3 vec )
inline constexpr float length( const glm::vec3 vec )
{
return std::sqrt( std::pow( vec.x, 2 ) + std::pow( vec.y, 2 ) + std::pow( vec.z, 2 ) );
return std::sqrt( std::pow( vec.x, 2.0f ) + std::pow( vec.y, 2.0f ) + std::pow( vec.z, 2.0f ) );
}
inline constexpr glm::vec3 normalize( glm::vec3 vec )
inline constexpr glm::vec3 normalize( const glm::vec3 vec )
{
if constexpr ( std::is_constant_evaluated() )
if ( std::is_constant_evaluated() )
{
const auto len { length( vec ) };
return glm::vec3( vec.x / len, vec.y / len, vec.z / len );