Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*ue4 sdk*/
- struct Vector2
- {
- float x = 0.f;
- float y = 0.f;
- };
- class Vector3
- {
- public:
- Vector3( ) : x( 0.f ), y( 0.f ), z( 0.f )
- {
- }
- Vector3( float _x, float _y, float _z ) : x( _x ), y( _y ), z( _z )
- {
- }
- ~Vector3( )
- {
- }
- float x = 0.f;
- float y = 0.f;
- float z = 0.f;
- float Dot( Vector3 v )
- {
- return x * v.x + y * v.y + z * v.z;
- }
- float Length2( ) const
- {
- return sqrt( x * x + y * y + z * z );
- }
- float DistTo( const Vector3& vecEnd ) const
- {
- return ( *this - vecEnd ).Length2( );
- }
- float Distance( Vector3 v )
- {
- return float( sqrt( pow( v.x - x, 2.0 ) + pow( v.y - y, 2.0 ) + pow( v.z - z, 2.0 ) ) );
- }
- };
- template<class T>
- struct TArray
- {
- friend struct FString;
- public:
- T* Data;
- int32_t Count;
- int32_t Max;
- TArray( )
- {
- Data = nullptr;
- Count = Max = 0;
- };
- int Num( ) const
- {
- return Count;
- };
- T& operator[]( int i )
- {
- return Data[ i ];
- };
- const T& operator[]( int i ) const
- {
- return Data[ i ];
- };
- bool IsValidIndex( int i ) const
- {
- return i < Num( );
- };
- private:
- };
- struct FString : public TArray<wchar_t>
- {
- FString( )
- {};
- FString( const wchar_t* other )
- {
- Max = Count = *other ? wcslen( other ) + 1 : 0;
- if ( Count )
- Data = const_cast< wchar_t* >( other );
- };
- bool IsValid( ) const
- {
- return Data != nullptr;
- }
- const wchar_t* c_str( ) const
- {
- return Data;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement